From 48b94864c51253da92e4444f0074eec36ef391fb Mon Sep 17 00:00:00 2001 From: imp Date: Mon, 3 Feb 2020 17:35:11 +0000 Subject: [PATCH] Remove sparc64 kernel support Remove all sparc64 specific files Remove all sparc64 ifdefs Removee indireeect sparc64 ifdefs --- lib/libkvm/Makefile | 3 +- sys/Makefile | 2 +- sys/cam/cam_xpt.c | 11 - sys/cddl/compat/opensolaris/sys/atomic.h | 4 - sys/cddl/contrib/opensolaris/common/lz4/lz4.c | 10 - .../opensolaris/uts/common/sys/asm_linkage.h | 5 - sys/conf/Makefile.sparc64 | 49 - sys/conf/NOTES | 3 - sys/conf/files | 6 - sys/conf/files.sparc64 | 146 - sys/conf/kern.mk | 13 - sys/conf/kern.opts.mk | 4 +- sys/conf/ldscript.sparc64 | 269 -- sys/conf/options.sparc64 | 31 - sys/contrib/ck/include/ck_md.h | 3 - sys/dev/ata/ata-pci.c | 8 - sys/dev/ata/chipsets/ata-promise.c | 8 - sys/dev/atkbdc/atkbd.c | 36 - sys/dev/atkbdc/atkbdc.c | 50 - sys/dev/atkbdc/atkbdc_ebus.c | 307 -- sys/dev/auxio/auxio.c | 325 -- sys/dev/auxio/auxioreg.h | 75 - sys/dev/bge/if_bge.c | 53 - sys/dev/cas/if_cas.c | 12 +- sys/dev/dc/if_dc.c | 13 - sys/dev/esp/esp_sbus.c | 846 ----- sys/dev/fb/creator.c | 1130 ------ sys/dev/fb/creator_vt.c | 274 -- sys/dev/fb/creatorreg.h | 249 -- sys/dev/fb/fbreg.h | 9 +- sys/dev/fb/machfb.c | 1581 --------- sys/dev/fb/machfbreg.h | 458 --- sys/dev/firewire/sbp.c | 4 - sys/dev/gem/if_gem_pci.c | 6 +- sys/dev/gem/if_gem_sbus.c | 210 -- sys/dev/hme/if_hme_pci.c | 6 +- sys/dev/hme/if_hme_sbus.c | 338 -- sys/dev/hwpmc/hwpmc_sparc64.c | 68 - sys/dev/isp/isp_freebsd.h | 4 - sys/dev/isp/isp_pci.c | 10 - sys/dev/isp/isp_sbus.c | 701 ---- sys/dev/ispfw/asm_1000.h | 1293 ------- sys/dev/ispfw/ispfw.c | 21 - sys/dev/le/if_le_lebuffer.c | 393 --- sys/dev/le/if_le_ledma.c | 496 --- sys/dev/le/lebuffer_sbus.c | 305 -- sys/dev/mpt/mpt.h | 5 - sys/dev/mpt/mpt_pci.c | 4 - sys/dev/mthca/mthca_srq.c | 10 +- sys/dev/mxge/if_mxge_var.h | 21 - sys/dev/ofw/openfirm.h | 5 +- sys/dev/pcf/envctrl.c | 194 -- sys/dev/pcf/pcf_ebus.c | 256 -- sys/dev/proto/proto_core.c | 2 - sys/dev/scc/scc_bfe_ebus.c | 99 - sys/dev/scc/scc_bfe_sbus.c | 96 - sys/dev/sfxge/common/efsys.h | 20 - sys/dev/sound/pci/t4dwave.c | 32 +- sys/dev/sound/sbus/apcdmareg.h | 116 - sys/dev/sound/sbus/cs4231.c | 1566 --------- sys/dev/sound/sbus/cs4231.h | 243 -- sys/dev/sym/sym_hipd.c | 10 - sys/dev/syscons/scgfbrndr.c | 34 +- sys/dev/syscons/schistory.c | 3 +- sys/dev/syscons/scterm-dumb.c | 3 +- sys/dev/syscons/scterm-sc.c | 3 +- sys/dev/syscons/scterm-teken.c | 3 +- sys/dev/syscons/scvtb.c | 28 - sys/dev/syscons/syscons.c | 19 +- sys/dev/syscons/syscons.h | 10 - sys/dev/uart/uart_bus_ebus.c | 108 - sys/dev/uart/uart_cpu_sparc64.c | 307 -- sys/dev/uart/uart_kbd_sun.c | 869 ----- sys/dev/uart/uart_kbd_sun.h | 70 - sys/dev/uart/uart_kbd_sun_tables.h | 144 - sys/dev/vt/hw/fb/vt_early_fb.c | 9 - sys/dev/vt/hw/ofwfb/ofwfb.c | 15 +- sys/kern/kern_exit.c | 1 + sys/kern/kern_malloc.c | 2 - sys/kern/subr_param.c | 2 +- sys/kern/subr_uio.c | 73 - sys/kern/subr_witness.c | 7 - sys/modules/Makefile | 11 +- sys/modules/auxio/Makefile | 10 - sys/modules/bge/Makefile | 4 - sys/modules/cas/Makefile | 2 +- sys/modules/epic/Makefile | 8 - sys/modules/esp/Makefile | 5 - sys/modules/gem/Makefile | 8 +- sys/modules/hme/Makefile | 9 +- sys/modules/hwpmc/Makefile | 4 - sys/modules/i2c/controllers/pcf/Makefile | 10 +- sys/modules/isp/Makefile | 4 - sys/modules/ispfw/Makefile | 3 - sys/modules/le/Makefile | 12 +- sys/modules/scc/Makefile | 3 - sys/modules/sound/driver/Makefile | 6 - sys/modules/sound/driver/audiocs/Makefile | 10 - sys/modules/syscons/Makefile | 34 +- sys/modules/uart/Makefile | 7 +- sys/sparc64/central/central.c | 301 -- sys/sparc64/conf/DEFAULTS | 23 - sys/sparc64/conf/GENERIC | 253 -- sys/sparc64/conf/GENERIC-NODEBUG | 38 - sys/sparc64/conf/GENERIC.hints | 1 - sys/sparc64/conf/Makefile | 5 - sys/sparc64/conf/NOTES | 168 - sys/sparc64/ebus/ebus.c | 730 ---- sys/sparc64/ebus/ebusreg.h | 91 - sys/sparc64/ebus/epic.c | 218 -- sys/sparc64/fhc/clkbrd.c | 214 -- sys/sparc64/fhc/clkbrdreg.h | 99 - sys/sparc64/fhc/fhc.c | 537 --- sys/sparc64/fhc/fhcreg.h | 97 - sys/sparc64/include/_align.h | 46 - sys/sparc64/include/_bus.h | 40 - sys/sparc64/include/_inttypes.h | 215 -- sys/sparc64/include/_limits.h | 87 - sys/sparc64/include/_stdint.h | 160 - sys/sparc64/include/_types.h | 102 - sys/sparc64/include/asi.h | 262 -- sys/sparc64/include/asm.h | 128 - sys/sparc64/include/asmacros.h | 226 -- sys/sparc64/include/atomic.h | 446 --- sys/sparc64/include/bus.h | 852 ----- sys/sparc64/include/bus_common.h | 77 - sys/sparc64/include/bus_dma.h | 221 -- sys/sparc64/include/bus_private.h | 82 - sys/sparc64/include/cache.h | 129 - sys/sparc64/include/ccr.h | 48 - sys/sparc64/include/clock.h | 10 - sys/sparc64/include/cmt.h | 41 - sys/sparc64/include/counter.h | 98 - sys/sparc64/include/cpu.h | 74 - sys/sparc64/include/cpufunc.h | 272 -- sys/sparc64/include/db_machdep.h | 64 - sys/sparc64/include/dcr.h | 72 - sys/sparc64/include/dump.h | 68 - sys/sparc64/include/efi.h | 14 - sys/sparc64/include/elf.h | 84 - sys/sparc64/include/endian.h | 126 - sys/sparc64/include/exec.h | 36 - sys/sparc64/include/fireplane.h | 42 - sys/sparc64/include/float.h | 101 - sys/sparc64/include/floatingpoint.h | 39 - sys/sparc64/include/fp.h | 41 - sys/sparc64/include/frame.h | 95 - sys/sparc64/include/fsr.h | 116 - sys/sparc64/include/gdb_machdep.h | 72 - sys/sparc64/include/idprom.h | 64 - sys/sparc64/include/ieee.h | 139 - sys/sparc64/include/ieeefp.h | 37 - sys/sparc64/include/in_cksum.h | 177 - sys/sparc64/include/instr.h | 620 ---- sys/sparc64/include/intr_machdep.h | 115 - sys/sparc64/include/iommureg.h | 214 -- sys/sparc64/include/iommuvar.h | 115 - sys/sparc64/include/jbus.h | 41 - sys/sparc64/include/kdb.h | 59 - sys/sparc64/include/kerneldump.h | 54 - sys/sparc64/include/ktr.h | 101 - sys/sparc64/include/limits.h | 43 - sys/sparc64/include/lsu.h | 88 - sys/sparc64/include/mcntl.h | 64 - sys/sparc64/include/md_var.h | 80 - sys/sparc64/include/memdev.h | 42 - sys/sparc64/include/metadata.h | 47 - sys/sparc64/include/nexusvar.h | 36 - sys/sparc64/include/ofw_machdep.h | 50 - sys/sparc64/include/ofw_mem.h | 48 - sys/sparc64/include/ofw_nexus.h | 81 - sys/sparc64/include/param.h | 155 - sys/sparc64/include/pcb.h | 65 - sys/sparc64/include/pcpu.h | 103 - sys/sparc64/include/pcpu_aux.h | 50 - sys/sparc64/include/pmap.h | 138 - sys/sparc64/include/pmc_mdep.h | 28 - sys/sparc64/include/proc.h | 80 - sys/sparc64/include/procctl.h | 4 - sys/sparc64/include/profile.h | 104 - sys/sparc64/include/pstate.h | 65 - sys/sparc64/include/ptrace.h | 38 - sys/sparc64/include/reg.h | 121 - sys/sparc64/include/reloc.h | 32 - sys/sparc64/include/resource.h | 45 - sys/sparc64/include/runq.h | 60 - sys/sparc64/include/sc_machdep.h | 78 - sys/sparc64/include/setjmp.h | 59 - sys/sparc64/include/sf_buf.h | 37 - sys/sparc64/include/sigframe.h | 42 - sys/sparc64/include/signal.h | 49 - sys/sparc64/include/smp.h | 404 --- sys/sparc64/include/stack.h | 42 - sys/sparc64/include/stdarg.h | 39 - sys/sparc64/include/sysarch.h | 76 - sys/sparc64/include/tick.h | 39 - sys/sparc64/include/tlb.h | 177 - sys/sparc64/include/trap.h | 101 - sys/sparc64/include/tsb.h | 97 - sys/sparc64/include/tstate.h | 84 - sys/sparc64/include/tte.h | 168 - sys/sparc64/include/ucontext.h | 66 - sys/sparc64/include/upa.h | 43 - sys/sparc64/include/utrap.h | 112 - sys/sparc64/include/vdso.h | 36 - sys/sparc64/include/ver.h | 94 - sys/sparc64/include/vm.h | 38 - sys/sparc64/include/vmparam.h | 248 -- sys/sparc64/include/watch.h | 43 - sys/sparc64/include/wstate.h | 68 - sys/sparc64/isa/isa.c | 363 -- sys/sparc64/isa/isa_dma.c | 98 - sys/sparc64/isa/ofw_isa.c | 148 - sys/sparc64/isa/ofw_isa.h | 102 - sys/sparc64/pci/apb.c | 309 -- sys/sparc64/pci/fire.c | 1877 ---------- sys/sparc64/pci/firereg.h | 1012 ------ sys/sparc64/pci/firevar.h | 91 - sys/sparc64/pci/ofw_pci.c | 406 --- sys/sparc64/pci/ofw_pci.h | 172 - sys/sparc64/pci/ofw_pci_if.m | 48 - sys/sparc64/pci/ofw_pcib.c | 176 - sys/sparc64/pci/ofw_pcib_subr.c | 109 - sys/sparc64/pci/ofw_pcib_subr.h | 48 - sys/sparc64/pci/ofw_pcibus.c | 368 -- sys/sparc64/pci/psycho.c | 1074 ------ sys/sparc64/pci/psychoreg.h | 330 -- sys/sparc64/pci/psychovar.h | 75 - sys/sparc64/pci/sbbc.c | 1113 ------ sys/sparc64/pci/schizo.c | 1260 ------- sys/sparc64/pci/schizoreg.h | 359 -- sys/sparc64/pci/schizovar.h | 92 - sys/sparc64/sbus/dma_sbus.c | 417 --- sys/sparc64/sbus/lsi64854.c | 764 ---- sys/sparc64/sbus/lsi64854reg.h | 200 -- sys/sparc64/sbus/lsi64854var.h | 96 - sys/sparc64/sbus/ofw_sbus.h | 55 - sys/sparc64/sbus/sbus.c | 938 ----- sys/sparc64/sbus/sbusreg.h | 145 - sys/sparc64/sbus/sbusvar.h | 125 - sys/sparc64/sparc64/ata_machdep.c | 53 - sys/sparc64/sparc64/autoconf.c | 90 - sys/sparc64/sparc64/bus_machdep.c | 791 ----- sys/sparc64/sparc64/cache.c | 190 - sys/sparc64/sparc64/cam_machdep.c | 76 - sys/sparc64/sparc64/cheetah.c | 308 -- sys/sparc64/sparc64/clock.c | 64 - sys/sparc64/sparc64/counter.c | 112 - sys/sparc64/sparc64/db_disasm.c | 1033 ------ sys/sparc64/sparc64/db_hwwatch.c | 213 -- sys/sparc64/sparc64/db_interface.c | 97 - sys/sparc64/sparc64/db_trace.c | 293 -- sys/sparc64/sparc64/dump_machdep.c | 146 - sys/sparc64/sparc64/eeprom.c | 191 - sys/sparc64/sparc64/elf_machdep.c | 438 --- sys/sparc64/sparc64/exception.S | 3064 ----------------- sys/sparc64/sparc64/gdb_machdep.c | 72 - sys/sparc64/sparc64/genassym.c | 246 -- sys/sparc64/sparc64/identcpu.c | 138 - sys/sparc64/sparc64/in_cksum.c | 264 -- sys/sparc64/sparc64/interrupt.S | 231 -- sys/sparc64/sparc64/intr_machdep.c | 574 --- sys/sparc64/sparc64/iommu.c | 1216 ------- sys/sparc64/sparc64/jbusppm.c | 232 -- sys/sparc64/sparc64/locore.S | 148 - sys/sparc64/sparc64/machdep.c | 1114 ------ sys/sparc64/sparc64/mem.c | 179 - sys/sparc64/sparc64/mp_exception.S | 309 -- sys/sparc64/sparc64/mp_locore.S | 296 -- sys/sparc64/sparc64/mp_machdep.c | 810 ----- sys/sparc64/sparc64/nexus.c | 612 ---- sys/sparc64/sparc64/ofw_machdep.c | 294 -- sys/sparc64/sparc64/pmap.c | 2313 ------------- sys/sparc64/sparc64/prof_machdep.c | 86 - sys/sparc64/sparc64/rtc.c | 255 -- sys/sparc64/sparc64/rwindow.c | 112 - sys/sparc64/sparc64/sc_machdep.c | 152 - sys/sparc64/sparc64/schppm.c | 134 - sys/sparc64/sparc64/spitfire.c | 186 - sys/sparc64/sparc64/ssm.c | 76 - sys/sparc64/sparc64/stack_machdep.c | 97 - sys/sparc64/sparc64/support.S | 943 ----- sys/sparc64/sparc64/swtch.S | 344 -- sys/sparc64/sparc64/sys_machdep.c | 157 - sys/sparc64/sparc64/tick.c | 414 --- sys/sparc64/sparc64/tlb.c | 148 - sys/sparc64/sparc64/trap.c | 614 ---- sys/sparc64/sparc64/tsb.c | 230 -- sys/sparc64/sparc64/uio_machdep.c | 141 - sys/sparc64/sparc64/upa.c | 597 ---- sys/sparc64/sparc64/vm_machdep.c | 489 --- sys/sparc64/sparc64/zeus.c | 173 - sys/sys/linker.h | 4 +- sys/vm/vm_kern.c | 2 +- 294 files changed, 52 insertions(+), 61270 deletions(-) delete mode 100644 sys/conf/Makefile.sparc64 delete mode 100644 sys/conf/files.sparc64 delete mode 100644 sys/conf/ldscript.sparc64 delete mode 100644 sys/conf/options.sparc64 delete mode 100644 sys/dev/atkbdc/atkbdc_ebus.c delete mode 100644 sys/dev/auxio/auxio.c delete mode 100644 sys/dev/auxio/auxioreg.h delete mode 100644 sys/dev/esp/esp_sbus.c delete mode 100644 sys/dev/fb/creator.c delete mode 100644 sys/dev/fb/creator_vt.c delete mode 100644 sys/dev/fb/creatorreg.h delete mode 100644 sys/dev/fb/machfb.c delete mode 100644 sys/dev/fb/machfbreg.h delete mode 100644 sys/dev/gem/if_gem_sbus.c delete mode 100644 sys/dev/hme/if_hme_sbus.c delete mode 100644 sys/dev/hwpmc/hwpmc_sparc64.c delete mode 100644 sys/dev/isp/isp_sbus.c delete mode 100644 sys/dev/ispfw/asm_1000.h delete mode 100644 sys/dev/le/if_le_lebuffer.c delete mode 100644 sys/dev/le/if_le_ledma.c delete mode 100644 sys/dev/le/lebuffer_sbus.c delete mode 100644 sys/dev/pcf/envctrl.c delete mode 100644 sys/dev/pcf/pcf_ebus.c delete mode 100644 sys/dev/scc/scc_bfe_ebus.c delete mode 100644 sys/dev/scc/scc_bfe_sbus.c delete mode 100644 sys/dev/sound/sbus/apcdmareg.h delete mode 100644 sys/dev/sound/sbus/cs4231.c delete mode 100644 sys/dev/sound/sbus/cs4231.h delete mode 100644 sys/dev/uart/uart_bus_ebus.c delete mode 100644 sys/dev/uart/uart_cpu_sparc64.c delete mode 100644 sys/dev/uart/uart_kbd_sun.c delete mode 100644 sys/dev/uart/uart_kbd_sun.h delete mode 100644 sys/dev/uart/uart_kbd_sun_tables.h delete mode 100644 sys/modules/auxio/Makefile delete mode 100644 sys/modules/epic/Makefile delete mode 100644 sys/modules/sound/driver/audiocs/Makefile delete mode 100644 sys/sparc64/central/central.c delete mode 100644 sys/sparc64/conf/DEFAULTS delete mode 100644 sys/sparc64/conf/GENERIC delete mode 100644 sys/sparc64/conf/GENERIC-NODEBUG delete mode 100644 sys/sparc64/conf/GENERIC.hints delete mode 100644 sys/sparc64/conf/Makefile delete mode 100644 sys/sparc64/conf/NOTES delete mode 100644 sys/sparc64/ebus/ebus.c delete mode 100644 sys/sparc64/ebus/ebusreg.h delete mode 100644 sys/sparc64/ebus/epic.c delete mode 100644 sys/sparc64/fhc/clkbrd.c delete mode 100644 sys/sparc64/fhc/clkbrdreg.h delete mode 100644 sys/sparc64/fhc/fhc.c delete mode 100644 sys/sparc64/fhc/fhcreg.h delete mode 100644 sys/sparc64/include/_align.h delete mode 100644 sys/sparc64/include/_bus.h delete mode 100644 sys/sparc64/include/_inttypes.h delete mode 100644 sys/sparc64/include/_limits.h delete mode 100644 sys/sparc64/include/_stdint.h delete mode 100644 sys/sparc64/include/_types.h delete mode 100644 sys/sparc64/include/asi.h delete mode 100644 sys/sparc64/include/asm.h delete mode 100644 sys/sparc64/include/asmacros.h delete mode 100644 sys/sparc64/include/atomic.h delete mode 100644 sys/sparc64/include/bus.h delete mode 100644 sys/sparc64/include/bus_common.h delete mode 100644 sys/sparc64/include/bus_dma.h delete mode 100644 sys/sparc64/include/bus_private.h delete mode 100644 sys/sparc64/include/cache.h delete mode 100644 sys/sparc64/include/ccr.h delete mode 100644 sys/sparc64/include/clock.h delete mode 100644 sys/sparc64/include/cmt.h delete mode 100644 sys/sparc64/include/counter.h delete mode 100644 sys/sparc64/include/cpu.h delete mode 100644 sys/sparc64/include/cpufunc.h delete mode 100644 sys/sparc64/include/db_machdep.h delete mode 100644 sys/sparc64/include/dcr.h delete mode 100644 sys/sparc64/include/dump.h delete mode 100644 sys/sparc64/include/efi.h delete mode 100644 sys/sparc64/include/elf.h delete mode 100644 sys/sparc64/include/endian.h delete mode 100644 sys/sparc64/include/exec.h delete mode 100644 sys/sparc64/include/fireplane.h delete mode 100644 sys/sparc64/include/float.h delete mode 100644 sys/sparc64/include/floatingpoint.h delete mode 100644 sys/sparc64/include/fp.h delete mode 100644 sys/sparc64/include/frame.h delete mode 100644 sys/sparc64/include/fsr.h delete mode 100644 sys/sparc64/include/gdb_machdep.h delete mode 100644 sys/sparc64/include/idprom.h delete mode 100644 sys/sparc64/include/ieee.h delete mode 100644 sys/sparc64/include/ieeefp.h delete mode 100644 sys/sparc64/include/in_cksum.h delete mode 100644 sys/sparc64/include/instr.h delete mode 100644 sys/sparc64/include/intr_machdep.h delete mode 100644 sys/sparc64/include/iommureg.h delete mode 100644 sys/sparc64/include/iommuvar.h delete mode 100644 sys/sparc64/include/jbus.h delete mode 100644 sys/sparc64/include/kdb.h delete mode 100644 sys/sparc64/include/kerneldump.h delete mode 100644 sys/sparc64/include/ktr.h delete mode 100644 sys/sparc64/include/limits.h delete mode 100644 sys/sparc64/include/lsu.h delete mode 100644 sys/sparc64/include/mcntl.h delete mode 100644 sys/sparc64/include/md_var.h delete mode 100644 sys/sparc64/include/memdev.h delete mode 100644 sys/sparc64/include/metadata.h delete mode 100644 sys/sparc64/include/nexusvar.h delete mode 100644 sys/sparc64/include/ofw_machdep.h delete mode 100644 sys/sparc64/include/ofw_mem.h delete mode 100644 sys/sparc64/include/ofw_nexus.h delete mode 100644 sys/sparc64/include/param.h delete mode 100644 sys/sparc64/include/pcb.h delete mode 100644 sys/sparc64/include/pcpu.h delete mode 100644 sys/sparc64/include/pcpu_aux.h delete mode 100644 sys/sparc64/include/pmap.h delete mode 100644 sys/sparc64/include/pmc_mdep.h delete mode 100644 sys/sparc64/include/proc.h delete mode 100644 sys/sparc64/include/procctl.h delete mode 100644 sys/sparc64/include/profile.h delete mode 100644 sys/sparc64/include/pstate.h delete mode 100644 sys/sparc64/include/ptrace.h delete mode 100644 sys/sparc64/include/reg.h delete mode 100644 sys/sparc64/include/reloc.h delete mode 100644 sys/sparc64/include/resource.h delete mode 100644 sys/sparc64/include/runq.h delete mode 100644 sys/sparc64/include/sc_machdep.h delete mode 100644 sys/sparc64/include/setjmp.h delete mode 100644 sys/sparc64/include/sf_buf.h delete mode 100644 sys/sparc64/include/sigframe.h delete mode 100644 sys/sparc64/include/signal.h delete mode 100644 sys/sparc64/include/smp.h delete mode 100644 sys/sparc64/include/stack.h delete mode 100644 sys/sparc64/include/stdarg.h delete mode 100644 sys/sparc64/include/sysarch.h delete mode 100644 sys/sparc64/include/tick.h delete mode 100644 sys/sparc64/include/tlb.h delete mode 100644 sys/sparc64/include/trap.h delete mode 100644 sys/sparc64/include/tsb.h delete mode 100644 sys/sparc64/include/tstate.h delete mode 100644 sys/sparc64/include/tte.h delete mode 100644 sys/sparc64/include/ucontext.h delete mode 100644 sys/sparc64/include/upa.h delete mode 100644 sys/sparc64/include/utrap.h delete mode 100644 sys/sparc64/include/vdso.h delete mode 100644 sys/sparc64/include/ver.h delete mode 100644 sys/sparc64/include/vm.h delete mode 100644 sys/sparc64/include/vmparam.h delete mode 100644 sys/sparc64/include/watch.h delete mode 100644 sys/sparc64/include/wstate.h delete mode 100644 sys/sparc64/isa/isa.c delete mode 100644 sys/sparc64/isa/isa_dma.c delete mode 100644 sys/sparc64/isa/ofw_isa.c delete mode 100644 sys/sparc64/isa/ofw_isa.h delete mode 100644 sys/sparc64/pci/apb.c delete mode 100644 sys/sparc64/pci/fire.c delete mode 100644 sys/sparc64/pci/firereg.h delete mode 100644 sys/sparc64/pci/firevar.h delete mode 100644 sys/sparc64/pci/ofw_pci.c delete mode 100644 sys/sparc64/pci/ofw_pci.h delete mode 100644 sys/sparc64/pci/ofw_pci_if.m delete mode 100644 sys/sparc64/pci/ofw_pcib.c delete mode 100644 sys/sparc64/pci/ofw_pcib_subr.c delete mode 100644 sys/sparc64/pci/ofw_pcib_subr.h delete mode 100644 sys/sparc64/pci/ofw_pcibus.c delete mode 100644 sys/sparc64/pci/psycho.c delete mode 100644 sys/sparc64/pci/psychoreg.h delete mode 100644 sys/sparc64/pci/psychovar.h delete mode 100644 sys/sparc64/pci/sbbc.c delete mode 100644 sys/sparc64/pci/schizo.c delete mode 100644 sys/sparc64/pci/schizoreg.h delete mode 100644 sys/sparc64/pci/schizovar.h delete mode 100644 sys/sparc64/sbus/dma_sbus.c delete mode 100644 sys/sparc64/sbus/lsi64854.c delete mode 100644 sys/sparc64/sbus/lsi64854reg.h delete mode 100644 sys/sparc64/sbus/lsi64854var.h delete mode 100644 sys/sparc64/sbus/ofw_sbus.h delete mode 100644 sys/sparc64/sbus/sbus.c delete mode 100644 sys/sparc64/sbus/sbusreg.h delete mode 100644 sys/sparc64/sbus/sbusvar.h delete mode 100644 sys/sparc64/sparc64/ata_machdep.c delete mode 100644 sys/sparc64/sparc64/autoconf.c delete mode 100644 sys/sparc64/sparc64/bus_machdep.c delete mode 100644 sys/sparc64/sparc64/cache.c delete mode 100644 sys/sparc64/sparc64/cam_machdep.c delete mode 100644 sys/sparc64/sparc64/cheetah.c delete mode 100644 sys/sparc64/sparc64/clock.c delete mode 100644 sys/sparc64/sparc64/counter.c delete mode 100644 sys/sparc64/sparc64/db_disasm.c delete mode 100644 sys/sparc64/sparc64/db_hwwatch.c delete mode 100644 sys/sparc64/sparc64/db_interface.c delete mode 100644 sys/sparc64/sparc64/db_trace.c delete mode 100644 sys/sparc64/sparc64/dump_machdep.c delete mode 100644 sys/sparc64/sparc64/eeprom.c delete mode 100644 sys/sparc64/sparc64/elf_machdep.c delete mode 100644 sys/sparc64/sparc64/exception.S delete mode 100644 sys/sparc64/sparc64/gdb_machdep.c delete mode 100644 sys/sparc64/sparc64/genassym.c delete mode 100644 sys/sparc64/sparc64/identcpu.c delete mode 100644 sys/sparc64/sparc64/in_cksum.c delete mode 100644 sys/sparc64/sparc64/interrupt.S delete mode 100644 sys/sparc64/sparc64/intr_machdep.c delete mode 100644 sys/sparc64/sparc64/iommu.c delete mode 100644 sys/sparc64/sparc64/jbusppm.c delete mode 100644 sys/sparc64/sparc64/locore.S delete mode 100644 sys/sparc64/sparc64/machdep.c delete mode 100644 sys/sparc64/sparc64/mem.c delete mode 100644 sys/sparc64/sparc64/mp_exception.S delete mode 100644 sys/sparc64/sparc64/mp_locore.S delete mode 100644 sys/sparc64/sparc64/mp_machdep.c delete mode 100644 sys/sparc64/sparc64/nexus.c delete mode 100644 sys/sparc64/sparc64/ofw_machdep.c delete mode 100644 sys/sparc64/sparc64/pmap.c delete mode 100644 sys/sparc64/sparc64/prof_machdep.c delete mode 100644 sys/sparc64/sparc64/rtc.c delete mode 100644 sys/sparc64/sparc64/rwindow.c delete mode 100644 sys/sparc64/sparc64/sc_machdep.c delete mode 100644 sys/sparc64/sparc64/schppm.c delete mode 100644 sys/sparc64/sparc64/spitfire.c delete mode 100644 sys/sparc64/sparc64/ssm.c delete mode 100644 sys/sparc64/sparc64/stack_machdep.c delete mode 100644 sys/sparc64/sparc64/support.S delete mode 100644 sys/sparc64/sparc64/swtch.S delete mode 100644 sys/sparc64/sparc64/sys_machdep.c delete mode 100644 sys/sparc64/sparc64/tick.c delete mode 100644 sys/sparc64/sparc64/tlb.c delete mode 100644 sys/sparc64/sparc64/trap.c delete mode 100644 sys/sparc64/sparc64/tsb.c delete mode 100644 sys/sparc64/sparc64/uio_machdep.c delete mode 100644 sys/sparc64/sparc64/upa.c delete mode 100644 sys/sparc64/sparc64/vm_machdep.c delete mode 100644 sys/sparc64/sparc64/zeus.c diff --git a/lib/libkvm/Makefile b/lib/libkvm/Makefile index 11c095a2255d1a..9fce7b9d467d6a 100644 --- a/lib/libkvm/Makefile +++ b/lib/libkvm/Makefile @@ -19,8 +19,7 @@ SRCS= kvm.c kvm_cptime.c kvm_getloadavg.c \ kvm_minidump_mips.c \ kvm_powerpc.c kvm_powerpc64.c \ kvm_minidump_riscv.c \ - kvm_minidump_powerpc64.c kvm_minidump_powerpc64_hpt.c \ - kvm_sparc64.c + kvm_minidump_powerpc64.c kvm_minidump_powerpc64_hpt.c INCS= kvm.h LIBADD= elf diff --git a/sys/Makefile b/sys/Makefile index 760c2073e5ee2c..688a00453b2d63 100644 --- a/sys/Makefile +++ b/sys/Makefile @@ -8,7 +8,7 @@ CSCOPEDIRS= bsm cam cddl compat conf contrib crypto ddb dev fs gdb \ rpc security sys ufs vm xdr xen ${CSCOPE_ARCHDIR} .if !defined(CSCOPE_ARCHDIR) .if defined(ALL_ARCH) -CSCOPE_ARCHDIR = amd64 arm arm64 i386 mips powerpc riscv sparc64 x86 +CSCOPE_ARCHDIR = amd64 arm arm64 i386 mips powerpc riscv x86 .else CSCOPE_ARCHDIR = ${MACHINE} .if ${MACHINE} != ${MACHINE_CPUARCH} diff --git a/sys/cam/cam_xpt.c b/sys/cam/cam_xpt.c index e58209300088a6..6ab6e94e8e38a9 100644 --- a/sys/cam/cam_xpt.c +++ b/sys/cam/cam_xpt.c @@ -2716,17 +2716,6 @@ xpt_action_default(union ccb *start_ccb) start_ccb->ccb_h.status = CAM_REQ_CMP; break; } -#if defined(__sparc64__) - /* - * For sparc64, we may need adjust the geometry of large - * disks in order to fit the limitations of the 16-bit - * fields of the VTOC8 disk label. - */ - if (scsi_da_bios_params(&start_ccb->ccg) != 0) { - start_ccb->ccb_h.status = CAM_REQ_CMP; - break; - } -#endif goto call_sim; case XPT_ABORT: { diff --git a/sys/cddl/compat/opensolaris/sys/atomic.h b/sys/cddl/compat/opensolaris/sys/atomic.h index b3a2f393afa48c..674ca5b1ff2405 100644 --- a/sys/cddl/compat/opensolaris/sys/atomic.h +++ b/sys/cddl/compat/opensolaris/sys/atomic.h @@ -91,7 +91,6 @@ atomic_dec_32_nv(volatile uint32_t *target) return (atomic_add_32_nv(target, -1)); } -#ifndef __sparc64__ static inline uint32_t atomic_cas_32(volatile uint32_t *target, uint32_t cmp, uint32_t newval) { @@ -107,7 +106,6 @@ atomic_cas_32(volatile uint32_t *target, uint32_t cmp, uint32_t newval) #endif return (cmp); } -#endif #if defined(__LP64__) || defined(__mips_n32) || \ defined(ARM_HAVE_ATOMIC64) || defined(I386_HAVE_ATOMIC64) || \ @@ -124,7 +122,6 @@ atomic_add_64_nv(volatile uint64_t *target, int64_t delta) return (atomic_fetchadd_64(target, delta) + delta); } -#ifndef __sparc64__ static inline uint64_t atomic_cas_64(volatile uint64_t *target, uint64_t cmp, uint64_t newval) { @@ -141,7 +138,6 @@ atomic_cas_64(volatile uint64_t *target, uint64_t cmp, uint64_t newval) return (cmp); } #endif -#endif static __inline void atomic_inc_64(volatile uint64_t *target) diff --git a/sys/cddl/contrib/opensolaris/common/lz4/lz4.c b/sys/cddl/contrib/opensolaris/common/lz4/lz4.c index 3a875565f4b46b..ee7f1fbe99e2db 100644 --- a/sys/cddl/contrib/opensolaris/common/lz4/lz4.c +++ b/sys/cddl/contrib/opensolaris/common/lz4/lz4.c @@ -245,16 +245,6 @@ lz4_decompress(void *s_start, void *d_start, size_t s_len, size_t d_len, #define LZ4_FORCE_UNALIGNED_ACCESS 1 #endif -/* - * FreeBSD: can't use GCC's __builtin_ctz when using sparc64 because - * gcc currently rely on libcompiler_rt. - * - * TODO: revisit this when situation changes. - */ -#if defined(__sparc64__) -#define LZ4_FORCE_SW_BITCOUNT -#endif - /* * Compiler Options */ diff --git a/sys/cddl/contrib/opensolaris/uts/common/sys/asm_linkage.h b/sys/cddl/contrib/opensolaris/uts/common/sys/asm_linkage.h index d694ea4844c39c..f10bcec40a7b4d 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/sys/asm_linkage.h +++ b/sys/cddl/contrib/opensolaris/uts/common/sys/asm_linkage.h @@ -41,11 +41,6 @@ extern "C" { #define ASM_ENTRY_ALIGN 16 -#elif defined(__sparc64__) - -/* GCC uses 32-byte function alignment for UltraSPARC CPUs. */ -#define ASM_ENTRY_ALIGN 32 - #else #error Unsupported architecture. diff --git a/sys/conf/Makefile.sparc64 b/sys/conf/Makefile.sparc64 deleted file mode 100644 index 736f9cba363857..00000000000000 --- a/sys/conf/Makefile.sparc64 +++ /dev/null @@ -1,49 +0,0 @@ -# Makefile.sparc64 -- with config changes. -# Copyright 1990 W. Jolitz -# from: @(#)Makefile.i386 7.1 5/10/91 -# $FreeBSD$ -# -# Makefile for FreeBSD -# -# This makefile is constructed from a machine description: -# config machineid -# Most changes should be made in the machine description -# /sys/sparc64/conf/``machineid'' -# after which you should do -# config machineid -# Generic makefile changes should be made in -# /sys/conf/Makefile.sparc64 -# after which config should be rerun for all machines. -# - -# Which version of config(8) is required. -%VERSREQ= 600012 - -STD8X16FONT?= iso - -.if !defined(S) -.if exists(./@/.) -S= ./@ -.else -S= ../../.. -.endif -.endif -.include "$S/conf/kern.pre.mk" - -MDOBJS= exception.o interrupt.o - -%BEFORE_DEPEND - -%OBJS - -%FILES.c - -%FILES.s - -%FILES.m - -%CLEAN - -%RULES - -.include "$S/conf/kern.post.mk" diff --git a/sys/conf/NOTES b/sys/conf/NOTES index 0f570e89b78132..2b67f4960eecc1 100644 --- a/sys/conf/NOTES +++ b/sys/conf/NOTES @@ -2045,8 +2045,6 @@ device sound # snd_ad1816: Analog Devices AD1816 ISA PnP/non-PnP. # snd_als4000: Avance Logic ALS4000 PCI. # snd_atiixp: ATI IXP 200/300/400 PCI. -# snd_audiocs: Crystal Semiconductor CS4231 SBus/EBus. Only -# for sparc64. # snd_cmi: CMedia CMI8338/CMI8738 PCI. # snd_cs4281: Crystal Semiconductor CS4281 PCI. # snd_csa: Crystal Semiconductor CS461x/428x PCI. (except @@ -2089,7 +2087,6 @@ device sound device snd_ad1816 device snd_als4000 device snd_atiixp -#device snd_audiocs device snd_cmi device snd_cs4281 device snd_csa diff --git a/sys/conf/files b/sys/conf/files index f09ffe13bc5f2a..32443799dc01b4 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -1743,7 +1743,6 @@ dev/fxp/if_fxp.c optional fxp dev/fxp/inphy.c optional fxp dev/gem/if_gem.c optional gem dev/gem/if_gem_pci.c optional gem pci -dev/gem/if_gem_sbus.c optional gem sbus dev/gpio/dwgpio/dwgpio.c optional gpio dwgpio fdt dev/gpio/dwgpio/dwgpio_bus.c optional gpio dwgpio fdt dev/gpio/dwgpio/dwgpio_if.m optional gpio dwgpio fdt @@ -1769,7 +1768,6 @@ dev/gpio/ofw_gpiobus.c optional fdt gpio dev/hifn/hifn7751.c optional hifn dev/hme/if_hme.c optional hme dev/hme/if_hme_pci.c optional hme pci -dev/hme/if_hme_sbus.c optional hme sbus dev/hptiop/hptiop.c optional hptiop scbus dev/hwpmc/hwpmc_logging.c optional hwpmc dev/hwpmc/hwpmc_mod.c optional hwpmc @@ -1885,7 +1883,6 @@ dev/isp/isp.c optional isp dev/isp/isp_freebsd.c optional isp dev/isp/isp_library.c optional isp dev/isp/isp_pci.c optional isp pci -dev/isp/isp_sbus.c optional isp sbus dev/isp/isp_target.c optional isp dev/ispfw/ispfw.c optional ispfw dev/iwi/if_iwi.c optional iwi @@ -3009,9 +3006,7 @@ rtwn-rtl8821aufw.fw optional rtwn-rtl8821aufw | rtwnfw \ clean "rtwn-rtl8821aufw.fw" dev/safe/safe.c optional safe dev/scc/scc_if.m optional scc -dev/scc/scc_bfe_ebus.c optional scc ebus dev/scc/scc_bfe_quicc.c optional scc quicc -dev/scc/scc_bfe_sbus.c optional scc fhc | scc sbus dev/scc/scc_core.c optional scc dev/scc/scc_dev_quicc.c optional scc quicc dev/scc/scc_dev_sab82532.c optional scc @@ -3171,7 +3166,6 @@ dev/tws/tws_hdm.c optional tws dev/tws/tws_services.c optional tws dev/tws/tws_user.c optional tws dev/uart/uart_bus_acpi.c optional uart acpi -dev/uart/uart_bus_ebus.c optional uart ebus dev/uart/uart_bus_fdt.c optional uart fdt dev/uart/uart_bus_isa.c optional uart isa dev/uart/uart_bus_pccard.c optional uart pccard diff --git a/sys/conf/files.sparc64 b/sys/conf/files.sparc64 deleted file mode 100644 index 66d039934f98a7..00000000000000 --- a/sys/conf/files.sparc64 +++ /dev/null @@ -1,146 +0,0 @@ -# This file tells config what files go into building a kernel, -# files marked standard are always included. -# -# $FreeBSD$ -# -# The long compile-with and dependency lines are required because of -# limitations in config: backslash-newline doesn't work in strings, and -# dependency lines other than the first are silently ignored. -# -atkbdmap.h optional atkbd_dflt_keymap \ - compile-with "kbdcontrol -P ${S:S/sys$/share/}/vt/keymaps -P ${S:S/sys$/share/}/syscons/keymaps -L ${ATKBD_DFLT_KEYMAP} | sed -e 's/^static keymap_t.* = /static keymap_t key_map = /' -e 's/^static accentmap_t.* = /static accentmap_t accent_map = /' > atkbdmap.h" \ - no-obj no-implicit-rule before-depend \ - clean "atkbdmap.h" -# -sunkbdmap.h optional sunkbd_dflt_keymap \ - compile-with "kbdcontrol -P ${S:S/sys$/share/}/vt/keymaps -P ${S:S/sys$/share/}/syscons/keymaps -L ${SUNKBD_DFLT_KEYMAP} | sed -e 's/^static keymap_t.* = /static keymap_t key_map = /' -e 's/^static accentmap_t.* = /static accentmap_t accent_map = /' > sunkbdmap.h" \ - no-obj no-implicit-rule before-depend \ - clean "sunkbdmap.h" -# -crypto/blowfish/bf_enc.c optional crypto | ipsec | ipsec_support -crypto/des/des_enc.c optional crypto | ipsec | ipsec_support | netsmb -dev/atkbdc/atkbd.c optional atkbd atkbdc -dev/atkbdc/atkbd_atkbdc.c optional atkbd atkbdc -dev/atkbdc/atkbdc.c optional atkbdc -dev/atkbdc/atkbdc_ebus.c optional atkbdc ebus -dev/atkbdc/atkbdc_isa.c optional atkbdc isa -dev/atkbdc/atkbdc_subr.c optional atkbdc -dev/atkbdc/psm.c optional psm atkbdc -dev/auxio/auxio.c optional auxio sbus | auxio ebus -dev/esp/esp_sbus.c optional esp sbus -dev/fb/creator.c optional creator sc -dev/fb/creator_vt.c optional creator vt -dev/fb/fb.c optional sc -dev/fb/gallant12x22.c optional sc -dev/fb/machfb.c optional machfb sc -dev/hwpmc/hwpmc_sparc64.c optional hwpmc -dev/le/if_le_lebuffer.c optional le sbus -dev/le/if_le_ledma.c optional le sbus -dev/le/lebuffer_sbus.c optional le sbus -dev/ofw/ofw_bus_if.m standard -dev/ofw/ofw_bus_subr.c standard -dev/ofw/ofw_console.c optional ofw_console -dev/ofw/ofw_if.m standard -dev/ofw/ofw_standard.c standard -dev/ofw/openfirm.c standard -dev/ofw/openfirmio.c standard -dev/ofw/openpromio.c standard -dev/pcf/envctrl.c optional pcf ebus -dev/pcf/pcf_ebus.c optional pcf ebus -dev/sound/sbus/cs4231.c optional snd_audiocs ebus | \ - snd_audiocs sbus -dev/syscons/scgfbrndr.c optional sc -dev/uart/uart_cpu_sparc64.c optional uart -dev/uart/uart_kbd_sun.c optional uart sc | vt -dev/vt/hw/ofwfb/ofwfb.c optional vt -kern/kern_clocksource.c standard -kern/subr_dummy_vdso_tc.c standard -kern/syscalls.c optional ktr -kern/subr_sfbuf.c standard -libkern/ffs.c standard -libkern/ffsl.c standard -libkern/ffsll.c standard -libkern/fls.c standard -libkern/flsl.c standard -libkern/flsll.c standard -libkern/memcmp.c standard -sparc64/central/central.c optional central -sparc64/ebus/ebus.c optional ebus -sparc64/ebus/epic.c optional epic ebus -sparc64/fhc/clkbrd.c optional fhc -sparc64/fhc/fhc.c optional fhc -sparc64/isa/isa.c optional isa -sparc64/isa/isa_dma.c optional isa -sparc64/isa/ofw_isa.c optional ebus | isa -sparc64/pci/apb.c optional pci -sparc64/pci/fire.c optional pci -sparc64/pci/ofw_pci.c optional pci -sparc64/pci/ofw_pcib.c optional pci -sparc64/pci/ofw_pcib_subr.c optional pci -sparc64/pci/ofw_pcibus.c optional pci -sparc64/pci/ofw_pci_if.m optional pci -sparc64/pci/psycho.c optional pci -sparc64/pci/sbbc.c optional sbbc uart -sparc64/pci/schizo.c optional pci -sparc64/sbus/dma_sbus.c optional sbus -sparc64/sbus/sbus.c optional sbus -sparc64/sbus/lsi64854.c optional sbus -sparc64/sparc64/ata_machdep.c optional ada | da -sparc64/sparc64/autoconf.c standard -sparc64/sparc64/bus_machdep.c standard -sparc64/sparc64/cache.c standard -sparc64/sparc64/cam_machdep.c optional scbus -sparc64/sparc64/cheetah.c standard -sparc64/sparc64/clock.c standard -sparc64/sparc64/counter.c standard -sparc64/sparc64/db_disasm.c optional ddb -sparc64/sparc64/db_interface.c optional ddb -sparc64/sparc64/db_trace.c optional ddb -sparc64/sparc64/db_hwwatch.c optional ddb -sparc64/sparc64/dump_machdep.c standard -sparc64/sparc64/elf_machdep.c standard -sparc64/sparc64/exception.S standard no-obj \ - compile-with "${NORMAL_S} -mcpu=ultrasparc" -sparc64/sparc64/eeprom.c optional eeprom ebus | eeprom fhc | \ - eeprom sbus -sparc64/sparc64/gdb_machdep.c optional gdb -sparc64/sparc64/identcpu.c standard -sparc64/sparc64/in_cksum.c optional inet | inet6 -sparc64/sparc64/interrupt.S standard no-obj \ - compile-with "${NORMAL_S} -mcpu=ultrasparc" -sparc64/sparc64/intr_machdep.c standard -sparc64/sparc64/iommu.c standard -sparc64/sparc64/jbusppm.c standard -sparc64/sparc64/locore.S standard no-obj -sparc64/sparc64/machdep.c standard -sparc64/sparc64/mem.c optional mem -sparc64/sparc64/mp_exception.S optional smp \ - compile-with "${NORMAL_S} -mcpu=ultrasparc" -sparc64/sparc64/mp_locore.S optional smp -sparc64/sparc64/mp_machdep.c optional smp -sparc64/sparc64/nexus.c standard -sparc64/sparc64/ofw_machdep.c standard -sparc64/sparc64/pmap.c standard -sparc64/sparc64/prof_machdep.c optional profiling-routine -sparc64/sparc64/rtc.c optional rtc ebus | rtc isa -sparc64/sparc64/rwindow.c standard -sparc64/sparc64/sc_machdep.c optional sc -sparc64/sparc64/schppm.c standard -sparc64/sparc64/spitfire.c standard -sparc64/sparc64/ssm.c standard -sparc64/sparc64/stack_machdep.c optional ddb | stack -sparc64/sparc64/support.S standard \ - compile-with "${NORMAL_S} -mcpu=ultrasparc" -sparc64/sparc64/sys_machdep.c standard -sparc64/sparc64/swtch.S standard -sparc64/sparc64/tick.c standard -sparc64/sparc64/tlb.c standard -sparc64/sparc64/trap.c standard -sparc64/sparc64/tsb.c standard -sparc64/sparc64/uio_machdep.c standard -sparc64/sparc64/upa.c optional creator -sparc64/sparc64/vm_machdep.c standard -sparc64/sparc64/zeus.c standard - -# Zstd -contrib/zstd/lib/freebsd/zstd_kfreebsd.c optional zstdio compile-with ${ZSTD_C} diff --git a/sys/conf/kern.mk b/sys/conf/kern.mk index 1e29b58663d473..56c0e76c25f6f0 100644 --- a/sys/conf/kern.mk +++ b/sys/conf/kern.mk @@ -153,18 +153,6 @@ CFLAGS+= -mno-relax .endif .endif -# -# For sparc64 we want the medany code model so modules may be located -# anywhere in the 64-bit address space. We also tell GCC to use floating -# point emulation. This avoids using floating point registers for integer -# operations which it has a tendency to do. -# -.if ${MACHINE_CPUARCH} == "sparc64" -CFLAGS.clang+= -mcmodel=large -fno-dwarf2-cfi-asm -CFLAGS.gcc+= -mcmodel=medany -msoft-float -INLINE_LIMIT?= 15000 -.endif - # # For AMD64, we explicitly prohibit the use of FPU, SSE and other SIMD # operations inside the kernel itself. These operations are exclusively @@ -315,5 +303,4 @@ LD_EMULATION_powerpc= elf32ppc_fbsd LD_EMULATION_powerpcspe= elf32ppc_fbsd LD_EMULATION_powerpc64= elf64ppc_fbsd LD_EMULATION_riscv64= elf64lriscv -LD_EMULATION_sparc64= elf64_sparc_fbsd LD_EMULATION=${LD_EMULATION_${MACHINE_ARCH}} diff --git a/sys/conf/kern.opts.mk b/sys/conf/kern.opts.mk index 3819acce8c1f9b..078d799136344e 100644 --- a/sys/conf/kern.opts.mk +++ b/sys/conf/kern.opts.mk @@ -93,8 +93,8 @@ BROKEN_OPTIONS+= OFED BROKEN_OPTIONS+= KERNEL_RETPOLINE .endif -# EFI doesn't exist on mips, powerpc, sparc or riscv. -.if ${MACHINE:Mmips} || ${MACHINE:Mpowerpc} || ${MACHINE:Msparc64} || ${MACHINE:Mriscv} +# EFI doesn't exist on mips, powerpc, or riscv. +.if ${MACHINE:Mmips} || ${MACHINE:Mpowerpc} || ${MACHINE:Mriscv} BROKEN_OPTIONS+=EFI .endif diff --git a/sys/conf/ldscript.sparc64 b/sys/conf/ldscript.sparc64 deleted file mode 100644 index aec138ed295fd6..00000000000000 --- a/sys/conf/ldscript.sparc64 +++ /dev/null @@ -1,269 +0,0 @@ -/* $FreeBSD$ */ -OUTPUT_FORMAT("elf64-sparc-freebsd", "elf64-sparc-freebsd", - "elf64-sparc-freebsd") -OUTPUT_ARCH(sparc:v9) -ENTRY(_start) -SEARCH_DIR(/usr/lib); -SECTIONS -{ - /* Read-only sections, merged into text segment: */ - . = kernbase + SIZEOF_HEADERS; - .interp : { *(.interp) } - .hash : { *(.hash) } - .dynsym : { *(.dynsym) } - .dynstr : { *(.dynstr) } - .gnu.version : { *(.gnu.version) } - .gnu.version_d : { *(.gnu.version_d) } - .gnu.version_r : { *(.gnu.version_r) } - .rel.init : { *(.rel.init) } - .rela.init : { *(.rela.init) } - .rel.text : - { - *(.rel.text) - *(.rel.text.*) - *(.rel.gnu.linkonce.t.*) - } - .rela.text : - { - *(.rela.text) - *(.rela.text.*) - *(.rela.gnu.linkonce.t.*) - } - .rel.fini : { *(.rel.fini) } - .rela.fini : { *(.rela.fini) } - .rel.rodata : - { - *(.rel.rodata) - *(.rel.rodata.*) - *(.rel.gnu.linkonce.r.*) - } - .rela.rodata : - { - *(.rela.rodata) - *(.rela.rodata.*) - *(.rela.gnu.linkonce.r.*) - } - .rel.data : - { - *(.rel.data) - *(.rel.data.*) - *(.rel.gnu.linkonce.d.*) - } - .rela.data : - { - *(.rela.data) - *(.rela.data.*) - *(.rela.gnu.linkonce.d.*) - } - .rel.ctors : { *(.rel.ctors) } - .rela.ctors : { *(.rela.ctors) } - .rel.dtors : { *(.rel.dtors) } - .rela.dtors : { *(.rela.dtors) } - .rel.got : { *(.rel.got) } - .rela.got : { *(.rela.got) } - .rel.sdata : - { - *(.rel.sdata) - *(.rel.sdata.*) - *(.rel.gnu.linkonce.s.*) - } - .rela.sdata : - { - *(.rela.sdata) - *(.rela.sdata.*) - *(.rela.gnu.linkonce.s.*) - } - .rel.sbss : - { - *(.rel.sbss) - *(.rel.sbss.*) - *(.rel.gnu.linkonce.sb.*) - } - .rela.sbss : - { - *(.rela.sbss) - *(.rela.sbss.*) - *(.rel.gnu.linkonce.sb.*) - } - .rel.sdata2 : - { - *(.rel.sdata2) - *(.rel.sdata2.*) - *(.rel.gnu.linkonce.s2.*) - } - .rela.sdata2 : - { - *(.rela.sdata2) - *(.rela.sdata2.*) - *(.rela.gnu.linkonce.s2.*) - } - .rel.sbss2 : - { - *(.rel.sbss2) - *(.rel.sbss2.*) - *(.rel.gnu.linkonce.sb2.*) - } - .rela.sbss2 : - { - *(.rela.sbss2) - *(.rela.sbss2.*) - *(.rela.gnu.linkonce.sb2.*) - } - .rel.bss : - { - *(.rel.bss) - *(.rel.bss.*) - *(.rel.gnu.linkonce.b.*) - } - .rela.bss : - { - *(.rela.bss) - *(.rela.bss.*) - *(.rela.gnu.linkonce.b.*) - } - .rel.plt : { *(.rel.plt) } - .rela.plt : { *(.rela.plt) } - .init : - { - KEEP (*(.init)) - } =0x1000000 - .text : - { - *(.trap) - *(.text) - *(.text.*) - *(.stub) - /* .gnu.warning sections are handled specially by elf32.em. */ - *(.gnu.warning) - *(.gnu.linkonce.t.*) - } =0x1000000 - .fini : - { - KEEP (*(.fini)) - } =0x1000000 - PROVIDE (__etext = .); - PROVIDE (_etext = .); - PROVIDE (etext = .); - .rodata : { *(.rodata) *(.rodata.*) *(.gnu.linkonce.r.*) } - .rodata1 : { *(.rodata1) } - .note.gnu.build-id : { - PROVIDE (__build_id_start = .); - *(.note.gnu.build-id) - PROVIDE (__build_id_end = .); - } - .sdata2 : { *(.sdata2) *(.sdata2.*) *(.gnu.linkonce.s2.*) } - .sbss2 : { *(.sbss2) *(.sbss2.*) *(.gnu.linkonce.sb2.*) } - . = ALIGN(0x2000) + (. & (0x2000 - 1)); - .data : - { - *(.data) - *(.data.*) - *(.gnu.linkonce.d.*) - } - .data1 : { *(.data1) } - .eh_frame : { KEEP (*(.eh_frame)) } - .gcc_except_table : { *(.gcc_except_table) } - .ctors : - { - /* gcc uses crtbegin.o to find the start of - the constructors, so we make sure it is - first. Because this is a wildcard, it - doesn't matter if the user does not - actually link against crtbegin.o; the - linker won't look for a file to match a - wildcard. The wildcard also means that it - doesn't matter which directory crtbegin.o - is in. */ - KEEP (*crtbegin.o(.ctors)) - /* We don't want to include the .ctor section from - from the crtend.o file until after the sorted ctors. - The .ctor section from the crtend file contains the - end of ctors marker and it must be last */ - KEEP (*(EXCLUDE_FILE (*crtend.o ) .ctors)) - KEEP (*(SORT(.ctors.*))) - KEEP (*(.ctors)) - } - .dtors : - { - KEEP (*crtbegin.o(.dtors)) - KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors)) - KEEP (*(SORT(.dtors.*))) - KEEP (*(.dtors)) - } - .plt : { *(.plt) } - .got : { *(.got.plt) *(.got) } - .dynamic : { *(.dynamic) } - /* We want the small data sections together, so single-instruction offsets - can access them all, and initialized data all before uninitialized, so - we can shorten the on-disk segment size. */ - .sdata : - { - *(.sdata) - *(.sdata.*) - *(.gnu.linkonce.s.*) - } - _edata = .; - PROVIDE (edata = .); - __bss_start = .; - .sbss : - { - PROVIDE (__sbss_start = .); - PROVIDE (___sbss_start = .); - *(.dynsbss) - *(.sbss) - *(.sbss.*) - *(.gnu.linkonce.sb.*) - *(.scommon) - PROVIDE (__sbss_end = .); - PROVIDE (___sbss_end = .); - } - .bss : - { - *(.dynbss) - *(.bss) - *(.bss.*) - *(.gnu.linkonce.b.*) - *(COMMON) - /* Align here to ensure that the .bss section occupies space up to - _end. Align after .bss to ensure correct alignment even if the - .bss section disappears because there are no input sections. */ - . = ALIGN(64 / 8); - } - . = ALIGN(64 / 8); - _end = .; - PROVIDE (end = .); - /* Stabs debugging sections. */ - .stab 0 : { *(.stab) } - .stabstr 0 : { *(.stabstr) } - .stab.excl 0 : { *(.stab.excl) } - .stab.exclstr 0 : { *(.stab.exclstr) } - .stab.index 0 : { *(.stab.index) } - .stab.indexstr 0 : { *(.stab.indexstr) } - .comment 0 : { *(.comment) } - /* DWARF debug sections. - Symbols in the DWARF debugging sections are relative to the beginning - of the section so we begin them at 0. */ - /* DWARF 1 */ - .debug 0 : { *(.debug) } - .line 0 : { *(.line) } - /* GNU DWARF 1 extensions */ - .debug_srcinfo 0 : { *(.debug_srcinfo) } - .debug_sfnames 0 : { *(.debug_sfnames) } - /* DWARF 1.1 and DWARF 2 */ - .debug_aranges 0 : { *(.debug_aranges) } - .debug_pubnames 0 : { *(.debug_pubnames) } - /* DWARF 2 */ - .debug_info 0 : { *(.debug_info) *(.gnu.linkonce.wi.*) } - .debug_abbrev 0 : { *(.debug_abbrev) } - .debug_line 0 : { *(.debug_line) } - .debug_frame 0 : { *(.debug_frame) } - .debug_str 0 : { *(.debug_str) } - .debug_loc 0 : { *(.debug_loc) } - .debug_macinfo 0 : { *(.debug_macinfo) } - /* SGI/MIPS DWARF 2 extensions */ - .debug_weaknames 0 : { *(.debug_weaknames) } - .debug_funcnames 0 : { *(.debug_funcnames) } - .debug_typenames 0 : { *(.debug_typenames) } - .debug_varnames 0 : { *(.debug_varnames) } - /* These must appear regardless of . */ -} diff --git a/sys/conf/options.sparc64 b/sys/conf/options.sparc64 deleted file mode 100644 index 883db166927933..00000000000000 --- a/sys/conf/options.sparc64 +++ /dev/null @@ -1,31 +0,0 @@ -# $FreeBSD$ - -GFB_DEBUG opt_gfb.h -GFB_NO_FONT_LOADING opt_gfb.h -GFB_NO_MODE_CHANGE opt_gfb.h - -SUN4U opt_global.h - -ATKBD_DFLT_KEYMAP opt_atkbd.h - -FIRE_DEBUG opt_fire.h - -# Debug IOMMU inserts/removes using diagnostic accesses. This is very loud. -IOMMU_DIAG opt_iommu.h - -OFWCONS_POLL_HZ opt_ofw.h - -OFW_PCI_DEBUG opt_ofw_pci.h - -PMAP_STATS opt_pmap.h - -PSM_DEBUG opt_psm.h -PSM_HOOKRESUME opt_psm.h -PSM_RESETAFTERSUSPEND opt_psm.h - -PSYCHO_DEBUG opt_psycho.h - -SCHIZO_DEBUG opt_schizo.h - -SUNKBD_DFLT_KEYMAP opt_sunkbd.h -SUNKBD_EMULATE_ATKBD opt_sunkbd.h diff --git a/sys/contrib/ck/include/ck_md.h b/sys/contrib/ck/include/ck_md.h index 8e452c7d35de61..51649597b25485 100644 --- a/sys/contrib/ck/include/ck_md.h +++ b/sys/contrib/ck/include/ck_md.h @@ -114,9 +114,6 @@ net $ #define CK_MD_SSE_DISABLE 1 #elif defined(__amd64__) #define CK_MD_TSO -#elif defined(__sparc64__) && !defined(__sparcv9__) -#define __sparcv9__ -#define CK_MD_TSO #elif defined(__powerpc64__) && !defined(__ppc64__) #define __ppc64__ #elif defined(__powerpc__) && !defined(__ppc__) diff --git a/sys/dev/ata/ata-pci.c b/sys/dev/ata/ata-pci.c index 48a31e69883ddb..426c1ee36e0b40 100644 --- a/sys/dev/ata/ata-pci.c +++ b/sys/dev/ata/ata-pci.c @@ -147,17 +147,9 @@ ata_pci_detach(device_t dev) if (ctlr->chipdeinit != NULL) ctlr->chipdeinit(dev); if (ctlr->r_res2) { -#ifdef __sparc64__ - bus_space_unmap(rman_get_bustag(ctlr->r_res2), - rman_get_bushandle(ctlr->r_res2), rman_get_size(ctlr->r_res2)); -#endif bus_release_resource(dev, ctlr->r_type2, ctlr->r_rid2, ctlr->r_res2); } if (ctlr->r_res1) { -#ifdef __sparc64__ - bus_space_unmap(rman_get_bustag(ctlr->r_res1), - rman_get_bushandle(ctlr->r_res1), rman_get_size(ctlr->r_res1)); -#endif bus_release_resource(dev, ctlr->r_type1, ctlr->r_rid1, ctlr->r_res1); } diff --git a/sys/dev/ata/chipsets/ata-promise.c b/sys/dev/ata/chipsets/ata-promise.c index c189509201d809..c9518f18d3dd2f 100644 --- a/sys/dev/ata/chipsets/ata-promise.c +++ b/sys/dev/ata/chipsets/ata-promise.c @@ -250,14 +250,6 @@ ata_promise_chipinit(device_t dev) &ctlr->r_rid1, RF_ACTIVE))) goto failnfree; -#ifdef __sparc64__ - if (ctlr->chip->cfg2 == PR_SX4X && - !bus_space_map(rman_get_bustag(ctlr->r_res1), - rman_get_bushandle(ctlr->r_res1), rman_get_size(ctlr->r_res1), - BUS_SPACE_MAP_LINEAR, NULL)) - goto failnfree; -#endif - ctlr->r_type2 = SYS_RES_MEMORY; ctlr->r_rid2 = PCIR_BAR(3); if (!(ctlr->r_res2 = bus_alloc_resource_any(dev, ctlr->r_type2, diff --git a/sys/dev/atkbdc/atkbd.c b/sys/dev/atkbdc/atkbd.c index b74587635d9e5c..ddf266abf5311f 100644 --- a/sys/dev/atkbdc/atkbd.c +++ b/sys/dev/atkbdc/atkbd.c @@ -74,7 +74,6 @@ typedef struct atkbd_state { } atkbd_state_t; static void atkbd_timeout(void *arg); -static void atkbd_shutdown_final(void *v); static int atkbd_reset(KBDC kbdc, int flags, int c); #define HAS_QUIRK(p, q) (((atkbdc_softc_t *)(p))->quirks & q) @@ -151,9 +150,6 @@ atkbd_attach_unit(device_t dev, keyboard_t **kbd, int irq, int flags) if (bootverbose) (*sw->diag)(*kbd, bootverbose); - EVENTHANDLER_REGISTER(shutdown_final, atkbd_shutdown_final, *kbd, - SHUTDOWN_PRI_DEFAULT); - return 0; } @@ -1148,30 +1144,6 @@ atkbd_poll(keyboard_t *kbd, int on) return 0; } -static void -atkbd_shutdown_final(void *v) -{ -#ifdef __sparc64__ - keyboard_t *kbd = v; - KBDC kbdc = ((atkbd_state_t *)kbd->kb_data)->kbdc; - - /* - * Turn off the translation in preparation for handing the keyboard - * over to the OFW as the OBP driver doesn't use translation and - * also doesn't disable it itself resulting in a broken keymap at - * the boot prompt. Also disable the aux port and the interrupts as - * the OBP driver doesn't use them, i.e. polls the keyboard. Not - * disabling the interrupts doesn't cause real problems but the - * responsiveness is a bit better when they are turned off. - */ - send_kbd_command(kbdc, KBDC_DISABLE_KBD); - set_controller_command_byte(kbdc, - KBD_AUX_CONTROL_BITS | KBD_KBD_CONTROL_BITS | KBD_TRANSLATION, - KBD_DISABLE_AUX_PORT | KBD_DISABLE_KBD_INT | KBD_ENABLE_KBD_PORT); - send_kbd_command(kbdc, KBDC_ENABLE_KBD); -#endif -} - static int atkbd_reset(KBDC kbdc, int flags, int c) { @@ -1468,14 +1440,6 @@ init_keyboard(KBDC kbdc, int *type, int flags) } } -#if defined(__sparc64__) - if (send_kbd_command_and_data( - kbdc, KBDC_SET_SCANCODE_SET, 2) != KBD_ACK) { - printf("atkbd: can't set translation.\n"); - } - c |= KBD_TRANSLATION; -#endif - /* * Some keyboards require a SETLEDS command to be sent after * the reset command before they will send keystrokes to us diff --git a/sys/dev/atkbdc/atkbdc.c b/sys/dev/atkbdc/atkbdc.c index bcb47e64517768..23ccbab3142bb6 100644 --- a/sys/dev/atkbdc/atkbdc.c +++ b/sys/dev/atkbdc/atkbdc.c @@ -52,13 +52,7 @@ __FBSDID("$FreeBSD$"); #include -#ifdef __sparc64__ -#include -#include -#include -#else #include -#endif /* constants */ @@ -98,10 +92,6 @@ static atkbdc_softc_t *atkbdc_softc[MAXKBDC] = { &default_kbdc }; static int verbose = KBDIO_DEBUG; -#ifdef __sparc64__ -static struct bus_space_tag atkbdc_bst_store[MAXKBDC]; -#endif - /* function prototypes */ static int atkbdc_setup(atkbdc_softc_t *sc, bus_space_tag_t tag, @@ -197,55 +187,16 @@ atkbdc_configure(void) volatile int i; register_t flags; #endif -#ifdef __sparc64__ - char name[32]; - phandle_t chosen, node; - ihandle_t stdin; - bus_addr_t port0; - bus_addr_t port1; - int space; -#else int port0; int port1; -#endif /* XXX: tag should be passed from the caller */ #if defined(__amd64__) || defined(__i386__) tag = X86_BUS_SPACE_IO; -#elif defined(__sparc64__) - tag = &atkbdc_bst_store[0]; #else #error "define tag!" #endif -#ifdef __sparc64__ - if ((chosen = OF_finddevice("/chosen")) == -1) - return 0; - if (OF_getprop(chosen, "stdin", &stdin, sizeof(stdin)) == -1) - return 0; - if ((node = OF_instance_to_package(stdin)) == -1) - return 0; - if (OF_getprop(node, "name", name, sizeof(name)) == -1) - return 0; - name[sizeof(name) - 1] = '\0'; - if (strcmp(name, "kb_ps2") != 0) - return 0; - /* - * The stdin handle points to an instance of a PS/2 keyboard - * package but we want the 8042 controller, which is the parent - * of that keyboard node. - */ - if ((node = OF_parent(node)) == 0) - return 0; - if (OF_decode_addr(node, 0, &space, &port0) != 0) - return 0; - h0 = sparc64_fake_bustag(space, port0, tag); - bus_space_subregion(tag, h0, KBD_DATA_PORT, 1, &h0); - if (OF_decode_addr(node, 1, &space, &port1) != 0) - return 0; - h1 = sparc64_fake_bustag(space, port1, tag); - bus_space_subregion(tag, h1, KBD_STATUS_PORT, 1, &h1); -#else port0 = IO_KBD; resource_int_value("atkbdc", 0, "port", &port0); port1 = IO_KBD + KBD_STATUS_PORT; @@ -256,7 +207,6 @@ atkbdc_configure(void) h0 = (bus_space_handle_t)port0; h1 = (bus_space_handle_t)port1; #endif -#endif #if defined(__i386__) || defined(__amd64__) /* diff --git a/sys/dev/atkbdc/atkbdc_ebus.c b/sys/dev/atkbdc/atkbdc_ebus.c deleted file mode 100644 index 53c40433d6bad5..00000000000000 --- a/sys/dev/atkbdc/atkbdc_ebus.c +++ /dev/null @@ -1,307 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 1999 Kazutaka YOKOTA - * Copyright (c) 2005 Marius Strobl - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer as - * the first lines of this file unmodified. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * from: FreeBSD: src/sys/isa/atkbdc_isa.c,v 1.31 2005/05/29 04:42:28 nyan - */ - -#include -__FBSDID("$FreeBSD$"); - -#include "opt_kbd.h" - -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include - -#include - -#include -#include -#include -#include -#include - -static device_probe_t atkbdc_ebus_probe; -static device_attach_t atkbdc_ebus_attach; - -static device_method_t atkbdc_ebus_methods[] = { - DEVMETHOD(device_probe, atkbdc_ebus_probe), - DEVMETHOD(device_attach, atkbdc_ebus_attach), - DEVMETHOD(device_suspend, bus_generic_suspend), - DEVMETHOD(device_resume, bus_generic_resume), - - DEVMETHOD(bus_print_child, atkbdc_print_child), - DEVMETHOD(bus_read_ivar, atkbdc_read_ivar), - DEVMETHOD(bus_write_ivar, atkbdc_write_ivar), - DEVMETHOD(bus_get_resource_list,atkbdc_get_resource_list), - DEVMETHOD(bus_alloc_resource, bus_generic_rl_alloc_resource), - DEVMETHOD(bus_release_resource, bus_generic_rl_release_resource), - DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), - DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), - DEVMETHOD(bus_get_resource, bus_generic_rl_get_resource), - DEVMETHOD(bus_set_resource, bus_generic_rl_set_resource), - DEVMETHOD(bus_delete_resource, bus_generic_rl_delete_resource), - DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), - DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), - - { 0, 0 } -}; - -static driver_t atkbdc_ebus_driver = { - ATKBDC_DRIVER_NAME, - atkbdc_ebus_methods, - sizeof(atkbdc_softc_t *), -}; - -DRIVER_MODULE(atkbdc, ebus, atkbdc_ebus_driver, atkbdc_devclass, 0, 0); - -static int -atkbdc_ebus_probe(device_t dev) -{ - struct resource *port0, *port1; - rman_res_t count, start; - int error, rid; - - if (strcmp(ofw_bus_get_name(dev), "8042") != 0) - return (ENXIO); - - /* - * On AXi and AXmp boards the NS16550 (used to connect keyboard/ - * mouse) share their IRQ lines with the i8042. Any IRQ activity - * (typically during attach) of the NS16550 used to connect the - * keyboard when actually the PS/2 keyboard is selected in OFW - * causes interaction with the OBP i8042 driver resulting in a - * hang and vice versa. As RS232 keyboards and mice obviously - * aren't meant to be used in parallel with PS/2 ones on these - * boards don't attach to the i8042 in case the PS/2 keyboard - * isn't selected in order to prevent such hangs. - * Note that it's not sufficient here to rely on the '8042' node - * only showing up when a PS/2 keyboard is actually connected as - * the user still might have adjusted the 'keyboard' alias to - * point to the RS232 keyboard. - */ - if ((!strcmp(sparc64_model, "SUNW,UltraAX-MP") || - !strcmp(sparc64_model, "SUNW,UltraSPARC-IIi-Engine")) && - OF_finddevice("keyboard") != ofw_bus_get_node(dev)) { - device_disable(dev); - return (ENXIO); - } - - device_set_desc(dev, "Keyboard controller (i8042)"); - - /* - * The '8042' node has two identical 8 addresses wide resources - * which are apparently meant to be used one for the keyboard - * half and the other one for the mouse half. To simplify matters - * we use one for the command/data port resource and the other - * one for the status port resource as the atkbdc(4) back-end - * expects two struct resource rather than two bus space handles. - */ - rid = 0; - if (bus_get_resource(dev, SYS_RES_MEMORY, rid, &start, &count) != 0) { - device_printf(dev, - "cannot determine command/data port resource\n"); - return (ENXIO); - } - port0 = bus_alloc_resource(dev, SYS_RES_MEMORY, &rid, start, start, 1, - RF_ACTIVE); - if (port0 == NULL) { - device_printf(dev, - "cannot allocate command/data port resource\n"); - return (ENXIO); - } - - rid = 1; - if (bus_get_resource(dev, SYS_RES_MEMORY, rid, &start, &count) != 0) { - device_printf(dev, "cannot determine status port resource\n"); - error = ENXIO; - goto fail_port0; - } - start += KBD_STATUS_PORT; - port1 = bus_alloc_resource(dev, SYS_RES_MEMORY, &rid, start, start, 1, - RF_ACTIVE); - if (port1 == NULL) { - device_printf(dev, "cannot allocate status port resource\n"); - error = ENXIO; - goto fail_port0; - } - - error = atkbdc_probe_unit(device_get_unit(dev), port0, port1); - if (error != 0) - device_printf(dev, "atkbdc_porbe_unit failed\n"); - - bus_release_resource(dev, SYS_RES_MEMORY, 1, port1); - fail_port0: - bus_release_resource(dev, SYS_RES_MEMORY, 0, port0); - - return (error); -} - -static int -atkbdc_ebus_attach(device_t dev) -{ - atkbdc_softc_t *sc; - atkbdc_device_t *adi; - device_t cdev; - phandle_t child; - rman_res_t count, intr, start; - int children, error, rid, unit; - char *cname, *dname; - - unit = device_get_unit(dev); - sc = *(atkbdc_softc_t **)device_get_softc(dev); - if (sc == NULL) { - /* - * We have to maintain two copies of the kbdc_softc struct, - * as the low-level console needs to have access to the - * keyboard controller before kbdc is probed and attached. - * kbdc_soft[] contains the default entry for that purpose. - * See atkbdc.c. XXX - */ - sc = atkbdc_get_softc(unit); - if (sc == NULL) - return (ENOMEM); - device_set_softc(dev, sc); - } - - rid = 0; - if (bus_get_resource(dev, SYS_RES_MEMORY, rid, &start, &count) != 0) { - device_printf(dev, - "cannot determine command/data port resource\n"); - return (ENXIO); - } - sc->retry = 5000; - sc->port0 = bus_alloc_resource(dev, SYS_RES_MEMORY, &rid, start, start, - 1, RF_ACTIVE); - if (sc->port0 == NULL) { - device_printf(dev, - "cannot allocate command/data port resource\n"); - return (ENXIO); - } - - rid = 1; - if (bus_get_resource(dev, SYS_RES_MEMORY, rid, &start, &count) != 0) { - device_printf(dev, "cannot determine status port resource\n"); - error = ENXIO; - goto fail_port0; - } - start += KBD_STATUS_PORT; - sc->port1 = bus_alloc_resource(dev, SYS_RES_MEMORY, &rid, start, start, - 1, RF_ACTIVE); - if (sc->port1 == NULL) { - device_printf(dev, "cannot allocate status port resource\n"); - error = ENXIO; - goto fail_port0; - } - - error = atkbdc_attach_unit(unit, sc, sc->port0, sc->port1); - if (error != 0) { - device_printf(dev, "atkbdc_attach_unit failed\n"); - goto fail_port1; - } - - /* Attach children. */ - children = 0; - for (child = OF_child(ofw_bus_get_node(dev)); child != 0; - child = OF_peer(child)) { - if ((OF_getprop_alloc(child, "name", (void **)&cname)) == -1) - continue; - if (children >= 2) { - device_printf(dev, - "<%s>: only two children per 8042 supported\n", - cname); - OF_prop_free(cname); - continue; - } - adi = malloc(sizeof(struct atkbdc_device), M_ATKBDDEV, - M_NOWAIT | M_ZERO); - if (adi == NULL) { - device_printf(dev, "<%s>: malloc failed\n", cname); - OF_prop_free(cname); - continue; - } - if (strcmp(cname, "kb_ps2") == 0) { - adi->rid = KBDC_RID_KBD; - dname = ATKBD_DRIVER_NAME; - } else if (strcmp(cname, "kdmouse") == 0) { - adi->rid = KBDC_RID_AUX; - dname = PSM_DRIVER_NAME; - } else { - device_printf(dev, "<%s>: unknown device\n", cname); - free(adi, M_ATKBDDEV); - OF_prop_free(cname); - continue; - } - intr = bus_get_resource_start(dev, SYS_RES_IRQ, adi->rid); - if (intr == 0) { - device_printf(dev, - "<%s>: cannot determine interrupt resource\n", - cname); - free(adi, M_ATKBDDEV); - OF_prop_free(cname); - continue; - } - resource_list_init(&adi->resources); - resource_list_add(&adi->resources, SYS_RES_IRQ, adi->rid, - intr, intr, 1); - if ((cdev = device_add_child(dev, dname, -1)) == NULL) { - device_printf(dev, "<%s>: device_add_child failed\n", - cname); - resource_list_free(&adi->resources); - free(adi, M_ATKBDDEV); - OF_prop_free(cname); - continue; - } - device_set_ivars(cdev, adi); - children++; - } - - error = bus_generic_attach(dev); - if (error != 0) { - device_printf(dev, "bus_generic_attach failed\n"); - goto fail_port1; - } - - return (0); - - fail_port1: - bus_release_resource(dev, SYS_RES_MEMORY, 1, sc->port1); - fail_port0: - bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->port0); - - return (error); -} diff --git a/sys/dev/auxio/auxio.c b/sys/dev/auxio/auxio.c deleted file mode 100644 index 8c5f28d50e8a26..00000000000000 --- a/sys/dev/auxio/auxio.c +++ /dev/null @@ -1,325 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD AND BSD-3-Clause - * - * Copyright (c) 2004 Pyun YongHyeon - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ - -/* $NetBSD: auxio.c,v 1.11 2003/07/15 03:36:04 lukem Exp $ */ - -/*- - * Copyright (c) 2000, 2001 Matthew R. Green - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* - * AUXIO registers support on the SBus & EBus2, used for the floppy driver - * and to control the system LED, for the BLINK option. - */ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include - -#include -#include - -/* - * On sun4u, auxio exists with one register (LED) on the SBus, and 5 - * registers on the EBus2 (pci) (LED, PCIMODE, FREQUENCY, SCSI - * OSCILLATOR, and TEMP SENSE. - */ - -#define AUXIO_PCIO_LED 0 -#define AUXIO_PCIO_PCI 1 -#define AUXIO_PCIO_FREQ 2 -#define AUXIO_PCIO_OSC 3 -#define AUXIO_PCIO_TEMP 4 -#define AUXIO_PCIO_NREG 5 - -struct auxio_softc { - device_t sc_dev; - - int sc_nauxio; - struct resource *sc_res[AUXIO_PCIO_NREG]; - int sc_rid[AUXIO_PCIO_NREG]; - bus_space_tag_t sc_regt[AUXIO_PCIO_NREG]; - bus_space_handle_t sc_regh[AUXIO_PCIO_NREG]; - struct cdev *sc_led_dev; - u_int32_t sc_led_stat; - - int sc_flags; -#define AUXIO_LEDONLY 0x1 -#define AUXIO_EBUS 0x2 -#define AUXIO_SBUS 0x4 - - struct mtx sc_lock; -}; - -static void auxio_led_func(void *arg, int onoff); -static int auxio_attach_common(struct auxio_softc *); -static int auxio_bus_probe(device_t); -static int auxio_sbus_attach(device_t); -static int auxio_ebus_attach(device_t); -static int auxio_bus_detach(device_t); -static void auxio_free_resource(struct auxio_softc *); -static __inline u_int32_t auxio_led_read(struct auxio_softc *); -static __inline void auxio_led_write(struct auxio_softc *, u_int32_t); - -/* SBus */ -static device_method_t auxio_sbus_methods[] = { - DEVMETHOD(device_probe, auxio_bus_probe), - DEVMETHOD(device_attach, auxio_sbus_attach), - DEVMETHOD(device_detach, auxio_bus_detach), - - DEVMETHOD_END -}; - -static driver_t auxio_sbus_driver = { - "auxio", - auxio_sbus_methods, - sizeof(struct auxio_softc) -}; - -static devclass_t auxio_devclass; -/* The probe order is handled by sbus(4). */ -EARLY_DRIVER_MODULE(auxio, sbus, auxio_sbus_driver, auxio_devclass, 0, 0, - BUS_PASS_DEFAULT); -MODULE_DEPEND(auxio, sbus, 1, 1, 1); - -/* EBus */ -static device_method_t auxio_ebus_methods[] = { - DEVMETHOD(device_probe, auxio_bus_probe), - DEVMETHOD(device_attach, auxio_ebus_attach), - DEVMETHOD(device_detach, auxio_bus_detach), - - DEVMETHOD_END -}; - -static driver_t auxio_ebus_driver = { - "auxio", - auxio_ebus_methods, - sizeof(struct auxio_softc) -}; - -EARLY_DRIVER_MODULE(auxio, ebus, auxio_ebus_driver, auxio_devclass, 0, 0, - BUS_PASS_DEFAULT); -MODULE_DEPEND(auxio, ebus, 1, 1, 1); -MODULE_VERSION(auxio, 1); - -#define AUXIO_LOCK_INIT(sc) \ - mtx_init(&sc->sc_lock, "auxio mtx", NULL, MTX_DEF) -#define AUXIO_LOCK(sc) mtx_lock(&sc->sc_lock) -#define AUXIO_UNLOCK(sc) mtx_unlock(&sc->sc_lock) -#define AUXIO_LOCK_DESTROY(sc) mtx_destroy(&sc->sc_lock) - -static __inline void -auxio_led_write(struct auxio_softc *sc, u_int32_t v) -{ - if (sc->sc_flags & AUXIO_EBUS) - bus_space_write_4(sc->sc_regt[AUXIO_PCIO_LED], - sc->sc_regh[AUXIO_PCIO_LED], 0, v); - else - bus_space_write_1(sc->sc_regt[AUXIO_PCIO_LED], - sc->sc_regh[AUXIO_PCIO_LED], 0, v); -} - -static __inline u_int32_t -auxio_led_read(struct auxio_softc *sc) -{ - u_int32_t led; - - if (sc->sc_flags & AUXIO_EBUS) - led = bus_space_read_4(sc->sc_regt[AUXIO_PCIO_LED], - sc->sc_regh[AUXIO_PCIO_LED], 0); - else - led = bus_space_read_1(sc->sc_regt[AUXIO_PCIO_LED], - sc->sc_regh[AUXIO_PCIO_LED], 0); - - return (led); -} - -static void -auxio_led_func(void *arg, int onoff) -{ - struct auxio_softc *sc; - u_int32_t led; - - sc = (struct auxio_softc *)arg; - - AUXIO_LOCK(sc); - /* - * NB: We must not touch the other bits of the SBus AUXIO reg. - */ - led = auxio_led_read(sc); - if (onoff) - led |= AUXIO_LED_LED; - else - led &= ~AUXIO_LED_LED; - auxio_led_write(sc, led); - AUXIO_UNLOCK(sc); -} - -static int -auxio_bus_probe(device_t dev) -{ - const char *name; - - name = ofw_bus_get_name(dev); - if (strcmp("auxio", name) == 0) { - device_set_desc(dev, "Sun Auxiliary I/O"); - return (0); - } - - return (ENXIO); -} - -static int -auxio_ebus_attach(device_t dev) -{ - struct auxio_softc *sc; - - sc = device_get_softc(dev); - sc->sc_dev = dev; - - AUXIO_LOCK_INIT(sc); - sc->sc_nauxio = AUXIO_PCIO_NREG; - sc->sc_flags = AUXIO_LEDONLY | AUXIO_EBUS; - - return(auxio_attach_common(sc)); -} - -static int -auxio_attach_common(struct auxio_softc *sc) -{ - struct resource *res; - int i; - - for (i = 0; i < sc->sc_nauxio; i++) { - sc->sc_rid[i] = i; - res = bus_alloc_resource_any(sc->sc_dev, SYS_RES_MEMORY, - &sc->sc_rid[i], RF_ACTIVE); - if (res == NULL) { - device_printf(sc->sc_dev, - "could not allocate resources\n"); - goto attach_fail; - } - sc->sc_res[i] = res; - sc->sc_regt[i] = rman_get_bustag(res); - sc->sc_regh[i] = rman_get_bushandle(res); - } - - sc->sc_led_stat = auxio_led_read(sc) & AUXIO_LED_LED; - sc->sc_led_dev = led_create(auxio_led_func, sc, "auxioled"); - /* turn on the LED */ - auxio_led_func(sc, 1); - - return (0); - -attach_fail: - auxio_free_resource(sc); - - return (ENXIO); -} - -static int -auxio_bus_detach(device_t dev) -{ - struct auxio_softc *sc; - - sc = device_get_softc(dev); - led_destroy(sc->sc_led_dev); - auxio_led_func(sc, sc->sc_led_stat); - auxio_free_resource(sc); - - return (0); -} - -static void -auxio_free_resource(struct auxio_softc *sc) -{ - int i; - - for (i = 0; i < sc->sc_nauxio; i++) - if (sc->sc_res[i]) - bus_release_resource(sc->sc_dev, SYS_RES_MEMORY, - sc->sc_rid[i], sc->sc_res[i]); - AUXIO_LOCK_DESTROY(sc); -} - -static int -auxio_sbus_attach(device_t dev) -{ - struct auxio_softc *sc; - - sc = device_get_softc(dev); - sc->sc_dev = dev; - - AUXIO_LOCK_INIT(sc); - sc->sc_nauxio = 1; - sc->sc_flags = AUXIO_LEDONLY | AUXIO_SBUS; - - return (auxio_attach_common(sc)); -} diff --git a/sys/dev/auxio/auxioreg.h b/sys/dev/auxio/auxioreg.h deleted file mode 100644 index 3f93cf40635e33..00000000000000 --- a/sys/dev/auxio/auxioreg.h +++ /dev/null @@ -1,75 +0,0 @@ -/* $FreeBSD$ */ -/* $NetBSD: auxioreg.h,v 1.4 2001/10/22 07:31:41 mrg Exp $ */ - -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 2000 Matthew R. Green - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* - * The AUXIO registers; their offset in the Ebus2 address space, plus the - * bits for each register. Note that the fdthree (FD), SUNW,CS4231 (AUDIO) - * and power (POWER) devices on the Ebus2 have their AUXIO regsiters mapped - * into their own "reg" properties, not the "auxio" device's "reg" properties. - */ -#define AUXIO_FD 0x00720000 -#define AUXIO_FD_DENSENSE_INPUT 0x0 -#define AUXIO_FD_DENSENSE_OUTPUT 0x1 - -#define AUXIO_AUDIO 0x00722000 -#define AUXIO_AUDIO_POWERDOWN 0x0 - -#define AUXIO_POWER 0x00724000 -#define AUXIO_POWER_SYSTEM_OFF 0x0 -#define AUXIO_POWER_COURTESY_OFF 0x1 - -#define AUXIO_LED 0x00726000 -#define AUXIO_LED_LED 1 - -#define AUXIO_PCI 0x00728000 -#define AUXIO_PCI_SLOT0 0x0 /* two bits each */ -#define AUXIO_PCI_SLOT1 0x2 -#define AUXIO_PCI_SLOT2 0x4 -#define AUXIO_PCI_SLOT3 0x6 -#define AUXIO_PCI_MODE 0x8 - -#define AUXIO_FREQ 0x0072a000 -#define AUXIO_FREQ_FREQ0 0x0 -#define AUXIO_FREQ_FREQ1 0x1 -#define AUXIO_FREQ_FREQ2 0x2 - -#define AUXIO_SCSI 0x0072c000 -#define AUXIO_SCSI_INT_OSC_EN 0x0 -#define AUXIO_SCSI_EXT_OSC_EN 0x1 - -#define AUXIO_TEMP 0x0072f000 -#define AUXIO_TEMP_SELECT 0x0 -#define AUXIO_TEMP_CLOCK 0x1 -#define AUXIO_TEMP_ENABLE 0x2 -#define AUXIO_TEMP_DATAOUT 0x3 -#define AUXIO_TEMP_DATAINT 0x4 diff --git a/sys/dev/bge/if_bge.c b/sys/dev/bge/if_bge.c index fab4c1bb4bb2d3..b91ee5de964979 100644 --- a/sys/dev/bge/if_bge.c +++ b/sys/dev/bge/if_bge.c @@ -112,13 +112,6 @@ __FBSDID("$FreeBSD$"); #include "miidevs.h" #include -#ifdef __sparc64__ -#include -#include -#include -#include -#endif - #include #include @@ -557,47 +550,9 @@ static SYSCTL_NODE(_hw, OID_AUTO, bge, CTLFLAG_RD, 0, "BGE driver parameters"); SYSCTL_INT(_hw_bge, OID_AUTO, allow_asf, CTLFLAG_RDTUN, &bge_allow_asf, 0, "Allow ASF mode if available"); -#define SPARC64_BLADE_1500_MODEL "SUNW,Sun-Blade-1500" -#define SPARC64_BLADE_1500_PATH_BGE "/pci@1f,700000/network@2" -#define SPARC64_BLADE_2500_MODEL "SUNW,Sun-Blade-2500" -#define SPARC64_BLADE_2500_PATH_BGE "/pci@1c,600000/network@3" -#define SPARC64_OFW_SUBVENDOR "subsystem-vendor-id" - static int bge_has_eaddr(struct bge_softc *sc) { -#ifdef __sparc64__ - char buf[sizeof(SPARC64_BLADE_1500_PATH_BGE)]; - device_t dev; - uint32_t subvendor; - - dev = sc->bge_dev; - - /* - * The on-board BGEs found in sun4u machines aren't fitted with - * an EEPROM which means that we have to obtain the MAC address - * via OFW and that some tests will always fail. We distinguish - * such BGEs by the subvendor ID, which also has to be obtained - * from OFW instead of the PCI configuration space as the latter - * indicates Broadcom as the subvendor of the netboot interface. - * For early Blade 1500 and 2500 we even have to check the OFW - * device path as the subvendor ID always defaults to Broadcom - * there. - */ - if (OF_getprop(ofw_bus_get_node(dev), SPARC64_OFW_SUBVENDOR, - &subvendor, sizeof(subvendor)) == sizeof(subvendor) && - (subvendor == FJTSU_VENDORID || subvendor == SUN_VENDORID)) - return (0); - memset(buf, 0, sizeof(buf)); - if (OF_package_to_path(ofw_bus_get_node(dev), buf, sizeof(buf)) > 0) { - if (strcmp(sparc64_model, SPARC64_BLADE_1500_MODEL) == 0 && - strcmp(buf, SPARC64_BLADE_1500_PATH_BGE) == 0) - return (0); - if (strcmp(sparc64_model, SPARC64_BLADE_2500_MODEL) == 0 && - strcmp(buf, SPARC64_BLADE_2500_PATH_BGE) == 0) - return (0); - } -#endif return (1); } @@ -6744,15 +6699,7 @@ bge_sysctl_mem_read(SYSCTL_HANDLER_ARGS) static int bge_get_eaddr_fw(struct bge_softc *sc, uint8_t ether_addr[]) { -#ifdef __sparc64__ - if (sc->bge_flags & BGE_FLAG_EADDR) - return (1); - - OF_getetheraddr(sc->bge_dev, ether_addr); - return (0); -#else return (1); -#endif } static int diff --git a/sys/dev/cas/if_cas.c b/sys/dev/cas/if_cas.c index 88408e2f3bca38..1a20596f2923eb 100644 --- a/sys/dev/cas/if_cas.c +++ b/sys/dev/cas/if_cas.c @@ -78,7 +78,7 @@ __FBSDID("$FreeBSD$"); #include #include -#if defined(__powerpc__) || defined(__sparc64__) +#if defined(__powerpc__) #include #include #include @@ -1045,14 +1045,10 @@ cas_init_locked(struct cas_softc *sc) /* * Enable infinite bursts for revisions without PCI issues if - * applicable. Doing so greatly improves the TX performance on - * !__sparc64__ (on sparc64, setting CAS_INF_BURST improves TX - * performance only marginally but hurts RX throughput quite a bit). + * applicable. Doing so greatly improves the TX performance. */ CAS_WRITE_4(sc, CAS_INF_BURST, -#if !defined(__sparc64__) (sc->sc_flags & CAS_TABORT) == 0 ? CAS_INF_BURST_EN : -#endif 0); /* Set up interrupts. */ @@ -2652,7 +2648,7 @@ cas_pci_attach(device_t dev) char buf[sizeof(CAS_LOCAL_MAC_ADDRESS)]; struct cas_softc *sc; int i; -#if !(defined(__powerpc__) || defined(__sparc64__)) +#if !defined(__powerpc__) u_char enaddr[4][ETHER_ADDR_LEN]; u_int j, k, lma, pcs[4], phy; #endif @@ -2696,7 +2692,7 @@ cas_pci_attach(device_t dev) CAS_LOCK_INIT(sc, device_get_nameunit(dev)); -#if defined(__powerpc__) || defined(__sparc64__) +#if defined(__powerpc__) OF_getetheraddr(dev, sc->sc_enaddr); if (OF_getprop(ofw_bus_get_node(dev), CAS_PHY_INTERFACE, buf, sizeof(buf)) > 0 || OF_getprop(ofw_bus_get_node(dev), diff --git a/sys/dev/dc/if_dc.c b/sys/dev/dc/if_dc.c index b7504a7200c64b..f471d1192dcb9e 100644 --- a/sys/dev/dc/if_dc.c +++ b/sys/dev/dc/if_dc.c @@ -135,11 +135,6 @@ __FBSDID("$FreeBSD$"); #include -#ifdef __sparc64__ -#include -#include -#endif - MODULE_DEPEND(dc, pci, 1, 1, 1); MODULE_DEPEND(dc, ether, 1, 1, 1); MODULE_DEPEND(dc, miibus, 1, 1, 1); @@ -2293,14 +2288,6 @@ dc_attach(device_t dev) break; case DC_TYPE_DM9102: dc_read_eeprom(sc, (caddr_t)&eaddr, DC_EE_NODEADDR, 3, 0); -#ifdef __sparc64__ - /* - * If this is an onboard dc(4) the station address read from - * the EEPROM is all zero and we have to get it from the FCode. - */ - if (eaddr[0] == 0 && (eaddr[1] & ~0xffff) == 0) - OF_getetheraddr(dev, (caddr_t)&eaddr); -#endif break; case DC_TYPE_21143: case DC_TYPE_ASIX: diff --git a/sys/dev/esp/esp_sbus.c b/sys/dev/esp/esp_sbus.c deleted file mode 100644 index c7f4cbbc9d2934..00000000000000 --- a/sys/dev/esp/esp_sbus.c +++ /dev/null @@ -1,846 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD AND BSD-2-Clause-NetBSD - * - * Copyright (c) 2004 Scott Long - * Copyright (c) 2005 Marius Strobl - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ - -/* $NetBSD: esp_sbus.c,v 1.51 2009/09/17 16:28:12 tsutsui Exp $ */ - -/*- - * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Charles M. Hannum; Jason R. Thorpe of the Numerical Aerospace - * Simulation Facility, NASA Ames Research Center; Paul Kranenburg. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include -#include -#include - -#include -#include - -/* #define ESP_SBUS_DEBUG */ - -struct esp_softc { - struct ncr53c9x_softc sc_ncr53c9x; /* glue to MI code */ - device_t sc_dev; - - struct resource *sc_res; - - struct resource *sc_irqres; - void *sc_irq; - - struct lsi64854_softc *sc_dma; /* pointer to my DMA */ -}; - -static int esp_probe(device_t); -static int esp_dma_attach(device_t); -static int esp_dma_detach(device_t); -static int esp_sbus_attach(device_t); -static int esp_sbus_detach(device_t); -static int esp_suspend(device_t); -static int esp_resume(device_t); - -static device_method_t esp_dma_methods[] = { - DEVMETHOD(device_probe, esp_probe), - DEVMETHOD(device_attach, esp_dma_attach), - DEVMETHOD(device_detach, esp_dma_detach), - DEVMETHOD(device_suspend, esp_suspend), - DEVMETHOD(device_resume, esp_resume), - - DEVMETHOD_END -}; - -static driver_t esp_dma_driver = { - "esp", - esp_dma_methods, - sizeof(struct esp_softc) -}; - -DRIVER_MODULE(esp, dma, esp_dma_driver, esp_devclass, 0, 0); -MODULE_DEPEND(esp, dma, 1, 1, 1); - -static device_method_t esp_sbus_methods[] = { - DEVMETHOD(device_probe, esp_probe), - DEVMETHOD(device_attach, esp_sbus_attach), - DEVMETHOD(device_detach, esp_sbus_detach), - DEVMETHOD(device_suspend, esp_suspend), - DEVMETHOD(device_resume, esp_resume), - - DEVMETHOD_END -}; - -static driver_t esp_sbus_driver = { - "esp", - esp_sbus_methods, - sizeof(struct esp_softc) -}; - -DRIVER_MODULE(esp, sbus, esp_sbus_driver, esp_devclass, 0, 0); -MODULE_DEPEND(esp, sbus, 1, 1, 1); - -/* - * Functions and the switch for the MI code - */ -static uint8_t esp_read_reg(struct ncr53c9x_softc *sc, int reg); -static void esp_write_reg(struct ncr53c9x_softc *sc, int reg, uint8_t v); -static int esp_dma_isintr(struct ncr53c9x_softc *sc); -static void esp_dma_reset(struct ncr53c9x_softc *sc); -static int esp_dma_intr(struct ncr53c9x_softc *sc); -static int esp_dma_setup(struct ncr53c9x_softc *sc, void **addr, - size_t *len, int datain, size_t *dmasize); -static void esp_dma_go(struct ncr53c9x_softc *sc); -static void esp_dma_stop(struct ncr53c9x_softc *sc); -static int esp_dma_isactive(struct ncr53c9x_softc *sc); -static int espattach(struct esp_softc *esc, - const struct ncr53c9x_glue *gluep); -static int espdetach(struct esp_softc *esc); - -static const struct ncr53c9x_glue esp_sbus_glue = { - esp_read_reg, - esp_write_reg, - esp_dma_isintr, - esp_dma_reset, - esp_dma_intr, - esp_dma_setup, - esp_dma_go, - esp_dma_stop, - esp_dma_isactive, -}; - -static int -esp_probe(device_t dev) -{ - const char *name; - - name = ofw_bus_get_name(dev); - if (strcmp("SUNW,fas", name) == 0) { - device_set_desc(dev, "Sun FAS366 Fast-Wide SCSI"); - return (BUS_PROBE_DEFAULT); - } else if (strcmp("esp", name) == 0) { - device_set_desc(dev, "Sun ESP SCSI/Sun FAS Fast-SCSI"); - return (BUS_PROBE_DEFAULT); - } - - return (ENXIO); -} - -static int -esp_sbus_attach(device_t dev) -{ - struct esp_softc *esc; - struct ncr53c9x_softc *sc; - struct lsi64854_softc *lsc; - device_t *children; - int error, i, nchildren; - - esc = device_get_softc(dev); - sc = &esc->sc_ncr53c9x; - - lsc = NULL; - esc->sc_dev = dev; - sc->sc_freq = sbus_get_clockfreq(dev); - - if (strcmp(ofw_bus_get_name(dev), "SUNW,fas") == 0) { - /* - * Allocate space for DMA, in SUNW,fas there are no - * separate DMA devices. - */ - lsc = malloc(sizeof (struct lsi64854_softc), M_DEVBUF, - M_NOWAIT | M_ZERO); - if (lsc == NULL) { - device_printf(dev, "out of memory (lsi64854_softc)\n"); - return (ENOMEM); - } - esc->sc_dma = lsc; - - /* - * SUNW,fas have 2 register spaces: DMA (lsi64854) and - * SCSI core (ncr53c9x). - */ - - /* Allocate DMA registers. */ - i = 0; - if ((lsc->sc_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, - &i, RF_ACTIVE)) == NULL) { - device_printf(dev, "cannot allocate DMA registers\n"); - error = ENXIO; - goto fail_sbus_lsc; - } - - /* Create a parent DMA tag based on this bus. */ - error = bus_dma_tag_create( - bus_get_dma_tag(dev), /* parent */ - 1, 0, /* alignment, boundary */ - BUS_SPACE_MAXADDR, /* lowaddr */ - BUS_SPACE_MAXADDR, /* highaddr */ - NULL, NULL, /* filter, filterarg */ - BUS_SPACE_MAXSIZE, /* maxsize */ - BUS_SPACE_UNRESTRICTED, /* nsegments */ - BUS_SPACE_MAXSIZE, /* maxsegsize */ - 0, /* flags */ - NULL, NULL, /* no locking */ - &lsc->sc_parent_dmat); - if (error != 0) { - device_printf(dev, "cannot allocate parent DMA tag\n"); - goto fail_sbus_lres; - } - - i = sbus_get_burstsz(dev); - -#ifdef ESP_SBUS_DEBUG - printf("%s: burst 0x%x\n", __func__, i); -#endif - - lsc->sc_burst = (i & SBUS_BURST_32) ? 32 : - (i & SBUS_BURST_16) ? 16 : 0; - - lsc->sc_channel = L64854_CHANNEL_SCSI; - lsc->sc_client = sc; - lsc->sc_dev = dev; - - /* - * Allocate SCSI core registers. - */ - i = 1; - if ((esc->sc_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, - &i, RF_ACTIVE)) == NULL) { - device_printf(dev, - "cannot allocate SCSI core registers\n"); - error = ENXIO; - goto fail_sbus_lpdma; - } - } else { - /* - * Search accompanying DMA engine. It should have been - * already attached otherwise there isn't much we can do. - */ - if (device_get_children(device_get_parent(dev), &children, - &nchildren) != 0) { - device_printf(dev, "cannot determine siblings\n"); - return (ENXIO); - } - for (i = 0; i < nchildren; i++) { - if (device_is_attached(children[i]) && - sbus_get_slot(children[i]) == - sbus_get_slot(dev) && - strcmp(ofw_bus_get_name(children[i]), - "dma") == 0) { - /* XXX hackery */ - esc->sc_dma = (struct lsi64854_softc *) - device_get_softc(children[i]); - break; - } - } - free(children, M_TEMP); - if (esc->sc_dma == NULL) { - device_printf(dev, "cannot find DMA engine\n"); - return (ENXIO); - } - esc->sc_dma->sc_client = sc; - - /* - * Allocate SCSI core registers. - */ - i = 0; - if ((esc->sc_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, - &i, RF_ACTIVE)) == NULL) { - device_printf(dev, - "cannot allocate SCSI core registers\n"); - return (ENXIO); - } - } - - error = espattach(esc, &esp_sbus_glue); - if (error != 0) { - device_printf(dev, "espattach failed\n"); - goto fail_sbus_eres; - } - - return (0); - - fail_sbus_eres: - bus_release_resource(dev, SYS_RES_MEMORY, rman_get_rid(esc->sc_res), - esc->sc_res); - if (strcmp(ofw_bus_get_name(dev), "SUNW,fas") != 0) - return (error); - fail_sbus_lpdma: - bus_dma_tag_destroy(lsc->sc_parent_dmat); - fail_sbus_lres: - bus_release_resource(dev, SYS_RES_MEMORY, rman_get_rid(lsc->sc_res), - lsc->sc_res); - fail_sbus_lsc: - free(lsc, M_DEVBUF); - return (error); -} - -static int -esp_sbus_detach(device_t dev) -{ - struct esp_softc *esc; - struct lsi64854_softc *lsc; - int error; - - esc = device_get_softc(dev); - lsc = esc->sc_dma; - - error = espdetach(esc); - if (error != 0) - return (error); - bus_release_resource(dev, SYS_RES_MEMORY, rman_get_rid(esc->sc_res), - esc->sc_res); - if (strcmp(ofw_bus_get_name(dev), "SUNW,fas") != 0) - return (0); - bus_dma_tag_destroy(lsc->sc_parent_dmat); - bus_release_resource(dev, SYS_RES_MEMORY, rman_get_rid(lsc->sc_res), - lsc->sc_res); - free(lsc, M_DEVBUF); - - return (0); -} - -static int -esp_dma_attach(device_t dev) -{ - struct esp_softc *esc; - struct ncr53c9x_softc *sc; - int error, i; - - esc = device_get_softc(dev); - sc = &esc->sc_ncr53c9x; - - esc->sc_dev = dev; - if (OF_getprop(ofw_bus_get_node(dev), "clock-frequency", - &sc->sc_freq, sizeof(sc->sc_freq)) == -1) { - printf("failed to query OFW for clock-frequency\n"); - return (ENXIO); - } - - /* XXX hackery */ - esc->sc_dma = (struct lsi64854_softc *) - device_get_softc(device_get_parent(dev)); - esc->sc_dma->sc_client = sc; - - /* - * Allocate SCSI core registers. - */ - i = 0; - if ((esc->sc_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, - &i, RF_ACTIVE)) == NULL) { - device_printf(dev, "cannot allocate SCSI core registers\n"); - return (ENXIO); - } - - error = espattach(esc, &esp_sbus_glue); - if (error != 0) { - device_printf(dev, "espattach failed\n"); - goto fail_dma_eres; - } - - return (0); - - fail_dma_eres: - bus_release_resource(dev, SYS_RES_MEMORY, rman_get_rid(esc->sc_res), - esc->sc_res); - return (error); -} - -static int -esp_dma_detach(device_t dev) -{ - struct esp_softc *esc; - int error; - - esc = device_get_softc(dev); - - error = espdetach(esc); - if (error != 0) - return (error); - bus_release_resource(dev, SYS_RES_MEMORY, rman_get_rid(esc->sc_res), - esc->sc_res); - - return (0); -} - -static int -esp_suspend(device_t dev) -{ - - return (ENXIO); -} - -static int -esp_resume(device_t dev) -{ - - return (ENXIO); -} - -static int -espattach(struct esp_softc *esc, const struct ncr53c9x_glue *gluep) -{ - struct ncr53c9x_softc *sc = &esc->sc_ncr53c9x; - unsigned int uid = 0; - int error, i; - - NCR_LOCK_INIT(sc); - - sc->sc_id = OF_getscsinitid(esc->sc_dev); - -#ifdef ESP_SBUS_DEBUG - device_printf(esc->sc_dev, "%s: sc_id %d, freq %d\n", - __func__, sc->sc_id, sc->sc_freq); -#endif - - /* - * The `ESC' DMA chip must be reset before we can access - * the ESP registers. - */ - if (esc->sc_dma->sc_rev == DMAREV_ESC) - DMA_RESET(esc->sc_dma); - - /* - * Set up glue for MI code early; we use some of it here. - */ - sc->sc_glue = gluep; - - /* gimme MHz */ - sc->sc_freq /= 1000000; - - /* - * XXX More of this should be in ncr53c9x_attach(), but - * XXX should we really poke around the chip that much in - * XXX the MI code? Think about this more... - */ - - /* - * Read the part-unique ID code of the SCSI chip. The contained - * value is only valid if all of the following conditions are met: - * - After power-up or chip reset. - * - Before any value is written to this register. - * - The NCRCFG2_FE bit is set. - * - A (NCRCMD_NOP | NCRCMD_DMA) command has been issued. - */ - NCRCMD(sc, NCRCMD_RSTCHIP); - NCRCMD(sc, NCRCMD_NOP); - sc->sc_cfg2 = NCRCFG2_FE; - NCR_WRITE_REG(sc, NCR_CFG2, sc->sc_cfg2); - NCRCMD(sc, NCRCMD_NOP | NCRCMD_DMA); - uid = NCR_READ_REG(sc, NCR_UID); - - /* - * It is necessary to try to load the 2nd config register here, - * to find out what rev the esp chip is, else the ncr53c9x_reset - * will not set up the defaults correctly. - */ - sc->sc_cfg1 = sc->sc_id | NCRCFG1_PARENB; - NCR_WRITE_REG(sc, NCR_CFG1, sc->sc_cfg1); - sc->sc_cfg2 = 0; - NCR_WRITE_REG(sc, NCR_CFG2, sc->sc_cfg2); - sc->sc_cfg2 = NCRCFG2_SCSI2 | NCRCFG2_RPE; - NCR_WRITE_REG(sc, NCR_CFG2, sc->sc_cfg2); - - if ((NCR_READ_REG(sc, NCR_CFG2) & ~NCRCFG2_RSVD) != - (NCRCFG2_SCSI2 | NCRCFG2_RPE)) - sc->sc_rev = NCR_VARIANT_ESP100; - else { - sc->sc_cfg2 = NCRCFG2_SCSI2; - NCR_WRITE_REG(sc, NCR_CFG2, sc->sc_cfg2); - sc->sc_cfg3 = 0; - NCR_WRITE_REG(sc, NCR_CFG3, sc->sc_cfg3); - sc->sc_cfg3 = (NCRCFG3_CDB | NCRCFG3_FCLK); - NCR_WRITE_REG(sc, NCR_CFG3, sc->sc_cfg3); - if (NCR_READ_REG(sc, NCR_CFG3) != - (NCRCFG3_CDB | NCRCFG3_FCLK)) - sc->sc_rev = NCR_VARIANT_ESP100A; - else { - /* NCRCFG2_FE enables > 64K transfers. */ - sc->sc_cfg2 |= NCRCFG2_FE; - sc->sc_cfg3 = 0; - NCR_WRITE_REG(sc, NCR_CFG3, sc->sc_cfg3); - if (sc->sc_freq <= 25) - sc->sc_rev = NCR_VARIANT_ESP200; - else { - switch ((uid & 0xf8) >> 3) { - case 0x00: - sc->sc_rev = NCR_VARIANT_FAS100A; - break; - - case 0x02: - if ((uid & 0x07) == 0x02) - sc->sc_rev = - NCR_VARIANT_FAS216; - else - sc->sc_rev = - NCR_VARIANT_FAS236; - break; - - case 0x0a: - sc->sc_rev = NCR_VARIANT_FAS366; - break; - - default: - /* - * We could just treat unknown chips - * as ESP200 but then we would most - * likely drive them out of specs. - */ - device_printf(esc->sc_dev, - "Unknown chip\n"); - error = ENXIO; - goto fail_lock; - } - } - } - } - -#ifdef ESP_SBUS_DEBUG - printf("%s: revision %d, uid 0x%x\n", __func__, sc->sc_rev, uid); -#endif - - /* - * This is the value used to start sync negotiations - * Note that the NCR register "SYNCTP" is programmed - * in "clocks per byte", and has a minimum value of 4. - * The SCSI period used in negotiation is one-fourth - * of the time (in nanoseconds) needed to transfer one byte. - * Since the chip's clock is given in MHz, we have the following - * formula: 4 * period = (1000 / freq) * 4 - */ - sc->sc_minsync = 1000 / sc->sc_freq; - - /* - * Except for some variants the maximum transfer size is 64k. - */ - sc->sc_maxxfer = 64 * 1024; - sc->sc_maxoffset = 15; - sc->sc_extended_geom = 1; - - /* - * Alas, we must now modify the value a bit, because it's - * only valid when we can switch on FASTCLK and FASTSCSI bits - * in the config register 3... - */ - switch (sc->sc_rev) { - case NCR_VARIANT_ESP100: - sc->sc_maxwidth = MSG_EXT_WDTR_BUS_8_BIT; - sc->sc_minsync = 0; /* No synch on old chip? */ - break; - - case NCR_VARIANT_ESP100A: - case NCR_VARIANT_ESP200: - sc->sc_maxwidth = MSG_EXT_WDTR_BUS_8_BIT; - /* Min clocks/byte is 5 */ - sc->sc_minsync = ncr53c9x_cpb2stp(sc, 5); - break; - - case NCR_VARIANT_FAS100A: - case NCR_VARIANT_FAS216: - case NCR_VARIANT_FAS236: - /* - * The onboard SCSI chips in Sun Ultra 1 are actually - * documented to be NCR53C9X which use NCRCFG3_FCLK and - * NCRCFG3_FSCSI. BSD/OS however probes these chips as - * FAS100A and uses NCRF9XCFG3_FCLK and NCRF9XCFG3_FSCSI - * instead which seems to be correct as otherwise sync - * negotiation just doesn't work. Using NCRF9XCFG3_FCLK - * and NCRF9XCFG3_FSCSI with these chips in fact also - * yields Fast-SCSI speed. - */ - sc->sc_features = NCR_F_FASTSCSI; - sc->sc_cfg3 = NCRF9XCFG3_FCLK; - sc->sc_cfg3_fscsi = NCRF9XCFG3_FSCSI; - sc->sc_maxwidth = MSG_EXT_WDTR_BUS_8_BIT; - sc->sc_maxxfer = 16 * 1024 * 1024; - break; - - case NCR_VARIANT_FAS366: - sc->sc_maxwidth = MSG_EXT_WDTR_BUS_16_BIT; - sc->sc_maxxfer = 16 * 1024 * 1024; - break; - } - - /* - * Given that we allocate resources based on sc->sc_maxxfer it doesn't - * make sense to supply a value higher than the maximum actually used. - */ - sc->sc_maxxfer = min(sc->sc_maxxfer, MAXPHYS); - - /* Attach the DMA engine. */ - error = lsi64854_attach(esc->sc_dma); - if (error != 0) { - device_printf(esc->sc_dev, "lsi64854_attach failed\n"); - goto fail_lock; - } - - /* Establish interrupt channel. */ - i = 0; - if ((esc->sc_irqres = bus_alloc_resource_any(esc->sc_dev, SYS_RES_IRQ, - &i, RF_SHAREABLE|RF_ACTIVE)) == NULL) { - device_printf(esc->sc_dev, "cannot allocate interrupt\n"); - goto fail_lsi; - } - if (bus_setup_intr(esc->sc_dev, esc->sc_irqres, - INTR_MPSAFE | INTR_TYPE_CAM, NULL, ncr53c9x_intr, sc, - &esc->sc_irq)) { - device_printf(esc->sc_dev, "cannot set up interrupt\n"); - error = ENXIO; - goto fail_ires; - } - - /* Turn on target selection using the `DMA' method. */ - if (sc->sc_rev != NCR_VARIANT_FAS366) - sc->sc_features |= NCR_F_DMASELECT; - - /* Do the common parts of attachment. */ - sc->sc_dev = esc->sc_dev; - error = ncr53c9x_attach(sc); - if (error != 0) { - device_printf(esc->sc_dev, "ncr53c9x_attach failed\n"); - goto fail_intr; - } - - return (0); - - fail_intr: - bus_teardown_intr(esc->sc_dev, esc->sc_irqres, esc->sc_irq); - fail_ires: - bus_release_resource(esc->sc_dev, SYS_RES_IRQ, - rman_get_rid(esc->sc_irqres), esc->sc_irqres); - fail_lsi: - lsi64854_detach(esc->sc_dma); - fail_lock: - NCR_LOCK_DESTROY(sc); - return (error); -} - -static int -espdetach(struct esp_softc *esc) -{ - struct ncr53c9x_softc *sc = &esc->sc_ncr53c9x; - int error; - - bus_teardown_intr(esc->sc_dev, esc->sc_irqres, esc->sc_irq); - error = ncr53c9x_detach(sc); - if (error != 0) - return (error); - error = lsi64854_detach(esc->sc_dma); - if (error != 0) - return (error); - NCR_LOCK_DESTROY(sc); - bus_release_resource(esc->sc_dev, SYS_RES_IRQ, - rman_get_rid(esc->sc_irqres), esc->sc_irqres); - - return (0); -} - -/* - * Glue functions - */ - -#ifdef ESP_SBUS_DEBUG -static int esp_sbus_debug = 0; - -static const struct { - const char *r_name; - int r_flag; -} const esp__read_regnames [] = { - { "TCL", 0}, /* 0/00 */ - { "TCM", 0}, /* 1/04 */ - { "FIFO", 0}, /* 2/08 */ - { "CMD", 0}, /* 3/0c */ - { "STAT", 0}, /* 4/10 */ - { "INTR", 0}, /* 5/14 */ - { "STEP", 0}, /* 6/18 */ - { "FFLAGS", 1}, /* 7/1c */ - { "CFG1", 1}, /* 8/20 */ - { "STAT2", 0}, /* 9/24 */ - { "CFG4", 1}, /* a/28 */ - { "CFG2", 1}, /* b/2c */ - { "CFG3", 1}, /* c/30 */ - { "-none", 1}, /* d/34 */ - { "TCH", 1}, /* e/38 */ - { "TCX", 1}, /* f/3c */ -}; - -static const const struct { - const char *r_name; - int r_flag; -} const esp__write_regnames[] = { - { "TCL", 1}, /* 0/00 */ - { "TCM", 1}, /* 1/04 */ - { "FIFO", 0}, /* 2/08 */ - { "CMD", 0}, /* 3/0c */ - { "SELID", 1}, /* 4/10 */ - { "TIMEOUT", 1}, /* 5/14 */ - { "SYNCTP", 1}, /* 6/18 */ - { "SYNCOFF", 1}, /* 7/1c */ - { "CFG1", 1}, /* 8/20 */ - { "CCF", 1}, /* 9/24 */ - { "TEST", 1}, /* a/28 */ - { "CFG2", 1}, /* b/2c */ - { "CFG3", 1}, /* c/30 */ - { "-none", 1}, /* d/34 */ - { "TCH", 1}, /* e/38 */ - { "TCX", 1}, /* f/3c */ -}; -#endif - -static uint8_t -esp_read_reg(struct ncr53c9x_softc *sc, int reg) -{ - struct esp_softc *esc = (struct esp_softc *)sc; - uint8_t v; - - v = bus_read_1(esc->sc_res, reg * 4); - -#ifdef ESP_SBUS_DEBUG - if (esp_sbus_debug && (reg < 0x10) && esp__read_regnames[reg].r_flag) - printf("RD:%x <%s> %x\n", reg * 4, ((unsigned)reg < 0x10) ? - esp__read_regnames[reg].r_name : "<***>", v); -#endif - - return (v); -} - -static void -esp_write_reg(struct ncr53c9x_softc *sc, int reg, uint8_t v) -{ - struct esp_softc *esc = (struct esp_softc *)sc; - -#ifdef ESP_SBUS_DEBUG - if (esp_sbus_debug && (reg < 0x10) && esp__write_regnames[reg].r_flag) - printf("WR:%x <%s> %x\n", reg * 4, ((unsigned)reg < 0x10) ? - esp__write_regnames[reg].r_name : "<***>", v); -#endif - - bus_write_1(esc->sc_res, reg * 4, v); -} - -static int -esp_dma_isintr(struct ncr53c9x_softc *sc) -{ - struct esp_softc *esc = (struct esp_softc *)sc; - - return (DMA_ISINTR(esc->sc_dma)); -} - -static void -esp_dma_reset(struct ncr53c9x_softc *sc) -{ - struct esp_softc *esc = (struct esp_softc *)sc; - - DMA_RESET(esc->sc_dma); -} - -static int -esp_dma_intr(struct ncr53c9x_softc *sc) -{ - struct esp_softc *esc = (struct esp_softc *)sc; - - return (DMA_INTR(esc->sc_dma)); -} - -static int -esp_dma_setup(struct ncr53c9x_softc *sc, void **addr, size_t *len, - int datain, size_t *dmasize) -{ - struct esp_softc *esc = (struct esp_softc *)sc; - - return (DMA_SETUP(esc->sc_dma, addr, len, datain, dmasize)); -} - -static void -esp_dma_go(struct ncr53c9x_softc *sc) -{ - struct esp_softc *esc = (struct esp_softc *)sc; - - DMA_GO(esc->sc_dma); -} - -static void -esp_dma_stop(struct ncr53c9x_softc *sc) -{ - struct esp_softc *esc = (struct esp_softc *)sc; - - L64854_SCSR(esc->sc_dma, L64854_GCSR(esc->sc_dma) & ~D_EN_DMA); -} - -static int -esp_dma_isactive(struct ncr53c9x_softc *sc) -{ - struct esp_softc *esc = (struct esp_softc *)sc; - - return (DMA_ISACTIVE(esc->sc_dma)); -} diff --git a/sys/dev/fb/creator.c b/sys/dev/fb/creator.c deleted file mode 100644 index 0c0f083aaaf7c9..00000000000000 --- a/sys/dev/fb/creator.c +++ /dev/null @@ -1,1130 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2003 Jake Burkholder. - * Copyright (c) 2005 - 2006 Marius Strobl - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include -#include - -#include - -#include -#include -#include -#include - -#define CREATOR_DRIVER_NAME "creator" - -struct creator_softc { - video_adapter_t sc_va; /* XXX must be first */ - - phandle_t sc_node; - - struct cdev *sc_si; - - struct resource *sc_reg[FFB_NREG]; - bus_space_tag_t sc_bt[FFB_NREG]; - bus_space_handle_t sc_bh[FFB_NREG]; - u_long sc_reg_size; - - u_int sc_height; - u_int sc_width; - - u_int sc_xmargin; - u_int sc_ymargin; - - const u_char *sc_font; - - int sc_bg_cache; - int sc_fg_cache; - int sc_fifo_cache; - int sc_fontinc_cache; - int sc_fontw_cache; - int sc_pmask_cache; - - u_int sc_flags; -#define CREATOR_AFB (1 << 0) -#define CREATOR_CONSOLE (1 << 1) -#define CREATOR_CUREN (1 << 2) -#define CREATOR_CURINV (1 << 3) -#define CREATOR_PAC1 (1 << 4) -}; - -#define FFB_READ(sc, reg, off) \ - bus_space_read_4((sc)->sc_bt[(reg)], (sc)->sc_bh[(reg)], (off)) -#define FFB_WRITE(sc, reg, off, val) \ - bus_space_write_4((sc)->sc_bt[(reg)], (sc)->sc_bh[(reg)], (off), (val)) - -#define C(r, g, b) ((b << 16) | (g << 8) | (r)) -static const uint32_t creator_cmap[] = { - C(0x00, 0x00, 0x00), /* black */ - C(0x00, 0x00, 0xff), /* blue */ - C(0x00, 0xff, 0x00), /* green */ - C(0x00, 0xc0, 0xc0), /* cyan */ - C(0xff, 0x00, 0x00), /* red */ - C(0xc0, 0x00, 0xc0), /* magenta */ - C(0xc0, 0xc0, 0x00), /* brown */ - C(0xc0, 0xc0, 0xc0), /* light grey */ - C(0x80, 0x80, 0x80), /* dark grey */ - C(0x80, 0x80, 0xff), /* light blue */ - C(0x80, 0xff, 0x80), /* light green */ - C(0x80, 0xff, 0xff), /* light cyan */ - C(0xff, 0x80, 0x80), /* light red */ - C(0xff, 0x80, 0xff), /* light magenta */ - C(0xff, 0xff, 0x80), /* yellow */ - C(0xff, 0xff, 0xff), /* white */ -}; -#undef C - -static const struct { - vm_offset_t virt; - vm_paddr_t phys; - vm_size_t size; -} creator_fb_map[] = { - { FFB_VIRT_SFB8R, FFB_PHYS_SFB8R, FFB_SIZE_SFB8R }, - { FFB_VIRT_SFB8G, FFB_PHYS_SFB8G, FFB_SIZE_SFB8G }, - { FFB_VIRT_SFB8B, FFB_PHYS_SFB8B, FFB_SIZE_SFB8B }, - { FFB_VIRT_SFB8X, FFB_PHYS_SFB8X, FFB_SIZE_SFB8X }, - { FFB_VIRT_SFB32, FFB_PHYS_SFB32, FFB_SIZE_SFB32 }, - { FFB_VIRT_SFB64, FFB_PHYS_SFB64, FFB_SIZE_SFB64 }, - { FFB_VIRT_FBC, FFB_PHYS_FBC, FFB_SIZE_FBC }, - { FFB_VIRT_FBC_BM, FFB_PHYS_FBC_BM, FFB_SIZE_FBC_BM }, - { FFB_VIRT_DFB8R, FFB_PHYS_DFB8R, FFB_SIZE_DFB8R }, - { FFB_VIRT_DFB8G, FFB_PHYS_DFB8G, FFB_SIZE_DFB8G }, - { FFB_VIRT_DFB8B, FFB_PHYS_DFB8B, FFB_SIZE_DFB8B }, - { FFB_VIRT_DFB8X, FFB_PHYS_DFB8X, FFB_SIZE_DFB8X }, - { FFB_VIRT_DFB24, FFB_PHYS_DFB24, FFB_SIZE_DFB24 }, - { FFB_VIRT_DFB32, FFB_PHYS_DFB32, FFB_SIZE_DFB32 }, - { FFB_VIRT_DFB422A, FFB_PHYS_DFB422A, FFB_SIZE_DFB422A }, - { FFB_VIRT_DFB422AD, FFB_PHYS_DFB422AD, FFB_SIZE_DFB422AD }, - { FFB_VIRT_DFB24B, FFB_PHYS_DFB24B, FFB_SIZE_DFB24B }, - { FFB_VIRT_DFB422B, FFB_PHYS_DFB422B, FFB_SIZE_DFB422B }, - { FFB_VIRT_DFB422BD, FFB_PHYS_DFB422BD, FFB_SIZE_DFB422BD }, - { FFB_VIRT_SFB16Z, FFB_PHYS_SFB16Z, FFB_SIZE_SFB16Z }, - { FFB_VIRT_SFB8Z, FFB_PHYS_SFB8Z, FFB_SIZE_SFB8Z }, - { FFB_VIRT_SFB422, FFB_PHYS_SFB422, FFB_SIZE_SFB422 }, - { FFB_VIRT_SFB422D, FFB_PHYS_SFB422D, FFB_SIZE_SFB422D }, - { FFB_VIRT_FBC_KREG, FFB_PHYS_FBC_KREG, FFB_SIZE_FBC_KREG }, - { FFB_VIRT_DAC, FFB_PHYS_DAC, FFB_SIZE_DAC }, - { FFB_VIRT_PROM, FFB_PHYS_PROM, FFB_SIZE_PROM }, - { FFB_VIRT_EXP, FFB_PHYS_EXP, FFB_SIZE_EXP }, -}; - -#define CREATOR_FB_MAP_SIZE nitems(creator_fb_map) - -extern const struct gfb_font gallant12x22; - -static struct creator_softc creator_softc; -static struct bus_space_tag creator_bst_store[FFB_FBC]; - -static device_probe_t creator_bus_probe; -static device_attach_t creator_bus_attach; - -static device_method_t creator_bus_methods[] = { - DEVMETHOD(device_probe, creator_bus_probe), - DEVMETHOD(device_attach, creator_bus_attach), - - { 0, 0 } -}; - -static devclass_t creator_devclass; - -DEFINE_CLASS_0(creator, creator_bus_driver, creator_bus_methods, - sizeof(struct creator_softc)); -DRIVER_MODULE(creator, nexus, creator_bus_driver, creator_devclass, 0, 0); -DRIVER_MODULE(creator, upa, creator_bus_driver, creator_devclass, 0, 0); - -static d_open_t creator_fb_open; -static d_close_t creator_fb_close; -static d_ioctl_t creator_fb_ioctl; -static d_mmap_t creator_fb_mmap; - -static struct cdevsw creator_fb_devsw = { - .d_version = D_VERSION, - .d_flags = D_NEEDGIANT, - .d_open = creator_fb_open, - .d_close = creator_fb_close, - .d_ioctl = creator_fb_ioctl, - .d_mmap = creator_fb_mmap, - .d_name = "fb", -}; - -static void creator_cursor_enable(struct creator_softc *sc, int onoff); -static void creator_cursor_install(struct creator_softc *sc); -static void creator_shutdown(void *xsc); - -static int creator_configure(int flags); - -static vi_probe_t creator_probe; -static vi_init_t creator_init; -static vi_get_info_t creator_get_info; -static vi_query_mode_t creator_query_mode; -static vi_set_mode_t creator_set_mode; -static vi_save_font_t creator_save_font; -static vi_load_font_t creator_load_font; -static vi_show_font_t creator_show_font; -static vi_save_palette_t creator_save_palette; -static vi_load_palette_t creator_load_palette; -static vi_set_border_t creator_set_border; -static vi_save_state_t creator_save_state; -static vi_load_state_t creator_load_state; -static vi_set_win_org_t creator_set_win_org; -static vi_read_hw_cursor_t creator_read_hw_cursor; -static vi_set_hw_cursor_t creator_set_hw_cursor; -static vi_set_hw_cursor_shape_t creator_set_hw_cursor_shape; -static vi_blank_display_t creator_blank_display; -static vi_mmap_t creator_mmap; -static vi_ioctl_t creator_ioctl; -static vi_clear_t creator_clear; -static vi_fill_rect_t creator_fill_rect; -static vi_bitblt_t creator_bitblt; -static vi_diag_t creator_diag; -static vi_save_cursor_palette_t creator_save_cursor_palette; -static vi_load_cursor_palette_t creator_load_cursor_palette; -static vi_copy_t creator_copy; -static vi_putp_t creator_putp; -static vi_putc_t creator_putc; -static vi_puts_t creator_puts; -static vi_putm_t creator_putm; - -static video_switch_t creatorvidsw = { - .probe = creator_probe, - .init = creator_init, - .get_info = creator_get_info, - .query_mode = creator_query_mode, - .set_mode = creator_set_mode, - .save_font = creator_save_font, - .load_font = creator_load_font, - .show_font = creator_show_font, - .save_palette = creator_save_palette, - .load_palette = creator_load_palette, - .set_border = creator_set_border, - .save_state = creator_save_state, - .load_state = creator_load_state, - .set_win_org = creator_set_win_org, - .read_hw_cursor = creator_read_hw_cursor, - .set_hw_cursor = creator_set_hw_cursor, - .set_hw_cursor_shape = creator_set_hw_cursor_shape, - .blank_display = creator_blank_display, - .mmap = creator_mmap, - .ioctl = creator_ioctl, - .clear = creator_clear, - .fill_rect = creator_fill_rect, - .bitblt = creator_bitblt, - .diag = creator_diag, - .save_cursor_palette = creator_save_cursor_palette, - .load_cursor_palette = creator_load_cursor_palette, - .copy = creator_copy, - .putp = creator_putp, - .putc = creator_putc, - .puts = creator_puts, - .putm = creator_putm -}; - -VIDEO_DRIVER(creator, creatorvidsw, creator_configure); - -extern sc_rndr_sw_t txtrndrsw; -RENDERER(creator, 0, txtrndrsw, gfb_set); - -RENDERER_MODULE(creator, gfb_set); - -static const u_char creator_mouse_pointer[64][8] __aligned(8) = { - { 0x00, 0x00, }, /* ............ */ - { 0x80, 0x00, }, /* *........... */ - { 0xc0, 0x00, }, /* **.......... */ - { 0xe0, 0x00, }, /* ***......... */ - { 0xf0, 0x00, }, /* ****........ */ - { 0xf8, 0x00, }, /* *****....... */ - { 0xfc, 0x00, }, /* ******...... */ - { 0xfe, 0x00, }, /* *******..... */ - { 0xff, 0x00, }, /* ********.... */ - { 0xff, 0x80, }, /* *********... */ - { 0xfc, 0xc0, }, /* ******..**.. */ - { 0xdc, 0x00, }, /* **.***...... */ - { 0x8e, 0x00, }, /* *...***..... */ - { 0x0e, 0x00, }, /* ....***..... */ - { 0x07, 0x00, }, /* .....***.... */ - { 0x04, 0x00, }, /* .....*...... */ - { 0x00, 0x00, }, /* ............ */ - { 0x00, 0x00, }, /* ............ */ - { 0x00, 0x00, }, /* ............ */ - { 0x00, 0x00, }, /* ............ */ - { 0x00, 0x00, }, /* ............ */ - { 0x00, 0x00, }, /* ............ */ -}; - -static inline void creator_ras_fifo_wait(struct creator_softc *sc, int n); -static inline void creator_ras_setfontinc(struct creator_softc *sc, int fontinc); -static inline void creator_ras_setfontw(struct creator_softc *sc, int fontw); -static inline void creator_ras_setbg(struct creator_softc *sc, int bg); -static inline void creator_ras_setfg(struct creator_softc *sc, int fg); -static inline void creator_ras_setpmask(struct creator_softc *sc, int pmask); -static inline void creator_ras_wait(struct creator_softc *sc); - -static inline void -creator_ras_wait(struct creator_softc *sc) -{ - int ucsr; - int r; - - for (;;) { - ucsr = FFB_READ(sc, FFB_FBC, FFB_FBC_UCSR); - if ((ucsr & (FBC_UCSR_FB_BUSY | FBC_UCSR_RP_BUSY)) == 0) - break; - r = ucsr & (FBC_UCSR_READ_ERR | FBC_UCSR_FIFO_OVFL); - if (r != 0) - FFB_WRITE(sc, FFB_FBC, FFB_FBC_UCSR, r); - } -} - -static inline void -creator_ras_fifo_wait(struct creator_softc *sc, int n) -{ - int cache; - - cache = sc->sc_fifo_cache; - while (cache < n) - cache = (FFB_READ(sc, FFB_FBC, FFB_FBC_UCSR) & - FBC_UCSR_FIFO_MASK) - 8; - sc->sc_fifo_cache = cache - n; -} - -static inline void -creator_ras_setfontinc(struct creator_softc *sc, int fontinc) -{ - - if (fontinc == sc->sc_fontinc_cache) - return; - sc->sc_fontinc_cache = fontinc; - creator_ras_fifo_wait(sc, 1); - FFB_WRITE(sc, FFB_FBC, FFB_FBC_FONTINC, fontinc); - creator_ras_wait(sc); -} - -static inline void -creator_ras_setfontw(struct creator_softc *sc, int fontw) -{ - - if (fontw == sc->sc_fontw_cache) - return; - sc->sc_fontw_cache = fontw; - creator_ras_fifo_wait(sc, 1); - FFB_WRITE(sc, FFB_FBC, FFB_FBC_FONTW, fontw); - creator_ras_wait(sc); -} - -static inline void -creator_ras_setbg(struct creator_softc *sc, int bg) -{ - - if (bg == sc->sc_bg_cache) - return; - sc->sc_bg_cache = bg; - creator_ras_fifo_wait(sc, 1); - FFB_WRITE(sc, FFB_FBC, FFB_FBC_BG, bg); - creator_ras_wait(sc); -} - -static inline void -creator_ras_setfg(struct creator_softc *sc, int fg) -{ - - if (fg == sc->sc_fg_cache) - return; - sc->sc_fg_cache = fg; - creator_ras_fifo_wait(sc, 1); - FFB_WRITE(sc, FFB_FBC, FFB_FBC_FG, fg); - creator_ras_wait(sc); -} - -static inline void -creator_ras_setpmask(struct creator_softc *sc, int pmask) -{ - - if (pmask == sc->sc_pmask_cache) - return; - sc->sc_pmask_cache = pmask; - creator_ras_fifo_wait(sc, 1); - FFB_WRITE(sc, FFB_FBC, FFB_FBC_PMASK, pmask); - creator_ras_wait(sc); -} - -/* - * video driver interface - */ -static int -creator_configure(int flags) -{ - struct creator_softc *sc; - phandle_t chosen; - phandle_t output; - ihandle_t stdout; - bus_addr_t addr; - char buf[sizeof("SUNW,ffb")]; - int i; - int space; - - /* - * For the high-level console probing return the number of - * registered adapters. - */ - if (!(flags & VIO_PROBE_ONLY)) { - for (i = 0; vid_find_adapter(CREATOR_DRIVER_NAME, i) >= 0; i++) - ; - return (i); - } - - /* Low-level console probing and initialization. */ - - sc = &creator_softc; - if (sc->sc_va.va_flags & V_ADP_REGISTERED) - goto found; - - if ((chosen = OF_finddevice("/chosen")) == -1) - return (0); - if (OF_getprop(chosen, "stdout", &stdout, sizeof(stdout)) == -1) - return (0); - if ((output = OF_instance_to_package(stdout)) == -1) - return (0); - if (OF_getprop(output, "name", buf, sizeof(buf)) == -1) - return (0); - if (strcmp(buf, "SUNW,ffb") == 0 || strcmp(buf, "SUNW,afb") == 0) { - sc->sc_flags = CREATOR_CONSOLE; - if (strcmp(buf, "SUNW,afb") == 0) - sc->sc_flags |= CREATOR_AFB; - sc->sc_node = output; - } else - return (0); - - for (i = FFB_DAC; i <= FFB_FBC; i++) { - if (OF_decode_addr(output, i, &space, &addr) != 0) - return (0); - sc->sc_bt[i] = &creator_bst_store[i - FFB_DAC]; - sc->sc_bh[i] = sparc64_fake_bustag(space, addr, sc->sc_bt[i]); - } - - if (creator_init(0, &sc->sc_va, 0) < 0) - return (0); - - found: - /* Return number of found adapters. */ - return (1); -} - -static int -creator_probe(int unit, video_adapter_t **adpp, void *arg, int flags) -{ - - return (0); -} - -static int -creator_init(int unit, video_adapter_t *adp, int flags) -{ - struct creator_softc *sc; - phandle_t options; - video_info_t *vi; - char buf[sizeof("screen-#columns")]; - - sc = (struct creator_softc *)adp; - vi = &adp->va_info; - - vid_init_struct(adp, CREATOR_DRIVER_NAME, -1, unit); - - if (OF_getprop(sc->sc_node, "height", &sc->sc_height, - sizeof(sc->sc_height)) == -1) - return (ENXIO); - if (OF_getprop(sc->sc_node, "width", &sc->sc_width, - sizeof(sc->sc_width)) == -1) - return (ENXIO); - if ((options = OF_finddevice("/options")) == -1) - return (ENXIO); - if (OF_getprop(options, "screen-#rows", buf, sizeof(buf)) == -1) - return (ENXIO); - vi->vi_height = strtol(buf, NULL, 10); - if (OF_getprop(options, "screen-#columns", buf, sizeof(buf)) == -1) - return (ENXIO); - vi->vi_width = strtol(buf, NULL, 10); - vi->vi_cwidth = gallant12x22.width; - vi->vi_cheight = gallant12x22.height; - vi->vi_flags = V_INFO_COLOR; - vi->vi_mem_model = V_INFO_MM_OTHER; - - sc->sc_font = gallant12x22.data; - sc->sc_xmargin = (sc->sc_width - (vi->vi_width * vi->vi_cwidth)) / 2; - sc->sc_ymargin = (sc->sc_height - (vi->vi_height * vi->vi_cheight)) / 2; - - creator_set_mode(adp, 0); - - if (!(sc->sc_flags & CREATOR_AFB)) { - FFB_WRITE(sc, FFB_DAC, FFB_DAC_TYPE, FFB_DAC_CFG_DID); - if (((FFB_READ(sc, FFB_DAC, FFB_DAC_VALUE) & - FFB_DAC_CFG_DID_PNUM) >> 12) != 0x236e) { - sc->sc_flags |= CREATOR_PAC1; - FFB_WRITE(sc, FFB_DAC, FFB_DAC_TYPE, FFB_DAC_CFG_UCTRL); - if (((FFB_READ(sc, FFB_DAC, FFB_DAC_VALUE) & - FFB_DAC_UCTRL_MANREV) >> 8) <= 2) - sc->sc_flags |= CREATOR_CURINV; - } - } - - creator_blank_display(adp, V_DISPLAY_ON); - creator_clear(adp); - - /* - * Setting V_ADP_MODECHANGE serves as hack so creator_set_mode() - * (which will invalidate our caches and restore our settings) is - * called when the X server shuts down. Otherwise screen corruption - * happens most of the time. - */ - adp->va_flags |= V_ADP_COLOR | V_ADP_MODECHANGE | V_ADP_BORDER | - V_ADP_INITIALIZED; - if (vid_register(adp) < 0) - return (ENXIO); - adp->va_flags |= V_ADP_REGISTERED; - - return (0); -} - -static int -creator_get_info(video_adapter_t *adp, int mode, video_info_t *info) -{ - - bcopy(&adp->va_info, info, sizeof(*info)); - return (0); -} - -static int -creator_query_mode(video_adapter_t *adp, video_info_t *info) -{ - - return (ENODEV); -} - -static int -creator_set_mode(video_adapter_t *adp, int mode) -{ - struct creator_softc *sc; - - sc = (struct creator_softc *)adp; - sc->sc_bg_cache = -1; - sc->sc_fg_cache = -1; - sc->sc_fontinc_cache = -1; - sc->sc_fontw_cache = -1; - sc->sc_pmask_cache = -1; - - creator_ras_wait(sc); - sc->sc_fifo_cache = 0; - creator_ras_fifo_wait(sc, 2); - FFB_WRITE(sc, FFB_FBC, FFB_FBC_PPC, FBC_PPC_VCE_DIS | - FBC_PPC_TBE_OPAQUE | FBC_PPC_APE_DIS | FBC_PPC_CS_CONST); - FFB_WRITE(sc, FFB_FBC, FFB_FBC_FBC, FFB_FBC_WB_A | FFB_FBC_RB_A | - FFB_FBC_SB_BOTH | FFB_FBC_XE_OFF | FFB_FBC_RGBE_MASK); - return (0); -} - -static int -creator_save_font(video_adapter_t *adp, int page, int size, int width, - u_char *data, int c, int count) -{ - - return (ENODEV); -} - -static int -creator_load_font(video_adapter_t *adp, int page, int size, int width, - u_char *data, int c, int count) -{ - - return (ENODEV); -} - -static int -creator_show_font(video_adapter_t *adp, int page) -{ - - return (ENODEV); -} - -static int -creator_save_palette(video_adapter_t *adp, u_char *palette) -{ - - return (ENODEV); -} - -static int -creator_load_palette(video_adapter_t *adp, u_char *palette) -{ - - return (ENODEV); -} - -static int -creator_set_border(video_adapter_t *adp, int border) -{ - struct creator_softc *sc; - - sc = (struct creator_softc *)adp; - creator_fill_rect(adp, border, 0, 0, sc->sc_width, sc->sc_ymargin); - creator_fill_rect(adp, border, 0, sc->sc_height - sc->sc_ymargin, - sc->sc_width, sc->sc_ymargin); - creator_fill_rect(adp, border, 0, 0, sc->sc_xmargin, sc->sc_height); - creator_fill_rect(adp, border, sc->sc_width - sc->sc_xmargin, 0, - sc->sc_xmargin, sc->sc_height); - return (0); -} - -static int -creator_save_state(video_adapter_t *adp, void *p, size_t size) -{ - - return (ENODEV); -} - -static int -creator_load_state(video_adapter_t *adp, void *p) -{ - - return (ENODEV); -} - -static int -creator_set_win_org(video_adapter_t *adp, off_t offset) -{ - - return (ENODEV); -} - -static int -creator_read_hw_cursor(video_adapter_t *adp, int *col, int *row) -{ - - *col = 0; - *row = 0; - return (0); -} - -static int -creator_set_hw_cursor(video_adapter_t *adp, int col, int row) -{ - - return (ENODEV); -} - -static int -creator_set_hw_cursor_shape(video_adapter_t *adp, int base, int height, - int celsize, int blink) -{ - - return (ENODEV); -} - -static int -creator_blank_display(video_adapter_t *adp, int mode) -{ - struct creator_softc *sc; - uint32_t v; - int i; - - sc = (struct creator_softc *)adp; - FFB_WRITE(sc, FFB_DAC, FFB_DAC_TYPE, FFB_DAC_CFG_TGEN); - v = FFB_READ(sc, FFB_DAC, FFB_DAC_VALUE); - switch (mode) { - case V_DISPLAY_ON: - v |= FFB_DAC_CFG_TGEN_VIDE; - break; - case V_DISPLAY_BLANK: - case V_DISPLAY_STAND_BY: - case V_DISPLAY_SUSPEND: - v &= ~FFB_DAC_CFG_TGEN_VIDE; - break; - } - FFB_WRITE(sc, FFB_DAC, FFB_DAC_TYPE, FFB_DAC_CFG_TGEN); - FFB_WRITE(sc, FFB_DAC, FFB_DAC_VALUE, v); - for (i = 0; i < 10; i++) { - FFB_WRITE(sc, FFB_DAC, FFB_DAC_TYPE, FFB_DAC_CFG_TGEN); - (void)FFB_READ(sc, FFB_DAC, FFB_DAC_VALUE); - } - return (0); -} - -static int -creator_mmap(video_adapter_t *adp, vm_ooffset_t offset, vm_paddr_t *paddr, - int prot, vm_memattr_t *memattr) -{ - - return (EINVAL); -} - -static int -creator_ioctl(video_adapter_t *adp, u_long cmd, caddr_t data) -{ - struct creator_softc *sc; - struct fbcursor *fbc; - struct fbtype *fb; - - sc = (struct creator_softc *)adp; - switch (cmd) { - case FBIOGTYPE: - fb = (struct fbtype *)data; - fb->fb_type = FBTYPE_CREATOR; - fb->fb_height = sc->sc_height; - fb->fb_width = sc->sc_width; - fb->fb_depth = fb->fb_cmsize = fb->fb_size = 0; - break; - case FBIOSCURSOR: - fbc = (struct fbcursor *)data; - if (fbc->set & FB_CUR_SETCUR && fbc->enable == 0) { - creator_cursor_enable(sc, 0); - sc->sc_flags &= ~CREATOR_CUREN; - } else - return (ENODEV); - break; - break; - default: - return (fb_commonioctl(adp, cmd, data)); - } - return (0); -} - -static int -creator_clear(video_adapter_t *adp) -{ - struct creator_softc *sc; - - sc = (struct creator_softc *)adp; - creator_fill_rect(adp, (SC_NORM_ATTR >> 4) & 0xf, 0, 0, sc->sc_width, - sc->sc_height); - return (0); -} - -static int -creator_fill_rect(video_adapter_t *adp, int val, int x, int y, int cx, int cy) -{ - struct creator_softc *sc; - - sc = (struct creator_softc *)adp; - creator_ras_setpmask(sc, 0xffffffff); - creator_ras_fifo_wait(sc, 2); - FFB_WRITE(sc, FFB_FBC, FFB_FBC_ROP, FBC_ROP_NEW); - FFB_WRITE(sc, FFB_FBC, FFB_FBC_DRAWOP, FBC_DRAWOP_RECTANGLE); - creator_ras_setfg(sc, creator_cmap[val & 0xf]); - /* - * Note that at least the Elite3D cards are sensitive to the order - * of operations here. - */ - creator_ras_fifo_wait(sc, 4); - FFB_WRITE(sc, FFB_FBC, FFB_FBC_BY, y); - FFB_WRITE(sc, FFB_FBC, FFB_FBC_BX, x); - FFB_WRITE(sc, FFB_FBC, FFB_FBC_BH, cy); - FFB_WRITE(sc, FFB_FBC, FFB_FBC_BW, cx); - creator_ras_wait(sc); - return (0); -} - -static int -creator_bitblt(video_adapter_t *adp, ...) -{ - - return (ENODEV); -} - -static int -creator_diag(video_adapter_t *adp, int level) -{ - video_info_t info; - - fb_dump_adp_info(adp->va_name, adp, level); - creator_get_info(adp, 0, &info); - fb_dump_mode_info(adp->va_name, adp, &info, level); - return (0); -} - -static int -creator_save_cursor_palette(video_adapter_t *adp, u_char *palette) -{ - - return (ENODEV); -} - -static int -creator_load_cursor_palette(video_adapter_t *adp, u_char *palette) -{ - - return (ENODEV); -} - -static int -creator_copy(video_adapter_t *adp, vm_offset_t src, vm_offset_t dst, int n) -{ - - return (ENODEV); -} - -static int -creator_putp(video_adapter_t *adp, vm_offset_t off, u_int32_t p, u_int32_t a, - int size, int bpp, int bit_ltor, int byte_ltor) -{ - - return (ENODEV); -} - -static int -creator_putc(video_adapter_t *adp, vm_offset_t off, u_int8_t c, u_int8_t a) -{ - struct creator_softc *sc; - const uint16_t *p; - int row; - int col; - int i; - - sc = (struct creator_softc *)adp; - row = (off / adp->va_info.vi_width) * adp->va_info.vi_cheight; - col = (off % adp->va_info.vi_width) * adp->va_info.vi_cwidth; - p = (const uint16_t *)sc->sc_font + (c * adp->va_info.vi_cheight); - creator_ras_setfg(sc, creator_cmap[a & 0xf]); - creator_ras_setbg(sc, creator_cmap[(a >> 4) & 0xf]); - creator_ras_fifo_wait(sc, 1 + adp->va_info.vi_cheight); - FFB_WRITE(sc, FFB_FBC, FFB_FBC_FONTXY, - ((row + sc->sc_ymargin) << 16) | (col + sc->sc_xmargin)); - creator_ras_setfontw(sc, adp->va_info.vi_cwidth); - creator_ras_setfontinc(sc, 0x10000); - for (i = 0; i < adp->va_info.vi_cheight; i++) { - FFB_WRITE(sc, FFB_FBC, FFB_FBC_FONT, *p++ << 16); - } - return (0); -} - -static int -creator_puts(video_adapter_t *adp, vm_offset_t off, u_int16_t *s, int len) -{ - int i; - - for (i = 0; i < len; i++) { - vidd_putc(adp, off + i, s[i] & 0xff, (s[i] & 0xff00) >> 8); - } - - return (0); -} - -static int -creator_putm(video_adapter_t *adp, int x, int y, u_int8_t *pixel_image, - u_int32_t pixel_mask, int size, int width) -{ - struct creator_softc *sc; - - sc = (struct creator_softc *)adp; - if (!(sc->sc_flags & CREATOR_CUREN)) { - creator_cursor_install(sc); - creator_cursor_enable(sc, 1); - sc->sc_flags |= CREATOR_CUREN; - } - FFB_WRITE(sc, FFB_DAC, FFB_DAC_TYPE2, FFB_DAC_CUR_POS); - FFB_WRITE(sc, FFB_DAC, FFB_DAC_VALUE2, - ((y + sc->sc_ymargin) << 16) | (x + sc->sc_xmargin)); - return (0); -} - -/* - * bus interface - */ -static int -creator_bus_probe(device_t dev) -{ - const char *name; - phandle_t node; - int type; - - name = ofw_bus_get_name(dev); - node = ofw_bus_get_node(dev); - if (strcmp(name, "SUNW,ffb") == 0) { - if (OF_getprop(node, "board_type", &type, sizeof(type)) == -1) - return (ENXIO); - switch (type & 7) { - case 0x0: - device_set_desc(dev, "Creator"); - break; - case 0x3: - device_set_desc(dev, "Creator3D"); - break; - default: - return (ENXIO); - } - } else if (strcmp(name, "SUNW,afb") == 0) - device_set_desc(dev, "Elite3D"); - else - return (ENXIO); - return (BUS_PROBE_DEFAULT); -} - -static int -creator_bus_attach(device_t dev) -{ - struct creator_softc *sc; - video_adapter_t *adp; - video_switch_t *sw; - phandle_t node; - int error; - int rid; - int unit; - int i; - - node = ofw_bus_get_node(dev); - if ((sc = (struct creator_softc *)vid_get_adapter(vid_find_adapter( - CREATOR_DRIVER_NAME, 0))) != NULL && sc->sc_node == node) { - device_printf(dev, "console\n"); - device_set_softc(dev, sc); - } else { - sc = device_get_softc(dev); - sc->sc_node = node; - } - adp = &sc->sc_va; - - /* - * Allocate resources regardless of whether we are the console - * and already obtained the bus tags and handles for the FFB_DAC - * and FFB_FBC register banks in creator_configure() or not so - * the resources are marked as taken in the respective RMAN. - * The supported cards use either 15 (Creator, Elite3D?) or 24 - * (Creator3D?) register banks. We make sure that we can also - * allocate the resources for at least the FFB_DAC and FFB_FBC - * banks here. We try but don't actually care whether we can - * allocate more than these two resources and just limit the - * range accessible via creator_fb_mmap() accordingly. - */ - for (i = 0; i < FFB_NREG; i++) { - rid = i; - sc->sc_reg[i] = bus_alloc_resource_any(dev, SYS_RES_MEMORY, - &rid, RF_ACTIVE); - if (sc->sc_reg[i] == NULL) { - if (i <= FFB_FBC) { - device_printf(dev, - "cannot allocate resources\n"); - error = ENXIO; - goto fail; - } - break; - } - sc->sc_bt[i] = rman_get_bustag(sc->sc_reg[i]); - sc->sc_bh[i] = rman_get_bushandle(sc->sc_reg[i]); - } - /* - * The XFree86/X.Org sunffb(4) expects to be able to access the - * memory spanned by the first and the last resource as one chunk - * via creator_fb_mmap(), using offsets from the first resource, - * even though the backing resources are actually non-continuous. - * So make sure that the memory we provide is at least backed by - * increasing resources. - */ - for (i = 1; i < FFB_NREG && sc->sc_reg[i] != NULL && - rman_get_start(sc->sc_reg[i]) > rman_get_start(sc->sc_reg[i - 1]); - i++) - ; - sc->sc_reg_size = rman_get_end(sc->sc_reg[i - 1]) - - rman_get_start(sc->sc_reg[0]) + 1; - - if (!(sc->sc_flags & CREATOR_CONSOLE)) { - if ((sw = vid_get_switch(CREATOR_DRIVER_NAME)) == NULL) { - device_printf(dev, "cannot get video switch\n"); - error = ENODEV; - goto fail; - } - /* - * During device configuration we don't necessarily probe - * the adapter which is the console first so we can't use - * the device unit number for the video adapter unit. The - * worst case would be that we use the video adapter unit - * 0 twice. As it doesn't really matter which unit number - * the corresponding video adapter has just use the next - * unused one. - */ - for (i = 0; i < devclass_get_maxunit(creator_devclass); i++) - if (vid_find_adapter(CREATOR_DRIVER_NAME, i) < 0) - break; - if (strcmp(ofw_bus_get_name(dev), "SUNW,afb") == 0) - sc->sc_flags |= CREATOR_AFB; - if ((error = sw->init(i, adp, 0)) != 0) { - device_printf(dev, "cannot initialize adapter\n"); - goto fail; - } - } - - if (bootverbose) { - if (sc->sc_flags & CREATOR_PAC1) - device_printf(dev, - "BT9068/PAC1 RAMDAC (%s cursor control)\n", - sc->sc_flags & CREATOR_CURINV ? "inverted" : - "normal"); - else - device_printf(dev, "BT498/PAC2 RAMDAC\n"); - } - device_printf(dev, "resolution %dx%d\n", sc->sc_width, sc->sc_height); - - unit = device_get_unit(dev); - sc->sc_si = make_dev(&creator_fb_devsw, unit, UID_ROOT, GID_WHEEL, - 0600, "fb%d", unit); - sc->sc_si->si_drv1 = sc; - - EVENTHANDLER_REGISTER(shutdown_final, creator_shutdown, sc, - SHUTDOWN_PRI_DEFAULT); - - return (0); - - fail: - for (i = 0; i < FFB_NREG && sc->sc_reg[i] != NULL; i++) - bus_release_resource(dev, SYS_RES_MEMORY, - rman_get_rid(sc->sc_reg[i]), sc->sc_reg[i]); - return (error); -} - -/* - * /dev/fb interface - */ -static int -creator_fb_open(struct cdev *dev, int flags, int mode, struct thread *td) -{ - - return (0); -} - -static int -creator_fb_close(struct cdev *dev, int flags, int mode, struct thread *td) -{ - - return (0); -} - -static int -creator_fb_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int flags, - struct thread *td) -{ - struct creator_softc *sc; - - sc = dev->si_drv1; - return (creator_ioctl(&sc->sc_va, cmd, data)); -} - -static int -creator_fb_mmap(struct cdev *dev, vm_ooffset_t offset, vm_paddr_t *paddr, - int prot, vm_memattr_t *memattr) -{ - struct creator_softc *sc; - int i; - - /* - * NB: This is a special implementation based on the /dev/fb - * requirements of the XFree86/X.Org sunffb(4). - */ - sc = dev->si_drv1; - for (i = 0; i < CREATOR_FB_MAP_SIZE; i++) { - if (offset >= creator_fb_map[i].virt && - offset < creator_fb_map[i].virt + creator_fb_map[i].size) { - offset += creator_fb_map[i].phys - - creator_fb_map[i].virt; - if (offset >= sc->sc_reg_size) - return (EINVAL); - *paddr = sc->sc_bh[0] + offset; - return (0); - } - } - return (EINVAL); -} - -/* - * internal functions - */ -static void -creator_cursor_enable(struct creator_softc *sc, int onoff) -{ - int v; - - FFB_WRITE(sc, FFB_DAC, FFB_DAC_TYPE2, FFB_DAC_CUR_CTRL); - if (sc->sc_flags & CREATOR_CURINV) - v = onoff ? FFB_DAC_CUR_CTRL_P0 | FFB_DAC_CUR_CTRL_P1 : 0; - else - v = onoff ? 0 : FFB_DAC_CUR_CTRL_P0 | FFB_DAC_CUR_CTRL_P1; - FFB_WRITE(sc, FFB_DAC, FFB_DAC_VALUE2, v); -} - -static void -creator_cursor_install(struct creator_softc *sc) -{ - int i, j; - - creator_cursor_enable(sc, 0); - FFB_WRITE(sc, FFB_DAC, FFB_DAC_TYPE2, FFB_DAC_CUR_COLOR1); - FFB_WRITE(sc, FFB_DAC, FFB_DAC_VALUE2, 0xffffff); - FFB_WRITE(sc, FFB_DAC, FFB_DAC_VALUE2, 0x0); - for (i = 0; i < 2; i++) { - FFB_WRITE(sc, FFB_DAC, FFB_DAC_TYPE2, - i ? FFB_DAC_CUR_BITMAP_P0 : FFB_DAC_CUR_BITMAP_P1); - for (j = 0; j < 64; j++) { - FFB_WRITE(sc, FFB_DAC, FFB_DAC_VALUE2, - *(const uint32_t *)(&creator_mouse_pointer[j][0])); - FFB_WRITE(sc, FFB_DAC, FFB_DAC_VALUE2, - *(const uint32_t *)(&creator_mouse_pointer[j][4])); - } - } -} - -static void -creator_shutdown(void *xsc) -{ - struct creator_softc *sc = xsc; - - creator_cursor_enable(sc, 0); - /* - * In case this is the console set the cursor of the stdout - * instance to the start of the last line so OFW output ends - * up beneath what FreeBSD left on the screen. - */ - if (sc->sc_flags & CREATOR_CONSOLE) { - OF_interpret("stdout @ is my-self 0 to column#", 0); - OF_interpret("stdout @ is my-self #lines 1 - to line#", 0); - } -} diff --git a/sys/dev/fb/creator_vt.c b/sys/dev/fb/creator_vt.c deleted file mode 100644 index f811f309b0fa30..00000000000000 --- a/sys/dev/fb/creator_vt.c +++ /dev/null @@ -1,274 +0,0 @@ -/*- - * Copyright (c) 2014 Nathan Whitehorn - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include - -#include -#include -#include - -#include -#include - -#include -#include "creatorreg.h" - -static vd_probe_t creatorfb_probe; -static vd_init_t creatorfb_init; -static vd_blank_t creatorfb_blank; -static vd_bitblt_text_t creatorfb_bitblt_text; -static vd_bitblt_bmp_t creatorfb_bitblt_bitmap; - -static const struct vt_driver vt_creatorfb_driver = { - .vd_name = "creatorfb", - .vd_probe = creatorfb_probe, - .vd_init = creatorfb_init, - .vd_blank = creatorfb_blank, - .vd_bitblt_text = creatorfb_bitblt_text, - .vd_bitblt_bmp = creatorfb_bitblt_bitmap, - .vd_fb_ioctl = vt_fb_ioctl, - .vd_fb_mmap = vt_fb_mmap, - .vd_priority = VD_PRIORITY_SPECIFIC -}; - -struct creatorfb_softc { - struct fb_info fb; - struct bus_space_tag memt[1]; - bus_space_handle_t memh; -}; - -static struct creatorfb_softc creatorfb_conssoftc; -VT_DRIVER_DECLARE(vt_creatorfb, vt_creatorfb_driver); - -static int -creatorfb_probe(struct vt_device *vd) -{ - phandle_t chosen, node; - ihandle_t stdout; - char type[64], name[64]; - - chosen = OF_finddevice("/chosen"); - OF_getprop(chosen, "stdout", &stdout, sizeof(stdout)); - node = OF_instance_to_package(stdout); - if (node == -1) { - /* - * The "/chosen/stdout" does not exist try - * using "screen" directly. - */ - node = OF_finddevice("screen"); - } - OF_getprop(node, "device_type", type, sizeof(type)); - if (strcmp(type, "display") != 0) - return (CN_DEAD); - - OF_getprop(node, "name", name, sizeof(name)); - if (strcmp(name, "SUNW,ffb") != 0 && strcmp(name, "SUNW,afb") != 0) - return (CN_DEAD); - - /* Looks OK... */ - return (CN_INTERNAL); -} - -static int -creatorfb_init(struct vt_device *vd) -{ - struct creatorfb_softc *sc; - phandle_t chosen; - phandle_t node; - ihandle_t handle; - uint32_t height, width; - char type[64], name[64]; - bus_addr_t phys; - int space; - - /* Initialize softc */ - vd->vd_softc = sc = &creatorfb_conssoftc; - - chosen = OF_finddevice("/chosen"); - OF_getprop(chosen, "stdout", &handle, sizeof(ihandle_t)); - node = OF_instance_to_package(handle); - if (node == -1) { - /* - * The "/chosen/stdout" does not exist try - * using "screen" directly. - */ - node = OF_finddevice("screen"); - handle = OF_open("screen"); - } - OF_getprop(node, "device_type", type, sizeof(type)); - if (strcmp(type, "display") != 0) - return (CN_DEAD); - - OF_getprop(node, "name", name, sizeof(name)); - if (strcmp(name, "SUNW,ffb") != 0 && strcmp(name, "SUNW,afb") != 0) - return (CN_DEAD); - - /* Make sure we have needed properties */ - if (OF_getproplen(node, "height") != sizeof(height) || - OF_getproplen(node, "width") != sizeof(width)) - return (CN_DEAD); - - OF_getprop(node, "height", &height, sizeof(height)); - OF_getprop(node, "width", &width, sizeof(width)); - - sc->fb.fb_height = height; - sc->fb.fb_width = width; - sc->fb.fb_bpp = sc->fb.fb_depth = 32; - sc->fb.fb_stride = 8192; /* Fixed */ - sc->fb.fb_size = sc->fb.fb_height * sc->fb.fb_stride; - - /* Map linear framebuffer */ - if (OF_decode_addr(node, FFB_DFB24, &space, &phys) != 0) - return (CN_DEAD); - sc->fb.fb_pbase = phys; - sc->memh = sparc64_fake_bustag(space, phys, &sc->memt[0]); - - /* 32-bit VGA palette */ - vt_generate_cons_palette(sc->fb.fb_cmap, COLOR_FORMAT_RGB, - 255, 0, 255, 8, 255, 16); - sc->fb.fb_cmsize = 16; - - vt_fb_init(vd); - - return (CN_INTERNAL); -} - -static void -creatorfb_blank(struct vt_device *vd, term_color_t color) -{ - struct creatorfb_softc *sc; - uint32_t c; - int i; - - sc = vd->vd_softc; - c = sc->fb.fb_cmap[color]; - - for (i = 0; i < sc->fb.fb_height; i++) - bus_space_set_region_4(sc->memt, sc->memh, i*sc->fb.fb_stride, - c, sc->fb.fb_width); -} - -static void -creatorfb_bitblt_bitmap(struct vt_device *vd, const struct vt_window *vw, - const uint8_t *pattern, const uint8_t *mask, - unsigned int width, unsigned int height, - unsigned int x, unsigned int y, term_color_t fg, term_color_t bg) -{ - struct creatorfb_softc *sc = vd->vd_softc; - u_long line; - uint32_t fgc, bgc; - int c, l; - uint8_t b, m; - - fgc = sc->fb.fb_cmap[fg]; - bgc = sc->fb.fb_cmap[bg]; - b = m = 0; - - line = (sc->fb.fb_stride * y) + 4*x; - for (l = 0; - l < height && y + l < vw->vw_draw_area.tr_end.tp_row; - l++) { - for (c = 0; - c < width && x + c < vw->vw_draw_area.tr_end.tp_col; - c++) { - if (c % 8 == 0) - b = *pattern++; - else - b <<= 1; - if (mask != NULL) { - if (c % 8 == 0) - m = *mask++; - else - m <<= 1; - /* Skip pixel write if mask not set. */ - if ((m & 0x80) == 0) - continue; - } - bus_space_write_4(sc->memt, sc->memh, line + 4*c, - (b & 0x80) ? fgc : bgc); - } - line += sc->fb.fb_stride; - } -} - -void -creatorfb_bitblt_text(struct vt_device *vd, const struct vt_window *vw, - const term_rect_t *area) -{ - unsigned int col, row, x, y; - struct vt_font *vf; - term_char_t c; - term_color_t fg, bg; - const uint8_t *pattern; - - vf = vw->vw_font; - - for (row = area->tr_begin.tp_row; row < area->tr_end.tp_row; ++row) { - for (col = area->tr_begin.tp_col; col < area->tr_end.tp_col; - ++col) { - x = col * vf->vf_width + - vw->vw_draw_area.tr_begin.tp_col; - y = row * vf->vf_height + - vw->vw_draw_area.tr_begin.tp_row; - - c = VTBUF_GET_FIELD(&vw->vw_buf, row, col); - pattern = vtfont_lookup(vf, c); - vt_determine_colors(c, - VTBUF_ISCURSOR(&vw->vw_buf, row, col), &fg, &bg); - - creatorfb_bitblt_bitmap(vd, vw, - pattern, NULL, vf->vf_width, vf->vf_height, - x, y, fg, bg); - } - } - -#ifndef SC_NO_CUTPASTE - if (!vd->vd_mshown) - return; - - term_rect_t drawn_area; - - drawn_area.tr_begin.tp_col = area->tr_begin.tp_col * vf->vf_width; - drawn_area.tr_begin.tp_row = area->tr_begin.tp_row * vf->vf_height; - drawn_area.tr_end.tp_col = area->tr_end.tp_col * vf->vf_width; - drawn_area.tr_end.tp_row = area->tr_end.tp_row * vf->vf_height; - - if (vt_is_cursor_in_area(vd, &drawn_area)) { - creatorfb_bitblt_bitmap(vd, vw, - vd->vd_mcursor->map, vd->vd_mcursor->mask, - vd->vd_mcursor->width, vd->vd_mcursor->height, - vd->vd_mx_drawn + vw->vw_draw_area.tr_begin.tp_col, - vd->vd_my_drawn + vw->vw_draw_area.tr_begin.tp_row, - vd->vd_mcursor_fg, vd->vd_mcursor_bg); - } -#endif -} diff --git a/sys/dev/fb/creatorreg.h b/sys/dev/fb/creatorreg.h deleted file mode 100644 index 2cdb2dff1b93de..00000000000000 --- a/sys/dev/fb/creatorreg.h +++ /dev/null @@ -1,249 +0,0 @@ -/*- - * Copyright (C) 2000 David S. Miller (davem@redhat.com) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * DAVID MILLER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * from: XFree86: ffb_dac.h,v 1.1 2000/05/23 04:47:44 dawes Exp - */ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2003 Jake Burkholder. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _DEV_FB_CREATORREG_H_ -#define _DEV_FB_CREATORREG_H_ - -#define FFB_NREG 24 - -#define FFB_PROM 0 -#define FFB_DAC 1 -#define FFB_FBC 2 -#define FFB_DFB8R 3 -#define FFB_DFB8G 4 -#define FFB_DFB8B 5 -#define FFB_DFB8X 6 -#define FFB_DFB24 7 -#define FFB_DFB32 8 -#define FFB_SFB8R 9 -#define FFB_SFB8G 10 -#define FFB_SFB8B 11 -#define FFB_SFB8X 12 -#define FFB_SFB32 13 -#define FFB_SFB64 14 -#define FFB_DFB422A 15 - -#define FFB_DAC_TYPE 0x0 -#define FFB_DAC_VALUE 0x4 -#define FFB_DAC_TYPE2 0x8 -#define FFB_DAC_VALUE2 0xc - -/* FFB_DAC_TYPE configuration and palette register addresses */ -#define FFB_DAC_CFG_UCTRL 0x1001 /* User Control */ -#define FFB_DAC_CFG_TGEN 0x6000 /* Timing Generator Control */ -#define FFB_DAC_CFG_DID 0x8000 /* Device Identification */ - -/* FFB_DAC_CFG_UCTRL register */ -#define FFB_DAC_UCTRL_IPDISAB 0x0001 /* Input Pullup Resistor Dis. */ -#define FFB_DAC_UCTRL_ABLANK 0x0002 /* Asynchronous Blank */ -#define FFB_DAC_UCTRL_DBENAB 0x0004 /* Double-Buffer Enable */ -#define FFB_DAC_UCTRL_OVENAB 0x0008 /* Overlay Enable */ -#define FFB_DAC_UCTRL_WMODE 0x0030 /* Window Mode */ -#define FFB_DAC_UCTRL_WM_COMB 0x0000 /* Window Mode Combined */ -#define FFB_DAC_UCTRL_WM_S4 0x0010 /* Window Mode Separate 4 */ -#define FFB_DAC_UCTRL_WM_S8 0x0020 /* Window Mode Separate 8 */ -#define FFB_DAC_UCTRL_WM_RESV 0x0030 /* Window Mode Reserved */ -#define FFB_DAC_UCTRL_MANREV 0x0f00 /* Manufacturing Revision */ - -/* FFB_DAC_CFG_TGEN register */ -#define FFB_DAC_CFG_TGEN_VIDE 0x01 /* Video Enable */ -#define FFB_DAC_CFG_TGEN_TGE 0x02 /* Timing Generator Enable */ -#define FFB_DAC_CFG_TGEN_HSD 0x04 /* HSYNC* Disable */ -#define FFB_DAC_CFG_TGEN_VSD 0x08 /* VSYNC* Disable */ -#define FFB_DAC_CFG_TGEN_EQD 0x10 /* Equalization Disable */ -#define FFB_DAC_CFG_TGEN_MM 0x20 /* 0 = Slave, 1 = Master */ -#define FFB_DAC_CFG_TGEN_IM 0x40 /* 1 = Interlaced Mode */ - -/* FFB_DAC_CFG_DID register */ -#define FFB_DAC_CFG_DID_ONE 0x00000001 /* Always Set */ -#define FFB_DAC_CFG_DID_MANUF 0x00000ffe /* DAC Manufacturer ID */ -#define FFB_DAC_CFG_DID_PNUM 0x0ffff000 /* DAC Part Number */ -#define FFB_DAC_CFG_DID_REV 0xf0000000 /* DAC Revision */ - -/* FFB_DAC_TYPE2 cursor register addresses */ -#define FFB_DAC_CUR_BITMAP_P0 0x0 /* Plane 0 Cursor Bitmap */ -#define FFB_DAC_CUR_BITMAP_P1 0x80 /* Plane 1 Cursor Bitmap */ -#define FFB_DAC_CUR_CTRL 0x100 /* Cursor Control */ -#define FFB_DAC_CUR_COLOR0 0x101 /* Cursor Color 0 */ -#define FFB_DAC_CUR_COLOR1 0x102 /* Cursor Color 1 (bg) */ -#define FFB_DAC_CUR_COLOR2 0x103 /* Cursor Color 2 (fg) */ -#define FFB_DAC_CUR_POS 0x104 /* Active Cursor Position */ - -/* FFB_DAC_CUR_CTRL register (might be inverted on PAC1 DACs) */ -#define FFB_DAC_CUR_CTRL_P0 0x1 /* Plane0 Display Disable */ -#define FFB_DAC_CUR_CTRL_P1 0x2 /* Plane1 Display Disable */ - -#define FFB_FBC_BY 0x60 -#define FFB_FBC_BX 0x64 -#define FFB_FBC_DY 0x68 -#define FFB_FBC_DX 0x6c -#define FFB_FBC_BH 0x70 -#define FFB_FBC_BW 0x74 -#define FFB_FBC_PPC 0x200 /* Pixel Processor Control */ -#define FFB_FBC_FG 0x208 /* Foreground */ -#define FFB_FBC_BG 0x20c /* Background */ -#define FFB_FBC_FBC 0x254 /* Frame Buffer Control */ -#define FFB_FBC_ROP 0x258 /* Raster Operation */ -#define FFB_FBC_PMASK 0x290 /* Pixel Mask */ -#define FFB_FBC_DRAWOP 0x300 /* Draw Operation */ -#define FFB_FBC_FONTXY 0x314 /* Font X/Y */ -#define FFB_FBC_FONTW 0x318 /* Font Width */ -#define FFB_FBC_FONTINC 0x31c /* Font Increment */ -#define FFB_FBC_FONT 0x320 /* Font Data */ -#define FFB_FBC_UCSR 0x900 /* User Control & Status */ - -#define FBC_PPC_VCE_DIS 0x00001000 -#define FBC_PPC_APE_DIS 0x00000800 -#define FBC_PPC_TBE_OPAQUE 0x00000200 -#define FBC_PPC_CS_CONST 0x00000003 - -#define FFB_FBC_WB_A 0x20000000 -#define FFB_FBC_RB_A 0x00004000 -#define FFB_FBC_SB_BOTH 0x00003000 -#define FFB_FBC_XE_OFF 0x00000040 -#define FFB_FBC_RGBE_MASK 0x0000003f - -#define FBC_ROP_NEW 0x83 - -#define FBC_DRAWOP_RECTANGLE 0x08 - -#define FBC_UCSR_FIFO_OVFL 0x80000000 -#define FBC_UCSR_READ_ERR 0x40000000 -#define FBC_UCSR_RP_BUSY 0x02000000 -#define FBC_UCSR_FB_BUSY 0x01000000 -#define FBC_UCSR_FIFO_MASK 0x00000fff - -#define FFB_VIRT_SFB8R 0x00000000 -#define FFB_VIRT_SFB8G 0x00400000 -#define FFB_VIRT_SFB8B 0x00800000 -#define FFB_VIRT_SFB8X 0x00c00000 -#define FFB_VIRT_SFB32 0x01000000 -#define FFB_VIRT_SFB64 0x02000000 -#define FFB_VIRT_FBC 0x04000000 -#define FFB_VIRT_FBC_BM 0x04002000 -#define FFB_VIRT_DFB8R 0x04004000 -#define FFB_VIRT_DFB8G 0x04404000 -#define FFB_VIRT_DFB8B 0x04804000 -#define FFB_VIRT_DFB8X 0x04c04000 -#define FFB_VIRT_DFB24 0x05004000 -#define FFB_VIRT_DFB32 0x06004000 -#define FFB_VIRT_DFB422A 0x07004000 -#define FFB_VIRT_DFB422AD 0x07804000 -#define FFB_VIRT_DFB24B 0x08004000 -#define FFB_VIRT_DFB422B 0x09004000 -#define FFB_VIRT_DFB422BD 0x09804000 -#define FFB_VIRT_SFB16Z 0x0a004000 -#define FFB_VIRT_SFB8Z 0x0a404000 -#define FFB_VIRT_SFB422 0x0ac04000 -#define FFB_VIRT_SFB422D 0x0b404000 -#define FFB_VIRT_FBC_KREG 0x0bc04000 -#define FFB_VIRT_DAC 0x0bc06000 -#define FFB_VIRT_PROM 0x0bc08000 -#define FFB_VIRT_EXP 0x0bc18000 - -#define FFB_PHYS_SFB8R 0x04000000 -#define FFB_PHYS_SFB8G 0x04400000 -#define FFB_PHYS_SFB8B 0x04800000 -#define FFB_PHYS_SFB8X 0x04c00000 -#define FFB_PHYS_SFB32 0x05000000 -#define FFB_PHYS_SFB64 0x06000000 -#define FFB_PHYS_FBC 0x00600000 -#define FFB_PHYS_FBC_BM 0x00600000 -#define FFB_PHYS_DFB8R 0x01000000 -#define FFB_PHYS_DFB8G 0x01400000 -#define FFB_PHYS_DFB8B 0x01800000 -#define FFB_PHYS_DFB8X 0x01c00000 -#define FFB_PHYS_DFB24 0x02000000 -#define FFB_PHYS_DFB32 0x03000000 -#define FFB_PHYS_DFB422A 0x09000000 -#define FFB_PHYS_DFB422AD 0x09800000 -#define FFB_PHYS_DFB24B 0x0a000000 -#define FFB_PHYS_DFB422B 0x0b000000 -#define FFB_PHYS_DFB422BD 0x0b800000 -#define FFB_PHYS_SFB16Z 0x0c800000 -#define FFB_PHYS_SFB8Z 0x0c000000 -#define FFB_PHYS_SFB422 0x0d000000 -#define FFB_PHYS_SFB422D 0x0d800000 -#define FFB_PHYS_FBC_KREG 0x00610000 -#define FFB_PHYS_DAC 0x00400000 -#define FFB_PHYS_PROM 0x00000000 -#define FFB_PHYS_EXP 0x00200000 - -#define FFB_SIZE_SFB8R 0x00400000 -#define FFB_SIZE_SFB8G 0x00400000 -#define FFB_SIZE_SFB8B 0x00400000 -#define FFB_SIZE_SFB8X 0x00400000 -#define FFB_SIZE_SFB32 0x01000000 -#define FFB_SIZE_SFB64 0x02000000 -#define FFB_SIZE_FBC 0x00002000 -#define FFB_SIZE_FBC_BM 0x00002000 -#define FFB_SIZE_DFB8R 0x00400000 -#define FFB_SIZE_DFB8G 0x00400000 -#define FFB_SIZE_DFB8B 0x00400000 -#define FFB_SIZE_DFB8X 0x00400000 -#define FFB_SIZE_DFB24 0x01000000 -#define FFB_SIZE_DFB32 0x01000000 -#define FFB_SIZE_DFB422A 0x00800000 -#define FFB_SIZE_DFB422AD 0x00800000 -#define FFB_SIZE_DFB24B 0x01000000 -#define FFB_SIZE_DFB422B 0x00800000 -#define FFB_SIZE_DFB422BD 0x00800000 -#define FFB_SIZE_SFB16Z 0x00800000 -#define FFB_SIZE_SFB8Z 0x00800000 -#define FFB_SIZE_SFB422 0x00800000 -#define FFB_SIZE_SFB422D 0x00800000 -#define FFB_SIZE_FBC_KREG 0x00002000 -#define FFB_SIZE_DAC 0x00002000 -#define FFB_SIZE_PROM 0x00010000 -#define FFB_SIZE_EXP 0x00002000 - -#endif /* !_DEV_FB_CREATORREG_H_ */ diff --git a/sys/dev/fb/fbreg.h b/sys/dev/fb/fbreg.h index d5bfd0daa0cda9..7637f06a86b4e8 100644 --- a/sys/dev/fb/fbreg.h +++ b/sys/dev/fb/fbreg.h @@ -51,13 +51,6 @@ copyw(uint16_t *src, uint16_t *dst, size_t size) #define bzero_io(d, c) bzero((void *)(d), (c)) #define fill_io(p, d, c) fill((p), (void *)(d), (c)) #define fillw_io(p, d, c) fillw((p), (void *)(d), (c)) -#elif defined(__sparc64__) -static __inline void -fillw(int val, uint16_t *buf, size_t size) -{ - while (size--) - *buf++ = val; -} #elif defined(__powerpc__) #define bcopy_io(s, d, c) ofwfb_bcopy((void *)(s), (void *)(d), (c)) @@ -102,7 +95,7 @@ fillw(int val, uint16_t *buf, size_t size) #define writew(a, v) (*(uint16_t*)(a) = (v)) #endif -#else /* !__i386__ && !__amd64__ && !__sparc64__ && !__powerpc__ */ +#else /* !__i386__ && !__amd64__ && !__powerpc__ */ #define bcopy_io(s, d, c) memcpy_io((d), (s), (c)) #define bcopy_toio(s, d, c) memcpy_toio((d), (void *)(s), (c)) #define bcopy_fromio(s, d, c) memcpy_fromio((void *)(d), (s), (c)) diff --git a/sys/dev/fb/machfb.c b/sys/dev/fb/machfb.c deleted file mode 100644 index 7c719bbe1cd900..00000000000000 --- a/sys/dev/fb/machfb.c +++ /dev/null @@ -1,1581 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 2002 Bang Jun-Young - * Copyright (c) 2005 Marius Strobl - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * from: NetBSD: machfb.c,v 1.23 2005/03/07 21:45:24 martin Exp - */ - -#include -__FBSDID("$FreeBSD$"); - -/* - * Driver for ATI Mach64 graphics chips. Some code is derived from the - * ATI Rage Pro and Derivatives Programmer's Guide. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include - -#include -#include -#include -#include -#include - -#include - -#include -#include -#include -#include -#include -#include - -/* #define MACHFB_DEBUG */ - -#define MACHFB_DRIVER_NAME "machfb" - -#define MACH64_REG_OFF 0x7ffc00 -#define MACH64_REG_SIZE 1024 - -struct machfb_softc { - video_adapter_t sc_va; /* must be first */ - - phandle_t sc_node; - uint16_t sc_chip_id; - uint8_t sc_chip_rev; - - struct resource *sc_memres; - struct resource *sc_vmemres; - bus_space_tag_t sc_memt; - bus_space_tag_t sc_regt; - bus_space_tag_t sc_vmemt; - bus_space_handle_t sc_memh; - bus_space_handle_t sc_vmemh; - bus_space_handle_t sc_regh; - u_long sc_mem; - u_long sc_vmem; - - u_int sc_height; - u_int sc_width; - u_int sc_depth; - u_int sc_xmargin; - u_int sc_ymargin; - - size_t sc_memsize; - u_int sc_memtype; - u_int sc_mem_freq; - u_int sc_ramdac_freq; - u_int sc_ref_freq; - - u_int sc_ref_div; - u_int sc_mclk_post_div; - u_int sc_mclk_fb_div; - - const u_char *sc_font; - u_int sc_cbwidth; - vm_offset_t sc_curoff; - - int sc_bg_cache; - int sc_fg_cache; - u_int sc_draw_cache; -#define MACHFB_DRAW_CHAR (1 << 0) -#define MACHFB_DRAW_FILLRECT (1 << 1) - - u_int sc_flags; -#define MACHFB_CONSOLE (1 << 0) -#define MACHFB_CUREN (1 << 1) -#define MACHFB_DSP (1 << 2) -#define MACHFB_SWAP (1 << 3) -}; - -static const struct { - uint16_t chip_id; - const char *name; - uint32_t ramdac_freq; -} machfb_info[] = { - { ATI_MACH64_CT, "ATI Mach64 CT", 135000 }, - { ATI_RAGE_PRO_AGP, "ATI 3D Rage Pro (AGP)", 230000 }, - { ATI_RAGE_PRO_AGP1X, "ATI 3D Rage Pro (AGP 1x)", 230000 }, - { ATI_RAGE_PRO_PCI_B, "ATI 3D Rage Pro Turbo", 230000 }, - { ATI_RAGE_XC_PCI66, "ATI Rage XL (PCI66)", 230000 }, - { ATI_RAGE_XL_AGP, "ATI Rage XL (AGP)", 230000 }, - { ATI_RAGE_XC_AGP, "ATI Rage XC (AGP)", 230000 }, - { ATI_RAGE_XL_PCI66, "ATI Rage XL (PCI66)", 230000 }, - { ATI_RAGE_PRO_PCI_P, "ATI 3D Rage Pro", 230000 }, - { ATI_RAGE_PRO_PCI_L, "ATI 3D Rage Pro (limited 3D)", 230000 }, - { ATI_RAGE_XL_PCI, "ATI Rage XL", 230000 }, - { ATI_RAGE_XC_PCI, "ATI Rage XC", 230000 }, - { ATI_RAGE_II, "ATI 3D Rage I/II", 135000 }, - { ATI_RAGE_IIP, "ATI 3D Rage II+", 200000 }, - { ATI_RAGE_IIC_PCI, "ATI 3D Rage IIC", 230000 }, - { ATI_RAGE_IIC_AGP_B, "ATI 3D Rage IIC (AGP)", 230000 }, - { ATI_RAGE_IIC_AGP_P, "ATI 3D Rage IIC (AGP)", 230000 }, - { ATI_RAGE_LT_PRO_AGP, "ATI 3D Rage LT Pro (AGP 133MHz)", 230000 }, - { ATI_RAGE_MOB_M3_PCI, "ATI Rage Mobility M3", 230000 }, - { ATI_RAGE_MOB_M3_AGP, "ATI Rage Mobility M3 (AGP)", 230000 }, - { ATI_RAGE_LT, "ATI 3D Rage LT", 230000 }, - { ATI_RAGE_LT_PRO_PCI, "ATI 3D Rage LT Pro", 230000 }, - { ATI_RAGE_MOBILITY, "ATI Rage Mobility", 230000 }, - { ATI_RAGE_L_MOBILITY, "ATI Rage L Mobility", 230000 }, - { ATI_RAGE_LT_PRO, "ATI 3D Rage LT Pro", 230000 }, - { ATI_RAGE_LT_PRO2, "ATI 3D Rage LT Pro", 230000 }, - { ATI_RAGE_MOB_M1_PCI, "ATI Rage Mobility M1 (PCI)", 230000 }, - { ATI_RAGE_L_MOB_M1_PCI, "ATI Rage L Mobility (PCI)", 230000 }, - { ATI_MACH64_VT, "ATI Mach64 VT", 170000 }, - { ATI_MACH64_VTB, "ATI Mach64 VTB", 200000 }, - { ATI_MACH64_VT4, "ATI Mach64 VT4", 230000 } -}; - -static const struct machfb_cmap { - uint8_t red; - uint8_t green; - uint8_t blue; -} machfb_default_cmap[16] = { - {0x00, 0x00, 0x00}, /* black */ - {0x00, 0x00, 0xff}, /* blue */ - {0x00, 0xff, 0x00}, /* green */ - {0x00, 0xc0, 0xc0}, /* cyan */ - {0xff, 0x00, 0x00}, /* red */ - {0xc0, 0x00, 0xc0}, /* magenta */ - {0xc0, 0xc0, 0x00}, /* brown */ - {0xc0, 0xc0, 0xc0}, /* light grey */ - {0x80, 0x80, 0x80}, /* dark grey */ - {0x80, 0x80, 0xff}, /* light blue */ - {0x80, 0xff, 0x80}, /* light green */ - {0x80, 0xff, 0xff}, /* light cyan */ - {0xff, 0x80, 0x80}, /* light red */ - {0xff, 0x80, 0xff}, /* light magenta */ - {0xff, 0xff, 0x80}, /* yellow */ - {0xff, 0xff, 0xff} /* white */ -}; - -#define MACHFB_CMAP_OFF 16 - -static const u_char machfb_mouse_pointer_bits[64][8] = { - { 0x00, 0x00, }, /* ............ */ - { 0x80, 0x00, }, /* *........... */ - { 0xc0, 0x00, }, /* **.......... */ - { 0xe0, 0x00, }, /* ***......... */ - { 0xf0, 0x00, }, /* ****........ */ - { 0xf8, 0x00, }, /* *****....... */ - { 0xfc, 0x00, }, /* ******...... */ - { 0xfe, 0x00, }, /* *******..... */ - { 0xff, 0x00, }, /* ********.... */ - { 0xff, 0x80, }, /* *********... */ - { 0xfc, 0xc0, }, /* ******..**.. */ - { 0xdc, 0x00, }, /* **.***...... */ - { 0x8e, 0x00, }, /* *...***..... */ - { 0x0e, 0x00, }, /* ....***..... */ - { 0x07, 0x00, }, /* .....***.... */ - { 0x04, 0x00, }, /* .....*...... */ - { 0x00, 0x00, }, /* ............ */ - { 0x00, 0x00, }, /* ............ */ - { 0x00, 0x00, }, /* ............ */ - { 0x00, 0x00, }, /* ............ */ - { 0x00, 0x00, }, /* ............ */ - { 0x00, 0x00, }, /* ............ */ -}; - -/* - * Lookup table to perform a bit-swap of the mouse pointer bits, - * map set bits to CUR_CLR0 and unset bits to transparent. - */ -static const u_char machfb_mouse_pointer_lut[] = { - 0xaa, 0x2a, 0x8a, 0x0a, 0xa2, 0x22, 0x82, 0x02, - 0xa8, 0x28, 0x88, 0x08, 0xa0, 0x20, 0x80, 0x00 -}; - -static const char *const machfb_memtype_names[] = { - "(N/A)", "DRAM", "EDO DRAM", "EDO DRAM", "SDRAM", "SGRAM", "WRAM", - "(unknown type)" -}; - -extern const struct gfb_font gallant12x22; - -static struct machfb_softc machfb_softc; -static struct bus_space_tag machfb_bst_store[1]; - -static device_probe_t machfb_pci_probe; -static device_attach_t machfb_pci_attach; -static device_detach_t machfb_pci_detach; - -static device_method_t machfb_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, machfb_pci_probe), - DEVMETHOD(device_attach, machfb_pci_attach), - DEVMETHOD(device_detach, machfb_pci_detach), - - { 0, 0 } -}; - -static driver_t machfb_pci_driver = { - MACHFB_DRIVER_NAME, - machfb_methods, - sizeof(struct machfb_softc), -}; - -static devclass_t machfb_devclass; - -DRIVER_MODULE(machfb, pci, machfb_pci_driver, machfb_devclass, 0, 0); -MODULE_DEPEND(machfb, pci, 1, 1, 1); - -static void machfb_cursor_enable(struct machfb_softc *, int); -static int machfb_cursor_install(struct machfb_softc *); -static int machfb_get_memsize(struct machfb_softc *); -static void machfb_reset_engine(struct machfb_softc *); -static void machfb_init_engine(struct machfb_softc *); -#if 0 -static void machfb_adjust_frame(struct machfb_softc *, int, int); -#endif -static void machfb_shutdown_final(void *); -static void machfb_shutdown_reset(void *); - -static int machfb_configure(int); - -static vi_probe_t machfb_probe; -static vi_init_t machfb_init; -static vi_get_info_t machfb_get_info; -static vi_query_mode_t machfb_query_mode; -static vi_set_mode_t machfb_set_mode; -static vi_save_font_t machfb_save_font; -static vi_load_font_t machfb_load_font; -static vi_show_font_t machfb_show_font; -static vi_save_palette_t machfb_save_palette; -static vi_load_palette_t machfb_load_palette; -static vi_set_border_t machfb_set_border; -static vi_save_state_t machfb_save_state; -static vi_load_state_t machfb_load_state; -static vi_set_win_org_t machfb_set_win_org; -static vi_read_hw_cursor_t machfb_read_hw_cursor; -static vi_set_hw_cursor_t machfb_set_hw_cursor; -static vi_set_hw_cursor_shape_t machfb_set_hw_cursor_shape; -static vi_blank_display_t machfb_blank_display; -static vi_mmap_t machfb_mmap; -static vi_ioctl_t machfb_ioctl; -static vi_clear_t machfb_clear; -static vi_fill_rect_t machfb_fill_rect; -static vi_bitblt_t machfb_bitblt; -static vi_diag_t machfb_diag; -static vi_save_cursor_palette_t machfb_save_cursor_palette; -static vi_load_cursor_palette_t machfb_load_cursor_palette; -static vi_copy_t machfb_copy; -static vi_putp_t machfb_putp; -static vi_putc_t machfb_putc; -static vi_puts_t machfb_puts; -static vi_putm_t machfb_putm; - -static video_switch_t machfbvidsw = { - .probe = machfb_probe, - .init = machfb_init, - .get_info = machfb_get_info, - .query_mode = machfb_query_mode, - .set_mode = machfb_set_mode, - .save_font = machfb_save_font, - .load_font = machfb_load_font, - .show_font = machfb_show_font, - .save_palette = machfb_save_palette, - .load_palette = machfb_load_palette, - .set_border = machfb_set_border, - .save_state = machfb_save_state, - .load_state = machfb_load_state, - .set_win_org = machfb_set_win_org, - .read_hw_cursor = machfb_read_hw_cursor, - .set_hw_cursor = machfb_set_hw_cursor, - .set_hw_cursor_shape = machfb_set_hw_cursor_shape, - .blank_display = machfb_blank_display, - .mmap = machfb_mmap, - .ioctl = machfb_ioctl, - .clear = machfb_clear, - .fill_rect = machfb_fill_rect, - .bitblt = machfb_bitblt, - .diag = machfb_diag, - .save_cursor_palette = machfb_save_cursor_palette, - .load_cursor_palette = machfb_load_cursor_palette, - .copy = machfb_copy, - .putp = machfb_putp, - .putc = machfb_putc, - .puts = machfb_puts, - .putm = machfb_putm -}; - -VIDEO_DRIVER(machfb, machfbvidsw, machfb_configure); - -extern sc_rndr_sw_t txtrndrsw; -RENDERER(machfb, 0, txtrndrsw, gfb_set); - -RENDERER_MODULE(machfb, gfb_set); - -/* - * Inline functions for getting access to register aperture. - */ -static inline uint32_t regr(struct machfb_softc *, uint32_t); -static inline uint8_t regrb(struct machfb_softc *, uint32_t); -static inline void regw(struct machfb_softc *, uint32_t, uint32_t); -static inline void regwb(struct machfb_softc *, uint32_t, uint8_t); -static inline void regwb_pll(struct machfb_softc *, uint32_t, uint8_t); - -static inline uint32_t -regr(struct machfb_softc *sc, uint32_t index) -{ - - return bus_space_read_4(sc->sc_regt, sc->sc_regh, index); -} - -static inline uint8_t -regrb(struct machfb_softc *sc, uint32_t index) -{ - - return bus_space_read_1(sc->sc_regt, sc->sc_regh, index); -} - -static inline void -regw(struct machfb_softc *sc, uint32_t index, uint32_t data) -{ - - bus_space_write_4(sc->sc_regt, sc->sc_regh, index, data); - bus_space_barrier(sc->sc_regt, sc->sc_regh, index, 4, - BUS_SPACE_BARRIER_WRITE); -} - -static inline void -regwb(struct machfb_softc *sc, uint32_t index, uint8_t data) -{ - - bus_space_write_1(sc->sc_regt, sc->sc_regh, index, data); - bus_space_barrier(sc->sc_regt, sc->sc_regh, index, 1, - BUS_SPACE_BARRIER_WRITE); -} - -static inline void -regwb_pll(struct machfb_softc *sc, uint32_t index, uint8_t data) -{ - - regwb(sc, CLOCK_CNTL + 1, (index << 2) | PLL_WR_EN); - regwb(sc, CLOCK_CNTL + 2, data); - regwb(sc, CLOCK_CNTL + 1, (index << 2) & ~PLL_WR_EN); -} - -static inline void -wait_for_fifo(struct machfb_softc *sc, uint8_t v) -{ - - while ((regr(sc, FIFO_STAT) & 0xffff) > (0x8000 >> v)) - ; -} - -static inline void -wait_for_idle(struct machfb_softc *sc) -{ - - wait_for_fifo(sc, 16); - while ((regr(sc, GUI_STAT) & 1) != 0) - ; -} - -/* - * Inline functions for setting the background and foreground colors. - */ -static inline void machfb_setbg(struct machfb_softc *sc, int bg); -static inline void machfb_setfg(struct machfb_softc *sc, int fg); - -static inline void -machfb_setbg(struct machfb_softc *sc, int bg) -{ - - if (bg == sc->sc_bg_cache) - return; - sc->sc_bg_cache = bg; - wait_for_fifo(sc, 1); - regw(sc, DP_BKGD_CLR, bg + MACHFB_CMAP_OFF); -} - -static inline void -machfb_setfg(struct machfb_softc *sc, int fg) -{ - - if (fg == sc->sc_fg_cache) - return; - sc->sc_fg_cache = fg; - wait_for_fifo(sc, 1); - regw(sc, DP_FRGD_CLR, fg + MACHFB_CMAP_OFF); -} - -/* - * video driver interface - */ -static int -machfb_configure(int flags) -{ - struct machfb_softc *sc; - phandle_t chosen, output; - ihandle_t stdout; - bus_addr_t addr; - uint32_t id; - int i, space; - - /* - * For the high-level console probing return the number of - * registered adapters. - */ - if (!(flags & VIO_PROBE_ONLY)) { - for (i = 0; vid_find_adapter(MACHFB_DRIVER_NAME, i) >= 0; i++) - ; - return (i); - } - - /* Low-level console probing and initialization. */ - - sc = &machfb_softc; - if (sc->sc_va.va_flags & V_ADP_REGISTERED) - goto found; - - if ((chosen = OF_finddevice("/chosen")) == -1) /* Quis contra nos? */ - return (0); - if (OF_getprop(chosen, "stdout", &stdout, sizeof(stdout)) == -1) - return (0); - if ((output = OF_instance_to_package(stdout)) == -1) - return (0); - if ((OF_getprop(output, "vendor-id", &id, sizeof(id)) == -1) || - id != ATI_VENDOR) - return (0); - if (OF_getprop(output, "device-id", &id, sizeof(id)) == -1) - return (0); - for (i = 0; i < nitems(machfb_info); i++) { - if (id == machfb_info[i].chip_id) { - sc->sc_flags = MACHFB_CONSOLE; - sc->sc_node = output; - sc->sc_chip_id = id; - break; - } - } - if (!(sc->sc_flags & MACHFB_CONSOLE)) - return (0); - - if (OF_getprop(output, "revision-id", &sc->sc_chip_rev, - sizeof(sc->sc_chip_rev)) == -1) - return (0); - if (OF_decode_addr(output, 0, &space, &addr) != 0) - return (0); - sc->sc_memt = &machfb_bst_store[0]; - sc->sc_memh = sparc64_fake_bustag(space, addr, sc->sc_memt); - sc->sc_regt = sc->sc_memt; - bus_space_subregion(sc->sc_regt, sc->sc_memh, MACH64_REG_OFF, - MACH64_REG_SIZE, &sc->sc_regh); - - if (machfb_init(0, &sc->sc_va, 0) < 0) - return (0); - - found: - /* Return number of found adapters. */ - return (1); -} - -static int -machfb_probe(int unit, video_adapter_t **adpp, void *arg, int flags) -{ - - return (0); -} - -static int -machfb_init(int unit, video_adapter_t *adp, int flags) -{ - struct machfb_softc *sc; - phandle_t options; - video_info_t *vi; - char buf[32]; - int i; - uint8_t dac_mask, dac_rindex, dac_windex; - - sc = (struct machfb_softc *)adp; - vi = &adp->va_info; - - if ((regr(sc, CONFIG_CHIP_ID) & 0xffff) != sc->sc_chip_id) - return (ENXIO); - - sc->sc_ramdac_freq = 0; - for (i = 0; i < nitems(machfb_info); i++) { - if (sc->sc_chip_id == machfb_info[i].chip_id) { - sc->sc_ramdac_freq = machfb_info[i].ramdac_freq; - break; - } - } - if (sc->sc_ramdac_freq == 0) - return (ENXIO); - if (sc->sc_chip_id == ATI_RAGE_II && sc->sc_chip_rev & 0x07) - sc->sc_ramdac_freq = 170000; - - vid_init_struct(adp, MACHFB_DRIVER_NAME, -1, unit); - - if (OF_getprop(sc->sc_node, "height", &sc->sc_height, - sizeof(sc->sc_height)) == -1) - return (ENXIO); - if (OF_getprop(sc->sc_node, "width", &sc->sc_width, - sizeof(sc->sc_width)) == -1) - return (ENXIO); - if (OF_getprop(sc->sc_node, "depth", &sc->sc_depth, - sizeof(sc->sc_depth)) == -1) - return (ENXIO); - if ((options = OF_finddevice("/options")) == -1) - return (ENXIO); - if (OF_getprop(options, "screen-#rows", buf, sizeof(buf)) == -1) - return (ENXIO); - vi->vi_height = strtol(buf, NULL, 10); - if (OF_getprop(options, "screen-#columns", buf, sizeof(buf)) == -1) - return (ENXIO); - vi->vi_width = strtol(buf, NULL, 10); - vi->vi_cwidth = gallant12x22.width; - vi->vi_cheight = gallant12x22.height; - vi->vi_flags = V_INFO_COLOR; - vi->vi_mem_model = V_INFO_MM_OTHER; - - sc->sc_font = gallant12x22.data; - sc->sc_cbwidth = howmany(vi->vi_cwidth, NBBY); /* width in bytes */ - sc->sc_xmargin = (sc->sc_width - (vi->vi_width * vi->vi_cwidth)) / 2; - sc->sc_ymargin = (sc->sc_height - (vi->vi_height * vi->vi_cheight)) / 2; - - if (sc->sc_chip_id != ATI_MACH64_CT && - !((sc->sc_chip_id == ATI_MACH64_VT || - sc->sc_chip_id == ATI_RAGE_II) && - (sc->sc_chip_rev & 0x07) == 0)) - sc->sc_flags |= MACHFB_DSP; - - sc->sc_memsize = machfb_get_memsize(sc); - if (sc->sc_memsize == 8192) - /* The last page is used as register aperture. */ - sc->sc_memsize -= 4; - sc->sc_memtype = regr(sc, CONFIG_STAT0) & 0x07; - - if ((sc->sc_chip_id >= ATI_RAGE_XC_PCI66 && - sc->sc_chip_id <= ATI_RAGE_XL_PCI66) || - (sc->sc_chip_id >= ATI_RAGE_XL_PCI && - sc->sc_chip_id <= ATI_RAGE_XC_PCI)) - sc->sc_ref_freq = 29498; - else - sc->sc_ref_freq = 14318; - - regwb(sc, CLOCK_CNTL + 1, PLL_REF_DIV << 2); - sc->sc_ref_div = regrb(sc, CLOCK_CNTL + 2); - regwb(sc, CLOCK_CNTL + 1, MCLK_FB_DIV << 2); - sc->sc_mclk_fb_div = regrb(sc, CLOCK_CNTL + 2); - sc->sc_mem_freq = (2 * sc->sc_ref_freq * sc->sc_mclk_fb_div) / - (sc->sc_ref_div * 2); - sc->sc_mclk_post_div = (sc->sc_mclk_fb_div * 2 * sc->sc_ref_freq) / - (sc->sc_mem_freq * sc->sc_ref_div); - - machfb_init_engine(sc); -#if 0 - machfb_adjust_frame(0, 0); -#endif - machfb_set_mode(adp, 0); - - /* - * Install our 16-color color map. This is done only once and with - * an offset of 16 on sparc64 as there the OBP driver expects white - * to be at index 0 and black at 255 (some versions also use 1 - 8 - * for color text support or the full palette for the boot banner - * logo but no versions seems to use the ISO 6429-1983 color map). - * Otherwise the colors are inverted when back in the OFW. - */ - dac_rindex = regrb(sc, DAC_RINDEX); - dac_windex = regrb(sc, DAC_WINDEX); - dac_mask = regrb(sc, DAC_MASK); - regwb(sc, DAC_MASK, 0xff); - regwb(sc, DAC_WINDEX, MACHFB_CMAP_OFF); - for (i = 0; i < 16; i++) { - regwb(sc, DAC_DATA, machfb_default_cmap[i].red); - regwb(sc, DAC_DATA, machfb_default_cmap[i].green); - regwb(sc, DAC_DATA, machfb_default_cmap[i].blue); - } - regwb(sc, DAC_MASK, dac_mask); - regwb(sc, DAC_RINDEX, dac_rindex); - regwb(sc, DAC_WINDEX, dac_windex); - - machfb_blank_display(adp, V_DISPLAY_ON); - machfb_clear(adp); - - /* - * Setting V_ADP_MODECHANGE serves as hack so machfb_set_mode() - * (which will invalidate our caches) is called as a precaution - * when the X server shuts down. - */ - adp->va_flags |= V_ADP_COLOR | V_ADP_MODECHANGE | V_ADP_PALETTE | - V_ADP_BORDER | V_ADP_INITIALIZED; - if (vid_register(adp) < 0) - return (ENXIO); - adp->va_flags |= V_ADP_REGISTERED; - - return (0); -} - -static int -machfb_get_info(video_adapter_t *adp, int mode, video_info_t *info) -{ - - bcopy(&adp->va_info, info, sizeof(*info)); - - return (0); -} - -static int -machfb_query_mode(video_adapter_t *adp, video_info_t *info) -{ - - return (ENODEV); -} - -static int -machfb_set_mode(video_adapter_t *adp, int mode) -{ - struct machfb_softc *sc; - - sc = (struct machfb_softc *)adp; - - sc->sc_bg_cache = -1; - sc->sc_fg_cache = -1; - sc->sc_draw_cache = 0; - - return (0); -} - -static int -machfb_save_font(video_adapter_t *adp, int page, int size, int width, - u_char *data, int c, int count) -{ - - return (ENODEV); -} - -static int -machfb_load_font(video_adapter_t *adp, int page, int size, int width, - u_char *data, int c, int count) -{ - - return (ENODEV); -} - -static int -machfb_show_font(video_adapter_t *adp, int page) -{ - - return (ENODEV); -} - -static int -machfb_save_palette(video_adapter_t *adp, u_char *palette) -{ - struct machfb_softc *sc; - int i; - uint8_t dac_mask, dac_rindex, dac_windex; - - sc = (struct machfb_softc *)adp; - - dac_rindex = regrb(sc, DAC_RINDEX); - dac_windex = regrb(sc, DAC_WINDEX); - dac_mask = regrb(sc, DAC_MASK); - regwb(sc, DAC_MASK, 0xff); - regwb(sc, DAC_RINDEX, 0x0); - for (i = 0; i < 256 * 3; i++) - palette[i] = regrb(sc, DAC_DATA); - regwb(sc, DAC_MASK, dac_mask); - regwb(sc, DAC_RINDEX, dac_rindex); - regwb(sc, DAC_WINDEX, dac_windex); - - return (0); -} - -static int -machfb_load_palette(video_adapter_t *adp, u_char *palette) -{ - struct machfb_softc *sc; - int i; - uint8_t dac_mask, dac_rindex, dac_windex; - - sc = (struct machfb_softc *)adp; - - dac_rindex = regrb(sc, DAC_RINDEX); - dac_windex = regrb(sc, DAC_WINDEX); - dac_mask = regrb(sc, DAC_MASK); - regwb(sc, DAC_MASK, 0xff); - regwb(sc, DAC_WINDEX, 0x0); - for (i = 0; i < 256 * 3; i++) - regwb(sc, DAC_DATA, palette[i]); - regwb(sc, DAC_MASK, dac_mask); - regwb(sc, DAC_RINDEX, dac_rindex); - regwb(sc, DAC_WINDEX, dac_windex); - - return (0); -} - -static int -machfb_set_border(video_adapter_t *adp, int border) -{ - struct machfb_softc *sc; - - sc = (struct machfb_softc *)adp; - - machfb_fill_rect(adp, border, 0, 0, sc->sc_width, sc->sc_ymargin); - machfb_fill_rect(adp, border, 0, sc->sc_height - sc->sc_ymargin, - sc->sc_width, sc->sc_ymargin); - machfb_fill_rect(adp, border, 0, 0, sc->sc_xmargin, sc->sc_height); - machfb_fill_rect(adp, border, sc->sc_width - sc->sc_xmargin, 0, - sc->sc_xmargin, sc->sc_height); - - return (0); -} - -static int -machfb_save_state(video_adapter_t *adp, void *p, size_t size) -{ - - return (ENODEV); -} - -static int -machfb_load_state(video_adapter_t *adp, void *p) -{ - - return (ENODEV); -} - -static int -machfb_set_win_org(video_adapter_t *adp, off_t offset) -{ - - return (ENODEV); -} - -static int -machfb_read_hw_cursor(video_adapter_t *adp, int *col, int *row) -{ - - *col = 0; - *row = 0; - - return (0); -} - -static int -machfb_set_hw_cursor(video_adapter_t *adp, int col, int row) -{ - - return (ENODEV); -} - -static int -machfb_set_hw_cursor_shape(video_adapter_t *adp, int base, int height, - int celsize, int blink) -{ - - return (ENODEV); -} - -static int -machfb_blank_display(video_adapter_t *adp, int mode) -{ - struct machfb_softc *sc; - uint32_t crtc_gen_cntl; - - sc = (struct machfb_softc *)adp; - - crtc_gen_cntl = (regr(sc, CRTC_GEN_CNTL) | CRTC_EXT_DISP_EN | CRTC_EN) & - ~(CRTC_HSYNC_DIS | CRTC_VSYNC_DIS | CRTC_DISPLAY_DIS); - switch (mode) { - case V_DISPLAY_ON: - break; - case V_DISPLAY_BLANK: - crtc_gen_cntl |= CRTC_HSYNC_DIS | CRTC_VSYNC_DIS | - CRTC_DISPLAY_DIS; - break; - case V_DISPLAY_STAND_BY: - crtc_gen_cntl |= CRTC_HSYNC_DIS | CRTC_DISPLAY_DIS; - break; - case V_DISPLAY_SUSPEND: - crtc_gen_cntl |= CRTC_VSYNC_DIS | CRTC_DISPLAY_DIS; - break; - } - regw(sc, CRTC_GEN_CNTL, crtc_gen_cntl); - - return (0); -} - -static int -machfb_mmap(video_adapter_t *adp, vm_ooffset_t offset, vm_paddr_t *paddr, - int prot, vm_memattr_t *memattr) -{ - struct machfb_softc *sc; - video_info_t *vi; - - sc = (struct machfb_softc *)adp; - vi = &adp->va_info; - - /* BAR 2 - VGA memory */ - if (sc->sc_vmem != 0 && offset >= sc->sc_vmem && - offset < sc->sc_vmem + vi->vi_registers_size) { - *paddr = vi->vi_registers + offset - sc->sc_vmem; - return (0); - } - - /* BAR 0 - framebuffer */ - if (offset >= sc->sc_mem && - offset < sc->sc_mem + vi->vi_buffer_size) { - *paddr = vi->vi_buffer + offset - sc->sc_mem; - return (0); - } - - /* 'regular' framebuffer mmap()ing */ - if (offset < adp->va_window_size) { - *paddr = vi->vi_window + offset; - return (0); - } - - return (EINVAL); -} - -static int -machfb_ioctl(video_adapter_t *adp, u_long cmd, caddr_t data) -{ - struct machfb_softc *sc; - struct fbcursor *fbc; - struct fbtype *fb; - - sc = (struct machfb_softc *)adp; - - switch (cmd) { - case FBIOGTYPE: - fb = (struct fbtype *)data; - fb->fb_type = FBTYPE_PCIMISC; - fb->fb_height = sc->sc_height; - fb->fb_width = sc->sc_width; - fb->fb_depth = sc->sc_depth; - if (sc->sc_depth <= 1 || sc->sc_depth > 8) - fb->fb_cmsize = 0; - else - fb->fb_cmsize = 1 << sc->sc_depth; - fb->fb_size = adp->va_buffer_size; - break; - case FBIOSCURSOR: - fbc = (struct fbcursor *)data; - if (fbc->set & FB_CUR_SETCUR && fbc->enable == 0) { - machfb_cursor_enable(sc, 0); - sc->sc_flags &= ~MACHFB_CUREN; - } else - return (ENODEV); - break; - default: - return (fb_commonioctl(adp, cmd, data)); - } - - return (0); -} - -static int -machfb_clear(video_adapter_t *adp) -{ - struct machfb_softc *sc; - - sc = (struct machfb_softc *)adp; - - machfb_fill_rect(adp, (SC_NORM_ATTR >> 4) & 0xf, 0, 0, sc->sc_width, - sc->sc_height); - - return (0); -} - -static int -machfb_fill_rect(video_adapter_t *adp, int val, int x, int y, int cx, int cy) -{ - struct machfb_softc *sc; - - sc = (struct machfb_softc *)adp; - - if (sc->sc_draw_cache != MACHFB_DRAW_FILLRECT) { - wait_for_fifo(sc, 7); - regw(sc, DP_WRITE_MASK, 0xff); - regw(sc, DP_PIX_WIDTH, DST_8BPP | SRC_8BPP | HOST_8BPP); - regw(sc, DP_SRC, FRGD_SRC_FRGD_CLR); - regw(sc, DP_MIX, MIX_SRC << 16); - regw(sc, CLR_CMP_CNTL, 0); /* no transparency */ - regw(sc, SRC_CNTL, SRC_LINE_X_LEFT_TO_RIGHT); - regw(sc, DST_CNTL, DST_X_LEFT_TO_RIGHT | DST_Y_TOP_TO_BOTTOM); - sc->sc_draw_cache = MACHFB_DRAW_FILLRECT; - } - machfb_setfg(sc, val); - wait_for_fifo(sc, 4); - regw(sc, SRC_Y_X, (x << 16) | y); - regw(sc, SRC_WIDTH1, cx); - regw(sc, DST_Y_X, (x << 16) | y); - regw(sc, DST_HEIGHT_WIDTH, (cx << 16) | cy); - - return (0); -} - -static int -machfb_bitblt(video_adapter_t *adp, ...) -{ - - return (ENODEV); -} - -static int -machfb_diag(video_adapter_t *adp, int level) -{ - video_info_t info; - - fb_dump_adp_info(adp->va_name, adp, level); - machfb_get_info(adp, 0, &info); - fb_dump_mode_info(adp->va_name, adp, &info, level); - - return (0); -} - -static int -machfb_save_cursor_palette(video_adapter_t *adp, u_char *palette) -{ - - return (ENODEV); -} - -static int -machfb_load_cursor_palette(video_adapter_t *adp, u_char *palette) -{ - - return (ENODEV); -} - -static int -machfb_copy(video_adapter_t *adp, vm_offset_t src, vm_offset_t dst, int n) -{ - - return (ENODEV); -} - -static int -machfb_putp(video_adapter_t *adp, vm_offset_t off, uint32_t p, uint32_t a, - int size, int bpp, int bit_ltor, int byte_ltor) -{ - - return (ENODEV); -} - -static int -machfb_putc(video_adapter_t *adp, vm_offset_t off, uint8_t c, uint8_t a) -{ - struct machfb_softc *sc; - const uint8_t *p; - int i; - - sc = (struct machfb_softc *)adp; - - if (sc->sc_draw_cache != MACHFB_DRAW_CHAR) { - wait_for_fifo(sc, 8); - regw(sc, DP_WRITE_MASK, 0xff); /* XXX only good for 8 bit */ - regw(sc, DP_PIX_WIDTH, DST_8BPP | SRC_1BPP | HOST_1BPP); - regw(sc, DP_SRC, MONO_SRC_HOST | BKGD_SRC_BKGD_CLR | - FRGD_SRC_FRGD_CLR); - regw(sc, DP_MIX ,((MIX_SRC & 0xffff) << 16) | MIX_SRC); - regw(sc, CLR_CMP_CNTL, 0); /* no transparency */ - regw(sc, SRC_CNTL, SRC_LINE_X_LEFT_TO_RIGHT); - regw(sc, DST_CNTL, DST_Y_TOP_TO_BOTTOM | DST_X_LEFT_TO_RIGHT); - regw(sc, HOST_CNTL, HOST_BYTE_ALIGN); - sc->sc_draw_cache = MACHFB_DRAW_CHAR; - } - machfb_setbg(sc, (a >> 4) & 0xf); - machfb_setfg(sc, a & 0xf); - wait_for_fifo(sc, 4 + (adp->va_info.vi_cheight / sc->sc_cbwidth)); - regw(sc, SRC_Y_X, 0); - regw(sc, SRC_WIDTH1, adp->va_info.vi_cwidth); - regw(sc, DST_Y_X, ((((off % adp->va_info.vi_width) * - adp->va_info.vi_cwidth) + sc->sc_xmargin) << 16) | - (((off / adp->va_info.vi_width) * adp->va_info.vi_cheight) + - sc->sc_ymargin)); - regw(sc, DST_HEIGHT_WIDTH, (adp->va_info.vi_cwidth << 16) | - adp->va_info.vi_cheight); - p = sc->sc_font + (c * adp->va_info.vi_cheight * sc->sc_cbwidth); - for (i = 0; i < adp->va_info.vi_cheight * sc->sc_cbwidth; i += 4) - regw(sc, HOST_DATA0 + i, (p[i + 3] << 24 | p[i + 2] << 16 | - p[i + 1] << 8 | p[i])); - - return (0); -} - -static int -machfb_puts(video_adapter_t *adp, vm_offset_t off, uint16_t *s, int len) -{ - struct machfb_softc *sc; - int blanks, i, x1, x2, y1, y2; - uint8_t a, c, color1, color2; - - sc = (struct machfb_softc *)adp; - -#define MACHFB_BLANK machfb_fill_rect(adp, color1, x1, y1, \ - blanks * adp->va_info.vi_cwidth, \ - adp->va_info.vi_cheight) - - blanks = color1 = x1 = y1 = 0; - for (i = 0; i < len; i++) { - /* - * Accelerate continuous blanks by drawing a respective - * rectangle instead. Drawing a rectangle of any size - * takes about the same number of operations as drawing - * a single character. - */ - c = s[i] & 0xff; - a = (s[i] & 0xff00) >> 8; - if (c == 0x00 || c == 0x20 || c == 0xdb || c == 0xff) { - color2 = (a >> (c == 0xdb ? 0 : 4) & 0xf); - x2 = (((off + i) % adp->va_info.vi_width) * - adp->va_info.vi_cwidth) + sc->sc_xmargin; - y2 = (((off + i) / adp->va_info.vi_width) * - adp->va_info.vi_cheight) + sc->sc_ymargin; - if (blanks == 0) { - color1 = color2; - x1 = x2; - y1 = y2; - blanks++; - } else if (color1 != color2 || y1 != y2) { - MACHFB_BLANK; - color1 = color2; - x1 = x2; - y1 = y2; - blanks = 1; - } else - blanks++; - } else { - if (blanks != 0) { - MACHFB_BLANK; - blanks = 0; - } - vidd_putc(adp, off + i, c, a); - } - } - if (blanks != 0) - MACHFB_BLANK; - -#undef MACHFB_BLANK - - return (0); -} - -static int -machfb_putm(video_adapter_t *adp, int x, int y, uint8_t *pixel_image, - uint32_t pixel_mask, int size, int width) -{ - struct machfb_softc *sc; - int error; - - sc = (struct machfb_softc *)adp; - - if ((!(sc->sc_flags & MACHFB_CUREN)) && - (error = machfb_cursor_install(sc)) < 0) - return (error); - else { - /* - * The hardware cursor always must be disabled when - * fiddling with its bits otherwise some artifacts - * may appear on the screen. - */ - machfb_cursor_enable(sc, 0); - } - - regw(sc, CUR_HORZ_VERT_OFF, 0); - if ((regr(sc, GEN_TEST_CNTL) & CRTC_DBL_SCAN_EN) != 0) - y <<= 1; - regw(sc, CUR_HORZ_VERT_POSN, ((y + sc->sc_ymargin) << 16) | - (x + sc->sc_xmargin)); - machfb_cursor_enable(sc, 1); - sc->sc_flags |= MACHFB_CUREN; - - return (0); -} - -/* - * PCI bus interface - */ -static int -machfb_pci_probe(device_t dev) -{ - int i; - - if (pci_get_class(dev) != PCIC_DISPLAY || - pci_get_subclass(dev) != PCIS_DISPLAY_VGA) - return (ENXIO); - - for (i = 0; i < nitems(machfb_info); i++) { - if (pci_get_device(dev) == machfb_info[i].chip_id) { - device_set_desc(dev, machfb_info[i].name); - return (BUS_PROBE_DEFAULT); - } - } - - return (ENXIO); -} - -static int -machfb_pci_attach(device_t dev) -{ - struct machfb_softc *sc; - video_adapter_t *adp; - video_switch_t *sw; - video_info_t *vi; - phandle_t node; - int error, i, rid; - uint32_t *p32, u32; - uint8_t *p; - - node = ofw_bus_get_node(dev); - if ((sc = (struct machfb_softc *)vid_get_adapter(vid_find_adapter( - MACHFB_DRIVER_NAME, 0))) != NULL && sc->sc_node == node) { - device_printf(dev, "console\n"); - device_set_softc(dev, sc); - } else { - sc = device_get_softc(dev); - - sc->sc_node = node; - sc->sc_chip_id = pci_get_device(dev); - sc->sc_chip_rev = pci_get_revid(dev); - } - adp = &sc->sc_va; - vi = &adp->va_info; - - rid = PCIR_BAR(0); - if ((sc->sc_memres = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, - RF_ACTIVE)) == NULL) { - device_printf(dev, "cannot allocate memory resources\n"); - return (ENXIO); - } - sc->sc_memt = rman_get_bustag(sc->sc_memres); - sc->sc_memh = rman_get_bushandle(sc->sc_memres); - sc->sc_mem = rman_get_start(sc->sc_memres); - vi->vi_buffer = sc->sc_memh; - vi->vi_buffer_size = rman_get_size(sc->sc_memres); - if (OF_getprop(sc->sc_node, "address", &u32, sizeof(u32)) > 0 && - vtophys(u32) == sc->sc_memh) - adp->va_mem_base = u32; - else { - if (bus_space_map(sc->sc_memt, vi->vi_buffer, - vi->vi_buffer_size, BUS_SPACE_MAP_LINEAR, - &sc->sc_memh) != 0) { - device_printf(dev, "cannot map memory resources\n"); - error = ENXIO; - goto fail_memres; - } - adp->va_mem_base = - (vm_offset_t)rman_get_virtual(sc->sc_memres); - } - adp->va_mem_size = vi->vi_buffer_size; - adp->va_buffer = adp->va_mem_base; - adp->va_buffer_size = adp->va_mem_size; - sc->sc_regt = sc->sc_memt; - if (bus_space_subregion(sc->sc_regt, sc->sc_memh, MACH64_REG_OFF, - MACH64_REG_SIZE, &sc->sc_regh) != 0) { - device_printf(dev, "cannot allocate register resources\n"); - error = ENXIO; - goto fail_memmap; - } - - /* - * Depending on the firmware version the VGA I/O and/or memory - * resources of the Mach64 chips come up disabled. These will be - * enabled by pci(4) when activating the resource in question but - * this doesn't necessarily mean that the resource is valid. - * Invalid resources seem to have in common that they start at - * address 0. We don't allocate the VGA memory in this case in - * order to avoid warnings in apb(4) and crashes when using this - * invalid resources. X.Org is aware of this and doesn't use the - * VGA memory resource in this case (but demands it if it's valid). - */ - rid = PCIR_BAR(2); - if (bus_get_resource_start(dev, SYS_RES_MEMORY, rid) != 0) { - if ((sc->sc_vmemres = bus_alloc_resource_any(dev, - SYS_RES_MEMORY, &rid, RF_ACTIVE)) == NULL) { - device_printf(dev, - "cannot allocate VGA memory resources\n"); - error = ENXIO; - goto fail_memmap; - } - sc->sc_vmemt = rman_get_bustag(sc->sc_vmemres); - sc->sc_vmemh = rman_get_bushandle(sc->sc_vmemres); - sc->sc_vmem = rman_get_start(sc->sc_vmemres); - vi->vi_registers = sc->sc_vmemh; - vi->vi_registers_size = rman_get_size(sc->sc_vmemres); - if (bus_space_map(sc->sc_vmemt, vi->vi_registers, - vi->vi_registers_size, BUS_SPACE_MAP_LINEAR, - &sc->sc_vmemh) != 0) { - device_printf(dev, - "cannot map VGA memory resources\n"); - error = ENXIO; - goto fail_vmemres; - } - adp->va_registers = - (vm_offset_t)rman_get_virtual(sc->sc_vmemres); - adp->va_registers_size = vi->vi_registers_size; - } - - if (!(sc->sc_flags & MACHFB_CONSOLE)) { - if ((sw = vid_get_switch(MACHFB_DRIVER_NAME)) == NULL) { - device_printf(dev, "cannot get video switch\n"); - error = ENODEV; - goto fail_vmemmap; - } - /* - * During device configuration we don't necessarily probe - * the adapter which is the console first so we can't use - * the device unit number for the video adapter unit. The - * worst case would be that we use the video adapter unit - * 0 twice. As it doesn't really matter which unit number - * the corresponding video adapter has just use the next - * unused one. - */ - for (i = 0; i < devclass_get_maxunit(machfb_devclass); i++) - if (vid_find_adapter(MACHFB_DRIVER_NAME, i) < 0) - break; - if ((error = sw->init(i, adp, 0)) != 0) { - device_printf(dev, "cannot initialize adapter\n"); - goto fail_vmemmap; - } - } - - /* - * Test whether the aperture is byte swapped or not, set - * va_window and va_window_size as appropriate. Note that - * the aperture could be mapped either big or little endian - * independently of the endianness of the host so this has - * to be a runtime test. - */ - p32 = (uint32_t *)adp->va_buffer; - u32 = *p32; - p = (uint8_t *)adp->va_buffer; - *p32 = 0x12345678; - if (!(p[0] == 0x12 && p[1] == 0x34 && p[2] == 0x56 && p[3] == 0x78)) { - adp->va_window = adp->va_buffer + 0x800000; - adp->va_window_size = adp->va_buffer_size - 0x800000; - vi->vi_window = vi->vi_buffer + 0x800000; - vi->vi_window_size = vi->vi_buffer_size - 0x800000; - sc->sc_flags |= MACHFB_SWAP; - } else { - adp->va_window = adp->va_buffer; - adp->va_window_size = adp->va_buffer_size; - vi->vi_window = vi->vi_buffer; - vi->vi_window_size = vi->vi_buffer_size; - } - *p32 = u32; - adp->va_window_gran = adp->va_window_size; - - device_printf(dev, - "%d MB aperture at %p %sswapped\n", - (u_int)(adp->va_window_size / (1024 * 1024)), - (void *)adp->va_window, (sc->sc_flags & MACHFB_SWAP) ? - "" : "not "); - device_printf(dev, - "%ld KB %s %d.%d MHz, maximum RAMDAC clock %d MHz, %sDSP\n", - (u_long)sc->sc_memsize, machfb_memtype_names[sc->sc_memtype], - sc->sc_mem_freq / 1000, sc->sc_mem_freq % 1000, - sc->sc_ramdac_freq / 1000, - (sc->sc_flags & MACHFB_DSP) ? "" : "no "); - device_printf(dev, "resolution %dx%d at %d bpp\n", - sc->sc_width, sc->sc_height, sc->sc_depth); - - /* - * Allocate one page for the mouse pointer image at the end of - * the little endian aperture, right before the memory mapped - * registers that might also reside there. Must be done after - * sc_memsize was set and possibly adjusted to account for the - * memory mapped registers. - */ - sc->sc_curoff = (sc->sc_memsize * 1024) - PAGE_SIZE; - sc->sc_memsize -= PAGE_SIZE / 1024; - machfb_cursor_enable(sc, 0); - /* Initialize with an all transparent image. */ - memset((void *)(adp->va_buffer + sc->sc_curoff), 0xaa, PAGE_SIZE); - - /* - * Register a handler that performs some cosmetic surgery like - * turning off the mouse pointer on halt in preparation for - * handing the screen over to the OFW. Register another handler - * that turns off the CRTC when resetting, otherwise the OFW - * boot command issued by cpu_reset() just doesn't work. - */ - EVENTHANDLER_REGISTER(shutdown_final, machfb_shutdown_final, sc, - SHUTDOWN_PRI_DEFAULT); - EVENTHANDLER_REGISTER(shutdown_reset, machfb_shutdown_reset, sc, - SHUTDOWN_PRI_DEFAULT); - - return (0); - - fail_vmemmap: - if (adp->va_registers != 0) - bus_space_unmap(sc->sc_vmemt, sc->sc_vmemh, - vi->vi_registers_size); - fail_vmemres: - if (sc->sc_vmemres != NULL) - bus_release_resource(dev, SYS_RES_MEMORY, - rman_get_rid(sc->sc_vmemres), sc->sc_vmemres); - fail_memmap: - bus_space_unmap(sc->sc_memt, sc->sc_memh, vi->vi_buffer_size); - fail_memres: - bus_release_resource(dev, SYS_RES_MEMORY, - rman_get_rid(sc->sc_memres), sc->sc_memres); - - return (error); -} - -static int -machfb_pci_detach(device_t dev) -{ - - return (EINVAL); -} - -/* - * internal functions - */ -static void -machfb_cursor_enable(struct machfb_softc *sc, int onoff) -{ - - if (onoff) - regw(sc, GEN_TEST_CNTL, - regr(sc, GEN_TEST_CNTL) | HWCURSOR_ENABLE); - else - regw(sc, GEN_TEST_CNTL, - regr(sc, GEN_TEST_CNTL) &~ HWCURSOR_ENABLE); -} - -static int -machfb_cursor_install(struct machfb_softc *sc) -{ - uint16_t *p, v; - uint8_t fg; - int i, j; - - if (sc->sc_curoff == 0) - return (ENODEV); - - machfb_cursor_enable(sc, 0); - regw(sc, CUR_OFFSET, sc->sc_curoff >> 3); - fg = SC_NORM_ATTR & 0xf; - regw(sc, CUR_CLR0, machfb_default_cmap[fg].red << 24 | - machfb_default_cmap[fg].green << 16 | - machfb_default_cmap[fg].blue << 8); - p = (uint16_t *)(sc->sc_va.va_buffer + sc->sc_curoff); - for (i = 0; i < 64; i++) { - for (j = 0; j < 8; j++) { - v = machfb_mouse_pointer_lut[ - machfb_mouse_pointer_bits[i][j] >> 4] << 8 | - machfb_mouse_pointer_lut[ - machfb_mouse_pointer_bits[i][j] & 0x0f]; - if (sc->sc_flags & MACHFB_SWAP) - *(p++) = bswap16(v); - else - *(p++) = v; - } - } - - return (0); -} - -static int -machfb_get_memsize(struct machfb_softc *sc) -{ - int tmp, memsize; - const int mem_tab[] = { - 512, 1024, 2048, 4096, 6144, 8192, 12288, 16384 - }; - - tmp = regr(sc, MEM_CNTL); -#ifdef MACHFB_DEBUG - printf("memcntl=0x%08x\n", tmp); -#endif - if (sc->sc_flags & MACHFB_DSP) { - tmp &= 0x0000000f; - if (tmp < 8) - memsize = (tmp + 1) * 512; - else if (tmp < 12) - memsize = (tmp - 3) * 1024; - else - memsize = (tmp - 7) * 2048; - } else - memsize = mem_tab[tmp & 0x07]; - - return (memsize); -} - -static void -machfb_reset_engine(struct machfb_softc *sc) -{ - - /* Reset engine.*/ - regw(sc, GEN_TEST_CNTL, regr(sc, GEN_TEST_CNTL) & ~GUI_ENGINE_ENABLE); - - /* Enable engine. */ - regw(sc, GEN_TEST_CNTL, regr(sc, GEN_TEST_CNTL) | GUI_ENGINE_ENABLE); - - /* - * Ensure engine is not locked up by clearing any FIFO or - * host errors. - */ - regw(sc, BUS_CNTL, regr(sc, BUS_CNTL) | BUS_HOST_ERR_ACK | - BUS_FIFO_ERR_ACK); -} - -static void -machfb_init_engine(struct machfb_softc *sc) -{ - uint32_t pitch_value; - - pitch_value = sc->sc_width; - - if (sc->sc_depth == 24) - pitch_value *= 3; - - machfb_reset_engine(sc); - - wait_for_fifo(sc, 14); - - regw(sc, CONTEXT_MASK, 0xffffffff); - - regw(sc, DST_OFF_PITCH, (pitch_value / 8) << 22); - - regw(sc, DST_Y_X, 0); - regw(sc, DST_HEIGHT, 0); - regw(sc, DST_BRES_ERR, 0); - regw(sc, DST_BRES_INC, 0); - regw(sc, DST_BRES_DEC, 0); - - regw(sc, DST_CNTL, DST_LAST_PEL | DST_X_LEFT_TO_RIGHT | - DST_Y_TOP_TO_BOTTOM); - - regw(sc, SRC_OFF_PITCH, (pitch_value / 8) << 22); - - regw(sc, SRC_Y_X, 0); - regw(sc, SRC_HEIGHT1_WIDTH1, 1); - regw(sc, SRC_Y_X_START, 0); - regw(sc, SRC_HEIGHT2_WIDTH2, 1); - - regw(sc, SRC_CNTL, SRC_LINE_X_LEFT_TO_RIGHT); - - wait_for_fifo(sc, 13); - regw(sc, HOST_CNTL, 0); - - regw(sc, PAT_REG0, 0); - regw(sc, PAT_REG1, 0); - regw(sc, PAT_CNTL, 0); - - regw(sc, SC_LEFT, 0); - regw(sc, SC_TOP, 0); - regw(sc, SC_BOTTOM, sc->sc_height - 1); - regw(sc, SC_RIGHT, pitch_value - 1); - - regw(sc, DP_BKGD_CLR, 0); - regw(sc, DP_FRGD_CLR, 0xffffffff); - regw(sc, DP_WRITE_MASK, 0xffffffff); - regw(sc, DP_MIX, (MIX_SRC << 16) | MIX_DST); - - regw(sc, DP_SRC, FRGD_SRC_FRGD_CLR); - - wait_for_fifo(sc, 3); - regw(sc, CLR_CMP_CLR, 0); - regw(sc, CLR_CMP_MASK, 0xffffffff); - regw(sc, CLR_CMP_CNTL, 0); - - wait_for_fifo(sc, 2); - switch (sc->sc_depth) { - case 8: - regw(sc, DP_PIX_WIDTH, HOST_8BPP | SRC_8BPP | DST_8BPP); - regw(sc, DP_CHAIN_MASK, DP_CHAIN_8BPP); - regw(sc, DAC_CNTL, regr(sc, DAC_CNTL) | DAC_8BIT_EN); - break; -#if 0 - case 32: - regw(sc, DP_PIX_WIDTH, HOST_32BPP | SRC_32BPP | DST_32BPP); - regw(sc, DP_CHAIN_MASK, DP_CHAIN_32BPP); - regw(sc, DAC_CNTL, regr(sc, DAC_CNTL) | DAC_8BIT_EN); - break; -#endif - } - - wait_for_fifo(sc, 2); - regw(sc, CRTC_INT_CNTL, regr(sc, CRTC_INT_CNTL) & ~0x20); - regw(sc, GUI_TRAJ_CNTL, DST_X_LEFT_TO_RIGHT | DST_Y_TOP_TO_BOTTOM); - - wait_for_idle(sc); -} - -#if 0 -static void -machfb_adjust_frame(struct machfb_softc *sc, int x, int y) -{ - int offset; - - offset = ((x + y * sc->sc_width) * (sc->sc_depth >> 3)) >> 3; - - regw(sc, CRTC_OFF_PITCH, (regr(sc, CRTC_OFF_PITCH) & 0xfff00000) | - offset); -} -#endif - -static void -machfb_shutdown_final(void *v) -{ - struct machfb_softc *sc = v; - - machfb_cursor_enable(sc, 0); - /* - * In case this is the console set the cursor of the stdout - * instance to the start of the last line so OFW output ends - * up beneath what FreeBSD left on the screen. - */ - if (sc->sc_flags & MACHFB_CONSOLE) { - OF_interpret("stdout @ is my-self 0 to column#", 0); - OF_interpret("stdout @ is my-self #lines 1 - to line#", 0); - } -} - -static void -machfb_shutdown_reset(void *v) -{ - struct machfb_softc *sc = v; - - machfb_blank_display(&sc->sc_va, V_DISPLAY_STAND_BY); -} diff --git a/sys/dev/fb/machfbreg.h b/sys/dev/fb/machfbreg.h deleted file mode 100644 index 8990a4e3993a8f..00000000000000 --- a/sys/dev/fb/machfbreg.h +++ /dev/null @@ -1,458 +0,0 @@ -/*- - * Copyright 1992,1993,1994,1995,1996,1997 by Kevin E. Martin, Chapel Hill, North Carolina. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and that - * both that copyright notice and this permission notice appear in - * supporting documentation, and that the name of Kevin E. Martin not be - * used in advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. Kevin E. Martin - * makes no representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * KEVIN E. MARTIN, RICKARD E. FAITH, AND TIAGO GONS DISCLAIM ALL - * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE - * AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR - * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, - * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - * - * Modified for the Mach-8 by Rickard E. Faith (faith@cs.unc.edu) - * Modified for the Mach32 by Kevin E. Martin (martin@cs.unc.edu) - * Modified for the Mach64 by Kevin E. Martin (martin@cs.unc.edu) - * - * from: NetBSD: machfbreg.h,v 1.1 2002/10/24 18:15:57 junyoung Exp - * - * $FreeBSD$ - */ - -#ifndef _DEV_FB_MACHFB_H_ -#define _DEV_FB_MACHFB_H_ - -/* NON-GUI MEMORY MAPPED Registers - expressed in BYTE offsets */ - -#define CRTC_H_TOTAL_DISP 0x0000 /* Dword offset 00 */ -#define CRTC_H_SYNC_STRT_WID 0x0004 /* Dword offset 01 */ -#define CRTC_V_TOTAL_DISP 0x0008 /* Dword offset 02 */ -#define CRTC_V_SYNC_STRT_WID 0x000C /* Dword offset 03 */ -#define CRTC_VLINE_CRNT_VLINE 0x0010 /* Dword offset 04 */ -#define CRTC_OFF_PITCH 0x0014 /* Dword offset 05 */ -#define CRTC_INT_CNTL 0x0018 /* Dword offset 06 */ -#define CRTC_GEN_CNTL 0x001C /* Dword offset 07 */ - -#define DSP_CONFIG 0x0020 /* Dword offset 08 */ -#define DSP_ON_OFF 0x0024 /* Dword offset 09 */ - -#define SHARED_CNTL 0x0038 /* Dword offset 0E */ - -#define OVR_CLR 0x0040 /* Dword offset 10 */ -#define OVR_WID_LEFT_RIGHT 0x0044 /* Dword offset 11 */ -#define OVR_WID_TOP_BOTTOM 0x0048 /* Dword offset 12 */ - -#define CUR_CLR0 0x0060 /* Dword offset 18 */ -#define CUR_CLR1 0x0064 /* Dword offset 19 */ -#define CUR_OFFSET 0x0068 /* Dword offset 1A */ -#define CUR_HORZ_VERT_POSN 0x006C /* Dword offset 1B */ -#define CUR_HORZ_VERT_OFF 0x0070 /* Dword offset 1C */ - -#define HW_DEBUG 0x007C /* Dword offset 1F */ - -#define SCRATCH_REG0 0x0080 /* Dword offset 20 */ -#define SCRATCH_REG1 0x0084 /* Dword offset 21 */ - -#define CLOCK_CNTL 0x0090 /* Dword offset 24 */ - -#define BUS_CNTL 0x00A0 /* Dword offset 28 */ - -#define LCD_INDEX 0x00A4 /* Dword offset 29 (LTPro) */ -#define LCD_DATA 0x00A8 /* Dword offset 2A (LTPro) */ - -#define MEM_CNTL 0x00B0 /* Dword offset 2C */ - -#define MEM_VGA_WP_SEL 0x00B4 /* Dword offset 2D */ -#define MEM_VGA_RP_SEL 0x00B8 /* Dword offset 2E */ - -#define DAC_REGS 0x00C0 /* Dword offset 30 */ -#define DAC_WINDEX 0x00C0 /* Dword offset 30 */ -#define DAC_DATA 0x00C1 /* Dword offset 30 */ -#define DAC_MASK 0x00C2 /* Dword offset 30 */ -#define DAC_RINDEX 0x00C3 /* Dword offset 30 */ -#define DAC_CNTL 0x00C4 /* Dword offset 31 */ - -#define HORZ_STRETCHING 0x00C8 /* Dword offset 32 (LT) */ -#define VERT_STRETCHING 0x00CC /* Dword offset 33 (LT) */ - -#define GEN_TEST_CNTL 0x00D0 /* Dword offset 34 */ - -#define LCD_GEN_CNTL 0x00D4 /* Dword offset 35 (LT) */ -#define POWER_MANAGEMENT 0x00D8 /* Dword offset 36 (LT) */ - -#define CONFIG_CNTL 0x00DC /* Dword offset 37 (CT, ET, VT) */ -#define CONFIG_CHIP_ID 0x00E0 /* Dword offset 38 */ -#define CONFIG_STAT0 0x00E4 /* Dword offset 39 */ -#define CONFIG_STAT1 0x00E8 /* Dword offset 3A */ - - -/* GUI MEMORY MAPPED Registers */ - -#define DST_OFF_PITCH 0x0100 /* Dword offset 40 */ -#define DST_X 0x0104 /* Dword offset 41 */ -#define DST_Y 0x0108 /* Dword offset 42 */ -#define DST_Y_X 0x010C /* Dword offset 43 */ -#define DST_WIDTH 0x0110 /* Dword offset 44 */ -#define DST_HEIGHT 0x0114 /* Dword offset 45 */ -#define DST_HEIGHT_WIDTH 0x0118 /* Dword offset 46 */ -#define DST_X_WIDTH 0x011C /* Dword offset 47 */ -#define DST_BRES_LNTH 0x0120 /* Dword offset 48 */ -#define DST_BRES_ERR 0x0124 /* Dword offset 49 */ -#define DST_BRES_INC 0x0128 /* Dword offset 4A */ -#define DST_BRES_DEC 0x012C /* Dword offset 4B */ -#define DST_CNTL 0x0130 /* Dword offset 4C */ - -#define SRC_OFF_PITCH 0x0180 /* Dword offset 60 */ -#define SRC_X 0x0184 /* Dword offset 61 */ -#define SRC_Y 0x0188 /* Dword offset 62 */ -#define SRC_Y_X 0x018C /* Dword offset 63 */ -#define SRC_WIDTH1 0x0190 /* Dword offset 64 */ -#define SRC_HEIGHT1 0x0194 /* Dword offset 65 */ -#define SRC_HEIGHT1_WIDTH1 0x0198 /* Dword offset 66 */ -#define SRC_X_START 0x019C /* Dword offset 67 */ -#define SRC_Y_START 0x01A0 /* Dword offset 68 */ -#define SRC_Y_X_START 0x01A4 /* Dword offset 69 */ -#define SRC_WIDTH2 0x01A8 /* Dword offset 6A */ -#define SRC_HEIGHT2 0x01AC /* Dword offset 6B */ -#define SRC_HEIGHT2_WIDTH2 0x01B0 /* Dword offset 6C */ -#define SRC_CNTL 0x01B4 /* Dword offset 6D */ - -#define HOST_DATA0 0x0200 /* Dword offset 80 */ -#define HOST_DATA1 0x0204 /* Dword offset 81 */ -#define HOST_DATA2 0x0208 /* Dword offset 82 */ -#define HOST_DATA3 0x020C /* Dword offset 83 */ -#define HOST_DATA4 0x0210 /* Dword offset 84 */ -#define HOST_DATA5 0x0214 /* Dword offset 85 */ -#define HOST_DATA6 0x0218 /* Dword offset 86 */ -#define HOST_DATA7 0x021C /* Dword offset 87 */ -#define HOST_DATA8 0x0220 /* Dword offset 88 */ -#define HOST_DATA9 0x0224 /* Dword offset 89 */ -#define HOST_DATAA 0x0228 /* Dword offset 8A */ -#define HOST_DATAB 0x022C /* Dword offset 8B */ -#define HOST_DATAC 0x0230 /* Dword offset 8C */ -#define HOST_DATAD 0x0234 /* Dword offset 8D */ -#define HOST_DATAE 0x0238 /* Dword offset 8E */ -#define HOST_DATAF 0x023C /* Dword offset 8F */ -#define HOST_CNTL 0x0240 /* Dword offset 90 */ - -#define PAT_REG0 0x0280 /* Dword offset A0 */ -#define PAT_REG1 0x0284 /* Dword offset A1 */ -#define PAT_CNTL 0x0288 /* Dword offset A2 */ - -#define SC_LEFT 0x02A0 /* Dword offset A8 */ -#define SC_RIGHT 0x02A4 /* Dword offset A9 */ -#define SC_LEFT_RIGHT 0x02A8 /* Dword offset AA */ -#define SC_TOP 0x02AC /* Dword offset AB */ -#define SC_BOTTOM 0x02B0 /* Dword offset AC */ -#define SC_TOP_BOTTOM 0x02B4 /* Dword offset AD */ - -#define DP_BKGD_CLR 0x02C0 /* Dword offset B0 */ -#define DP_FRGD_CLR 0x02C4 /* Dword offset B1 */ -#define DP_WRITE_MASK 0x02C8 /* Dword offset B2 */ -#define DP_CHAIN_MASK 0x02CC /* Dword offset B3 */ -#define DP_PIX_WIDTH 0x02D0 /* Dword offset B4 */ -#define DP_MIX 0x02D4 /* Dword offset B5 */ -#define DP_SRC 0x02D8 /* Dword offset B6 */ - -#define CLR_CMP_CLR 0x0300 /* Dword offset C0 */ -#define CLR_CMP_MASK 0x0304 /* Dword offset C1 */ -#define CLR_CMP_CNTL 0x0308 /* Dword offset C2 */ - -#define FIFO_STAT 0x0310 /* Dword offset C4 */ - -#define CONTEXT_MASK 0x0320 /* Dword offset C8 */ -#define CONTEXT_LOAD_CNTL 0x032C /* Dword offset CB */ - -#define GUI_TRAJ_CNTL 0x0330 /* Dword offset CC */ -#define GUI_STAT 0x0338 /* Dword offset CE */ - - -/* CRTC control values */ - -#define CRTC_HSYNC_NEG 0x00200000 -#define CRTC_VSYNC_NEG 0x00200000 - -#define CRTC_DBL_SCAN_EN 0x00000001 -#define CRTC_INTERLACE_EN 0x00000002 -#define CRTC_HSYNC_DIS 0x00000004 -#define CRTC_VSYNC_DIS 0x00000008 -#define CRTC_CSYNC_EN 0x00000010 -#define CRTC_PIX_BY_2_EN 0x00000020 -#define CRTC_DISPLAY_DIS 0x00000040 -#define CRTC_VGA_XOVERSCAN 0x00000080 - -#define CRTC_PIX_WIDTH 0x00000700 -#define CRTC_PIX_WIDTH_4BPP 0x00000100 -#define CRTC_PIX_WIDTH_8BPP 0x00000200 -#define CRTC_PIX_WIDTH_15BPP 0x00000300 -#define CRTC_PIX_WIDTH_16BPP 0x00000400 -#define CRTC_PIX_WIDTH_24BPP 0x00000500 -#define CRTC_PIX_WIDTH_32BPP 0x00000600 - -#define CRTC_BYTE_PIX_ORDER 0x00000800 -#define CRTC_PIX_ORDER_MSN_LSN 0x00000000 -#define CRTC_PIX_ORDER_LSN_MSN 0x00000800 - -#define CRTC_FIFO_LWM 0x000f0000 -#define CRTC_LOCK_REGS 0x00400000 -#define CRTC_EXT_DISP_EN 0x01000000 -#define CRTC_EN 0x02000000 -#define CRTC_DISP_REQ_EN 0x04000000 -#define CRTC_VGA_LINEAR 0x08000000 -#define CRTC_VSYNC_FALL_EDGE 0x10000000 -#define CRTC_VGA_TEXT_132 0x20000000 -#define CRTC_CNT_EN 0x40000000 -#define CRTC_CUR_B_TEST 0x80000000 - -#define CRTC_CRNT_VLINE 0x07f00000 -#define CRTC_VBLANK 0x00000001 - -/* DAC control values */ - -#define DAC_EXT_SEL_RS2 0x01 -#define DAC_EXT_SEL_RS3 0x02 -#define DAC_8BIT_EN 0x00000100 -#define DAC_PIX_DLY_MASK 0x00000600 -#define DAC_PIX_DLY_0NS 0x00000000 -#define DAC_PIX_DLY_2NS 0x00000200 -#define DAC_PIX_DLY_4NS 0x00000400 -#define DAC_BLANK_ADJ_MASK 0x00001800 -#define DAC_BLANK_ADJ_0 0x00000000 -#define DAC_BLANK_ADJ_1 0x00000800 -#define DAC_BLANK_ADJ_2 0x00001000 - - -/* Mix control values */ - -#define MIX_NOT_DST 0x0000 -#define MIX_0 0x0001 -#define MIX_1 0x0002 -#define MIX_DST 0x0003 -#define MIX_NOT_SRC 0x0004 -#define MIX_XOR 0x0005 -#define MIX_XNOR 0x0006 -#define MIX_SRC 0x0007 -#define MIX_NAND 0x0008 -#define MIX_NOT_SRC_OR_DST 0x0009 -#define MIX_SRC_OR_NOT_DST 0x000a -#define MIX_OR 0x000b -#define MIX_AND 0x000c -#define MIX_SRC_AND_NOT_DST 0x000d -#define MIX_NOT_SRC_AND_DST 0x000e -#define MIX_NOR 0x000f - -/* Maximum engine dimensions */ -#define ENGINE_MIN_X 0 -#define ENGINE_MIN_Y 0 -#define ENGINE_MAX_X 4095 -#define ENGINE_MAX_Y 16383 - -/* Mach64 engine bit constants - these are typically ORed together */ - -/* HW_DEBUG register constants */ -/* For RagePro only... */ -#define AUTO_FF_DIS 0x000001000 -#define AUTO_BLKWRT_DIS 0x000002000 - -/* BUS_CNTL register constants */ -#define BUS_FIFO_ERR_ACK 0x00200000 -#define BUS_HOST_ERR_ACK 0x00800000 -#define BUS_APER_REG_DIS 0x00000010 - -/* GEN_TEST_CNTL register constants */ -#define GEN_OVR_OUTPUT_EN 0x20 -#define HWCURSOR_ENABLE 0x80 -#define GUI_ENGINE_ENABLE 0x100 -#define BLOCK_WRITE_ENABLE 0x200 - -/* DSP_CONFIG register constants */ -#define DSP_XCLKS_PER_QW 0x00003fff -#define DSP_LOOP_LATENCY 0x000f0000 -#define DSP_PRECISION 0x00700000 - -/* DSP_ON_OFF register constants */ -#define DSP_OFF 0x000007ff -#define DSP_ON 0x07ff0000 - -/* SHARED_CNTL register constants */ -#define CTD_FIFO5 0x01000000 - -/* CLOCK_CNTL register constants */ -#define CLOCK_SEL 0x0f -#define CLOCK_DIV 0x30 -#define CLOCK_DIV1 0x00 -#define CLOCK_DIV2 0x10 -#define CLOCK_DIV4 0x20 -#define CLOCK_STROBE 0x40 -#define PLL_WR_EN 0x02 - -/* PLL registers */ -#define PLL_MACRO_CNTL 0x01 -#define PLL_REF_DIV 0x02 -#define PLL_GEN_CNTL 0x03 -#define MCLK_FB_DIV 0x04 -#define PLL_VCLK_CNTL 0x05 -#define VCLK_POST_DIV 0x06 -#define VCLK0_FB_DIV 0x07 -#define VCLK1_FB_DIV 0x08 -#define VCLK2_FB_DIV 0x09 -#define VCLK3_FB_DIV 0x0A -#define PLL_XCLK_CNTL 0x0B -#define PLL_TEST_CTRL 0x0E -#define PLL_TEST_COUNT 0x0F - -/* Memory types for CT, ET, VT, GT */ -#define DRAM 1 -#define EDO_DRAM 2 -#define PSEUDO_EDO 3 -#define SDRAM 4 -#define SGRAM 5 -#define SGRAM32 6 - -#define DAC_INTERNAL 0x00 -#define DAC_IBMRGB514 0x01 -#define DAC_ATI68875 0x02 -#define DAC_TVP3026_A 0x72 -#define DAC_BT476 0x03 -#define DAC_BT481 0x04 -#define DAC_ATT20C491 0x14 -#define DAC_SC15026 0x24 -#define DAC_MU9C1880 0x34 -#define DAC_IMSG174 0x44 -#define DAC_ATI68860_B 0x05 -#define DAC_ATI68860_C 0x15 -#define DAC_TVP3026_B 0x75 -#define DAC_STG1700 0x06 -#define DAC_ATT498 0x16 -#define DAC_STG1702 0x07 -#define DAC_SC15021 0x17 -#define DAC_ATT21C498 0x27 -#define DAC_STG1703 0x37 -#define DAC_CH8398 0x47 -#define DAC_ATT20C408 0x57 - -#define CLK_ATI18818_0 0 -#define CLK_ATI18818_1 1 -#define CLK_STG1703 2 -#define CLK_CH8398 3 -#define CLK_INTERNAL 4 -#define CLK_ATT20C408 5 -#define CLK_IBMRGB514 6 - -/* DST_CNTL register constants */ -#define DST_X_RIGHT_TO_LEFT 0 -#define DST_X_LEFT_TO_RIGHT 1 -#define DST_Y_BOTTOM_TO_TOP 0 -#define DST_Y_TOP_TO_BOTTOM 2 -#define DST_X_MAJOR 0 -#define DST_Y_MAJOR 4 -#define DST_X_TILE 8 -#define DST_Y_TILE 0x10 -#define DST_LAST_PEL 0x20 -#define DST_POLYGON_ENABLE 0x40 -#define DST_24_ROTATION_ENABLE 0x80 - -/* SRC_CNTL register constants */ -#define SRC_PATTERN_ENABLE 1 -#define SRC_ROTATION_ENABLE 2 -#define SRC_LINEAR_ENABLE 4 -#define SRC_BYTE_ALIGN 8 -#define SRC_LINE_X_RIGHT_TO_LEFT 0 -#define SRC_LINE_X_LEFT_TO_RIGHT 0x10 - -/* HOST_CNTL register constants */ -#define HOST_BYTE_ALIGN 1 - -/* DP_CHAIN_MASK register constants */ -#define DP_CHAIN_4BPP 0x8888 -#define DP_CHAIN_7BPP 0xD2D2 -#define DP_CHAIN_8BPP 0x8080 -#define DP_CHAIN_8BPP_RGB 0x9292 -#define DP_CHAIN_15BPP 0x4210 -#define DP_CHAIN_16BPP 0x8410 -#define DP_CHAIN_24BPP 0x8080 -#define DP_CHAIN_32BPP 0x8080 - -/* DP_PIX_WIDTH register constants */ -#define DST_1BPP 0 -#define DST_4BPP 1 -#define DST_8BPP 2 -#define DST_15BPP 3 -#define DST_16BPP 4 -#define DST_32BPP 6 -#define SRC_1BPP 0 -#define SRC_4BPP 0x100 -#define SRC_8BPP 0x200 -#define SRC_15BPP 0x300 -#define SRC_16BPP 0x400 -#define SRC_32BPP 0x600 -#define HOST_1BPP 0 -#define HOST_4BPP 0x10000 -#define HOST_8BPP 0x20000 -#define HOST_15BPP 0x30000 -#define HOST_16BPP 0x40000 -#define HOST_32BPP 0x60000 -#define BYTE_ORDER_MSB_TO_LSB 0 -#define BYTE_ORDER_LSB_TO_MSB 0x1000000 - -/* DP_SRC register constants */ -#define BKGD_SRC_BKGD_CLR 0 -#define BKGD_SRC_FRGD_CLR 1 -#define BKGD_SRC_HOST 2 -#define BKGD_SRC_BLIT 3 -#define BKGD_SRC_PATTERN 4 -#define FRGD_SRC_BKGD_CLR 0 -#define FRGD_SRC_FRGD_CLR 0x100 -#define FRGD_SRC_HOST 0x200 -#define FRGD_SRC_BLIT 0x300 -#define FRGD_SRC_PATTERN 0x400 -#define MONO_SRC_ONE 0 -#define MONO_SRC_PATTERN 0x10000 -#define MONO_SRC_HOST 0x20000 -#define MONO_SRC_BLIT 0x30000 - -/* PCI IDs */ -#define ATI_VENDOR 0x1002 -#define ATI_MACH64_CT 0x4354 /* Mach64 CT */ -#define ATI_RAGE_PRO_AGP 0x4742 /* 3D Rage Pro (AGP) */ -#define ATI_RAGE_PRO_AGP1X 0x4744 /* 3D Rage Pro (AGP 1x) */ -#define ATI_RAGE_PRO_PCI_B 0x4749 /* 3D Rage Pro Turbo */ -#define ATI_RAGE_XC_PCI66 0x474c /* Rage XC (PCI66) */ -#define ATI_RAGE_XL_AGP 0x474d /* Rage XL (AGP) */ -#define ATI_RAGE_XC_AGP 0x474e /* Rage XC (AGP) */ -#define ATI_RAGE_XL_PCI66 0x474f /* Rage XL (PCI66) */ -#define ATI_RAGE_PRO_PCI_P 0x4750 /* 3D Rage Pro */ -#define ATI_RAGE_PRO_PCI_L 0x4751 /* 3D Rage Pro (limited 3D) */ -#define ATI_RAGE_XL_PCI 0x4752 /* Rage XL */ -#define ATI_RAGE_XC_PCI 0x4753 /* Rage XC */ -#define ATI_RAGE_II 0x4754 /* 3D Rage I/II */ -#define ATI_RAGE_IIP 0x4755 /* 3D Rage II+ */ -#define ATI_RAGE_IIC_PCI 0x4756 /* 3D Rage IIC */ -#define ATI_RAGE_IIC_AGP_B 0x4757 /* 3D Rage IIC (AGP) */ -#define ATI_RAGE_IIC_AGP_P 0x475a /* 3D Rage IIC (AGP) */ -#define ATI_RAGE_LT_PRO_AGP 0x4c42 /* 3D Rage LT Pro (AGP 133MHz) */ -#define ATI_RAGE_MOB_M3_PCI 0x4c45 /* Rage Mobility M3 */ -#define ATI_RAGE_MOB_M3_AGP 0x4c46 /* Rage Mobility M3 (AGP) */ -#define ATI_RAGE_LT 0x4c47 /* 3D Rage LT */ -#define ATI_RAGE_LT_PRO_PCI 0x4c49 /* 3D Rage LT Pro */ -#define ATI_RAGE_MOBILITY 0x4c4d /* Rage Mobility */ -#define ATI_RAGE_L_MOBILITY 0x4c4e /* Rage L Mobility */ -#define ATI_RAGE_LT_PRO 0x4c50 /* 3D Rage LT Pro */ -#define ATI_RAGE_LT_PRO2 0x4c51 /* 3D Rage LT Pro */ -#define ATI_RAGE_MOB_M1_PCI 0x4c52 /* Rage Mobility M1 (PCI) */ -#define ATI_RAGE_L_MOB_M1_PCI 0x4c53 /* Rage L Mobility (PCI) */ -#define ATI_MACH64_VT 0x5654 /* Mach64 VT */ -#define ATI_MACH64_VTB 0x5655 /* Mach64 VTB */ -#define ATI_MACH64_VT4 0x5656 /* Mach64 VT4 */ - -#endif /* !_DEV_FB_MACHFB_H_ */ diff --git a/sys/dev/firewire/sbp.c b/sys/dev/firewire/sbp.c index 9daa9f00166147..38e44193cf5803 100644 --- a/sys/dev/firewire/sbp.c +++ b/sys/dev/firewire/sbp.c @@ -134,11 +134,7 @@ SYSCTL_INT(_hw_firewire_sbp, OID_AUTO, tags, CTLFLAG_RWTUN, &sbp_tags, 0, #define NEED_RESPONSE 0 #define SBP_SEG_MAX rounddown(0xffff, PAGE_SIZE) -#ifdef __sparc64__ /* iommu */ -#define SBP_IND_MAX howmany(SBP_MAXPHYS, SBP_SEG_MAX) -#else #define SBP_IND_MAX howmany(SBP_MAXPHYS, PAGE_SIZE) -#endif struct sbp_ocb { STAILQ_ENTRY(sbp_ocb) ocb; union ccb *ccb; diff --git a/sys/dev/gem/if_gem_pci.c b/sys/dev/gem/if_gem_pci.c index ce3027fb3441ab..1b20d9352a712c 100644 --- a/sys/dev/gem/if_gem_pci.c +++ b/sys/dev/gem/if_gem_pci.c @@ -53,7 +53,7 @@ __FBSDID("$FreeBSD$"); #include #include -#if defined(__powerpc__) || defined(__sparc64__) +#if defined(__powerpc__) #include #include #include @@ -149,7 +149,7 @@ gem_pci_attach(device_t dev) { struct gem_softc *sc; int i; -#if defined(__powerpc__) || defined(__sparc64__) +#if defined(__powerpc__) char buf[sizeof(GEM_SHARED_PINS)]; #else int j; @@ -215,7 +215,7 @@ gem_pci_attach(device_t dev) GEM_PCI_BIF_CNF_M66EN) != 0) sc->sc_flags |= GEM_PCI66; -#if defined(__powerpc__) || defined(__sparc64__) +#if defined(__powerpc__) OF_getetheraddr(dev, sc->sc_enaddr); if (OF_getprop(ofw_bus_get_node(dev), GEM_SHARED_PINS, buf, sizeof(buf)) > 0) { diff --git a/sys/dev/gem/if_gem_sbus.c b/sys/dev/gem/if_gem_sbus.c deleted file mode 100644 index 59f79e2167814c..00000000000000 --- a/sys/dev/gem/if_gem_sbus.c +++ /dev/null @@ -1,210 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-NetBSD - * - * Copyright (C) 2001 Eduardo Horvath. - * Copyright (c) 2007 Marius Strobl - * All rights reserved. - * - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: NetBSD: if_gem_pci.c,v 1.7 2001/10/18 15:09:15 thorpej Exp - */ - -#include -__FBSDID("$FreeBSD$"); - -/* - * SBus bindings for Sun GEM Ethernet controllers - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include - -#include -#include -#include - -#include - -#include -#include - -#include "miibus_if.h" - -static device_probe_t gem_sbus_probe; -static device_attach_t gem_sbus_attach; -static device_detach_t gem_sbus_detach; -static device_suspend_t gem_sbus_suspend; -static device_resume_t gem_sbus_resume; - -static device_method_t gem_sbus_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, gem_sbus_probe), - DEVMETHOD(device_attach, gem_sbus_attach), - DEVMETHOD(device_detach, gem_sbus_detach), - DEVMETHOD(device_suspend, gem_sbus_suspend), - DEVMETHOD(device_resume, gem_sbus_resume), - /* Use the suspend handler here, it is all that is required. */ - DEVMETHOD(device_shutdown, gem_sbus_suspend), - - /* MII interface */ - DEVMETHOD(miibus_readreg, gem_mii_readreg), - DEVMETHOD(miibus_writereg, gem_mii_writereg), - DEVMETHOD(miibus_statchg, gem_mii_statchg), - - DEVMETHOD_END -}; - -static driver_t gem_sbus_driver = { - "gem", - gem_sbus_methods, - sizeof(struct gem_softc) -}; - -DRIVER_MODULE(gem, sbus, gem_sbus_driver, gem_devclass, 0, 0); -MODULE_DEPEND(gem, sbus, 1, 1, 1); -MODULE_DEPEND(gem, ether, 1, 1, 1); - -static int -gem_sbus_probe(device_t dev) -{ - - if (strcmp(ofw_bus_get_name(dev), "network") == 0 && - ofw_bus_get_compat(dev) != NULL && - strcmp(ofw_bus_get_compat(dev), "SUNW,sbus-gem") == 0) { - device_set_desc(dev, "Sun GEM Gigabit Ethernet"); - return (0); - } - - return (ENXIO); -} - -static struct resource_spec gem_sbus_res_spec[] = { - { SYS_RES_IRQ, 0, RF_SHAREABLE | RF_ACTIVE }, /* GEM_RES_INTR */ - { SYS_RES_MEMORY, 1, RF_ACTIVE }, /* GEM_RES_BANK1 */ - { SYS_RES_MEMORY, 0, RF_ACTIVE }, /* GEM_RES_BANK2 */ - { -1, 0 } -}; - -static int -gem_sbus_attach(device_t dev) -{ - struct gem_softc *sc; - int burst; - uint32_t val; - - sc = device_get_softc(dev); - sc->sc_variant = GEM_SUN_GEM; - sc->sc_dev = dev; - /* All known SBus models use a SERDES. */ - sc->sc_flags = GEM_SERDES; - - if (bus_alloc_resources(dev, gem_sbus_res_spec, sc->sc_res)) { - device_printf(dev, "failed to allocate resources\n"); - bus_release_resources(dev, gem_sbus_res_spec, sc->sc_res); - return (ENXIO); - } - - GEM_LOCK_INIT(sc, device_get_nameunit(dev)); - - OF_getetheraddr(dev, sc->sc_enaddr); - - burst = sbus_get_burstsz(dev); - val = GEM_SBUS_CFG_PARITY; - if ((burst & SBUS_BURST64_MASK) != 0) { - val |= GEM_SBUS_CFG_64BIT; - burst >>= SBUS_BURST64_SHIFT; - } - if ((burst & SBUS_BURST_64) != 0) - val |= GEM_SBUS_CFG_BURST_64; - else if ((burst & SBUS_BURST_32) != 0) - val |= GEM_SBUS_CFG_BURST_32; - else { - device_printf(dev, "unsupported burst size\n"); - goto fail; - } - /* Reset the SBus interface only. */ - (void)GEM_BANK2_READ_4(sc, GEM_SBUS_BIF_RESET); - DELAY(100); - GEM_BANK2_WRITE_4(sc, GEM_SBUS_CONFIG, val); - - if (gem_attach(sc) != 0) { - device_printf(dev, "could not be attached\n"); - goto fail; - } - - if (bus_setup_intr(dev, sc->sc_res[GEM_RES_INTR], INTR_TYPE_NET | - INTR_MPSAFE, NULL, gem_intr, sc, &sc->sc_ih) != 0) { - device_printf(dev, "failed to set up interrupt\n"); - gem_detach(sc); - goto fail; - } - return (0); - - fail: - GEM_LOCK_DESTROY(sc); - bus_release_resources(dev, gem_sbus_res_spec, sc->sc_res); - return (ENXIO); -} - -static int -gem_sbus_detach(device_t dev) -{ - struct gem_softc *sc; - - sc = device_get_softc(dev); - bus_teardown_intr(dev, sc->sc_res[GEM_RES_INTR], sc->sc_ih); - gem_detach(sc); - GEM_LOCK_DESTROY(sc); - bus_release_resources(dev, gem_sbus_res_spec, sc->sc_res); - return (0); -} - -static int -gem_sbus_suspend(device_t dev) -{ - - gem_suspend(device_get_softc(dev)); - return (0); -} - -static int -gem_sbus_resume(device_t dev) -{ - - gem_resume(device_get_softc(dev)); - return (0); -} diff --git a/sys/dev/hme/if_hme_pci.c b/sys/dev/hme/if_hme_pci.c index a7ba6f24fdbc98..35cf3f7f90de99 100644 --- a/sys/dev/hme/if_hme_pci.c +++ b/sys/dev/hme/if_hme_pci.c @@ -50,7 +50,7 @@ __FBSDID("$FreeBSD$"); #include #include -#if defined(__powerpc__) || defined(__sparc64__) +#if defined(__powerpc__) #include #include #endif @@ -140,7 +140,7 @@ hme_pci_attach(device_t dev) bus_space_tag_t memt; bus_space_handle_t memh; int i, error = 0; -#if !(defined(__powerpc__) || defined(__sparc64__)) +#if !defined(__powerpc__) device_t *children, ebus_dev; struct resource *ebus_rres; int j, slot; @@ -197,7 +197,7 @@ hme_pci_attach(device_t dev) bus_space_subregion(memt, memh, 0x6000, 0x1000, &sc->sc_mach); bus_space_subregion(memt, memh, 0x7000, 0x1000, &sc->sc_mifh); -#if defined(__powerpc__) || defined(__sparc64__) +#if defined(__powerpc__) OF_getetheraddr(dev, sc->sc_enaddr); #else /* diff --git a/sys/dev/hme/if_hme_sbus.c b/sys/dev/hme/if_hme_sbus.c deleted file mode 100644 index 0ea789adac71e1..00000000000000 --- a/sys/dev/hme/if_hme_sbus.c +++ /dev/null @@ -1,338 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 1999 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Paul Kranenburg. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * from: NetBSD: if_hme_sbus.c,v 1.19 2004/03/17 17:04:58 pk Exp - */ - -#include -__FBSDID("$FreeBSD$"); - -/* - * SBus front-end device driver for the HME ethernet device. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include -#include - -#include - -#include -#include -#include - -#include -#include - -#include - -#include -#include - -#include "miibus_if.h" - -struct hme_sbus_softc { - struct hme_softc hsc_hme; /* HME device */ - struct resource *hsc_seb_res; - struct resource *hsc_etx_res; - struct resource *hsc_erx_res; - struct resource *hsc_mac_res; - struct resource *hsc_mif_res; - struct resource *hsc_ires; - void *hsc_ih; -}; - -static int hme_sbus_probe(device_t); -static int hme_sbus_attach(device_t); -static int hme_sbus_detach(device_t); -static int hme_sbus_suspend(device_t); -static int hme_sbus_resume(device_t); - -static device_method_t hme_sbus_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, hme_sbus_probe), - DEVMETHOD(device_attach, hme_sbus_attach), - DEVMETHOD(device_detach, hme_sbus_detach), - DEVMETHOD(device_suspend, hme_sbus_suspend), - DEVMETHOD(device_resume, hme_sbus_resume), - /* Can just use the suspend method here. */ - DEVMETHOD(device_shutdown, hme_sbus_suspend), - - /* MII interface */ - DEVMETHOD(miibus_readreg, hme_mii_readreg), - DEVMETHOD(miibus_writereg, hme_mii_writereg), - DEVMETHOD(miibus_statchg, hme_mii_statchg), - - DEVMETHOD_END -}; - -static driver_t hme_sbus_driver = { - "hme", - hme_sbus_methods, - sizeof(struct hme_sbus_softc) -}; - -DRIVER_MODULE(hme, sbus, hme_sbus_driver, hme_devclass, 0, 0); -MODULE_DEPEND(hme, sbus, 1, 1, 1); -MODULE_DEPEND(hme, ether, 1, 1, 1); - -static int -hme_sbus_probe(device_t dev) -{ - const char *name; - - name = ofw_bus_get_name(dev); - if (strcmp(name, "SUNW,qfe") == 0 || - strcmp(name, "SUNW,hme") == 0) { - device_set_desc(dev, "Sun HME 10/100 Ethernet"); - return (0); - } - return (ENXIO); -} - -static int -hme_sbus_attach(device_t dev) -{ - struct hme_sbus_softc *hsc; - struct hme_softc *sc; - u_long start, count; - uint32_t burst; - int i, error = 0; - - hsc = device_get_softc(dev); - sc = &hsc->hsc_hme; - mtx_init(&sc->sc_lock, device_get_nameunit(dev), MTX_NETWORK_LOCK, - MTX_DEF); - /* - * Map five register banks: - * - * bank 0: HME SEB registers - * bank 1: HME ETX registers - * bank 2: HME ERX registers - * bank 3: HME MAC registers - * bank 4: HME MIF registers - * - */ - i = 0; - hsc->hsc_seb_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, - &i, RF_ACTIVE); - if (hsc->hsc_seb_res == NULL) { - device_printf(dev, "cannot map SEB registers\n"); - error = ENXIO; - goto fail_mtx_res; - } - sc->sc_sebt = rman_get_bustag(hsc->hsc_seb_res); - sc->sc_sebh = rman_get_bushandle(hsc->hsc_seb_res); - - i = 1; - hsc->hsc_etx_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, - &i, RF_ACTIVE); - if (hsc->hsc_etx_res == NULL) { - device_printf(dev, "cannot map ETX registers\n"); - error = ENXIO; - goto fail_seb_res; - } - sc->sc_etxt = rman_get_bustag(hsc->hsc_etx_res); - sc->sc_etxh = rman_get_bushandle(hsc->hsc_etx_res); - - i = 2; - hsc->hsc_erx_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, - &i, RF_ACTIVE); - if (hsc->hsc_erx_res == NULL) { - device_printf(dev, "cannot map ERX registers\n"); - error = ENXIO; - goto fail_etx_res; - } - sc->sc_erxt = rman_get_bustag(hsc->hsc_erx_res); - sc->sc_erxh = rman_get_bushandle(hsc->hsc_erx_res); - - i = 3; - hsc->hsc_mac_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, - &i, RF_ACTIVE); - if (hsc->hsc_mac_res == NULL) { - device_printf(dev, "cannot map MAC registers\n"); - error = ENXIO; - goto fail_erx_res; - } - sc->sc_mact = rman_get_bustag(hsc->hsc_mac_res); - sc->sc_mach = rman_get_bushandle(hsc->hsc_mac_res); - - /* - * At least on some HMEs, the MIF registers seem to be inside the MAC - * range, so try to kludge around it. - */ - i = 4; - hsc->hsc_mif_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, - &i, RF_ACTIVE); - if (hsc->hsc_mif_res == NULL) { - if (bus_get_resource(dev, SYS_RES_MEMORY, i, - &start, &count) != 0) { - device_printf(dev, "cannot get MIF registers\n"); - error = ENXIO; - goto fail_mac_res; - } - if (start < rman_get_start(hsc->hsc_mac_res) || - start + count - 1 > rman_get_end(hsc->hsc_mac_res)) { - device_printf(dev, "cannot move MIF registers to MAC " - "bank\n"); - error = ENXIO; - goto fail_mac_res; - } - sc->sc_mift = sc->sc_mact; - bus_space_subregion(sc->sc_mact, sc->sc_mach, - start - rman_get_start(hsc->hsc_mac_res), count, - &sc->sc_mifh); - } else { - sc->sc_mift = rman_get_bustag(hsc->hsc_mif_res); - sc->sc_mifh = rman_get_bushandle(hsc->hsc_mif_res); - } - - i = 0; - hsc->hsc_ires = bus_alloc_resource_any(dev, SYS_RES_IRQ, - &i, RF_SHAREABLE | RF_ACTIVE); - if (hsc->hsc_ires == NULL) { - device_printf(dev, "could not allocate interrupt\n"); - error = ENXIO; - goto fail_mif_res; - } - - OF_getetheraddr(dev, sc->sc_enaddr); - - burst = sbus_get_burstsz(dev); - /* Translate into plain numerical format */ - if ((burst & SBUS_BURST_64)) - sc->sc_burst = 64; - else if ((burst & SBUS_BURST_32)) - sc->sc_burst = 32; - else if ((burst & SBUS_BURST_16)) - sc->sc_burst = 16; - else - sc->sc_burst = 0; - - sc->sc_dev = dev; - sc->sc_flags = 0; - - if ((error = hme_config(sc)) != 0) { - device_printf(dev, "could not be configured\n"); - goto fail_ires; - } - - if ((error = bus_setup_intr(dev, hsc->hsc_ires, INTR_TYPE_NET | - INTR_MPSAFE, NULL, hme_intr, sc, &hsc->hsc_ih)) != 0) { - device_printf(dev, "couldn't establish interrupt\n"); - hme_detach(sc); - goto fail_ires; - } - return (0); - -fail_ires: - bus_release_resource(dev, SYS_RES_IRQ, - rman_get_rid(hsc->hsc_ires), hsc->hsc_ires); -fail_mif_res: - if (hsc->hsc_mif_res != NULL) { - bus_release_resource(dev, SYS_RES_MEMORY, - rman_get_rid(hsc->hsc_mif_res), hsc->hsc_mif_res); - } -fail_mac_res: - bus_release_resource(dev, SYS_RES_MEMORY, - rman_get_rid(hsc->hsc_mac_res), hsc->hsc_mac_res); -fail_erx_res: - bus_release_resource(dev, SYS_RES_MEMORY, - rman_get_rid(hsc->hsc_erx_res), hsc->hsc_erx_res); -fail_etx_res: - bus_release_resource(dev, SYS_RES_MEMORY, - rman_get_rid(hsc->hsc_etx_res), hsc->hsc_etx_res); -fail_seb_res: - bus_release_resource(dev, SYS_RES_MEMORY, - rman_get_rid(hsc->hsc_seb_res), hsc->hsc_seb_res); -fail_mtx_res: - mtx_destroy(&sc->sc_lock); - return (error); -} - -static int -hme_sbus_detach(device_t dev) -{ - struct hme_sbus_softc *hsc; - struct hme_softc *sc; - - hsc = device_get_softc(dev); - sc = &hsc->hsc_hme; - bus_teardown_intr(dev, hsc->hsc_ires, hsc->hsc_ih); - hme_detach(sc); - bus_release_resource(dev, SYS_RES_IRQ, - rman_get_rid(hsc->hsc_ires), hsc->hsc_ires); - if (hsc->hsc_mif_res != NULL) { - bus_release_resource(dev, SYS_RES_MEMORY, - rman_get_rid(hsc->hsc_mif_res), hsc->hsc_mif_res); - } - bus_release_resource(dev, SYS_RES_MEMORY, - rman_get_rid(hsc->hsc_mac_res), hsc->hsc_mac_res); - bus_release_resource(dev, SYS_RES_MEMORY, - rman_get_rid(hsc->hsc_erx_res), hsc->hsc_erx_res); - bus_release_resource(dev, SYS_RES_MEMORY, - rman_get_rid(hsc->hsc_etx_res), hsc->hsc_etx_res); - bus_release_resource(dev, SYS_RES_MEMORY, - rman_get_rid(hsc->hsc_seb_res), hsc->hsc_seb_res); - mtx_destroy(&sc->sc_lock); - return (0); -} - -static int -hme_sbus_suspend(device_t dev) -{ - struct hme_sbus_softc *hsc; - - hsc = device_get_softc(dev); - hme_suspend(&hsc->hsc_hme); - return (0); -} - -static int -hme_sbus_resume(device_t dev) -{ - struct hme_sbus_softc *hsc; - - hsc = device_get_softc(dev); - hme_resume(&hsc->hsc_hme); - return (0); -} diff --git a/sys/dev/hwpmc/hwpmc_sparc64.c b/sys/dev/hwpmc/hwpmc_sparc64.c deleted file mode 100644 index 3ded908e252917..00000000000000 --- a/sys/dev/hwpmc/hwpmc_sparc64.c +++ /dev/null @@ -1,68 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2005, Joseph Koshy - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include - -#include - -struct pmc_mdep * -pmc_md_initialize() -{ - return NULL; -} - -void -pmc_md_finalize(struct pmc_mdep *md) -{ - (void) md; -} - -int -pmc_save_kernel_callchain(uintptr_t *cc, int maxsamples, - struct trapframe *tf) -{ - (void) cc; - (void) maxsamples; - (void) tf; - return (0); -} - -int -pmc_save_user_callchain(uintptr_t *cc, int maxsamples, - struct trapframe *tf) -{ - (void) cc; - (void) maxsamples; - (void) tf; - return (0); -} diff --git a/sys/dev/isp/isp_freebsd.h b/sys/dev/isp/isp_freebsd.h index 6bd2a71b5f0fd6..971fc0b05d8453 100644 --- a/sys/dev/isp/isp_freebsd.h +++ b/sys/dev/isp/isp_freebsd.h @@ -71,11 +71,7 @@ /* * Efficiency- get rid of SBus code && tests unless we need them. */ -#ifdef __sparc64__ -#define ISP_SBUS_SUPPORTED 1 -#else #define ISP_SBUS_SUPPORTED 0 -#endif #define ISP_IFLAGS INTR_TYPE_CAM | INTR_ENTROPY | INTR_MPSAFE diff --git a/sys/dev/isp/isp_pci.c b/sys/dev/isp/isp_pci.c index 42415f5091b2b3..6cd7fa7ebd0aca 100644 --- a/sys/dev/isp/isp_pci.c +++ b/sys/dev/isp/isp_pci.c @@ -48,12 +48,6 @@ __FBSDID("$FreeBSD$"); #include #include #include - -#ifdef __sparc64__ -#include -#include -#endif - #include static uint32_t isp_pci_rd_reg(ispsoftc_t *, int); @@ -493,11 +487,7 @@ isp_get_specific_options(device_t dev, int chan, ispsoftc_t *isp) if (IS_FC(isp)) { ISP_FC_PC(isp, chan)->default_id = 109 - chan; } else { -#ifdef __sparc64__ - ISP_SPI_PC(isp, chan)->iid = OF_getscsinitid(dev); -#else ISP_SPI_PC(isp, chan)->iid = 7; -#endif } } else { if (IS_FC(isp)) { diff --git a/sys/dev/isp/isp_sbus.c b/sys/dev/isp/isp_sbus.c deleted file mode 100644 index 35e3e220b276cf..00000000000000 --- a/sys/dev/isp/isp_sbus.c +++ /dev/null @@ -1,701 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 1997-2006 by Matthew Jacob - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice immediately at the beginning of the file, without modification, - * this list of conditions, and the following disclaimer. - * 2. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ -/* - * SBus specific probe and attach routines for Qlogic ISP SCSI adapters. - * FreeBSD Version. - */ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include -#include - -#include - -static uint32_t isp_sbus_rd_reg(ispsoftc_t *, int); -static void isp_sbus_wr_reg(ispsoftc_t *, int, uint32_t); -static void isp_sbus_run_isr(ispsoftc_t *); -static int isp_sbus_mbxdma(ispsoftc_t *); -static void isp_sbus_mbxdmafree(ispsoftc_t *); -static int isp_sbus_dmasetup(ispsoftc_t *, XS_T *, void *); -static void isp_sbus_dumpregs(ispsoftc_t *, const char *); - -static struct ispmdvec mdvec = { - isp_sbus_run_isr, - isp_sbus_rd_reg, - isp_sbus_wr_reg, - isp_sbus_mbxdma, - isp_sbus_dmasetup, - isp_common_dmateardown, - NULL, - isp_sbus_dumpregs, - NULL, - BIU_BURST_ENABLE|BIU_PCI_CONF1_FIFO_64 -}; - -static int isp_sbus_probe (device_t); -static int isp_sbus_attach (device_t); -static int isp_sbus_detach (device_t); - - -#define ISP_SBD(isp) ((struct isp_sbussoftc *)isp)->sbus_dev -struct isp_sbussoftc { - ispsoftc_t sbus_isp; - device_t sbus_dev; - struct resource * regs; - void * irq; - int iqd; - int rgd; - void * ih; - int16_t sbus_poff[_NREG_BLKS]; - sdparam sbus_param; - struct isp_spi sbus_spi; - struct ispmdvec sbus_mdvec; -}; - - -static device_method_t isp_sbus_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, isp_sbus_probe), - DEVMETHOD(device_attach, isp_sbus_attach), - DEVMETHOD(device_detach, isp_sbus_detach), - { 0, 0 } -}; - -static driver_t isp_sbus_driver = { - "isp", isp_sbus_methods, sizeof (struct isp_sbussoftc) -}; -static devclass_t isp_devclass; -DRIVER_MODULE(isp, sbus, isp_sbus_driver, isp_devclass, 0, 0); -MODULE_DEPEND(isp, cam, 1, 1, 1); -MODULE_DEPEND(isp, firmware, 1, 1, 1); - -static int -isp_sbus_probe(device_t dev) -{ - int found = 0; - const char *name = ofw_bus_get_name(dev); - if (strcmp(name, "SUNW,isp") == 0 || - strcmp(name, "QLGC,isp") == 0 || - strcmp(name, "ptisp") == 0 || - strcmp(name, "PTI,ptisp") == 0) { - found++; - } - if (!found) - return (ENXIO); - - if (isp_announced == 0 && bootverbose) { - printf("Qlogic ISP Driver, FreeBSD Version %d.%d, " - "Core Version %d.%d\n", - ISP_PLATFORM_VERSION_MAJOR, ISP_PLATFORM_VERSION_MINOR, - ISP_CORE_VERSION_MAJOR, ISP_CORE_VERSION_MINOR); - isp_announced++; - } - return (0); -} - -static int -isp_sbus_attach(device_t dev) -{ - struct isp_sbussoftc *sbs = device_get_softc(dev); - ispsoftc_t *isp = &sbs->sbus_isp; - int tval, isp_debug, role, ispburst, default_id; - - sbs->sbus_dev = dev; - sbs->sbus_mdvec = mdvec; - isp->isp_dev = dev; - mtx_init(&isp->isp_lock, "isp", NULL, MTX_DEF); - - role = 0; - if (resource_int_value(device_get_name(dev), device_get_unit(dev), - "role", &role) == 0 && - ((role & ~(ISP_ROLE_INITIATOR|ISP_ROLE_TARGET)) == 0)) { - device_printf(dev, "setting role to 0x%x\n", role); - } else { - role = ISP_DEFAULT_ROLES; - } - - sbs->irq = sbs->regs = NULL; - sbs->rgd = sbs->iqd = 0; - - sbs->regs = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &sbs->rgd, - RF_ACTIVE); - if (sbs->regs == NULL) { - device_printf(dev, "unable to map registers\n"); - goto bad; - } - - sbs->sbus_poff[BIU_BLOCK >> _BLK_REG_SHFT] = BIU_REGS_OFF; - sbs->sbus_poff[MBOX_BLOCK >> _BLK_REG_SHFT] = SBUS_MBOX_REGS_OFF; - sbs->sbus_poff[SXP_BLOCK >> _BLK_REG_SHFT] = SBUS_SXP_REGS_OFF; - sbs->sbus_poff[RISC_BLOCK >> _BLK_REG_SHFT] = SBUS_RISC_REGS_OFF; - sbs->sbus_poff[DMA_BLOCK >> _BLK_REG_SHFT] = DMA_REGS_OFF; - isp->isp_regs = sbs->regs; - isp->isp_mdvec = &sbs->sbus_mdvec; - isp->isp_bustype = ISP_BT_SBUS; - isp->isp_type = ISP_HA_SCSI_UNKNOWN; - isp->isp_param = &sbs->sbus_param; - isp->isp_osinfo.pc.ptr = &sbs->sbus_spi; - isp->isp_revision = 0; /* XXX */ - isp->isp_nchan = 1; - if (IS_FC(isp)) - ISP_FC_PC(isp, 0)->def_role = role; - - /* - * Get the clock frequency and convert it from HZ to MHz, - * rounding up. This defaults to 25MHz if there isn't a - * device specific one in the OFW device tree. - */ - sbs->sbus_mdvec.dv_clock = (sbus_get_clockfreq(dev) + 500000)/1000000; - - /* - * Now figure out what the proper burst sizes, etc., to use. - * Unfortunately, there is no ddi_dma_burstsizes here which - * walks up the tree finding the limiting burst size node (if - * any). We just use what's here for isp. - */ - ispburst = sbus_get_burstsz(dev); - if (ispburst == 0) { - ispburst = SBUS_BURST_32 - 1; - } - sbs->sbus_mdvec.dv_conf1 = 0; - if (ispburst & (1 << 5)) { - sbs->sbus_mdvec.dv_conf1 = BIU_SBUS_CONF1_FIFO_32; - } else if (ispburst & (1 << 4)) { - sbs->sbus_mdvec.dv_conf1 = BIU_SBUS_CONF1_FIFO_16; - } else if (ispburst & (1 << 3)) { - sbs->sbus_mdvec.dv_conf1 = - BIU_SBUS_CONF1_BURST8 | BIU_SBUS_CONF1_FIFO_8; - } - if (sbs->sbus_mdvec.dv_conf1) { - sbs->sbus_mdvec.dv_conf1 |= BIU_BURST_ENABLE; - } - - /* - * We don't trust NVRAM on SBus cards - */ - isp->isp_confopts |= ISP_CFG_NONVRAM; - - /* - * Mark things if we're a PTI SBus adapter. - */ - if (strcmp("PTI,ptisp", ofw_bus_get_name(dev)) == 0 || - strcmp("ptisp", ofw_bus_get_name(dev)) == 0) { - SDPARAM(isp, 0)->isp_ptisp = 1; - } - - isp->isp_osinfo.fw = firmware_get("isp_1000"); - if (isp->isp_osinfo.fw) { - union { - const void *cp; - uint16_t *sp; - } stupid; - stupid.cp = isp->isp_osinfo.fw->data; - isp->isp_mdvec->dv_ispfw = stupid.sp; - } - - tval = 0; - if (resource_int_value(device_get_name(dev), device_get_unit(dev), - "fwload_disable", &tval) == 0 && tval != 0) { - isp->isp_confopts |= ISP_CFG_NORELOAD; - } - - default_id = -1; - if (resource_int_value(device_get_name(dev), device_get_unit(dev), - "iid", &tval) == 0) { - default_id = tval; - isp->isp_confopts |= ISP_CFG_OWNLOOPID; - } - if (default_id == -1) { - default_id = OF_getscsinitid(dev); - } - ISP_SPI_PC(isp, 0)->iid = default_id; - - isp_debug = 0; - (void) resource_int_value(device_get_name(dev), device_get_unit(dev), - "debug", &isp_debug); - - sbs->irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &sbs->iqd, - RF_ACTIVE | RF_SHAREABLE); - if (sbs->irq == NULL) { - device_printf(dev, "could not allocate interrupt\n"); - goto bad; - } - - if (bus_setup_intr(dev, sbs->irq, ISP_IFLAGS, NULL, isp_platform_intr, - isp, &sbs->ih)) { - device_printf(dev, "could not setup interrupt\n"); - (void) bus_release_resource(dev, SYS_RES_IRQ, - sbs->iqd, sbs->irq); - goto bad; - } - isp->isp_nirq = 1; - - /* - * Set up logging levels. - */ - if (isp_debug) { - isp->isp_dblev = isp_debug; - } else { - isp->isp_dblev = ISP_LOGWARN|ISP_LOGERR; - } - if (bootverbose) { - isp->isp_dblev |= ISP_LOGCONFIG|ISP_LOGINFO; - } - - /* - * Make sure we're in reset state. - */ - ISP_LOCK(isp); - if (isp_reinit(isp, 1) != 0) { - ISP_UNLOCK(isp); - goto bad; - } - ISP_UNLOCK(isp); - if (isp_attach(isp)) { - ISP_LOCK(isp); - isp_shutdown(isp); - ISP_UNLOCK(isp); - goto bad; - } - return (0); - -bad: - if (isp->isp_nirq > 0) { - (void) bus_teardown_intr(dev, sbs->irq, sbs->ih); - (void) bus_release_resource(dev, SYS_RES_IRQ, sbs->iqd, - sbs->irq); - } - - if (sbs->regs) { - (void) bus_release_resource(dev, SYS_RES_MEMORY, sbs->rgd, - sbs->regs); - } - mtx_destroy(&isp->isp_lock); - return (ENXIO); -} - -static int -isp_sbus_detach(device_t dev) -{ - struct isp_sbussoftc *sbs = device_get_softc(dev); - ispsoftc_t *isp = &sbs->sbus_isp; - int status; - - status = isp_detach(isp); - if (status) - return (status); - ISP_LOCK(isp); - isp_shutdown(isp); - ISP_UNLOCK(isp); - if (isp->isp_nirq > 0) { - (void) bus_teardown_intr(dev, sbs->irq, sbs->ih); - (void) bus_release_resource(dev, SYS_RES_IRQ, sbs->iqd, - sbs->irq); - } - (void) bus_release_resource(dev, SYS_RES_MEMORY, sbs->rgd, sbs->regs); - isp_sbus_mbxdmafree(isp); - mtx_destroy(&isp->isp_lock); - return (0); -} - -#define IspVirt2Off(a, x) \ - (((struct isp_sbussoftc *)a)->sbus_poff[((x) & _BLK_REG_MASK) >> \ - _BLK_REG_SHFT] + ((x) & 0xff)) - -#define BXR2(isp, off) bus_read_2((isp)->isp_regs, (off)) - -static void -isp_sbus_run_isr(ispsoftc_t *isp) -{ - uint16_t isr, sema, info; - - isr = BXR2(isp, IspVirt2Off(isp, BIU_ISR)); - sema = BXR2(isp, IspVirt2Off(isp, BIU_SEMA)); - isp_prt(isp, ISP_LOGDEBUG3, "ISR 0x%x SEMA 0x%x", isr, sema); - isr &= INT_PENDING_MASK(isp); - sema &= BIU_SEMA_LOCK; - if (isr == 0 && sema == 0) - return; - if (sema != 0) { - info = BXR2(isp, IspVirt2Off(isp, OUTMAILBOX0)); - if (info & MBOX_COMMAND_COMPLETE) - isp_intr_mbox(isp, info); - else - isp_intr_async(isp, info); - if (isp->isp_state == ISP_RUNSTATE) - isp_intr_respq(isp); - } else - isp_intr_respq(isp); - ISP_WRITE(isp, HCCR, HCCR_CMD_CLEAR_RISC_INT); - if (sema) - ISP_WRITE(isp, BIU_SEMA, 0); -} - -static uint32_t -isp_sbus_rd_reg(ispsoftc_t *isp, int regoff) -{ - uint16_t rval; - struct isp_sbussoftc *sbs = (struct isp_sbussoftc *) isp; - int offset = sbs->sbus_poff[(regoff & _BLK_REG_MASK) >> _BLK_REG_SHFT]; - offset += (regoff & 0xff); - rval = BXR2(isp, offset); - isp_prt(isp, ISP_LOGDEBUG3, - "isp_sbus_rd_reg(off %x) = %x", regoff, rval); - return (rval); -} - -static void -isp_sbus_wr_reg(ispsoftc_t *isp, int regoff, uint32_t val) -{ - struct isp_sbussoftc *sbs = (struct isp_sbussoftc *) isp; - int offset = sbs->sbus_poff[(regoff & _BLK_REG_MASK) >> _BLK_REG_SHFT]; - offset += (regoff & 0xff); - isp_prt(isp, ISP_LOGDEBUG3, - "isp_sbus_wr_reg(off %x) = %x", regoff, val); - bus_write_2(isp->isp_regs, offset, val); - MEMORYBARRIER(isp, SYNC_REG, offset, 2, -1); -} - -struct imush { - bus_addr_t maddr; - int error; -}; - -static void imc(void *, bus_dma_segment_t *, int, int); - -static void -imc(void *arg, bus_dma_segment_t *segs, int nseg, int error) -{ - struct imush *imushp = (struct imush *) arg; - - if (!(imushp->error = error)) - imushp->maddr = segs[0].ds_addr; -} - -static int -isp_sbus_mbxdma(ispsoftc_t *isp) -{ - caddr_t base; - uint32_t len; - int i, error; - struct imush im; - - /* Already been here? If so, leave... */ - if (isp->isp_xflist != NULL) - return (0); - if (isp->isp_rquest != NULL && isp->isp_maxcmds == 0) - return (0); - ISP_UNLOCK(isp); - if (isp->isp_rquest != NULL) - goto gotmaxcmds; - - if (bus_dma_tag_create(bus_get_dma_tag(ISP_SBD(isp)), 1, - BUS_SPACE_MAXADDR_24BIT+1, BUS_SPACE_MAXADDR_32BIT, - BUS_SPACE_MAXADDR_32BIT, NULL, NULL, BUS_SPACE_MAXSIZE_32BIT, - ISP_NSEG_MAX, BUS_SPACE_MAXADDR_24BIT, 0, - busdma_lock_mutex, &isp->isp_lock, &isp->isp_osinfo.dmat)) { - isp_prt(isp, ISP_LOGERR, "could not create master dma tag"); - goto bad; - } - - /* - * Allocate and map the request queue. - */ - len = ISP_QUEUE_SIZE(RQUEST_QUEUE_LEN(isp)); - if (bus_dma_tag_create(isp->isp_osinfo.dmat, QENTRY_LEN, BUS_SPACE_MAXADDR_24BIT+1, - BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, - len, 1, len, 0, busdma_lock_mutex, &isp->isp_lock, - &isp->isp_osinfo.reqdmat)) { - isp_prt(isp, ISP_LOGERR, "cannot create request DMA tag"); - goto bad; - } - if (bus_dmamem_alloc(isp->isp_osinfo.reqdmat, (void **)&base, - BUS_DMA_COHERENT, &isp->isp_osinfo.reqmap) != 0) { - isp_prt(isp, ISP_LOGERR, "cannot allocate request DMA memory"); - bus_dma_tag_destroy(isp->isp_osinfo.reqdmat); - goto bad; - } - isp->isp_rquest = base; - im.error = 0; - if (bus_dmamap_load(isp->isp_osinfo.reqdmat, isp->isp_osinfo.reqmap, - base, len, imc, &im, 0) || im.error) { - isp_prt(isp, ISP_LOGERR, "error loading request DMA map %d", im.error); - goto bad; - } - isp_prt(isp, ISP_LOGDEBUG0, "request area @ 0x%jx/0x%jx", - (uintmax_t)im.maddr, (uintmax_t)len); - isp->isp_rquest_dma = im.maddr; - - /* - * Allocate and map the result queue. - */ - len = ISP_QUEUE_SIZE(RESULT_QUEUE_LEN(isp)); - if (bus_dma_tag_create(isp->isp_osinfo.dmat, QENTRY_LEN, BUS_SPACE_MAXADDR_24BIT+1, - BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, - len, 1, len, 0, busdma_lock_mutex, &isp->isp_lock, - &isp->isp_osinfo.respdmat)) { - isp_prt(isp, ISP_LOGERR, "cannot create response DMA tag"); - goto bad; - } - if (bus_dmamem_alloc(isp->isp_osinfo.respdmat, (void **)&base, - BUS_DMA_COHERENT, &isp->isp_osinfo.respmap) != 0) { - isp_prt(isp, ISP_LOGERR, "cannot allocate response DMA memory"); - bus_dma_tag_destroy(isp->isp_osinfo.respdmat); - goto bad; - } - isp->isp_result = base; - im.error = 0; - if (bus_dmamap_load(isp->isp_osinfo.respdmat, isp->isp_osinfo.respmap, - base, len, imc, &im, 0) || im.error) { - isp_prt(isp, ISP_LOGERR, "error loading response DMA map %d", im.error); - goto bad; - } - isp_prt(isp, ISP_LOGDEBUG0, "response area @ 0x%jx/0x%jx", - (uintmax_t)im.maddr, (uintmax_t)len); - isp->isp_result_dma = im.maddr; - - if (isp->isp_maxcmds == 0) { - ISP_LOCK(isp); - return (0); - } - -gotmaxcmds: - len = sizeof (struct isp_pcmd) * isp->isp_maxcmds; - isp->isp_osinfo.pcmd_pool = (struct isp_pcmd *) - malloc(len, M_DEVBUF, M_WAITOK | M_ZERO); - for (i = 0; i < isp->isp_maxcmds; i++) { - struct isp_pcmd *pcmd = &isp->isp_osinfo.pcmd_pool[i]; - error = bus_dmamap_create(isp->isp_osinfo.dmat, 0, &pcmd->dmap); - if (error) { - isp_prt(isp, ISP_LOGERR, - "error %d creating per-cmd DMA maps", error); - while (--i >= 0) { - bus_dmamap_destroy(isp->isp_osinfo.dmat, - isp->isp_osinfo.pcmd_pool[i].dmap); - } - goto bad; - } - callout_init_mtx(&pcmd->wdog, &isp->isp_lock, 0); - if (i == isp->isp_maxcmds-1) { - pcmd->next = NULL; - } else { - pcmd->next = &isp->isp_osinfo.pcmd_pool[i+1]; - } - } - isp->isp_osinfo.pcmd_free = &isp->isp_osinfo.pcmd_pool[0]; - - len = sizeof (isp_hdl_t *) * isp->isp_maxcmds; - isp->isp_xflist = (isp_hdl_t *) malloc(len, M_DEVBUF, M_WAITOK | M_ZERO); - for (len = 0; len < isp->isp_maxcmds - 1; len++) - isp->isp_xflist[len].cmd = &isp->isp_xflist[len+1]; - isp->isp_xffree = isp->isp_xflist; - - ISP_LOCK(isp); - return (0); - -bad: - isp_sbus_mbxdmafree(isp); - ISP_LOCK(isp); - return (1); -} - -static void -isp_sbus_mbxdmafree(ispsoftc_t *isp) -{ - int i; - - if (isp->isp_xflist != NULL) { - free(isp->isp_xflist, M_DEVBUF); - isp->isp_xflist = NULL; - } - if (isp->isp_osinfo.pcmd_pool != NULL) { - for (i = 0; i < isp->isp_maxcmds; i++) { - bus_dmamap_destroy(isp->isp_osinfo.dmat, - isp->isp_osinfo.pcmd_pool[i].dmap); - } - free(isp->isp_osinfo.pcmd_pool, M_DEVBUF); - isp->isp_osinfo.pcmd_pool = NULL; - } - if (isp->isp_result_dma != 0) { - bus_dmamap_unload(isp->isp_osinfo.respdmat, - isp->isp_osinfo.respmap); - isp->isp_result_dma = 0; - } - if (isp->isp_result != NULL) { - bus_dmamem_free(isp->isp_osinfo.respdmat, isp->isp_result, - isp->isp_osinfo.respmap); - bus_dma_tag_destroy(isp->isp_osinfo.respdmat); - isp->isp_result = NULL; - } - if (isp->isp_rquest_dma != 0) { - bus_dmamap_unload(isp->isp_osinfo.reqdmat, - isp->isp_osinfo.reqmap); - isp->isp_rquest_dma = 0; - } - if (isp->isp_rquest != NULL) { - bus_dmamem_free(isp->isp_osinfo.reqdmat, isp->isp_rquest, - isp->isp_osinfo.reqmap); - bus_dma_tag_destroy(isp->isp_osinfo.reqdmat); - isp->isp_rquest = NULL; - } -} - -typedef struct { - ispsoftc_t *isp; - void *cmd_token; - void *rq; /* original request */ - int error; -} mush_t; - -#define MUSHERR_NOQENTRIES -2 - -static void -dma2(void *arg, bus_dma_segment_t *dm_segs, int nseg, int error) -{ - mush_t *mp = (mush_t *) arg; - ispsoftc_t *isp = mp->isp; - struct ccb_scsiio *csio = mp->cmd_token; - isp_ddir_t ddir; - int sdir; - - if (error) { - mp->error = error; - return; - } - if (nseg == 0) { - ddir = ISP_NOXFR; - } else { - if ((csio->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) { - ddir = ISP_FROM_DEVICE; - } else { - ddir = ISP_TO_DEVICE; - } - if ((csio->ccb_h.func_code == XPT_CONT_TARGET_IO) ^ - ((csio->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN)) { - sdir = BUS_DMASYNC_PREREAD; - } else { - sdir = BUS_DMASYNC_PREWRITE; - } - bus_dmamap_sync(isp->isp_osinfo.dmat, PISP_PCMD(csio)->dmap, - sdir); - } - - if (isp_send_cmd(isp, mp->rq, dm_segs, nseg, XS_XFRLEN(csio), - ddir, NULL) != CMD_QUEUED) { - mp->error = MUSHERR_NOQENTRIES; - } -} - -static int -isp_sbus_dmasetup(ispsoftc_t *isp, struct ccb_scsiio *csio, void *ff) -{ - mush_t mush, *mp; - int error; - - mp = &mush; - mp->isp = isp; - mp->cmd_token = csio; - mp->rq = ff; - mp->error = 0; - - error = bus_dmamap_load_ccb(isp->isp_osinfo.dmat, - PISP_PCMD(csio)->dmap, (union ccb *)csio, dma2, mp, 0); - if (error == EINPROGRESS) { - bus_dmamap_unload(isp->isp_osinfo.dmat, PISP_PCMD(csio)->dmap); - mp->error = EINVAL; - isp_prt(isp, ISP_LOGERR, - "deferred dma allocation not supported"); - } else if (error && mp->error == 0) { -#ifdef DIAGNOSTIC - isp_prt(isp, ISP_LOGERR, "error %d in dma mapping code", error); -#endif - mp->error = error; - } - if (mp->error) { - int retval = CMD_COMPLETE; - if (mp->error == MUSHERR_NOQENTRIES) { - retval = CMD_EAGAIN; - } else if (mp->error == EFBIG) { - XS_SETERR(csio, CAM_REQ_TOO_BIG); - } else if (mp->error == EINVAL) { - XS_SETERR(csio, CAM_REQ_INVALID); - } else { - XS_SETERR(csio, CAM_UNREC_HBA_ERROR); - } - return (retval); - } - return (CMD_QUEUED); -} - -static void -isp_sbus_dumpregs(ispsoftc_t *isp, const char *msg) -{ - if (msg) - printf("%s: %s\n", device_get_nameunit(isp->isp_dev), msg); - else - printf("%s:\n", device_get_nameunit(isp->isp_dev)); - printf(" biu_conf1=%x", ISP_READ(isp, BIU_CONF1)); - printf(" biu_icr=%x biu_isr=%x biu_sema=%x ", ISP_READ(isp, BIU_ICR), - ISP_READ(isp, BIU_ISR), ISP_READ(isp, BIU_SEMA)); - printf("risc_hccr=%x\n", ISP_READ(isp, HCCR)); - - - ISP_WRITE(isp, HCCR, HCCR_CMD_PAUSE); - printf(" cdma_conf=%x cdma_sts=%x cdma_fifostat=%x\n", - ISP_READ(isp, CDMA_CONF), ISP_READ(isp, CDMA_STATUS), - ISP_READ(isp, CDMA_FIFO_STS)); - printf(" ddma_conf=%x ddma_sts=%x ddma_fifostat=%x\n", - ISP_READ(isp, DDMA_CONF), ISP_READ(isp, DDMA_STATUS), - ISP_READ(isp, DDMA_FIFO_STS)); - printf(" sxp_int=%x sxp_gross=%x sxp(scsi_ctrl)=%x\n", - ISP_READ(isp, SXP_INTERRUPT), - ISP_READ(isp, SXP_GROSS_ERR), - ISP_READ(isp, SXP_PINS_CTRL)); - ISP_WRITE(isp, HCCR, HCCR_CMD_RELEASE); - printf(" mbox regs: %x %x %x %x %x\n", - ISP_READ(isp, OUTMAILBOX0), ISP_READ(isp, OUTMAILBOX1), - ISP_READ(isp, OUTMAILBOX2), ISP_READ(isp, OUTMAILBOX3), - ISP_READ(isp, OUTMAILBOX4)); -} diff --git a/sys/dev/ispfw/asm_1000.h b/sys/dev/ispfw/asm_1000.h deleted file mode 100644 index 69193fac602da6..00000000000000 --- a/sys/dev/ispfw/asm_1000.h +++ /dev/null @@ -1,1293 +0,0 @@ -/* $FreeBSD$ */ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000 Qlogic, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms are permitted provided - * that the following conditions are met: - * 1. Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * Firmware Version 1.37.00 (11:28 Aug 28, 2000) - */ -static const u_int16_t isp_1000_risc_code[] = { - 0x0078, 0x1041, 0x0000, 0x2757, 0x0000, 0x12ff, 0x2043, 0x4f50, - 0x5952, 0x4947, 0x4854, 0x2031, 0x3939, 0x312c, 0x3139, 0x3932, - 0x2c31, 0x3939, 0x332c, 0x3139, 0x3934, 0x2051, 0x4c4f, 0x4749, - 0x4320, 0x434f, 0x5250, 0x4f52, 0x4154, 0x494f, 0x4e00, 0x2049, - 0x5350, 0x3130, 0x3030, 0x2046, 0x6972, 0x6d77, 0x6172, 0x6520, - 0x2056, 0x6572, 0x7369, 0x6f6e, 0x2030, 0x312e, 0x3337, 0x2020, - 0x2043, 0x7573, 0x746f, 0x6d65, 0x7220, 0x4e6f, 0x2e20, 0x3135, - 0x2050, 0x726f, 0x6475, 0x6374, 0x204e, 0x6f2e, 0x2000, 0x3030, - 0x2024, 0x20b9, 0x1212, 0x20c1, 0x0008, 0x2071, 0x0010, 0x70c3, - 0x0004, 0x20c9, 0x5cff, 0x2089, 0x10ee, 0x70c7, 0x4953, 0x70cb, - 0x5020, 0x70cf, 0x2020, 0x70d3, 0x0001, 0x3f00, 0x70d6, 0x2031, - 0x0030, 0x2079, 0x3800, 0x7863, 0x0000, 0x2fa0, 0x2009, 0x031b, - 0x2011, 0x0000, 0x20a9, 0x0040, 0x42a4, 0x8109, 0x00c0, 0x1062, - 0x789b, 0x0101, 0x780b, 0x0002, 0x780f, 0x0002, 0x784f, 0x0bb8, - 0x2009, 0x3835, 0x200b, 0x0003, 0x78bb, 0x0000, 0x78bf, 0x0000, - 0x78c3, 0x0000, 0x2069, 0x3840, 0x00a8, 0x1085, 0x681b, 0x003c, - 0x2009, 0x1313, 0x21b8, 0x0078, 0x1087, 0x681b, 0x0028, 0x6807, - 0x0007, 0x680b, 0x00fa, 0x680f, 0x0008, 0x6813, 0x0005, 0x681f, - 0x0000, 0x6823, 0x0006, 0x6817, 0x0008, 0x6827, 0x0000, 0x2069, - 0x3a80, 0x2011, 0x0020, 0x2009, 0x0010, 0x680b, 0x0c19, 0x680f, - 0x0019, 0x6803, 0xdd00, 0x6807, 0x001a, 0x6a1a, 0x2d00, 0xa0e8, - 0x0008, 0xa290, 0x0004, 0x8109, 0x00c0, 0x109d, 0x2069, 0x3b00, - 0x2009, 0x0002, 0x20a9, 0x0100, 0x683f, 0x0000, 0x2001, 0x0008, - 0x8007, 0x6832, 0x6837, 0x000a, 0x680b, 0x0040, 0x6817, 0x0100, - 0x681f, 0x0064, 0xade8, 0x0010, 0x0070, 0x10c8, 0x0078, 0x10b4, - 0x8109, 0x00c0, 0x10b2, 0x1078, 0x1b64, 0x1078, 0x31c0, 0x1078, - 0x1747, 0x1078, 0x368b, 0x3200, 0xa085, 0x000d, 0x2090, 0x70c3, - 0x0000, 0x0090, 0x10e2, 0x70c0, 0xa086, 0x0002, 0x00c0, 0x10e2, - 0x1078, 0x11e0, 0x1078, 0x1112, 0x1078, 0x18f2, 0x1078, 0x1aaf, - 0x1078, 0x34fd, 0x1078, 0x184d, 0x0078, 0x10e2, 0x10f6, 0x10f8, - 0x1d05, 0x1d05, 0x321e, 0x321e, 0x1d05, 0x1d05, 0x0078, 0x10f6, - 0x0078, 0x10f8, 0x0078, 0x10fa, 0x0078, 0x10fc, 0x7008, 0x800c, - 0x00c8, 0x110d, 0x7007, 0x0002, 0xa08c, 0x000c, 0x00c0, 0x110e, - 0x8004, 0x8004, 0x00c8, 0x110d, 0x087a, 0x097a, 0x70c3, 0x4002, - 0x0078, 0x11e3, 0x7814, 0xa005, 0x00c0, 0x111a, 0x0010, 0x1156, - 0x0078, 0x1155, 0x2009, 0x3868, 0x2104, 0xa005, 0x00c0, 0x1155, - 0x7814, 0xa086, 0x0001, 0x00c0, 0x1127, 0x1078, 0x15ae, 0x7817, - 0x0000, 0x2009, 0x386f, 0x2104, 0xa065, 0x0040, 0x1143, 0x2009, - 0x386a, 0x211c, 0x8108, 0x2114, 0x8108, 0x2104, 0xa210, 0xa399, - 0x0000, 0x2009, 0x0018, 0x6083, 0x0103, 0x1078, 0x16d7, 0x00c0, - 0x114f, 0x1078, 0x173e, 0x2009, 0x386f, 0x200b, 0x0000, 0x2009, - 0x3869, 0x2104, 0x200b, 0x0000, 0xa005, 0x0040, 0x1153, 0x2001, - 0x4005, 0x0078, 0x11e2, 0x0078, 0x11e0, 0x007c, 0x2061, 0x0000, - 0x6018, 0xa084, 0x0001, 0x0040, 0x115e, 0x007c, 0x70c3, 0x0000, - 0x70c7, 0x0000, 0x70cb, 0x0000, 0x70cf, 0x0000, 0x70c0, 0xa0bc, - 0xffc0, 0x00c0, 0x11ae, 0x2038, 0x0079, 0x116e, 0x11e0, 0x122e, - 0x11fc, 0x122e, 0x127f, 0x127f, 0x11f3, 0x1608, 0x128a, 0x11ef, - 0x1200, 0x1202, 0x1204, 0x1206, 0x160d, 0x11ef, 0x1292, 0x12ba, - 0x15bc, 0x1602, 0x1208, 0x14e3, 0x1505, 0x151f, 0x1548, 0x149c, - 0x14aa, 0x14be, 0x14d2, 0x1357, 0x1332, 0x12e2, 0x12e9, 0x12ee, - 0x12f3, 0x12f9, 0x12fe, 0x1303, 0x1308, 0x130d, 0x1311, 0x1326, - 0x11ef, 0x11ef, 0x11ef, 0x11ef, 0x11ef, 0x1363, 0x136c, 0x137b, - 0x13a1, 0x13ab, 0x13b2, 0x13d8, 0x13e7, 0x13f6, 0x1408, 0x147a, - 0x11ef, 0x148a, 0x11ef, 0x11ef, 0x11ef, 0x1491, 0xa0bc, 0xffa0, - 0x00c0, 0x11ef, 0x2038, 0xa084, 0x001f, 0x0079, 0x11b7, 0x11ef, - 0x11ef, 0x11ef, 0x11ef, 0x11ef, 0x11ef, 0x11ef, 0x11ef, 0x11ef, - 0x11ef, 0x11ef, 0x11ef, 0x11ef, 0x11ef, 0x1665, 0x1674, 0x11ef, - 0x11ef, 0x11ef, 0x11ef, 0x11ef, 0x11ef, 0x11ef, 0x11ef, 0x11ef, - 0x11ef, 0x16b3, 0x16bd, 0x16c1, 0x16cf, 0x167f, 0x169c, 0x72ca, - 0x71c6, 0x2001, 0x4006, 0x0078, 0x11e2, 0x73ce, 0x72ca, 0x71c6, - 0x2001, 0x4000, 0x70c2, 0x2061, 0x0000, 0x601b, 0x0001, 0x2091, - 0x5000, 0x2091, 0x4080, 0x007c, 0x71c6, 0x0078, 0x11e2, 0x70c3, - 0x4001, 0x0078, 0x11e3, 0x2099, 0x0041, 0x20a1, 0x0041, 0x20a9, - 0x0005, 0x53a3, 0x0078, 0x11e0, 0x70c4, 0x70c3, 0x0004, 0x007a, - 0x0078, 0x11e0, 0x0078, 0x11e0, 0x0078, 0x11e0, 0x0078, 0x11e0, - 0x2091, 0x8000, 0x70c3, 0x0000, 0x70c7, 0x4953, 0x70cb, 0x5020, - 0x70cf, 0x2020, 0x70d3, 0x0001, 0x3f00, 0x70d6, 0x2079, 0x0000, - 0x781b, 0x0001, 0x2031, 0x0030, 0x2059, 0x1000, 0x2029, 0x0457, - 0x2051, 0x0470, 0x2061, 0x0472, 0x20b9, 0xffff, 0x20c1, 0x0000, - 0x2091, 0x5000, 0x2091, 0x4080, 0x0078, 0x0455, 0x71d0, 0x72c8, - 0x73cc, 0x70c4, 0x20a0, 0x2098, 0x2031, 0x0030, 0x81ff, 0x0040, - 0x11e0, 0x7007, 0x0004, 0x731a, 0x721e, 0x2051, 0x0012, 0x2049, - 0x125d, 0x2041, 0x11e0, 0x7003, 0x0002, 0xa786, 0x0001, 0x00c0, - 0x124f, 0x2049, 0x126b, 0x2041, 0x1277, 0x7003, 0x0003, 0x7017, - 0x0000, 0x810b, 0x7112, 0x00c8, 0x1257, 0x7017, 0x0001, 0x7007, - 0x0001, 0xa786, 0x0001, 0x0040, 0x126b, 0x700c, 0xa084, 0x007f, - 0x8004, 0x2009, 0x0020, 0xa102, 0x0942, 0x094a, 0x20a8, 0x26a0, - 0x53a6, 0x0078, 0x10fe, 0x700c, 0xa084, 0x007f, 0x0040, 0x126b, - 0x80ac, 0x0048, 0x126b, 0x2698, 0x53a5, 0x0078, 0x10fe, 0x700c, - 0xa084, 0x007f, 0x80ac, 0x2698, 0x53a5, 0x0078, 0x11e0, 0x71c4, - 0x70c8, 0x2114, 0xa79e, 0x0004, 0x00c0, 0x1287, 0x200a, 0x72ca, - 0x0078, 0x11df, 0x70c7, 0x0125, 0x70cb, 0x0000, 0x70cf, 0x0f00, - 0x0078, 0x11e0, 0x70c4, 0x72c8, 0x73cc, 0x74d0, 0x70c6, 0x72ca, - 0x73ce, 0x74d2, 0xa005, 0x0040, 0x12b4, 0x8001, 0x7872, 0xa084, - 0xfc00, 0x0040, 0x12ab, 0x7898, 0xa085, 0x0001, 0x789a, 0x2001, - 0x4005, 0x0078, 0x11e2, 0x7a7a, 0x7b7e, 0x7c76, 0x7898, 0xa084, - 0xfffc, 0x789a, 0x0078, 0x12b8, 0x7898, 0xa085, 0x0001, 0x789a, - 0x0078, 0x11e0, 0x70c4, 0x72c8, 0x73cc, 0x74d4, 0x70c6, 0x72ca, - 0x73ce, 0x74d6, 0xa005, 0x0040, 0x12dc, 0x8001, 0x7886, 0xa084, - 0xfc00, 0x0040, 0x12d3, 0x7898, 0xa085, 0x0100, 0x789a, 0x2001, - 0x4005, 0x0078, 0x11e2, 0x7a8e, 0x7b92, 0x7c8a, 0x7898, 0xa084, - 0xfcff, 0x789a, 0x0078, 0x12e0, 0x7898, 0xa085, 0x0100, 0x789a, - 0x0078, 0x11e0, 0x2009, 0x3859, 0x210c, 0x2011, 0x0372, 0x0078, - 0x11de, 0x2009, 0x3841, 0x210c, 0x0078, 0x11df, 0x2009, 0x3842, - 0x210c, 0x0078, 0x11df, 0x2061, 0x3840, 0x610c, 0x6210, 0x0078, - 0x11de, 0x2009, 0x3845, 0x210c, 0x0078, 0x11df, 0x2009, 0x3846, - 0x210c, 0x0078, 0x11df, 0x2009, 0x3847, 0x210c, 0x0078, 0x11df, - 0x2009, 0x3848, 0x210c, 0x0078, 0x11df, 0x7908, 0x7a0c, 0x0078, - 0x11de, 0x71c4, 0x8107, 0xa084, 0x000f, 0x8003, 0x8003, 0x8003, - 0xa0e8, 0x3a80, 0x6a00, 0x6804, 0xa084, 0x0008, 0x0040, 0x1323, - 0x6b08, 0x0078, 0x1324, 0x6b0c, 0x0078, 0x11dd, 0x77c4, 0x1078, - 0x1758, 0x2091, 0x8000, 0x6b1c, 0x6a14, 0x2091, 0x8001, 0x2708, - 0x0078, 0x11dd, 0x2091, 0x8000, 0x7848, 0xa005, 0x00c0, 0x1346, - 0x2061, 0x3b00, 0x20a9, 0x0100, 0x603c, 0xa005, 0x00c0, 0x1346, - 0xace0, 0x0010, 0x00f0, 0x133c, 0x0078, 0x134e, 0x2019, 0x0000, - 0x2011, 0x0000, 0x2009, 0x0000, 0x0078, 0x1353, 0x7bb8, 0x7abc, - 0x79c0, 0x78c3, 0x0000, 0x2091, 0x8001, 0x0078, 0x11dd, 0x77c4, - 0x1078, 0x1758, 0x2091, 0x8000, 0x6908, 0x6a18, 0x6b10, 0x2091, - 0x8001, 0x0078, 0x11dd, 0x71c4, 0xa182, 0x0010, 0x00c8, 0x11d8, - 0x1078, 0x1be8, 0x0078, 0x11dd, 0x71c4, 0xa182, 0x0010, 0x00c8, - 0x11d8, 0x2011, 0x3841, 0x2204, 0x007e, 0x2112, 0x1078, 0x1ba1, - 0x017f, 0x0078, 0x11df, 0x71c4, 0x2011, 0x1399, 0x20a9, 0x0008, - 0x2204, 0xa106, 0x0040, 0x138b, 0x8210, 0x0070, 0x1389, 0x0078, - 0x1380, 0x0078, 0x11d8, 0xa292, 0x1399, 0x027e, 0x2011, 0x3842, - 0x2204, 0x2112, 0x017f, 0x007e, 0x1078, 0x1bad, 0x017f, 0x0078, - 0x11df, 0x03e8, 0x00fa, 0x01f4, 0x02ee, 0x0064, 0x0019, 0x0032, - 0x004b, 0x2061, 0x3840, 0x610c, 0x6210, 0x70c4, 0x600e, 0x70c8, - 0x6012, 0x0078, 0x11de, 0x2061, 0x3840, 0x6114, 0x70c4, 0x6016, - 0x0078, 0x11df, 0x71c4, 0x2011, 0x0004, 0x2019, 0x1212, 0xa186, - 0x0028, 0x0040, 0x13cb, 0x2011, 0x0005, 0x2019, 0x1212, 0xa186, - 0x0032, 0x0040, 0x13cb, 0x2011, 0x0006, 0x2019, 0x1313, 0xa186, - 0x003c, 0x00c0, 0x11d8, 0x2061, 0x3840, 0x6018, 0x007e, 0x611a, - 0x23b8, 0x1078, 0x1bbe, 0x1078, 0x368b, 0x017f, 0x0078, 0x11df, - 0x71c4, 0xa184, 0xffcf, 0x00c0, 0x11d8, 0x2011, 0x3847, 0x2204, - 0x2112, 0x007e, 0x1078, 0x1be0, 0x017f, 0x0078, 0x11df, 0x71c4, - 0xa182, 0x0010, 0x00c8, 0x11d8, 0x2011, 0x3848, 0x2204, 0x007e, - 0x2112, 0x1078, 0x1bcf, 0x017f, 0x0078, 0x11df, 0x71c4, 0x72c8, - 0xa184, 0xfffd, 0x00c0, 0x11d7, 0xa284, 0xfffd, 0x00c0, 0x11d7, - 0x2100, 0x7908, 0x780a, 0x2200, 0x7a0c, 0x780e, 0x0078, 0x11de, - 0x71c4, 0x8107, 0xa084, 0x000f, 0x8003, 0x8003, 0x8003, 0xa0e8, - 0x3a80, 0x2019, 0x0000, 0x72c8, 0x6800, 0x007e, 0xa226, 0x0040, - 0x1440, 0xa284, 0x0001, 0x0040, 0x1422, 0x2220, 0xa39d, 0x0002, - 0xa294, 0xfffe, 0x6a02, 0xa484, 0x2000, 0x0040, 0x1429, 0xa39d, - 0x0010, 0xa484, 0x1000, 0x0040, 0x142f, 0xa39d, 0x0008, 0xa484, - 0x4000, 0x0040, 0x1440, 0x810f, 0xa284, 0x4000, 0x0040, 0x143c, - 0x1078, 0x1c02, 0x0078, 0x1440, 0x1078, 0x1bf4, 0x0078, 0x1440, - 0x72cc, 0x82ff, 0x0040, 0x1472, 0x6808, 0xa206, 0x0040, 0x1472, - 0xa2a4, 0x00ff, 0x2061, 0x3840, 0x6118, 0xa186, 0x0028, 0x0040, - 0x1459, 0xa186, 0x0032, 0x0040, 0x145f, 0xa186, 0x003c, 0x0040, - 0x1465, 0xa482, 0x0064, 0x0048, 0x146f, 0x0078, 0x1469, 0xa482, - 0x0050, 0x0048, 0x146f, 0x0078, 0x1469, 0xa482, 0x0043, 0x0048, - 0x146f, 0x71c4, 0x71c6, 0x027f, 0x72ca, 0x0078, 0x11d9, 0x6a0a, - 0xa39d, 0x000a, 0x6804, 0xa305, 0x6806, 0x027f, 0x6b0c, 0x71c4, - 0x0078, 0x11dd, 0x77c4, 0x1078, 0x1758, 0x2091, 0x8000, 0x6a14, - 0x6b1c, 0x2091, 0x8001, 0x70c8, 0x6816, 0x70cc, 0x681e, 0x2708, - 0x0078, 0x11dd, 0x2011, 0x3835, 0x220c, 0x70c4, 0x2012, 0x0078, - 0x11df, 0x71c4, 0x72c8, 0x73cc, 0xa182, 0x0010, 0x00c8, 0x11d8, - 0x1078, 0x1c10, 0x0078, 0x11dd, 0x77c4, 0x1078, 0x1758, 0x2091, - 0x8000, 0x6a08, 0xa295, 0x0002, 0x6a0a, 0x2091, 0x8001, 0x2708, - 0x0078, 0x11de, 0x77c4, 0x1078, 0x1758, 0x2091, 0x8000, 0x6a08, - 0xa294, 0xfff9, 0x6a0a, 0x6804, 0xa005, 0x0040, 0x14b9, 0x1078, - 0x1b49, 0x2091, 0x8001, 0x2708, 0x0078, 0x11de, 0x77c4, 0x1078, - 0x1758, 0x2091, 0x8000, 0x6a08, 0xa295, 0x0004, 0x6a0a, 0x6804, - 0xa005, 0x0040, 0x14cd, 0x1078, 0x1b49, 0x2091, 0x8001, 0x2708, - 0x0078, 0x11de, 0x77c4, 0x2041, 0x0001, 0x2049, 0x0005, 0x2051, - 0x0020, 0x2091, 0x8000, 0x1078, 0x1765, 0x2091, 0x8001, 0x2708, - 0x6a08, 0x0078, 0x11de, 0x77c4, 0x72c8, 0x73cc, 0x77c6, 0x72ca, - 0x73ce, 0x1078, 0x17e6, 0x00c0, 0x1501, 0x6818, 0xa005, 0x0040, - 0x14fb, 0x2708, 0x1078, 0x1c20, 0x00c0, 0x14fb, 0x7817, 0xffff, - 0x2091, 0x8001, 0x007c, 0x2091, 0x8001, 0x2001, 0x4005, 0x0078, - 0x11e2, 0x2091, 0x8001, 0x0078, 0x11e0, 0x77c4, 0x77c6, 0x2041, - 0x0021, 0x2049, 0x0005, 0x2051, 0x0020, 0x2091, 0x8000, 0x1078, - 0x1765, 0x2061, 0x3840, 0x60a3, 0x0003, 0x67b6, 0x60a7, 0x0000, - 0x7817, 0xffff, 0x1078, 0x1b49, 0x2091, 0x8001, 0x007c, 0x77c8, - 0x77ca, 0x77c4, 0x77c6, 0xa7bc, 0xff00, 0x2091, 0x8000, 0x2061, - 0x3840, 0x60a3, 0x0002, 0x60a7, 0x0000, 0x67b6, 0x7817, 0xffff, - 0x1078, 0x1b49, 0x2091, 0x8001, 0x2041, 0x0021, 0x2049, 0x0004, - 0x2051, 0x0010, 0x2091, 0x8000, 0x1078, 0x1765, 0x70c8, 0x683e, - 0x8738, 0xa784, 0x001f, 0x00c0, 0x153c, 0x2091, 0x8001, 0x007c, - 0x7898, 0xa084, 0x0003, 0x00c0, 0x156c, 0x2039, 0x0000, 0x2041, - 0x0021, 0x2049, 0x0004, 0x2051, 0x0008, 0x1078, 0x1758, 0x2091, - 0x8000, 0x6808, 0xa80d, 0x690a, 0x2091, 0x8001, 0x8738, 0xa784, - 0x001f, 0x00c0, 0x1555, 0xa7bc, 0xff00, 0x873f, 0x8738, 0x873f, - 0xa784, 0x0f00, 0x00c0, 0x1555, 0x2091, 0x8000, 0x2069, 0x0100, - 0x6830, 0xa084, 0x0040, 0x0040, 0x1595, 0x684b, 0x0004, 0x20a9, - 0x0014, 0x6848, 0xa084, 0x0004, 0x0040, 0x1582, 0x0070, 0x1582, - 0x0078, 0x1579, 0x684b, 0x0009, 0x20a9, 0x0014, 0x6848, 0xa084, - 0x0001, 0x0040, 0x158f, 0x0070, 0x158f, 0x0078, 0x1586, 0x20a9, - 0x00fa, 0x0070, 0x1595, 0x0078, 0x1591, 0x2079, 0x3800, 0x7817, - 0x0001, 0x2061, 0x3840, 0x60a3, 0x0001, 0x60a7, 0x0000, 0x60c3, - 0x000f, 0x7898, 0xa085, 0x0002, 0x789a, 0x6808, 0xa084, 0xfffd, - 0x680a, 0x681b, 0x0046, 0x2091, 0x8001, 0x007c, 0x7898, 0xa084, - 0xfffd, 0x789a, 0xa084, 0x0001, 0x00c0, 0x15b8, 0x1078, 0x1830, - 0x71c4, 0x71c6, 0x794a, 0x007c, 0x74c4, 0x73c8, 0x72cc, 0x74c6, - 0x73ca, 0x72ce, 0x2079, 0x3800, 0x2009, 0x0040, 0x1078, 0x1735, - 0x0040, 0x15fe, 0x1078, 0x1705, 0x0040, 0x15d2, 0x1078, 0x173e, - 0x0078, 0x15fe, 0x6010, 0x2091, 0x8000, 0x7817, 0xffff, 0x2009, - 0x3868, 0x200b, 0x0005, 0x8108, 0x200b, 0x0000, 0x8108, 0x230a, - 0x8108, 0x220a, 0x8108, 0x240a, 0x8108, 0x200a, 0x8108, 0x200b, - 0x0000, 0x8108, 0x2c0a, 0xa02e, 0x2530, 0x0e7e, 0x1078, 0x3199, - 0x0e7f, 0x6592, 0x65a2, 0x6696, 0x66a6, 0x60ab, 0x0000, 0x60af, - 0x0000, 0x1078, 0x1b49, 0x2091, 0x8001, 0x007c, 0x70c3, 0x4005, - 0x0078, 0x11e3, 0x71c4, 0x70c7, 0x0000, 0x7906, 0x0078, 0x11e0, - 0x71c4, 0x71c6, 0x2168, 0x0078, 0x160f, 0x2069, 0x1000, 0x690c, - 0xa016, 0x2d04, 0xa210, 0x8d68, 0x8109, 0x00c0, 0x1611, 0xa285, - 0x0000, 0x00c0, 0x161f, 0x70c3, 0x4000, 0x0078, 0x1621, 0x70c3, - 0x4003, 0x70ca, 0x0078, 0x11e3, 0x71c4, 0x72c8, 0x73cc, 0x2100, - 0xa184, 0xfffc, 0x00c0, 0x11ef, 0x2100, 0x0079, 0x162f, 0x1646, - 0x165b, 0x165d, 0x165f, 0x70c3, 0x4003, 0x71ce, 0x72d2, 0x73d6, - 0x0078, 0x1642, 0x70c3, 0x4000, 0x70cf, 0x0000, 0x70d3, 0x0000, - 0x70d7, 0x0000, 0x77c6, 0x71ca, 0x0078, 0x11e0, 0x2031, 0x1661, - 0x2624, 0x8630, 0x2412, 0x2204, 0xa446, 0x00c0, 0x1633, 0xa484, - 0xffff, 0x00c0, 0x1648, 0x2031, 0x1661, 0x8210, 0x8319, 0xa384, - 0xffff, 0x00c0, 0x1648, 0x0078, 0x163a, 0x0078, 0x163a, 0x0078, - 0x163a, 0x5555, 0xaaaa, 0xffff, 0x0000, 0x77c4, 0x1078, 0x1758, - 0x2091, 0x8000, 0x6830, 0xa084, 0xff00, 0x8007, 0x2010, 0x2091, - 0x8001, 0x2708, 0x0078, 0x11de, 0x77c4, 0x1078, 0x1758, 0x2091, - 0x8000, 0x6a34, 0x2091, 0x8001, 0x2708, 0x0078, 0x11de, 0x77c4, - 0x077e, 0xa7bc, 0xff00, 0x20a9, 0x0020, 0x72c8, 0x8217, 0xa294, - 0xff00, 0x1078, 0x1758, 0x2091, 0x8000, 0x6c30, 0x6a32, 0x2091, - 0x8001, 0x8738, 0x00f0, 0x1689, 0x077f, 0x2708, 0x8427, 0xa4a4, - 0x00ff, 0x2410, 0x0078, 0x11de, 0x77c4, 0x077e, 0xa7bc, 0xff00, - 0x20a9, 0x0020, 0x72c8, 0x1078, 0x1758, 0x2091, 0x8000, 0x6c34, - 0x6a36, 0x2091, 0x8001, 0x8738, 0x00f0, 0x16a3, 0x077f, 0x2708, - 0x2410, 0x0078, 0x11de, 0x7960, 0x71c6, 0x71c4, 0xa182, 0x0003, - 0x00c8, 0x11d8, 0x7962, 0x0078, 0x11e0, 0x7960, 0x71c6, 0x0078, - 0x11e0, 0x7954, 0x71c6, 0x71c4, 0x7956, 0x7958, 0x71ca, 0x71c8, - 0x795a, 0x795c, 0x71ce, 0x71cc, 0x795e, 0x0078, 0x11e0, 0x7954, - 0x71c6, 0x7958, 0x71ca, 0x795c, 0x71ce, 0x0078, 0x11e0, 0x700c, - 0xa084, 0x007f, 0x0040, 0x16e3, 0x7007, 0x0004, 0x7004, 0xa084, - 0x0004, 0x00c0, 0x16de, 0x7017, 0x0000, 0x7112, 0x721a, 0x731e, - 0x8108, 0x810c, 0x81a9, 0x8c98, 0x20a1, 0x0030, 0x6080, 0x20a2, - 0x53a6, 0x780c, 0xa085, 0x0000, 0x7002, 0x7007, 0x0001, 0x7108, - 0x8104, 0x00c8, 0x16f7, 0x7007, 0x0002, 0xa184, 0x000c, 0x710c, - 0xa184, 0x0300, 0x7003, 0x0000, 0x007c, 0x700c, 0xa084, 0x007f, - 0x0040, 0x1711, 0x7007, 0x0004, 0x7004, 0xa084, 0x0004, 0x00c0, - 0x170c, 0x7017, 0x0000, 0x7112, 0x721a, 0x731e, 0x2099, 0x0030, - 0x8108, 0x81ac, 0x780c, 0xa085, 0x0001, 0x7002, 0x7007, 0x0001, - 0x7008, 0x800c, 0x00c8, 0x1720, 0x7007, 0x0002, 0xa08c, 0x000c, - 0x00c0, 0x1732, 0x710c, 0xa184, 0x0300, 0x00c0, 0x1732, 0x2ca0, - 0x53a5, 0xa006, 0x7003, 0x0000, 0x007c, 0x7850, 0xa065, 0x0040, - 0x173d, 0x2c04, 0x7852, 0x2063, 0x0000, 0x007c, 0x0f7e, 0x2079, - 0x3800, 0x7850, 0x2062, 0x2c00, 0x7852, 0x0f7f, 0x007c, 0x2011, - 0x5d00, 0x7a52, 0x2019, 0x0372, 0x8319, 0x0040, 0x1755, 0xa280, - 0x002f, 0x2012, 0x2010, 0x0078, 0x174c, 0x2013, 0x0000, 0x007c, - 0xa784, 0x0f00, 0x800b, 0xa784, 0x001f, 0x8003, 0x8003, 0x8003, - 0x8003, 0xa105, 0xa0e8, 0x3b00, 0x007c, 0x1078, 0x1758, 0x2900, - 0x682a, 0x2a00, 0x682e, 0x6808, 0xa084, 0xffef, 0xa80d, 0x690a, - 0x2091, 0x8000, 0x2009, 0x384f, 0x210c, 0x6804, 0xa005, 0x0040, - 0x1784, 0xa116, 0x00c0, 0x1784, 0x2060, 0x6000, 0x6806, 0x017e, - 0x200b, 0x0000, 0x0078, 0x1787, 0x2009, 0x0000, 0x017e, 0x6804, - 0xa065, 0x0040, 0x1798, 0x6000, 0x6806, 0x1078, 0x17ad, 0x1078, - 0x18a4, 0x1078, 0x2b27, 0x6810, 0x8001, 0x6812, 0x00c0, 0x1787, - 0x1078, 0x2b27, 0x017f, 0x6902, 0x6906, 0x2091, 0x8001, 0x007c, - 0xa065, 0x0040, 0x17ac, 0x6098, 0x609b, 0x0000, 0x2008, 0x1078, - 0x173e, 0x2100, 0x0078, 0x17a0, 0x007c, 0x6003, 0x0103, 0x20a9, - 0x001c, 0xac80, 0x0004, 0x20a0, 0x2001, 0x0000, 0x40a4, 0x6828, - 0x6016, 0x682c, 0x601e, 0x007c, 0x0e7e, 0x2071, 0x3840, 0x7040, - 0xa08c, 0x0200, 0x00c0, 0x17ca, 0xa088, 0x3880, 0x2d0a, 0x8000, - 0x7042, 0xa006, 0x0e7f, 0x007c, 0x0e7e, 0x2071, 0x3840, 0x2009, - 0x3880, 0x7240, 0x8221, 0x8211, 0x0048, 0x17e4, 0x2104, 0x8108, - 0xad06, 0x00c0, 0x17d3, 0x8119, 0x211e, 0x8108, 0x8318, 0x8211, - 0x00c8, 0x17dc, 0x7442, 0xa006, 0x0e7f, 0x007c, 0x1078, 0x1758, - 0x2091, 0x8000, 0x6804, 0x781e, 0xa065, 0x0040, 0x182f, 0x0078, - 0x17f7, 0x2c00, 0x781e, 0x6000, 0xa065, 0x0040, 0x182f, 0x600c, - 0xa306, 0x00c0, 0x17f1, 0x6008, 0xa206, 0x00c0, 0x17f1, 0x2c28, - 0x2001, 0x384f, 0x2004, 0xac06, 0x0040, 0x182f, 0x6804, 0xac06, - 0x00c0, 0x1814, 0x6000, 0x2060, 0x6806, 0xa005, 0x00c0, 0x1814, - 0x6803, 0x0000, 0x0078, 0x181e, 0x6400, 0x781c, 0x2060, 0x6402, - 0xa486, 0x0000, 0x00c0, 0x181e, 0x2c00, 0x6802, 0x2560, 0x1078, - 0x17ad, 0x6017, 0x0005, 0x601f, 0x0020, 0x1078, 0x18a4, 0x1078, - 0x2b27, 0x6810, 0x8001, 0x6812, 0x2001, 0xffff, 0xa005, 0x007c, - 0x2039, 0x0000, 0x2041, 0x0021, 0x2049, 0x0004, 0x2051, 0x0008, - 0x2091, 0x8000, 0x1078, 0x1765, 0x8738, 0xa784, 0x001f, 0x00c0, - 0x183a, 0xa7bc, 0xff00, 0x873f, 0x8738, 0x873f, 0xa784, 0x0f00, - 0x00c0, 0x183a, 0x2091, 0x8001, 0x007c, 0x0068, 0x185c, 0x2061, - 0x0000, 0x6018, 0xa084, 0x0001, 0x00c0, 0x185c, 0x78ac, 0x78af, - 0x0000, 0xa005, 0x00c0, 0x185d, 0x007c, 0xa08c, 0xfff0, 0x0040, - 0x1863, 0x1078, 0x1ce7, 0x0079, 0x1865, 0x1875, 0x1877, 0x187d, - 0x1881, 0x1875, 0x1885, 0x1875, 0x1875, 0x188b, 0x1875, 0x1892, - 0x1896, 0x1875, 0x1875, 0x1875, 0x1875, 0x1078, 0x1ce7, 0x1078, - 0x1830, 0x2001, 0x8001, 0x0078, 0x189c, 0x2001, 0x8003, 0x0078, - 0x189c, 0x2001, 0x8004, 0x0078, 0x189c, 0x1078, 0x1830, 0x2001, - 0x8006, 0x0078, 0x189c, 0x2001, 0x8009, 0x2011, 0x382c, 0x220c, - 0x0078, 0x11ec, 0x2001, 0x800c, 0x0078, 0x189c, 0x1078, 0x1830, - 0x2001, 0x800d, 0x0078, 0x189c, 0x70c2, 0x2061, 0x0000, 0x601b, - 0x0001, 0x2091, 0x4080, 0x007c, 0x2c04, 0x6082, 0x2c08, 0x2063, - 0x0000, 0x7864, 0x8000, 0x7866, 0x7868, 0xa005, 0x796a, 0x0040, - 0x18b4, 0x2c02, 0x0078, 0x18b5, 0x796e, 0x007c, 0x0c7e, 0x2061, - 0x3800, 0x6883, 0x0103, 0x2d08, 0x206b, 0x0000, 0x6064, 0x8000, - 0x6066, 0x6068, 0xa005, 0x616a, 0x0040, 0x18c9, 0x2d02, 0x0078, - 0x18cc, 0x616e, 0x1078, 0x2b41, 0x0c7f, 0x007c, 0x1078, 0x18df, - 0x0040, 0x18de, 0x0c7e, 0x6098, 0xa065, 0x0040, 0x18d9, 0x1078, - 0x17a0, 0x0c7f, 0x609b, 0x0000, 0x1078, 0x173e, 0x007c, 0x786c, - 0xa065, 0x0040, 0x18f1, 0x2091, 0x8000, 0x7864, 0x8001, 0x7866, - 0x2c04, 0x786e, 0xa005, 0x00c0, 0x18ef, 0x786a, 0x8000, 0x2091, - 0x8001, 0x007c, 0x7898, 0xa005, 0x00c0, 0x194d, 0x7974, 0x70d0, - 0x0005, 0x0005, 0x72d0, 0xa206, 0x00c0, 0x18f7, 0x2200, 0xa106, - 0x00c0, 0x190e, 0x7804, 0xa005, 0x0040, 0x194d, 0x7807, 0x0000, - 0x0068, 0x194d, 0x2091, 0x4080, 0x0078, 0x194d, 0x1078, 0x1735, - 0x0040, 0x194d, 0x7a7c, 0x7b78, 0xa184, 0xff00, 0x0040, 0x1921, - 0x810f, 0x810c, 0x810c, 0x8004, 0x8004, 0x8007, 0xa100, 0x0078, - 0x1924, 0x8107, 0x8004, 0x8004, 0xa210, 0xa399, 0x0000, 0x2009, - 0x0040, 0x1078, 0x1705, 0x0040, 0x1944, 0x1078, 0x173e, 0x7880, - 0x8000, 0x7882, 0xa086, 0x0002, 0x00c0, 0x194d, 0x2091, 0x8000, - 0x78af, 0x0002, 0x7883, 0x0000, 0x7898, 0xa085, 0x0003, 0x789a, - 0x2091, 0x8001, 0x0078, 0x194d, 0x7883, 0x0000, 0x1078, 0x1a99, - 0x6000, 0xa084, 0x0007, 0x0079, 0x194e, 0x007c, 0x1956, 0x1965, - 0x1985, 0x1956, 0x1997, 0x1956, 0x1956, 0x1956, 0x2039, 0x0400, - 0x78a8, 0xa705, 0x78aa, 0x6004, 0xa705, 0x6006, 0x1078, 0x19e2, - 0x6018, 0x78a6, 0x1078, 0x1a81, 0x007c, 0x78a8, 0xa084, 0x0100, - 0x0040, 0x196c, 0x0078, 0x1956, 0x78ab, 0x0000, 0x6000, 0x8007, - 0xa084, 0x00ff, 0x789e, 0x8001, 0x609b, 0x0000, 0x0040, 0x1982, - 0x1078, 0x19e2, 0x0040, 0x1982, 0x78a8, 0xa085, 0x0100, 0x78aa, - 0x0078, 0x1984, 0x1078, 0x1a06, 0x007c, 0x78a8, 0xa08c, 0x0e00, - 0x00c0, 0x198e, 0xa084, 0x0100, 0x00c0, 0x1990, 0x0078, 0x1956, - 0x1078, 0x19e2, 0x00c0, 0x1996, 0x1078, 0x1a06, 0x007c, 0x78a8, - 0xa084, 0x0100, 0x0040, 0x199e, 0x0078, 0x1956, 0x78ab, 0x0000, - 0x6710, 0x2011, 0x0001, 0x20a9, 0x0001, 0x6014, 0xa084, 0x00ff, - 0xa005, 0x0040, 0x19c1, 0x2011, 0x0001, 0xa7bc, 0xff00, 0x20a9, - 0x0020, 0xa08e, 0x0001, 0x0040, 0x19c1, 0x2039, 0x0000, 0x2011, - 0x0002, 0x20a9, 0x0100, 0xa08e, 0x0002, 0x0040, 0x19c1, 0x0078, - 0x19df, 0x1078, 0x1758, 0x2d00, 0x2091, 0x8000, 0x682b, 0x0000, - 0x682f, 0x0000, 0x6808, 0xa084, 0xffde, 0x680a, 0x2d00, 0xa080, - 0x0010, 0x2068, 0x2091, 0x8001, 0x0070, 0x19d8, 0x0078, 0x19c4, - 0x8211, 0x0040, 0x19df, 0x20a9, 0x0100, 0x0078, 0x19c4, 0x1078, - 0x173e, 0x007c, 0x78a0, 0xa06d, 0x00c0, 0x19ed, 0x2c00, 0x78a2, - 0x78a6, 0x609b, 0x0000, 0x0078, 0x19f9, 0x2c00, 0x689a, 0x609b, - 0x0000, 0x78a2, 0x2d00, 0x6002, 0x78a4, 0xad06, 0x00c0, 0x19f9, - 0x6002, 0x789c, 0x8001, 0x789e, 0x00c0, 0x1a05, 0x78a8, 0xa084, - 0x0000, 0x78aa, 0x78a4, 0x2060, 0xa006, 0x007c, 0xa02e, 0x2530, - 0x6118, 0xa184, 0x0060, 0x619e, 0x0040, 0x1a12, 0x0e7e, 0x1078, - 0x3199, 0x0e7f, 0x6592, 0x65a2, 0x6696, 0x66a6, 0x60ab, 0x0000, - 0x60af, 0x0000, 0x6710, 0x1078, 0x1758, 0x2091, 0x8000, 0x6808, - 0xa084, 0x0001, 0x0040, 0x1a34, 0x2091, 0x8001, 0x1078, 0x17ad, - 0x2091, 0x8000, 0x1078, 0x18a4, 0x2091, 0x8001, 0x78a3, 0x0000, - 0x78a7, 0x0000, 0x0078, 0x1a80, 0x6020, 0xa096, 0x0001, 0x00c0, - 0x1a3b, 0x8000, 0x6022, 0x6a10, 0x6814, 0x2091, 0x8001, 0xa202, - 0x0048, 0x1a4a, 0x0040, 0x1a4a, 0x2039, 0x0200, 0x1078, 0x1a81, - 0x0078, 0x1a80, 0x2c08, 0x2091, 0x8000, 0x6800, 0xa065, 0x0040, - 0x1a52, 0x6102, 0x6902, 0x00c0, 0x1a56, 0x6906, 0x2160, 0x6003, - 0x0000, 0x6810, 0x8000, 0x6812, 0x78b8, 0x8000, 0x78ba, 0x2091, - 0x8001, 0x6808, 0xa08c, 0x0040, 0x0040, 0x1a76, 0xa086, 0x0040, - 0x680a, 0x1078, 0x17bc, 0x017e, 0x007e, 0x6930, 0x2100, 0x810f, - 0xa105, 0x6832, 0x6934, 0x693a, 0x007f, 0x017f, 0x2091, 0x8000, - 0x1078, 0x1b49, 0x2091, 0x8001, 0x78a7, 0x0000, 0x78a3, 0x0000, - 0x007c, 0x6004, 0xa705, 0x6006, 0x2091, 0x8000, 0x1078, 0x18a4, - 0x2091, 0x8001, 0x78a4, 0xa065, 0x0040, 0x1a94, 0x6098, 0x78a6, - 0x609b, 0x0000, 0x0078, 0x1a84, 0x78a3, 0x0000, 0x78a7, 0x0000, - 0x007c, 0x7970, 0x7874, 0x8000, 0xa10a, 0x00c8, 0x1aa0, 0xa006, - 0x7876, 0x70d2, 0x7804, 0xa005, 0x0040, 0x1aae, 0x8001, 0x7806, - 0x00c0, 0x1aae, 0x0068, 0x1aae, 0x2091, 0x4080, 0x007c, 0x0068, - 0x1ac9, 0x2029, 0x0000, 0x786c, 0xa065, 0x0040, 0x1ac4, 0x1078, - 0x1aca, 0x0040, 0x1ac4, 0x057e, 0x1078, 0x1ae8, 0x057f, 0x00c0, - 0x1ac4, 0x8528, 0x0078, 0x1ab3, 0x85ff, 0x0040, 0x1ac9, 0x2091, - 0x4080, 0x007c, 0x2091, 0x8000, 0x7b84, 0x7988, 0x72d4, 0x0005, - 0x0005, 0x70d4, 0xa206, 0x00c0, 0x1ace, 0x2200, 0xa102, 0x00c0, - 0x1ade, 0x2300, 0x2091, 0x8001, 0xa005, 0x007c, 0x0048, 0x1ae4, - 0xa302, 0x2091, 0x8001, 0x007c, 0x8002, 0x2091, 0x8001, 0x007c, - 0x2091, 0x8000, 0x2071, 0x0020, 0x7004, 0xa005, 0x00c0, 0x1b3f, - 0x7008, 0x7208, 0xa206, 0x00c0, 0x1b3f, 0xa286, 0x0002, 0x00c0, - 0x1b3f, 0x2071, 0x0010, 0xa184, 0xff00, 0x0040, 0x1b08, 0x810f, - 0x810c, 0x810c, 0x8004, 0x8004, 0x8007, 0xa100, 0x0078, 0x1b0b, - 0x8107, 0x8004, 0x8004, 0x7a90, 0x7b8c, 0xa210, 0xa399, 0x0000, - 0x2009, 0x0018, 0x6024, 0xa005, 0x0040, 0x1b18, 0x2009, 0x0040, - 0x1078, 0x16d7, 0x0040, 0x1b31, 0x7894, 0x8000, 0x7896, 0xa086, - 0x0002, 0x00c0, 0x1b3f, 0x2091, 0x8000, 0x78af, 0x0003, 0x7897, - 0x0000, 0x7898, 0xa085, 0x0300, 0x789a, 0x2091, 0x8001, 0x0078, - 0x1b3f, 0x7897, 0x0000, 0x1078, 0x18ce, 0x7984, 0x7888, 0x8000, - 0xa10a, 0x00c8, 0x1b3c, 0xa006, 0x788a, 0x70d6, 0xa006, 0x2071, - 0x0010, 0x2091, 0x8001, 0x007c, 0x2009, 0x3868, 0x2091, 0x8000, - 0x200a, 0x0f7e, 0x2079, 0x0100, 0x2009, 0x3840, 0x2104, 0xa086, - 0x0000, 0x00c0, 0x1b62, 0x2009, 0x3812, 0x2104, 0xa005, 0x00c0, - 0x1b62, 0x7830, 0xa084, 0x00c0, 0x00c0, 0x1b62, 0x0018, 0x1b62, - 0x781b, 0x0044, 0x0f7f, 0x007c, 0x127e, 0x2091, 0x2300, 0x2071, - 0x3840, 0x2079, 0x0100, 0x2019, 0x305e, 0x20a1, 0x012b, 0x2304, - 0xa005, 0x0040, 0x1b7c, 0x789a, 0x8318, 0x23ac, 0x8318, 0x2398, - 0x53a6, 0x3318, 0x0078, 0x1b6f, 0x789b, 0x0020, 0x20a9, 0x0010, - 0x78af, 0x0000, 0x78af, 0x0220, 0x0070, 0x1b88, 0x0078, 0x1b80, - 0x7003, 0x0000, 0x1078, 0x1c87, 0x7004, 0xa084, 0x000f, 0xa085, - 0x6280, 0x7806, 0x780f, 0x9200, 0x7843, 0x00d8, 0x7853, 0x0080, - 0x780b, 0x0008, 0x7047, 0x387f, 0x7043, 0x0000, 0x127f, 0x2000, - 0x007c, 0xa18c, 0x000f, 0x2011, 0x0101, 0x2204, 0xa084, 0xfff0, - 0xa105, 0x2012, 0x1078, 0x1c87, 0x007c, 0x2011, 0x0101, 0x20a9, - 0x0009, 0x810b, 0x0070, 0x1bb6, 0x0078, 0x1bb1, 0xa18c, 0x0e00, - 0x2204, 0xa084, 0xf1ff, 0xa105, 0x2012, 0x007c, 0x2009, 0x0101, - 0x20a9, 0x0005, 0x8213, 0x0070, 0x1bc7, 0x0078, 0x1bc2, 0xa294, - 0x00e0, 0x2104, 0xa084, 0xff1f, 0xa205, 0x200a, 0x007c, 0x2011, - 0x0101, 0x20a9, 0x000c, 0x810b, 0x0070, 0x1bd8, 0x0078, 0x1bd3, - 0xa18c, 0xf000, 0x2204, 0xa084, 0x0fff, 0xa105, 0x2012, 0x007c, - 0x2011, 0x0102, 0x2204, 0xa084, 0xffcf, 0xa105, 0x2012, 0x007c, - 0x8103, 0x8003, 0xa080, 0x0020, 0x0c7e, 0x2061, 0x0100, 0x609a, - 0x62ac, 0x63ac, 0x0c7f, 0x007c, 0x8103, 0x8003, 0xa080, 0x0022, - 0x0c7e, 0x2061, 0x0100, 0x609a, 0x60a4, 0xa084, 0xffdf, 0x60ae, - 0x0c7f, 0x007c, 0x8103, 0x8003, 0xa080, 0x0022, 0x0c7e, 0x2061, - 0x0100, 0x609a, 0x60a4, 0xa085, 0x0020, 0x60ae, 0x0c7f, 0x007c, - 0x8103, 0x8003, 0xa080, 0x0020, 0x0c7e, 0x2061, 0x0100, 0x609a, - 0x60a4, 0x62ae, 0x2010, 0x60a4, 0x63ae, 0x2018, 0x0c7f, 0x007c, - 0x2091, 0x8000, 0x0c7e, 0x0e7e, 0x6818, 0xa005, 0x0040, 0x1c65, - 0x2061, 0x5c00, 0x1078, 0x1c6d, 0x0040, 0x1c53, 0x20a9, 0x0000, - 0x2061, 0x5b00, 0x0c7e, 0x1078, 0x1c6d, 0x0040, 0x1c3f, 0x0c7f, - 0x8c60, 0x0070, 0x1c3d, 0x0078, 0x1c32, 0x0078, 0x1c65, 0x007f, - 0xa082, 0x5b00, 0x2071, 0x3840, 0x70ba, 0x601c, 0xa085, 0x0800, - 0x601e, 0x71b6, 0x60a7, 0x0000, 0x2001, 0x0004, 0x70a2, 0x1078, - 0x1b44, 0x0078, 0x1c61, 0x2071, 0x3840, 0x601c, 0xa085, 0x0800, - 0x601e, 0x71b6, 0x60a7, 0x0000, 0x2001, 0x0006, 0x70a2, 0x1078, - 0x1b44, 0x2001, 0x0000, 0x0078, 0x1c67, 0x2001, 0x0001, 0x2091, - 0x8001, 0xa005, 0x0e7f, 0x0c7f, 0x007c, 0x2c04, 0xa005, 0x0040, - 0x1c84, 0x2060, 0x600c, 0xa306, 0x00c0, 0x1c81, 0x6008, 0xa206, - 0x00c0, 0x1c81, 0x6010, 0xa106, 0x00c0, 0x1c81, 0xa006, 0x0078, - 0x1c86, 0x6000, 0x0078, 0x1c6e, 0xa085, 0x0001, 0x007c, 0x2011, - 0x3841, 0x220c, 0xa18c, 0x000f, 0x2011, 0x013b, 0x2204, 0xa084, - 0x0100, 0x0040, 0x1c96, 0x2021, 0xff00, 0x2122, 0x007c, 0x0e7e, - 0x68e4, 0xa08c, 0x0020, 0x0040, 0x1ce5, 0xa084, 0x0006, 0x00c0, - 0x1ce5, 0x6010, 0x8007, 0xa084, 0x000f, 0x8003, 0x8003, 0x8003, - 0xa0f0, 0x3a80, 0x7004, 0xa084, 0x000a, 0x00c0, 0x1ce5, 0x7108, - 0xa194, 0xff00, 0x0040, 0x1ce5, 0xa18c, 0x00ff, 0x7104, 0xa084, - 0x0014, 0x00c0, 0x1cd2, 0x017e, 0x611c, 0xa18d, 0x0002, 0x611e, - 0x017f, 0xa085, 0x0014, 0x7006, 0x2001, 0x000c, 0xa106, 0x0040, - 0x1cce, 0x2100, 0x8003, 0x2008, 0x0078, 0x1ce2, 0x2009, 0x0019, - 0x0078, 0x1ce2, 0x2011, 0x0000, 0x7000, 0xa084, 0xdfff, 0x7002, - 0x7004, 0xa084, 0xffef, 0x7006, 0x017e, 0x611c, 0xa18d, 0x0002, - 0x611e, 0x017f, 0x2100, 0xa205, 0x700a, 0x0e7f, 0x007c, 0x0068, - 0x1ce7, 0x007e, 0x2071, 0x0000, 0x7018, 0xa084, 0x0001, 0x00c0, - 0x1cec, 0x007f, 0x2e08, 0x2071, 0x0010, 0x70ca, 0x007f, 0x70c6, - 0x70c3, 0x8002, 0x2071, 0x0000, 0x701b, 0x0001, 0x2091, 0x4080, - 0x007f, 0x2070, 0x007f, 0x0078, 0x1d03, 0x107e, 0x007e, 0x127e, - 0x2091, 0x2300, 0x7f3c, 0x7e58, 0x7c30, 0x7d38, 0xa594, 0x003f, - 0xa484, 0x4000, 0x0040, 0x1d1a, 0xa784, 0x007c, 0x00c0, 0x3022, - 0x1078, 0x1ce7, 0xa49c, 0x000f, 0xa382, 0x0004, 0x0050, 0x1d22, - 0x1078, 0x1ce7, 0x8507, 0xa084, 0x000f, 0x0079, 0x1d27, 0x21a1, - 0x2251, 0x2277, 0x24cf, 0x2787, 0x27cf, 0x2808, 0x2883, 0x28dd, - 0x2962, 0x1d4d, 0x1d37, 0x1fb8, 0x208d, 0x2766, 0x1d37, 0x1078, - 0x1ce7, 0x0018, 0x1d0a, 0x127f, 0x2091, 0x8001, 0x007f, 0x107f, - 0x007c, 0x7003, 0x0000, 0x703f, 0x0000, 0x7030, 0xa005, 0x0040, - 0x1d4b, 0x7033, 0x0000, 0x0018, 0x1d0a, 0x705c, 0xa005, 0x00c0, - 0x1df8, 0x70a0, 0xa084, 0x001f, 0x0079, 0x1d56, 0x1e18, 0x1d5e, - 0x1d6c, 0x1d8d, 0x1db3, 0x1ddf, 0x1ddd, 0x1d5e, 0x7808, 0xa084, - 0xfffd, 0x780a, 0x2009, 0x0046, 0x1078, 0x260f, 0x00c0, 0x1d6a, - 0x7003, 0x0004, 0x0078, 0x1d39, 0x1078, 0x2fe4, 0x00c0, 0x1d8b, - 0x70b4, 0x8007, 0x789b, 0x007e, 0x78aa, 0x789b, 0x0010, 0x78ab, - 0x000c, 0x789b, 0x0060, 0x78ab, 0x0001, 0x785b, 0x0004, 0x2009, - 0x00f7, 0x1078, 0x260d, 0x00c0, 0x1d8b, 0x7003, 0x0004, 0x70c3, - 0x000f, 0x7033, 0x3870, 0x0078, 0x1d39, 0x1078, 0x2fe4, 0x00c0, - 0x1db1, 0x71b4, 0x8107, 0x789b, 0x007e, 0x78aa, 0x789b, 0x0010, - 0xa18c, 0x0007, 0xa18d, 0x00c0, 0x79aa, 0x78ab, 0x0006, 0x789b, - 0x0060, 0x78ab, 0x0002, 0x785b, 0x0004, 0x2009, 0x00f7, 0x1078, - 0x260d, 0x00c0, 0x1db1, 0x7003, 0x0004, 0x70c3, 0x000f, 0x7033, - 0x3870, 0x0078, 0x1d39, 0x1078, 0x2fe4, 0x00c0, 0x1ddb, 0x71b4, - 0x8107, 0x789b, 0x007e, 0x78aa, 0x789b, 0x0010, 0xa18c, 0x0007, - 0xa18d, 0x00c0, 0x79aa, 0x78ab, 0x0020, 0x71b8, 0x79aa, 0x78ab, - 0x000d, 0x789b, 0x0060, 0x78ab, 0x0004, 0x785b, 0x0004, 0x2009, - 0x00f7, 0x1078, 0x260d, 0x00c0, 0x1ddb, 0x7003, 0x0004, 0x70c3, - 0x000f, 0x7033, 0x3870, 0x0078, 0x1d39, 0x0078, 0x1d8d, 0x1078, - 0x2fe4, 0x00c0, 0x1d39, 0x70bc, 0x2068, 0x789b, 0x0010, 0x6f10, - 0x1078, 0x2f11, 0x2c50, 0x6810, 0xa084, 0x001f, 0xa085, 0x0080, - 0x78aa, 0x6e18, 0x2041, 0x0001, 0x2001, 0x0004, 0x0078, 0x1f41, - 0x1078, 0x2fe4, 0x00c0, 0x1d39, 0x789b, 0x0010, 0x705c, 0x2068, - 0x6f10, 0x1078, 0x2f11, 0x2c50, 0x6008, 0xa085, 0x0010, 0x600a, - 0x6810, 0xa084, 0x001f, 0xa085, 0x0080, 0x78aa, 0x2031, 0x0020, - 0x2041, 0x0001, 0x1078, 0x304b, 0x2001, 0x0003, 0x0078, 0x1f2c, - 0x0018, 0x1d0a, 0x7440, 0xa485, 0x0000, 0x0040, 0x1e32, 0xa080, - 0x3880, 0x2030, 0x7144, 0x8108, 0xa12a, 0x0048, 0x1e29, 0x2009, - 0x3880, 0x2164, 0x6504, 0x85ff, 0x00c0, 0x1e3f, 0x8421, 0x00c0, - 0x1e23, 0x7146, 0x7003, 0x0000, 0x703f, 0x0000, 0x0078, 0x1d39, - 0x7640, 0xa6b0, 0x3880, 0x7144, 0x2600, 0x0078, 0x1e2e, 0x7146, - 0x2568, 0x2558, 0x753e, 0x2c50, 0x603c, 0xa085, 0x0000, 0x00c0, - 0x1e3c, 0x6708, 0x7736, 0xa784, 0x033f, 0x0040, 0x1e75, 0xa784, - 0x0021, 0x00c0, 0x1e3c, 0xa784, 0x0002, 0x0040, 0x1e5e, 0xa784, - 0x0004, 0x0040, 0x1e3c, 0xa7bc, 0xfffb, 0x670a, 0xa784, 0x0008, - 0x00c0, 0x1e3c, 0xa784, 0x0010, 0x00c0, 0x1e3c, 0xa184, 0x0200, - 0x00c0, 0x1e3c, 0xa784, 0x0100, 0x0040, 0x1e75, 0x6018, 0xa005, - 0x00c0, 0x1e3c, 0xa7bc, 0xfeff, 0x670a, 0x681f, 0x0000, 0x6e18, - 0xa684, 0x000e, 0x6118, 0x0040, 0x1e85, 0x601c, 0xa102, 0x0048, - 0x1e92, 0x0040, 0x1e92, 0x0078, 0x1e38, 0x81ff, 0x0040, 0x1e92, - 0x6828, 0x8007, 0xa084, 0x00ff, 0xa082, 0x0003, 0x0040, 0x1e92, - 0x00c0, 0x1e38, 0xa184, 0x0400, 0x00c0, 0x1ea1, 0x6130, 0xa18c, - 0xff00, 0x810f, 0x6030, 0xa084, 0xff00, 0xa105, 0x6032, 0x0078, - 0x1ea5, 0x6034, 0x603a, 0xa7bc, 0xfbff, 0xa784, 0x0080, 0x00c0, - 0x1eab, 0x700c, 0x6022, 0xa7bc, 0xff7f, 0x670a, 0x6b10, 0x8307, - 0xa084, 0x000f, 0x8003, 0x8003, 0x8003, 0xa080, 0x3a80, 0x2060, - 0x2048, 0x704a, 0x6000, 0x704e, 0x6004, 0x7052, 0x2a60, 0x0018, - 0x1d0a, 0x789b, 0x0010, 0xa046, 0x1078, 0x2fe4, 0x00c0, 0x1d39, - 0x6b10, 0xa39c, 0x001f, 0xa39d, 0x00c0, 0x704c, 0xa084, 0x8000, - 0x0040, 0x1ed6, 0xa684, 0x0001, 0x0040, 0x1ed8, 0xa39c, 0xffbf, - 0xa684, 0x0010, 0x0040, 0x1ede, 0xa39d, 0x0020, 0x7baa, 0x8840, - 0xa684, 0x000e, 0x00c0, 0x1ee9, 0xa7bd, 0x0010, 0x670a, 0x0078, - 0x1f2a, 0x714c, 0xa18c, 0x0800, 0x0040, 0x2b74, 0x2011, 0x0021, - 0x8004, 0x8004, 0x0048, 0x1f00, 0x2011, 0x0022, 0x8004, 0x0048, - 0x1f00, 0x2011, 0x0020, 0x8004, 0x0048, 0x1f00, 0x0040, 0x1f2a, - 0x7aaa, 0x8840, 0x1078, 0x2ffd, 0x6a10, 0x610c, 0x8108, 0xa18c, - 0x00ff, 0xa1e0, 0x5b00, 0x2c64, 0x8cff, 0x0040, 0x1f21, 0x6010, - 0xa206, 0x00c0, 0x1f0b, 0x60b4, 0x8001, 0x60b6, 0x00c0, 0x1f06, - 0x0c7e, 0x2a60, 0x6008, 0xa085, 0x0100, 0x600a, 0x0c7f, 0x0078, - 0x1e18, 0x1078, 0x2fe4, 0x00c0, 0x1d39, 0x2a60, 0x610e, 0x79aa, - 0x8840, 0x712e, 0x2001, 0x0001, 0x007e, 0x7150, 0xa184, 0x0018, - 0x0040, 0x1f40, 0xa184, 0x0010, 0x0040, 0x1f3a, 0x1078, 0x2d3d, - 0x00c0, 0x1f40, 0xa184, 0x0008, 0x0040, 0x1f40, 0x1078, 0x2c58, - 0x007f, 0x7002, 0xa68c, 0x0060, 0x88ff, 0x0040, 0x1f49, 0xa18d, - 0x0004, 0x795a, 0x69b2, 0x789b, 0x0060, 0x2800, 0x78aa, 0x789b, - 0x0061, 0x6814, 0xa085, 0x8000, 0x6816, 0x78aa, 0x157e, 0x137e, - 0x147e, 0x20a1, 0x012c, 0x789b, 0x0000, 0x8000, 0x80ac, 0xad80, - 0x000a, 0x2098, 0x53a6, 0x147f, 0x137f, 0x157f, 0x6810, 0x8007, - 0x789b, 0x007e, 0x78aa, 0x6d90, 0x7dd6, 0x7dde, 0x6e94, 0x7ed2, - 0x7eda, 0x7830, 0xa084, 0x00c0, 0x00c0, 0x1f78, 0x0098, 0x1f80, - 0x6008, 0xa084, 0xffef, 0x600a, 0x1078, 0x2ffd, 0x0078, 0x1d41, - 0x7200, 0xa284, 0x0007, 0xa086, 0x0001, 0x00c0, 0x1f8d, 0x781b, - 0x0049, 0x1078, 0x2ffd, 0x0078, 0x1f9e, 0x6ab0, 0xa295, 0x2000, - 0x7a5a, 0x781b, 0x0049, 0x1078, 0x2ffd, 0x7200, 0x2500, 0xa605, - 0x0040, 0x1f9e, 0xa284, 0x0007, 0x1079, 0x1fae, 0xad80, 0x0008, - 0x7032, 0xa284, 0x0007, 0xa086, 0x0001, 0x00c0, 0x1fac, 0x6018, - 0x8000, 0x601a, 0x1078, 0x2b4b, 0x0078, 0x1d39, 0x1fb6, 0x3376, - 0x3376, 0x3365, 0x3376, 0x1fb6, 0x1fb6, 0x1fb6, 0x1078, 0x1ce7, - 0x7808, 0xa084, 0xfffd, 0x780a, 0x0f7e, 0x2079, 0x3800, 0x7898, - 0x0f7f, 0xa084, 0x0001, 0x0040, 0x1fde, 0x70a0, 0xa086, 0x0001, - 0x00c0, 0x1fcd, 0x70a2, 0x0078, 0x2071, 0x70a0, 0xa086, 0x0005, - 0x00c0, 0x1fdc, 0x70bc, 0x2068, 0x6817, 0x0004, 0x6813, 0x0000, - 0x681c, 0xa085, 0x0008, 0x681e, 0x70a3, 0x0000, 0x157e, 0x2011, - 0x0004, 0x71a0, 0xa186, 0x0001, 0x0040, 0x2000, 0xa186, 0x0007, - 0x00c0, 0x1ff0, 0x2009, 0x382b, 0x200b, 0x0005, 0x0078, 0x2000, - 0x2009, 0x3813, 0x2104, 0x2009, 0x3812, 0x200a, 0x2009, 0x382b, - 0x200b, 0x0001, 0x70a3, 0x0000, 0x70a7, 0x0001, 0x0078, 0x2002, - 0x70a3, 0x0000, 0x1078, 0x314d, 0x20a9, 0x0010, 0x2039, 0x0000, - 0x1078, 0x2e16, 0xa7b8, 0x0100, 0x0070, 0x2010, 0x0078, 0x2008, - 0x7000, 0x2020, 0x0079, 0x2014, 0x2042, 0x202b, 0x202b, 0x201e, - 0x2042, 0x2042, 0x201c, 0x201c, 0x1078, 0x1ce7, 0x2021, 0x3857, - 0x2404, 0xa005, 0x0040, 0x202b, 0xad06, 0x00c0, 0x202b, 0x6800, - 0x2022, 0x0078, 0x203b, 0x681c, 0xa084, 0x0001, 0x00c0, 0x2037, - 0x6f10, 0x1078, 0x2f11, 0x1078, 0x2b06, 0x0078, 0x203b, 0x7054, - 0x2060, 0x6800, 0x6002, 0x6a16, 0x681c, 0xa085, 0x0008, 0x681e, - 0x1078, 0x18b6, 0x2021, 0x5c00, 0x1078, 0x2077, 0x2021, 0x3857, - 0x1078, 0x2077, 0x20a9, 0x0000, 0x2021, 0x5b00, 0x1078, 0x2077, - 0x8420, 0x0070, 0x2055, 0x0078, 0x204e, 0x1078, 0x2b55, 0x2061, - 0x3b00, 0x2021, 0x0002, 0x20a9, 0x0100, 0x6018, 0x6110, 0xa102, - 0x6012, 0x601b, 0x0000, 0xace0, 0x0010, 0x0070, 0x2069, 0x0078, - 0x205d, 0x2009, 0x382f, 0x200b, 0x0000, 0x8421, 0x00c0, 0x205b, - 0x157f, 0x7003, 0x0000, 0x703f, 0x0000, 0x0078, 0x1d39, 0x047e, - 0x2404, 0xa005, 0x0040, 0x2089, 0x2068, 0x6800, 0x007e, 0x6a16, - 0x681c, 0xa085, 0x0008, 0x681e, 0x1078, 0x18b6, 0x007f, 0x0078, - 0x2079, 0x047f, 0x2023, 0x0000, 0x007c, 0xa282, 0x0003, 0x0050, - 0x2093, 0x1078, 0x1ce7, 0x2300, 0x0079, 0x2096, 0x2099, 0x210c, - 0x211a, 0xa282, 0x0002, 0x0040, 0x209f, 0x1078, 0x1ce7, 0x70a0, - 0x70a3, 0x0000, 0x70c3, 0x0000, 0x0079, 0x20a6, 0x20ae, 0x20ae, - 0x20b0, 0x20e4, 0x2b7a, 0x20ae, 0x20e4, 0x20ae, 0x1078, 0x1ce7, - 0x77b4, 0x1078, 0x2e16, 0x77b4, 0xa7bc, 0x0f00, 0x1078, 0x2f11, - 0x6018, 0xa005, 0x0040, 0x20db, 0x2021, 0x5c00, 0x2009, 0x0004, - 0x2011, 0x0010, 0x1078, 0x216a, 0x0040, 0x20db, 0x157e, 0x20a9, - 0x0000, 0x2021, 0x5b00, 0x047e, 0x2009, 0x0004, 0x2011, 0x0010, - 0x1078, 0x216a, 0x047f, 0x0040, 0x20da, 0x8420, 0x0070, 0x20da, - 0x0078, 0x20cb, 0x157f, 0x8738, 0xa784, 0x001f, 0x00c0, 0x20b6, - 0x0078, 0x1d41, 0x0078, 0x1d41, 0x77b4, 0x1078, 0x2f11, 0x6018, - 0xa005, 0x0040, 0x210a, 0x2021, 0x5c00, 0x2009, 0x0005, 0x2011, - 0x0020, 0x1078, 0x216a, 0x0040, 0x210a, 0x157e, 0x20a9, 0x0000, - 0x2021, 0x5b00, 0x047e, 0x2009, 0x0005, 0x2011, 0x0020, 0x1078, - 0x216a, 0x047f, 0x0040, 0x2109, 0x8420, 0x0070, 0x2109, 0x0078, - 0x20fa, 0x157f, 0x0078, 0x1d41, 0x2200, 0x0079, 0x210f, 0x2112, - 0x2114, 0x2114, 0x1078, 0x1ce7, 0x70a3, 0x0000, 0x70a7, 0x0001, - 0x0078, 0x1d39, 0x2200, 0x0079, 0x211d, 0x2122, 0x2114, 0x2120, - 0x1078, 0x1ce7, 0x1078, 0x261c, 0x70a0, 0xa086, 0x0002, 0x00c0, - 0x2159, 0x77b4, 0x1078, 0x2e16, 0x77b4, 0xa7bc, 0x0f00, 0x1078, - 0x2f11, 0x6018, 0xa005, 0x0040, 0x2154, 0x2021, 0x5c00, 0x2009, - 0x0005, 0x2011, 0x0020, 0x1078, 0x216a, 0x0040, 0x2154, 0x157e, - 0x20a9, 0x0000, 0x2021, 0x5b00, 0x047e, 0x2009, 0x0005, 0x2011, - 0x0020, 0x1078, 0x216a, 0x047f, 0x0040, 0x2153, 0x8420, 0x0070, - 0x2153, 0x0078, 0x2144, 0x157f, 0x8738, 0xa784, 0x001f, 0x00c0, - 0x212f, 0x7000, 0xa086, 0x0001, 0x00c0, 0x2acd, 0x1078, 0x2b1e, - 0x6008, 0xa084, 0xffef, 0x600a, 0x1078, 0x2ac0, 0x0040, 0x2acd, - 0x0078, 0x1e18, 0x2404, 0xa005, 0x0040, 0x219d, 0x2068, 0x2d04, - 0x007e, 0x6810, 0xa706, 0x0040, 0x2179, 0x2d20, 0x007f, 0x0078, - 0x216b, 0x007f, 0x2022, 0x6916, 0x6814, 0xa086, 0x0050, 0x00c0, - 0x218c, 0x6817, 0x0006, 0x2200, 0xa086, 0x0010, 0x00c0, 0x218c, - 0x681c, 0xa084, 0xffef, 0x681e, 0x681c, 0xa205, 0x681e, 0x1078, - 0x18b6, 0x1078, 0x2b27, 0x6010, 0x8001, 0x6012, 0x6008, 0xa084, - 0xffef, 0x600a, 0x1078, 0x2b1e, 0x007c, 0xa085, 0x0001, 0x0078, - 0x219c, 0x2300, 0x0079, 0x21a4, 0x21a9, 0x21a7, 0x21ec, 0x1078, - 0x1ce7, 0x78e4, 0xa005, 0x00d0, 0x21cc, 0x0018, 0x21cc, 0x2008, - 0xa084, 0x0030, 0x00c0, 0x21b8, 0x781b, 0x0049, 0x0078, 0x1d39, - 0x78ec, 0xa084, 0x0003, 0x0040, 0x21b4, 0x2100, 0xa084, 0x0007, - 0x0079, 0x21c2, 0x21da, 0x21e0, 0x21d4, 0x21ca, 0x2fde, 0x2fde, - 0x21ca, 0x21e6, 0x1078, 0x1ce7, 0x7000, 0xa005, 0x0040, 0x1d41, - 0x2001, 0x0003, 0x0078, 0x24e3, 0x1078, 0x2df9, 0x781b, 0x0055, - 0x0078, 0x1d39, 0x1078, 0x2df9, 0x781b, 0x00dc, 0x0078, 0x1d39, - 0x1078, 0x2df9, 0x781b, 0x00e3, 0x0078, 0x1d39, 0x1078, 0x2df9, - 0x781b, 0x009d, 0x0078, 0x1d39, 0xa584, 0x000f, 0x00c0, 0x2216, - 0x1078, 0x261c, 0x7000, 0x0079, 0x21f5, 0x21fd, 0x220a, 0x21fd, - 0x2acd, 0x21ff, 0x2acd, 0x21fd, 0x21fd, 0x1078, 0x1ce7, 0x71a0, - 0x70a3, 0x0000, 0xa186, 0x0004, 0x00c0, 0x2208, 0x0078, 0x2b7a, - 0x0078, 0x2acd, 0x1078, 0x2b1e, 0x6008, 0xa084, 0xffef, 0x600a, - 0x1078, 0x2ac0, 0x0040, 0x2acd, 0x0078, 0x1e18, 0x78e4, 0xa005, - 0x00d0, 0x21cc, 0x0018, 0x21cc, 0x2008, 0xa084, 0x0030, 0x00c0, - 0x2225, 0x781b, 0x0049, 0x0078, 0x1d39, 0x78ec, 0xa084, 0x0003, - 0x0040, 0x2221, 0x2100, 0xa184, 0x0007, 0x0079, 0x222f, 0x223f, - 0x2245, 0x2239, 0x2237, 0x2fde, 0x2fde, 0x2237, 0x2fd6, 0x1078, - 0x1ce7, 0x1078, 0x2e01, 0x781b, 0x0055, 0x0078, 0x1d39, 0x1078, - 0x2e01, 0x781b, 0x00dc, 0x0078, 0x1d39, 0x1078, 0x2e01, 0x781b, - 0x00e3, 0x0078, 0x1d39, 0x1078, 0x2e01, 0x781b, 0x009d, 0x0078, - 0x1d39, 0x2300, 0x0079, 0x2254, 0x2259, 0x2257, 0x225b, 0x1078, - 0x1ce7, 0x0078, 0x2883, 0x6817, 0x0008, 0x78a3, 0x0000, 0x79e4, - 0xa184, 0x0030, 0x0040, 0x2883, 0x78ec, 0xa084, 0x0003, 0x0040, - 0x2883, 0xa184, 0x0007, 0x0079, 0x226d, 0x21da, 0x21e0, 0x21d4, - 0x2fb6, 0x2fde, 0x2fde, 0x2275, 0x2fd6, 0x1078, 0x1ce7, 0xa282, - 0x0005, 0x0050, 0x227d, 0x1078, 0x1ce7, 0x2300, 0x0079, 0x2280, - 0x2283, 0x24b7, 0x24c3, 0x2200, 0x0079, 0x2286, 0x228b, 0x228d, - 0x22a0, 0x228b, 0x249c, 0x1078, 0x1ce7, 0x789b, 0x0018, 0x78a8, - 0xa084, 0x00ff, 0xa082, 0x0020, 0x0048, 0x2dda, 0xa08a, 0x0004, - 0x00c8, 0x2dda, 0x0079, 0x229c, 0x2dda, 0x2dda, 0x2dda, 0x2d7c, - 0x789b, 0x0018, 0x79a8, 0xa184, 0x0080, 0x0040, 0x22b5, 0xa184, - 0x0018, 0x0040, 0x22b1, 0x0078, 0x2dda, 0x7000, 0xa005, 0x00c0, - 0x22ab, 0x2011, 0x0003, 0x0078, 0x2970, 0xa184, 0x00ff, 0xa08c, - 0x0080, 0x0040, 0x22e9, 0x7000, 0xa086, 0x0001, 0x00c0, 0x22c8, - 0x1078, 0x2b1e, 0x1078, 0x314d, 0x7034, 0x600a, 0x0078, 0x22cd, - 0x7000, 0xa086, 0x0003, 0x0040, 0x22c2, 0x7003, 0x0005, 0x2001, - 0x5c10, 0x2068, 0x703e, 0x7032, 0x157e, 0x20a9, 0x002f, 0x2003, - 0x0000, 0x8000, 0x0070, 0x22de, 0x0078, 0x22d7, 0x157f, 0x6813, - 0x0000, 0x68b3, 0x0700, 0x681f, 0x0800, 0x6823, 0x0003, 0x0078, - 0x2dda, 0xa08a, 0x0010, 0x00c8, 0x2dda, 0x0079, 0x22ef, 0x2301, - 0x22ff, 0x2317, 0x2319, 0x23ab, 0x2dda, 0x2dda, 0x23ad, 0x2dda, - 0x2dda, 0x2498, 0x2498, 0x2dda, 0x2dda, 0x2dda, 0x249a, 0x1078, - 0x1ce7, 0xa684, 0x1000, 0x0040, 0x230e, 0x2001, 0x0300, 0x8000, - 0x8000, 0x783a, 0x781b, 0x009a, 0x0078, 0x1d39, 0x6814, 0xa084, - 0x8000, 0x0040, 0x2315, 0x6817, 0x0003, 0x0078, 0x2fb6, 0x1078, - 0x1ce7, 0x691c, 0x691e, 0xa684, 0x1800, 0x00c0, 0x2333, 0x681c, - 0xa084, 0x0001, 0x00c0, 0x233b, 0x6814, 0xa086, 0x0008, 0x00c0, - 0x232b, 0x6817, 0x0000, 0xa684, 0x0400, 0x0040, 0x23a7, 0x781b, - 0x0058, 0x0078, 0x1d39, 0xa684, 0x1000, 0x0040, 0x233b, 0x781b, - 0x0058, 0x0078, 0x1d39, 0xa684, 0x0060, 0x0040, 0x23a3, 0xa684, - 0x0800, 0x0040, 0x23a3, 0xa684, 0x8000, 0x00c0, 0x2349, 0x0078, - 0x2363, 0xa6b4, 0x7fff, 0x7e5a, 0x6eb2, 0x789b, 0x0074, 0x7aac, - 0x79ac, 0x78ac, 0x801b, 0x00c8, 0x2356, 0x8000, 0xa084, 0x003f, - 0xa108, 0xa291, 0x0000, 0x6b94, 0x2100, 0xa302, 0x68ae, 0x6b90, - 0x2200, 0xa303, 0x68aa, 0xa684, 0x4000, 0x0040, 0x236b, 0xa6b4, - 0xbfff, 0x7e5a, 0x6eb2, 0x7000, 0xa086, 0x0003, 0x00c0, 0x2378, - 0x1078, 0x31c0, 0x1078, 0x3365, 0x781b, 0x0067, 0x0078, 0x1d39, - 0xa006, 0x1078, 0x3414, 0x6aac, 0x69a8, 0x6c94, 0x6b90, 0x2200, - 0xa105, 0x0040, 0x2387, 0x2200, 0xa422, 0x2100, 0xa31b, 0x7cd2, - 0x7bd6, 0x2300, 0xa405, 0x00c0, 0x2395, 0xa6b5, 0x4000, 0x7e5a, - 0x6eb2, 0x781b, 0x0067, 0x0078, 0x1d39, 0x781b, 0x0067, 0x2200, - 0xa115, 0x00c0, 0x239f, 0x1078, 0x3376, 0x0078, 0x1d39, 0x1078, - 0x339d, 0x0078, 0x1d39, 0x781b, 0x006a, 0x0078, 0x1d39, 0x781b, - 0x0058, 0x0078, 0x1d39, 0x1078, 0x1ce7, 0x0078, 0x240a, 0x691c, - 0xa184, 0x0100, 0x0040, 0x23c5, 0xa18c, 0xfeff, 0x691e, 0x0c7e, - 0x7048, 0x2060, 0x6000, 0xa084, 0xefff, 0x6002, 0x6004, 0xa084, - 0xfff5, 0x6006, 0x0c7f, 0x0078, 0x23f9, 0xa184, 0x0200, 0x0040, - 0x23f9, 0xa18c, 0xfdff, 0x691e, 0x0c7e, 0x7048, 0x2060, 0x6000, - 0xa084, 0xdfff, 0x6002, 0x6004, 0xa084, 0xffef, 0x6006, 0x2008, - 0x2c48, 0x0c7f, 0xa184, 0x0008, 0x0040, 0x23f9, 0x1078, 0x2f0d, - 0x1078, 0x2c58, 0x88ff, 0x0040, 0x23f9, 0x789b, 0x0060, 0x2800, - 0x78aa, 0x7e58, 0xa6b5, 0x0004, 0x7e5a, 0xa684, 0x0400, 0x00c0, - 0x23f5, 0x781b, 0x0055, 0x0078, 0x1d39, 0x781b, 0x0069, 0x0078, - 0x1d39, 0x7e58, 0xa684, 0x0400, 0x00c0, 0x2402, 0x781b, 0x0058, - 0x0078, 0x1d39, 0x781b, 0x006a, 0x0078, 0x1d39, 0x0078, 0x2de0, - 0x0078, 0x2de0, 0x2019, 0x0000, 0x7990, 0xa18c, 0x0007, 0x0040, - 0x2408, 0x789b, 0x0010, 0x78a8, 0xa094, 0x00ff, 0xa286, 0x0001, - 0x00c0, 0x242d, 0x2300, 0x7ca8, 0xa400, 0x2018, 0xa102, 0x0040, - 0x2425, 0x0048, 0x2425, 0x0078, 0x2427, 0x0078, 0x23af, 0x24a8, - 0x7aa8, 0x00f0, 0x2427, 0x0078, 0x2413, 0xa284, 0x00f0, 0xa086, - 0x0020, 0x00c0, 0x2489, 0x8318, 0x8318, 0x2300, 0xa102, 0x0040, - 0x243d, 0x0048, 0x243d, 0x0078, 0x2486, 0xa286, 0x0023, 0x0040, - 0x2408, 0x6818, 0xa084, 0xfff1, 0x681a, 0x7e58, 0xa684, 0xfff1, - 0xa085, 0x0010, 0x2030, 0x7e5a, 0x6008, 0xa085, 0x0010, 0x600a, - 0x0c7e, 0x7048, 0x2060, 0x6004, 0x2008, 0x2c48, 0x0c7f, 0xa184, - 0x0010, 0x0040, 0x2461, 0x1078, 0x2f0d, 0x1078, 0x2d3d, 0x0078, - 0x2470, 0x0c7e, 0x7048, 0x2060, 0x6004, 0x2008, 0x2c48, 0x0c7f, - 0xa184, 0x0008, 0x0040, 0x23f9, 0x1078, 0x2f0d, 0x1078, 0x2c58, - 0x88ff, 0x0040, 0x23f9, 0x789b, 0x0060, 0x2800, 0x78aa, 0xa6b5, - 0x0004, 0x7e5a, 0xa684, 0x0400, 0x00c0, 0x2482, 0x781b, 0x0055, - 0x0078, 0x1d39, 0x781b, 0x0069, 0x0078, 0x1d39, 0x7aa8, 0x0078, - 0x2413, 0x8318, 0x2300, 0xa102, 0x0040, 0x2492, 0x0048, 0x2492, - 0x0078, 0x2413, 0xa284, 0x0080, 0x00c0, 0x2de6, 0x0078, 0x2de0, - 0x0078, 0x2de6, 0x0078, 0x2dda, 0x789b, 0x0018, 0x78a8, 0xa084, - 0x00ff, 0xa08e, 0x0001, 0x0040, 0x24a7, 0x1078, 0x1ce7, 0x7aa8, - 0xa294, 0x00ff, 0x78a8, 0xa084, 0x00ff, 0xa08a, 0x0004, 0x00c8, - 0x2dda, 0x0079, 0x24b3, 0x2dda, 0x2bab, 0x2dda, 0x2cd8, 0xa282, - 0x0000, 0x00c0, 0x24bd, 0x1078, 0x1ce7, 0x1078, 0x2df9, 0x781b, - 0x0069, 0x0078, 0x1d39, 0xa282, 0x0003, 0x00c0, 0x24c9, 0x1078, - 0x1ce7, 0x1078, 0x2e09, 0x781b, 0x0069, 0x0078, 0x1d39, 0xa282, - 0x0004, 0x0050, 0x24d5, 0x1078, 0x1ce7, 0x2300, 0x0079, 0x24d8, - 0x24db, 0x25c6, 0x25f7, 0xa286, 0x0003, 0x0040, 0x24e1, 0x1078, - 0x1ce7, 0x2001, 0x0000, 0x703a, 0x7000, 0xa084, 0x0007, 0x0079, - 0x24e9, 0x24f1, 0x24f3, 0x24f3, 0x2703, 0x274c, 0x26cd, 0x24f1, - 0x24f1, 0x1078, 0x1ce7, 0xa684, 0x1000, 0x00c0, 0x24fb, 0x1078, - 0x314d, 0x0040, 0x25a0, 0x7868, 0xa08c, 0x00ff, 0x0040, 0x2557, - 0xa186, 0x0008, 0x00c0, 0x2512, 0x6008, 0xa084, 0xffef, 0x600a, - 0x1078, 0x2ac0, 0x0040, 0x2557, 0x1078, 0x2b1e, 0x1078, 0x314d, - 0x0078, 0x253e, 0xa186, 0x0028, 0x00c0, 0x2557, 0x1078, 0x314d, - 0x6008, 0xa084, 0xffef, 0x600a, 0x1078, 0x2b34, 0x6018, 0xa005, - 0x0040, 0x253e, 0x8001, 0x601a, 0xa005, 0x0040, 0x2534, 0x8001, - 0xa005, 0x0040, 0x2534, 0x601e, 0x0078, 0x253e, 0x6813, 0x0028, - 0x6817, 0x0000, 0x0078, 0x25b5, 0x6030, 0xa084, 0x00ff, 0xa005, - 0x0040, 0x252e, 0x6008, 0xa085, 0x0200, 0x600a, 0x681c, 0xa084, - 0x0001, 0x0040, 0x1d41, 0x681c, 0xa084, 0xfffe, 0x681e, 0x7054, - 0x0c7e, 0x2060, 0x6800, 0x6002, 0x0c7f, 0x6004, 0x6802, 0xa005, - 0x2d00, 0x00c0, 0x2554, 0x6002, 0x6006, 0x0078, 0x1d41, 0x017e, - 0x1078, 0x261c, 0x017f, 0xa684, 0xdf00, 0x681a, 0x6827, 0x0000, - 0x6f10, 0x81ff, 0x0040, 0x25a0, 0xa186, 0x0002, 0x00c0, 0x2598, - 0xa684, 0x0800, 0x00c0, 0x2574, 0xa684, 0x0060, 0x0040, 0x2574, - 0x78d8, 0x7adc, 0x682e, 0x6a2a, 0x8717, 0xa294, 0x000f, 0x8213, - 0x8213, 0x8213, 0xa290, 0x3a80, 0xa290, 0x0000, 0x221c, 0xa384, - 0x0100, 0x00c0, 0x2585, 0x0078, 0x258b, 0x8210, 0x2204, 0xa085, - 0x0018, 0x2012, 0x8211, 0xa384, 0x0400, 0x0040, 0x2598, 0x689c, - 0xa084, 0x0100, 0x00c0, 0x2598, 0x1078, 0x268c, 0x0078, 0x1d41, - 0xa186, 0x0018, 0x0040, 0x25a0, 0xa186, 0x0014, 0x0040, 0x1d41, - 0x6912, 0x6814, 0xa084, 0x8000, 0x0040, 0x25a8, 0x7038, 0x6816, - 0xa68c, 0xdf00, 0x691a, 0x1078, 0x2b0d, 0x1078, 0x2b1e, 0x00c0, - 0x25b5, 0x6008, 0xa084, 0xffef, 0x600a, 0x681c, 0xa084, 0x0001, - 0x00c0, 0x25be, 0x1078, 0x2b06, 0x0078, 0x25c2, 0x7054, 0x2060, - 0x6800, 0x6002, 0x1078, 0x18b6, 0x0078, 0x1d41, 0xa282, 0x0004, - 0x0048, 0x25cc, 0x1078, 0x1ce7, 0x2200, 0x0079, 0x25cf, 0x25d3, - 0x25d5, 0x25e2, 0x25d5, 0x1078, 0x1ce7, 0x7000, 0xa086, 0x0005, - 0x0040, 0x25de, 0x1078, 0x2df9, 0x781b, 0x0069, 0x781b, 0x006a, - 0x0078, 0x1d39, 0x7890, 0x8007, 0x8001, 0xa084, 0x0007, 0xa080, - 0x0018, 0x789a, 0x79a8, 0xa18c, 0x00ff, 0xa186, 0x0003, 0x0040, - 0x25f3, 0x0078, 0x2dda, 0x781b, 0x006a, 0x0078, 0x1d39, 0x681c, - 0xa085, 0x0004, 0x681e, 0x82ff, 0x00c0, 0x2602, 0x1078, 0x2df9, - 0x0078, 0x2609, 0x8211, 0x0040, 0x2607, 0x1078, 0x1ce7, 0x1078, - 0x2e09, 0x781b, 0x0069, 0x0078, 0x1d39, 0x1078, 0x2ffd, 0x7830, - 0xa084, 0x00c0, 0x00c0, 0x2619, 0x0018, 0x2619, 0x791a, 0xa006, - 0x007c, 0xa085, 0x0001, 0x007c, 0xa684, 0x0060, 0x00c0, 0x2626, - 0x682f, 0x0000, 0x682b, 0x0000, 0x0078, 0x268b, 0xa684, 0x0800, - 0x00c0, 0x2635, 0x68b0, 0xa084, 0x4800, 0xa635, 0xa684, 0x0800, - 0x00c0, 0x2635, 0x1078, 0x314d, 0x007c, 0xa684, 0x0020, 0x0040, - 0x265f, 0x78d0, 0x8003, 0x00c8, 0x2643, 0xa006, 0x1078, 0x3414, - 0x78d4, 0x1078, 0x3479, 0xa684, 0x4000, 0x0040, 0x264d, 0x682f, - 0x0000, 0x682b, 0x0000, 0x0078, 0x2632, 0x68b0, 0xa084, 0x4800, - 0xa635, 0xa684, 0x4000, 0x00c0, 0x2647, 0x7038, 0xa005, 0x00c0, - 0x2659, 0x79d8, 0x7adc, 0x692e, 0x6a2a, 0x0078, 0x2632, 0xa684, - 0x4000, 0x0040, 0x2669, 0x682f, 0x0000, 0x682b, 0x0000, 0x0078, - 0x2632, 0x68b0, 0xa084, 0x4800, 0xa635, 0xa684, 0x4000, 0x00c0, - 0x2663, 0x7038, 0xa005, 0x00c0, 0x2675, 0x79d8, 0x7adc, 0x78d0, - 0x80f3, 0x00c8, 0x267c, 0x8000, 0xa084, 0x003f, 0xa108, 0xa291, - 0x0000, 0x692e, 0x6a2a, 0x2100, 0xa205, 0x00c0, 0x2689, 0x0078, - 0x2632, 0x1078, 0x3414, 0x007c, 0xa384, 0x0200, 0x0040, 0x2694, - 0x6008, 0xa085, 0x0002, 0x600a, 0x6817, 0x0006, 0x6a28, 0x692c, - 0x6a3a, 0x693e, 0x682b, 0x0300, 0x682f, 0x0000, 0x6833, 0x2000, - 0x6893, 0x0000, 0x6897, 0x0020, 0x7000, 0x0079, 0x26a7, 0x26af, - 0x26b1, 0x26ba, 0x26af, 0x26af, 0x26af, 0x26af, 0x26af, 0x1078, - 0x1ce7, 0x681c, 0xa084, 0x0001, 0x00c0, 0x26ba, 0x1078, 0x2b06, - 0x0078, 0x26c0, 0x7054, 0x2c50, 0x2060, 0x6800, 0x6002, 0x2a60, - 0x2021, 0x3857, 0x2404, 0xa005, 0x0040, 0x26c9, 0x2020, 0x0078, - 0x26c2, 0x2d22, 0x206b, 0x0000, 0x007c, 0x77b4, 0x1078, 0x2e16, - 0xa7bc, 0x0f00, 0x1078, 0x2f11, 0x6018, 0xa005, 0x0040, 0x26fc, - 0x0d7e, 0x2001, 0x5c10, 0x2068, 0x0d7f, 0x2021, 0x5c00, 0x2009, - 0x0004, 0x2011, 0x0010, 0x1078, 0x216a, 0x0040, 0x26fc, 0x157e, - 0x20a9, 0x0000, 0x2021, 0x5b00, 0x047e, 0x2009, 0x0004, 0x2011, - 0x0010, 0x1078, 0x216a, 0x047f, 0x0040, 0x26fb, 0x8420, 0x0070, - 0x26fb, 0x0078, 0x26ec, 0x157f, 0x8738, 0xa784, 0x001f, 0x00c0, - 0x26d2, 0x0078, 0x1d41, 0x1078, 0x2b0d, 0x1078, 0x2b1e, 0x6827, - 0x0000, 0x789b, 0x000e, 0x6f10, 0x1078, 0x344a, 0x017e, 0xad88, - 0x0010, 0xa188, 0x0006, 0x2104, 0x017f, 0x8007, 0xa084, 0x00ff, - 0xa082, 0x0047, 0x0040, 0x271e, 0x0078, 0x272f, 0x0c7e, 0x6810, - 0x8007, 0xa084, 0x000f, 0x8003, 0x8003, 0x8003, 0xa0e0, 0x3a80, - 0x6004, 0xa084, 0xfff5, 0x6006, 0x0c7f, 0x1078, 0x2f6b, 0x6813, - 0x0002, 0xa684, 0x0800, 0x0040, 0x2739, 0x6918, 0xa18d, 0x2000, - 0x691a, 0x6814, 0xa084, 0x8000, 0x0040, 0x2740, 0x6817, 0x0000, - 0x2021, 0x3857, 0x6800, 0x2022, 0x6a38, 0x693c, 0x6a2a, 0x692e, - 0x1078, 0x18b6, 0x0078, 0x1d41, 0x1078, 0x261c, 0x6827, 0x0000, - 0x789b, 0x000e, 0x6f10, 0x1078, 0x3002, 0xa08c, 0x00ff, 0x6912, - 0x6814, 0xa084, 0x8000, 0x0040, 0x275f, 0x7038, 0x6816, 0xa68c, - 0xdf00, 0x691a, 0x70a3, 0x0000, 0x0078, 0x1d41, 0xa006, 0x1078, - 0x314d, 0x6813, 0x0000, 0x6817, 0x0001, 0xa68c, 0xdf00, 0x691a, - 0x6827, 0x0000, 0x7000, 0x0079, 0x2775, 0x277d, 0x277f, 0x277f, - 0x2781, 0x2781, 0x2781, 0x277d, 0x277d, 0x1078, 0x1ce7, 0x1078, - 0x2b1e, 0x6008, 0xa084, 0xffef, 0x600a, 0x0078, 0x2ad8, 0x2300, - 0x0079, 0x278a, 0x278d, 0x278f, 0x27cd, 0x1078, 0x1ce7, 0x7000, - 0x0079, 0x2792, 0x279a, 0x279c, 0x279c, 0x27a7, 0x279c, 0x27ae, - 0x279a, 0x279a, 0x1078, 0x1ce7, 0xa684, 0x2000, 0x00c0, 0x27a7, - 0xa6b5, 0x2000, 0x7e5a, 0x1078, 0x3376, 0x0078, 0x2fb6, 0x6814, - 0xa084, 0x8000, 0x0040, 0x27ae, 0x6817, 0x0007, 0x2009, 0x3818, - 0x210c, 0xa186, 0x0000, 0x0040, 0x27c3, 0xa186, 0x0001, 0x0040, - 0x27c7, 0x2009, 0x382b, 0x200b, 0x000b, 0x70a3, 0x0001, 0x781b, - 0x0046, 0x0078, 0x1d39, 0x781b, 0x00dd, 0x0078, 0x1d39, 0x2009, - 0x382b, 0x200b, 0x000a, 0x0078, 0x1d39, 0x1078, 0x1ce7, 0x2300, - 0x0079, 0x27d2, 0x27d5, 0x27d7, 0x27fa, 0x1078, 0x1ce7, 0x7000, - 0x0079, 0x27da, 0x27e2, 0x27e4, 0x27e4, 0x27ef, 0x27e4, 0x27f6, - 0x27e2, 0x27e2, 0x1078, 0x1ce7, 0xa684, 0x2000, 0x00c0, 0x27ef, - 0xa6b5, 0x2000, 0x7e5a, 0x1078, 0x3376, 0x0078, 0x2fb6, 0x6814, - 0xa084, 0x8000, 0x0040, 0x27f6, 0x6817, 0x0007, 0x781b, 0x00e4, - 0x0078, 0x1d39, 0x681c, 0xa085, 0x0004, 0x681e, 0x1078, 0x2f6b, - 0xa6b5, 0x0800, 0x1078, 0x2df9, 0x781b, 0x0069, 0x0078, 0x1d39, - 0x2300, 0x0079, 0x280b, 0x280e, 0x2810, 0x2812, 0x1078, 0x1ce7, - 0x1078, 0x1ce7, 0xa684, 0x0400, 0x00c0, 0x2831, 0x782b, 0x3009, - 0x789b, 0x0060, 0x78ab, 0x0000, 0xa684, 0xfffb, 0x785a, 0x79e4, - 0xa184, 0x0020, 0x0040, 0x2829, 0x78ec, 0xa084, 0x0003, 0x00c0, - 0x282d, 0x2001, 0x0014, 0x0078, 0x24e3, 0xa184, 0x0007, 0x0079, - 0x2869, 0x7a90, 0xa294, 0x0007, 0x789b, 0x0060, 0x79a8, 0x81ff, - 0x0040, 0x2867, 0x789b, 0x0010, 0x7ba8, 0xa384, 0x0001, 0x00c0, - 0x2858, 0x7ba8, 0x7ba8, 0xa386, 0x0001, 0x00c0, 0x284b, 0x2009, - 0xfff7, 0x0078, 0x2851, 0xa386, 0x0003, 0x00c0, 0x2858, 0x2009, - 0xffef, 0x0c7e, 0x7048, 0x2060, 0x6004, 0xa104, 0x6006, 0x0c7f, - 0x789b, 0x0060, 0x78ab, 0x0000, 0xa684, 0xfffb, 0x785a, 0x782b, - 0x3009, 0x691c, 0xa18c, 0xfdff, 0xa18c, 0xfeff, 0x691e, 0x0078, - 0x2fb6, 0x21da, 0x21e0, 0x2873, 0x287b, 0x2871, 0x2871, 0x2871, - 0x2fb6, 0x1078, 0x1ce7, 0x691c, 0xa18c, 0xfdff, 0xa18c, 0xfeff, - 0x691e, 0x0078, 0x2fbe, 0x691c, 0xa18c, 0xfdff, 0xa18c, 0xfeff, - 0x691e, 0x0078, 0x2fb6, 0x79e4, 0xa184, 0x0030, 0x0040, 0x288d, - 0x78ec, 0xa084, 0x0003, 0x00c0, 0x2895, 0x6814, 0xa085, 0x8000, - 0x6816, 0x2001, 0x0014, 0x0078, 0x24e3, 0xa184, 0x0007, 0x0079, - 0x2899, 0x2fb6, 0x2fb6, 0x28a1, 0x2fb6, 0x2fde, 0x2fde, 0x2fb6, - 0x2fb6, 0xa684, 0x0400, 0x00c0, 0x28d2, 0x681c, 0xa084, 0x0001, - 0x0040, 0x2fbe, 0xa68c, 0x2060, 0xa18c, 0xfffb, 0x795a, 0x69b2, - 0x789b, 0x0060, 0x78ab, 0x0000, 0x789b, 0x0061, 0x6814, 0xa085, - 0x8000, 0x6816, 0x78aa, 0x157e, 0x137e, 0x147e, 0x20a1, 0x012c, - 0x789b, 0x0000, 0x8000, 0x80ac, 0xad80, 0x000a, 0x2098, 0x53a6, - 0x147f, 0x137f, 0x157f, 0x6810, 0x8007, 0x789b, 0x007e, 0x78aa, - 0x0078, 0x2fbe, 0x6814, 0xa084, 0x8000, 0x0040, 0x28d9, 0x6817, - 0x0008, 0x781b, 0x00d8, 0x0078, 0x1d39, 0x2300, 0x0079, 0x28e0, - 0x28e5, 0x2960, 0x28e3, 0x1078, 0x1ce7, 0x7000, 0xa084, 0x0007, - 0x0079, 0x28ea, 0x28f2, 0x28f4, 0x2910, 0x28f2, 0x28f2, 0x26cd, - 0x28f2, 0x28f2, 0x1078, 0x1ce7, 0x691c, 0xa18d, 0x0001, 0x691e, - 0x6800, 0x6006, 0xa005, 0x00c0, 0x28fe, 0x6002, 0x6818, 0xa084, - 0x000e, 0x0040, 0x290a, 0x7014, 0x68b6, 0x712c, 0xa188, 0x5b00, - 0x0078, 0x290c, 0x2009, 0x5c00, 0x2104, 0x6802, 0x2d0a, 0x7156, - 0x6eb2, 0xa684, 0x0060, 0x0040, 0x295e, 0xa684, 0x0800, 0x00c0, - 0x2922, 0xa684, 0x7fff, 0x68b2, 0x6890, 0x6894, 0x1078, 0x314d, - 0x0078, 0x295e, 0xa684, 0x0020, 0x0040, 0x2934, 0xa006, 0x1078, - 0x3414, 0x78d0, 0x8003, 0x00c8, 0x2930, 0x78d4, 0x1078, 0x3479, - 0x79d8, 0x7adc, 0x0078, 0x2938, 0x1078, 0x2f1e, 0x1078, 0x3414, - 0xa684, 0x8000, 0x0040, 0x295e, 0xa684, 0x7fff, 0x68b2, 0x789b, - 0x0074, 0x1078, 0x3002, 0x2010, 0x1078, 0x3002, 0x2008, 0xa684, - 0x0020, 0x00c0, 0x2956, 0x1078, 0x3002, 0x801b, 0x00c8, 0x2951, - 0x8000, 0xa084, 0x003f, 0xa108, 0xa291, 0x0000, 0x6b94, 0x2100, - 0xa302, 0x68ae, 0x6b90, 0x2200, 0xa303, 0x68aa, 0x0078, 0x1d41, - 0x0078, 0x2de6, 0x7033, 0x0000, 0xa282, 0x0005, 0x0050, 0x296a, - 0x1078, 0x1ce7, 0x2300, 0x0079, 0x296d, 0x2970, 0x297a, 0x299d, - 0x2200, 0x0079, 0x2973, 0x2978, 0x2de6, 0x2978, 0x29c6, 0x2a17, - 0x1078, 0x1ce7, 0x7000, 0xa086, 0x0001, 0x00c0, 0x2987, 0x1078, - 0x2b1e, 0x1078, 0x314d, 0x7034, 0x600a, 0x0078, 0x298c, 0x7000, - 0xa086, 0x0003, 0x0040, 0x2981, 0x7003, 0x0005, 0x2001, 0x5c10, - 0x2068, 0x703e, 0x7032, 0x2200, 0x0079, 0x2996, 0x2de6, 0x299b, - 0x29c6, 0x299b, 0x2de6, 0x1078, 0x1ce7, 0x7000, 0xa086, 0x0001, - 0x00c0, 0x29aa, 0x1078, 0x2b1e, 0x1078, 0x314d, 0x7034, 0x600a, - 0x0078, 0x29af, 0x7000, 0xa086, 0x0003, 0x0040, 0x29a4, 0x7003, - 0x0005, 0x2001, 0x5c10, 0x2068, 0x703e, 0x7032, 0x2200, 0x0079, - 0x29b9, 0x29c0, 0x29be, 0x29c0, 0x29be, 0x29c0, 0x1078, 0x1ce7, - 0x1078, 0x2e09, 0x781b, 0x0069, 0x0078, 0x1d39, 0x7000, 0xa086, - 0x0001, 0x00c0, 0x29d3, 0x1078, 0x2b1e, 0x1078, 0x314d, 0x7034, - 0x600a, 0x0078, 0x29d8, 0x7000, 0xa086, 0x0003, 0x0040, 0x29cd, - 0x7003, 0x0002, 0x7a80, 0xa294, 0x0f00, 0x789b, 0x0018, 0x7ca8, - 0xa484, 0x001f, 0xa215, 0x2069, 0x5c00, 0x2d04, 0x2d08, 0x7156, - 0x2068, 0xa005, 0x0040, 0x29f3, 0x6810, 0xa206, 0x0040, 0x2a0c, - 0x6800, 0x0078, 0x29e6, 0x7003, 0x0005, 0x2001, 0x5c10, 0x2068, - 0x703e, 0x7032, 0x157e, 0x20a9, 0x002f, 0x2003, 0x0000, 0x8000, - 0x0070, 0x2a04, 0x0078, 0x29fd, 0x157f, 0x6a12, 0x68b3, 0x0700, - 0x681f, 0x0800, 0x6823, 0x0003, 0x6eb0, 0x7e5a, 0x681c, 0xa084, - 0x0c00, 0x0040, 0x2a6d, 0x1078, 0x2e01, 0x0078, 0x2a6d, 0x7000, - 0xa086, 0x0001, 0x00c0, 0x2a24, 0x1078, 0x2b1e, 0x1078, 0x314d, - 0x7034, 0x600a, 0x0078, 0x2a29, 0x7000, 0xa086, 0x0003, 0x0040, - 0x2a1e, 0x7003, 0x0002, 0x7a80, 0xa294, 0x0f00, 0x789b, 0x0018, - 0x7ca8, 0xa484, 0x001f, 0xa215, 0x79a8, 0x79a8, 0xa18c, 0x00ff, - 0xa1e8, 0x5b00, 0x2d04, 0x2d08, 0x7156, 0x2068, 0xa005, 0x0040, - 0x2a48, 0x6810, 0xa206, 0x0040, 0x2a61, 0x6800, 0x0078, 0x2a3b, - 0x7003, 0x0005, 0x2001, 0x5c10, 0x2068, 0x703e, 0x7032, 0x157e, - 0x20a9, 0x002f, 0x2003, 0x0000, 0x8000, 0x0070, 0x2a59, 0x0078, - 0x2a52, 0x157f, 0x6a12, 0x68b3, 0x0700, 0x681f, 0x0800, 0x6823, - 0x0003, 0x6eb0, 0x7e5a, 0x681c, 0xa084, 0x0c00, 0x0040, 0x2a6d, - 0x1078, 0x2dfd, 0x7e58, 0x0078, 0x2a6d, 0x027e, 0x8207, 0xa084, - 0x000f, 0x8003, 0x8003, 0x8003, 0xa080, 0x3a80, 0x2060, 0x704a, - 0x6000, 0x704e, 0x6004, 0x7052, 0xa684, 0x0060, 0x0040, 0x2aa4, - 0x6b94, 0x6c90, 0x69a8, 0x68ac, 0xa105, 0x00c0, 0x2a92, 0x7bd2, - 0x7bda, 0x7cd6, 0x7cde, 0xa6b4, 0xb7ff, 0x7e5a, 0x1078, 0x3376, - 0x0078, 0x2aa4, 0x68ac, 0xa31a, 0x2100, 0xa423, 0x2400, 0xa305, - 0x0040, 0x2aa4, 0x7bd2, 0x7bda, 0x7cd6, 0x7cde, 0x68ac, 0xa6b4, - 0xbfff, 0x7e5a, 0x1078, 0x339d, 0x077f, 0x1078, 0x2f11, 0x2009, - 0x006a, 0xa684, 0x0008, 0x0040, 0x2aaf, 0x2009, 0x0069, 0xa6b5, - 0x2000, 0x7e5a, 0x791a, 0x2d00, 0x703e, 0x8207, 0xa084, 0x000f, - 0x8003, 0x8003, 0x8003, 0xa080, 0x3a80, 0x2048, 0x0078, 0x1d39, - 0x6020, 0xa005, 0x0040, 0x2acc, 0x8001, 0x6022, 0x6008, 0xa085, - 0x0008, 0x600a, 0x7010, 0x6026, 0x007c, 0xa006, 0x1078, 0x314d, - 0x6813, 0x0000, 0x6817, 0x0001, 0x681f, 0x0040, 0x681b, 0x0100, - 0x7000, 0xa084, 0x0007, 0x0079, 0x2add, 0x2ae5, 0x2ae7, 0x2ae7, - 0x2b02, 0x2aef, 0x2ae5, 0x2ae5, 0x2ae5, 0x1078, 0x1ce7, 0x1078, - 0x2b0d, 0x1078, 0x2b06, 0x1078, 0x18b6, 0x0078, 0x1d41, 0x70a0, - 0x70a3, 0x0000, 0x0079, 0x2af4, 0x2afe, 0x2afe, 0x2afc, 0x2afc, - 0x2afc, 0x2afe, 0x2afc, 0x2afe, 0x0079, 0x20a6, 0x70a3, 0x0000, - 0x0078, 0x1d41, 0x6817, 0x0000, 0x0078, 0x2703, 0x6800, 0xa005, - 0x00c0, 0x2b0b, 0x6002, 0x6006, 0x007c, 0x1078, 0x2b27, 0x6010, - 0xa005, 0x0040, 0x2b18, 0x8001, 0x00d0, 0x2b18, 0x1078, 0x1ce7, - 0x6012, 0x6008, 0xa084, 0xffef, 0x600a, 0x007c, 0x1078, 0x2b34, - 0x6018, 0xa005, 0x0040, 0x2b26, 0x8001, 0x601a, 0x007c, 0x017e, - 0x007e, 0x2009, 0x382e, 0x2104, 0xa005, 0x0040, 0x2b31, 0x8001, - 0x200a, 0x007f, 0x017f, 0x007c, 0x017e, 0x007e, 0x2009, 0x382f, - 0x2104, 0xa005, 0x0040, 0x2b3e, 0x8001, 0x200a, 0x007f, 0x017f, - 0x007c, 0x017e, 0x007e, 0x2009, 0x3830, 0x2104, 0x8000, 0x200a, - 0x007f, 0x017f, 0x007c, 0x017e, 0x007e, 0x2009, 0x382f, 0x2104, - 0x8000, 0x200a, 0x007f, 0x017f, 0x007c, 0x027e, 0x037e, 0x007e, - 0x2009, 0x382e, 0x2114, 0x2019, 0x382f, 0x2304, 0xa202, 0x200a, - 0x201b, 0x0000, 0x2009, 0x3830, 0x007f, 0x037f, 0x027f, 0x007c, - 0x1078, 0x2ffd, 0x6817, 0x0018, 0x0078, 0x2b98, 0x1078, 0x2ffd, - 0x6817, 0x0019, 0x0078, 0x2b98, 0x1078, 0x2ffd, 0x6817, 0x001a, - 0x0078, 0x2b98, 0x77b4, 0x1078, 0x2f11, 0x71b8, 0xa18c, 0x00ff, - 0xa1e8, 0x5b00, 0x2d04, 0x2d08, 0x2068, 0xa005, 0x00c0, 0x2b8a, - 0x0078, 0x1d41, 0x6810, 0x72b4, 0xa206, 0x0040, 0x2b92, 0x6800, - 0x0078, 0x2b83, 0x6800, 0x200a, 0x6817, 0x0005, 0x70bf, 0x0000, - 0x1078, 0x2b0d, 0x681c, 0xa084, 0x0001, 0x00c0, 0x2ba1, 0x1078, - 0x2b06, 0x1078, 0x2b1e, 0x681b, 0x0000, 0x681f, 0x0020, 0x1078, - 0x18b6, 0x0078, 0x1d41, 0xa282, 0x0003, 0x00c0, 0x2dda, 0x7da8, - 0xa5ac, 0x00ff, 0x7ea8, 0xa6b4, 0x00ff, 0x691c, 0xa18d, 0x0080, - 0x691e, 0xa184, 0x0100, 0x0040, 0x2c0b, 0xa18c, 0xfeff, 0x691e, - 0xa6b4, 0x00ff, 0x0040, 0x2bf5, 0xa682, 0x000f, 0x0048, 0x2bcc, - 0x0040, 0x2bcc, 0x2031, 0x000f, 0x852b, 0x852b, 0x1078, 0x2e94, - 0x0040, 0x2bd6, 0x1078, 0x2ca4, 0x0078, 0x2bfe, 0x1078, 0x2e4f, - 0x0c7e, 0x2960, 0x6004, 0xa084, 0xfff5, 0x6006, 0x1078, 0x2cc8, - 0x0c7f, 0x691c, 0xa18d, 0x0100, 0x691e, 0x7e58, 0xa6b5, 0x0004, - 0x7e5a, 0xa684, 0x0400, 0x00c0, 0x2bf1, 0x781b, 0x0055, 0x0078, - 0x1d39, 0x781b, 0x0069, 0x0078, 0x1d39, 0x0c7e, 0x2960, 0x6004, - 0xa084, 0xfff5, 0x6006, 0x1078, 0x2cc8, 0x0c7f, 0x7e58, 0xa684, - 0x0400, 0x00c0, 0x2c07, 0x781b, 0x0058, 0x0078, 0x1d39, 0x781b, - 0x006a, 0x0078, 0x1d39, 0x0c7e, 0x7048, 0x2060, 0x6100, 0xa18c, - 0x1000, 0x0040, 0x2c4b, 0x6208, 0x8217, 0xa294, 0x00ff, 0xa282, - 0x000f, 0x0048, 0x2c1f, 0x0040, 0x2c1f, 0x2011, 0x000f, 0x2600, - 0xa202, 0x00c8, 0x2c24, 0x2230, 0x6208, 0xa294, 0x00ff, 0x7018, - 0xa086, 0x0028, 0x00c0, 0x2c34, 0xa282, 0x0019, 0x00c8, 0x2c3a, - 0x2011, 0x0019, 0x0078, 0x2c3a, 0xa282, 0x000c, 0x00c8, 0x2c3a, - 0x2011, 0x000c, 0x2200, 0xa502, 0x00c8, 0x2c3f, 0x2228, 0x1078, - 0x2e53, 0x852b, 0x852b, 0x1078, 0x2e94, 0x0040, 0x2c4b, 0x1078, - 0x2ca4, 0x0078, 0x2c4f, 0x1078, 0x2e4f, 0x1078, 0x2cc8, 0x7858, - 0xa085, 0x0004, 0x785a, 0x0c7f, 0x781b, 0x0069, 0x0078, 0x1d39, - 0x0c7e, 0x2960, 0x6000, 0xa084, 0x1000, 0x00c0, 0x2c72, 0xa084, - 0x0040, 0x00c0, 0x2c6c, 0xa18c, 0x0002, 0x00c0, 0x2c6c, 0xa18c, - 0xfff5, 0x6106, 0x0c7f, 0x007c, 0x2011, 0x0032, 0x2019, 0x0000, - 0x0078, 0x2c94, 0x6208, 0xa294, 0x00ff, 0x7018, 0xa086, 0x0028, - 0x00c0, 0x2c82, 0xa282, 0x0019, 0x00c8, 0x2c88, 0x2011, 0x0019, - 0x0078, 0x2c88, 0xa282, 0x000c, 0x00c8, 0x2c88, 0x2011, 0x000c, - 0x6308, 0x831f, 0xa39c, 0x00ff, 0xa382, 0x000f, 0x0048, 0x2c94, - 0x0040, 0x2c94, 0x2019, 0x000f, 0x78ab, 0x0001, 0x78ab, 0x0003, - 0x78ab, 0x0001, 0x7aaa, 0x7baa, 0xa8c0, 0x0005, 0x681c, 0xa085, - 0x0100, 0x681e, 0x0c7f, 0x007c, 0x0c7e, 0x7148, 0x2160, 0x2008, - 0xa084, 0xfff0, 0xa635, 0x7e86, 0x6018, 0x789a, 0x7eae, 0x6612, - 0x78a4, 0xa084, 0xfff8, 0xa18c, 0x0007, 0xa105, 0x78a6, 0x6016, - 0x788a, 0xa6b4, 0x000f, 0x8637, 0x8204, 0x8004, 0xa084, 0x00ff, - 0xa605, 0x600e, 0x6004, 0xa084, 0xfff5, 0x6006, 0x0c7f, 0x007c, - 0x0c7e, 0x7048, 0x2060, 0x6018, 0x789a, 0x78a4, 0xa084, 0xfff0, - 0x78a6, 0x6012, 0x7884, 0xa084, 0xfff0, 0x7886, 0x0c7f, 0x007c, - 0xa282, 0x0002, 0x00c0, 0x2dda, 0x7aa8, 0x691c, 0xa18d, 0x0080, - 0x691e, 0xa184, 0x0200, 0x0040, 0x2d1d, 0xa18c, 0xfdff, 0x691e, - 0xa294, 0x00ff, 0xa282, 0x0002, 0x00c8, 0x2dda, 0x1078, 0x2d63, - 0x1078, 0x2cc8, 0xa980, 0x0001, 0x200c, 0x1078, 0x2f0d, 0x1078, - 0x2c58, 0x88ff, 0x0040, 0x2d10, 0x789b, 0x0060, 0x2800, 0x78aa, - 0x7e58, 0xa6b5, 0x0004, 0x7e5a, 0xa684, 0x0400, 0x00c0, 0x2d0c, - 0x781b, 0x0055, 0x0078, 0x1d39, 0x781b, 0x0069, 0x0078, 0x1d39, - 0x7e58, 0xa684, 0x0400, 0x00c0, 0x2d19, 0x781b, 0x0058, 0x0078, - 0x1d39, 0x781b, 0x006a, 0x0078, 0x1d39, 0xa282, 0x0002, 0x00c8, - 0x2d25, 0xa284, 0x0001, 0x0040, 0x2d2f, 0x7148, 0xa188, 0x0000, - 0x210c, 0xa18c, 0x2000, 0x00c0, 0x2d2f, 0x2011, 0x0000, 0x1078, - 0x2e41, 0x1078, 0x2d63, 0x1078, 0x2cc8, 0x7858, 0xa085, 0x0004, - 0x785a, 0x781b, 0x0069, 0x0078, 0x1d39, 0x0c7e, 0x027e, 0x2960, - 0x6000, 0x2011, 0x0001, 0xa084, 0x2000, 0x00c0, 0x2d53, 0xa084, - 0x0080, 0x00c0, 0x2d51, 0xa18c, 0xffef, 0x6106, 0xa006, 0x0078, - 0x2d60, 0x2011, 0x0000, 0x78ab, 0x0001, 0x78ab, 0x0002, 0x78ab, - 0x0003, 0x7aaa, 0xa8c0, 0x0004, 0x681c, 0xa085, 0x0200, 0x681e, - 0x027f, 0x0c7f, 0x007c, 0x0c7e, 0x7048, 0x2060, 0x82ff, 0x0040, - 0x2d6b, 0x2011, 0x0040, 0x6018, 0xa080, 0x0002, 0x789a, 0x78a4, - 0xa084, 0xffbf, 0xa205, 0x78a6, 0x6016, 0x788a, 0x6004, 0xa084, - 0xffef, 0x6006, 0x0c7f, 0x007c, 0x007e, 0x7000, 0xa086, 0x0003, - 0x0040, 0x2d85, 0x007f, 0x0078, 0x2d88, 0x007f, 0x0078, 0x2dd6, - 0xa684, 0x0020, 0x0040, 0x2dd6, 0x7888, 0xa084, 0x0040, 0x0040, - 0x2dd6, 0x78a8, 0x8001, 0x0040, 0x2d95, 0x7bb8, 0xa384, 0x003f, - 0x831b, 0x00c8, 0x2d9c, 0x8000, 0xa005, 0x0040, 0x2dbd, 0x831b, - 0x00c8, 0x2da5, 0x8001, 0x0040, 0x2dd2, 0xa006, 0x1078, 0x3414, - 0x78b4, 0x1078, 0x3479, 0x0078, 0x2dd6, 0xa684, 0x4000, 0x0040, - 0x2dbd, 0x78b8, 0x801b, 0x00c8, 0x2db6, 0x8000, 0xa084, 0x003f, - 0x00c0, 0x2dd2, 0xa6b4, 0xbfff, 0x7e5a, 0x79d8, 0x7adc, 0x2001, - 0x0001, 0xa108, 0x00c8, 0x2dc6, 0xa291, 0x0000, 0x79d2, 0x79da, - 0x7ad6, 0x7ade, 0x1078, 0x3414, 0x781b, 0x0067, 0x1078, 0x32e4, - 0x0078, 0x1d39, 0x781b, 0x0067, 0x0078, 0x1d39, 0x781b, 0x006a, - 0x0078, 0x1d39, 0x1078, 0x2e0d, 0x781b, 0x0069, 0x0078, 0x1d39, - 0x1078, 0x2df9, 0x781b, 0x0069, 0x0078, 0x1d39, 0x6823, 0x0002, - 0x1078, 0x2e01, 0x691c, 0xa18d, 0x0020, 0x691e, 0x6814, 0xa084, - 0x8000, 0x0040, 0x2df5, 0x6817, 0x0005, 0x781b, 0x0069, 0x0078, - 0x1d39, 0x2001, 0x0005, 0x0078, 0x2e0f, 0x2001, 0x000c, 0x0078, - 0x2e0f, 0x2001, 0x0006, 0x0078, 0x2e0f, 0x2001, 0x000d, 0x0078, - 0x2e0f, 0x2001, 0x0009, 0x0078, 0x2e0f, 0x2001, 0x0007, 0x789b, - 0x007f, 0x78aa, 0xa6b5, 0x0008, 0x7e5a, 0x007c, 0x077e, 0x873f, - 0xa7bc, 0x000f, 0x873b, 0x873b, 0x8703, 0xa0e0, 0x3a80, 0xa7b8, - 0x0020, 0x7f9a, 0x79a4, 0xa184, 0x000f, 0x0040, 0x2e2f, 0xa184, - 0xfff0, 0x78a6, 0x6012, 0x6004, 0xa085, 0x0008, 0x6006, 0x8738, - 0x8738, 0x7f9a, 0x79a4, 0xa184, 0x0040, 0x0040, 0x2e3f, 0xa184, - 0xffbf, 0x78a6, 0x6016, 0x6004, 0xa085, 0x0010, 0x6006, 0x077f, - 0x007c, 0x789b, 0x0010, 0x78ab, 0x0001, 0x78ab, 0x0002, 0x78ab, - 0x0003, 0x7aaa, 0x789b, 0x0060, 0x78ab, 0x0004, 0x007c, 0x2031, - 0x0000, 0x2029, 0x0032, 0x789b, 0x0010, 0x78ab, 0x0001, 0x78ab, - 0x0003, 0x78ab, 0x0001, 0x7daa, 0x7eaa, 0x789b, 0x0060, 0x78ab, - 0x0005, 0x007c, 0x157e, 0x8007, 0xa084, 0x00ff, 0x8003, 0x8003, - 0xa080, 0x0020, 0x789a, 0x79a4, 0xa18c, 0xfff0, 0x2001, 0x3846, - 0x2004, 0xa082, 0x0028, 0x0040, 0x2e7d, 0x2021, 0x2ef4, 0x2019, - 0x0014, 0x20a9, 0x000c, 0x0078, 0x2e83, 0x2021, 0x2f00, 0x2019, - 0x0019, 0x20a9, 0x000d, 0x2011, 0x0064, 0x2404, 0xa084, 0xfff0, - 0xa106, 0x0040, 0x2e92, 0x8420, 0x2300, 0xa210, 0x0070, 0x2e92, - 0x0078, 0x2e85, 0x157f, 0x007c, 0x157e, 0x2011, 0x3846, 0x2214, - 0xa282, 0x0032, 0x0048, 0x2ea8, 0x0040, 0x2eac, 0x2021, 0x2ee6, - 0x2019, 0x0011, 0x20a9, 0x000e, 0x2011, 0x0032, 0x0078, 0x2ebc, - 0xa282, 0x0028, 0x0040, 0x2eb4, 0x2021, 0x2ef4, 0x2019, 0x0014, - 0x20a9, 0x000c, 0x0078, 0x2eba, 0x2021, 0x2f00, 0x2019, 0x0019, - 0x20a9, 0x000d, 0x2011, 0x0064, 0x2200, 0xa502, 0x0040, 0x2ecc, - 0x0048, 0x2ecc, 0x8420, 0x2300, 0xa210, 0x0070, 0x2ec9, 0x0078, - 0x2ebc, 0x157f, 0xa006, 0x007c, 0x157f, 0xa582, 0x0064, 0x00c8, - 0x2ed5, 0x7808, 0xa085, 0x0070, 0x780a, 0x78ec, 0xa084, 0x0300, - 0x0040, 0x2ee3, 0x2404, 0xa09e, 0x1201, 0x00c0, 0x2ee3, 0x2001, - 0x2101, 0x0078, 0x2ee4, 0x2404, 0xa005, 0x007c, 0x1201, 0x3002, - 0x3202, 0x4203, 0x4403, 0x5404, 0x5604, 0x6605, 0x6805, 0x7806, - 0x7a06, 0x0a07, 0x0c07, 0x0e07, 0x3202, 0x4202, 0x5202, 0x6202, - 0x7202, 0x6605, 0x7605, 0x7805, 0x7a05, 0x7c05, 0x7e05, 0x7f05, - 0x2202, 0x3202, 0x4202, 0x5202, 0x5404, 0x6404, 0x7404, 0x7604, - 0x7804, 0x7a04, 0x7c04, 0x7e04, 0x7f04, 0x789b, 0x0010, 0xa046, - 0x007c, 0xa784, 0x0f00, 0x800b, 0xa784, 0x001f, 0x8003, 0x8003, - 0x8003, 0x8003, 0xa105, 0xa0e0, 0x3b00, 0x007c, 0x79d8, 0x7adc, - 0x78d0, 0x801b, 0x00c8, 0x2f25, 0x8000, 0xa084, 0x003f, 0xa108, - 0xa291, 0x0000, 0x007c, 0x0f7e, 0x2079, 0x0100, 0x2009, 0x3840, - 0x2091, 0x8000, 0x2104, 0x0079, 0x2f35, 0x2f67, 0x2f3f, 0x2f3f, - 0x2f3f, 0x2f3f, 0x2f3f, 0x2f3d, 0x2f3d, 0x1078, 0x1ce7, 0x784b, - 0x0004, 0x7848, 0xa084, 0x0004, 0x00c0, 0x2f41, 0x784b, 0x0008, - 0x7848, 0xa084, 0x0008, 0x00c0, 0x2f48, 0x68b0, 0xa085, 0x4000, - 0x68b2, 0x7858, 0xa085, 0x4000, 0x785a, 0x7830, 0xa084, 0x0080, - 0x00c0, 0x2f67, 0x0018, 0x2f67, 0x6818, 0xa084, 0x0020, 0x00c0, - 0x2f65, 0x781b, 0x00dd, 0x0078, 0x2f67, 0x781b, 0x00e4, 0x2091, - 0x8001, 0x0f7f, 0x007c, 0x0c7e, 0x6810, 0x8007, 0xa084, 0x000f, - 0x8003, 0x8003, 0x8003, 0xa0e0, 0x3a80, 0x6004, 0xa084, 0x000a, - 0x00c0, 0x2fb4, 0x6108, 0xa194, 0xff00, 0x0040, 0x2fb4, 0xa18c, - 0x00ff, 0x6004, 0xa084, 0x0014, 0x00c0, 0x2f9d, 0xa085, 0x0014, - 0x6006, 0x017e, 0x691c, 0xa18d, 0x0002, 0x691e, 0x017f, 0x2001, - 0x000c, 0xa106, 0x0040, 0x2f99, 0x2100, 0x8003, 0x2008, 0x0078, - 0x2fad, 0x2009, 0x0019, 0x0078, 0x2fad, 0x2011, 0x0000, 0x6000, - 0xa084, 0xdfff, 0x6002, 0x6004, 0xa084, 0xffef, 0x6006, 0x017e, - 0x691c, 0xa18d, 0x0002, 0x691e, 0x017f, 0x2100, 0xa205, 0x600a, - 0x6004, 0xa085, 0x000a, 0x6006, 0x0c7f, 0x007c, 0x781b, 0x006a, - 0x0078, 0x1d39, 0x781b, 0x0069, 0x0078, 0x1d39, 0x781b, 0x0058, - 0x0078, 0x1d39, 0x781b, 0x0055, 0x0078, 0x1d39, 0x781b, 0x00dd, - 0x0078, 0x1d39, 0x781b, 0x00dc, 0x0078, 0x1d39, 0x781b, 0x00e4, - 0x0078, 0x1d39, 0x781b, 0x00e3, 0x0078, 0x1d39, 0x781b, 0x009e, - 0x0078, 0x1d39, 0x781b, 0x009d, 0x0078, 0x1d39, 0x70a3, 0x0001, - 0x781b, 0x0046, 0x0078, 0x1d39, 0x007e, 0x7830, 0xa084, 0x00c0, - 0x00c0, 0x2ffb, 0x7808, 0xa084, 0xfffd, 0x780a, 0x0005, 0x0005, - 0x0005, 0x0005, 0x78ec, 0xa084, 0x0021, 0x0040, 0x2ffb, 0x7808, - 0xa085, 0x0002, 0x780a, 0x007f, 0x007c, 0x7808, 0xa085, 0x0002, - 0x780a, 0x007c, 0x7830, 0xa084, 0x0040, 0x00c0, 0x3002, 0x0098, - 0x300b, 0x78ac, 0x007c, 0x7808, 0xa084, 0xfffd, 0x780a, 0x0005, - 0x0005, 0x0005, 0x0005, 0x78ec, 0xa084, 0x0021, 0x0040, 0x301a, - 0x0098, 0x3018, 0x78ac, 0x007e, 0x7808, 0xa085, 0x0002, 0x780a, - 0x007f, 0x007c, 0xa784, 0x0070, 0x0040, 0x302e, 0x0c7e, 0x2d60, - 0x2f68, 0x1078, 0x1c97, 0x2d78, 0x2c68, 0x0c7f, 0x6817, 0x0003, - 0x7858, 0xa084, 0x3f00, 0x681a, 0x682f, 0x0000, 0x682b, 0x0000, - 0x784b, 0x0008, 0x78e4, 0xa005, 0x00d0, 0x21cc, 0xa084, 0x0020, - 0x0040, 0x21cc, 0x78ec, 0xa084, 0x0003, 0x0040, 0x21cc, 0x0018, - 0x21cc, 0x0078, 0x2de0, 0x0c7e, 0x6810, 0x8007, 0xa084, 0x000f, - 0x8003, 0x8003, 0x8003, 0xa080, 0x3a80, 0x2060, 0x2048, 0x704a, - 0x6000, 0x704e, 0x6004, 0x7052, 0x0c7f, 0x007c, 0x0020, 0x0020, - 0x0000, 0x0020, 0x0000, 0x0020, 0x0000, 0x0020, 0x0000, 0x0020, - 0x0000, 0x0020, 0x0000, 0x0020, 0x0000, 0x0020, 0x0000, 0x0020, - 0x0000, 0x0020, 0x0000, 0x0020, 0x0000, 0x0020, 0x0000, 0x0020, - 0x0000, 0x0020, 0x0000, 0x0020, 0x0000, 0x0020, 0x0000, 0x0020, - 0x0062, 0x0009, 0x0014, 0x0014, 0x9847, 0x0014, 0x0014, 0x98f5, - 0x98e7, 0x0014, 0x0014, 0x0080, 0x00bf, 0x0100, 0x0402, 0x2008, - 0xf880, 0xa20a, 0x0014, 0x300b, 0xa20c, 0x0014, 0xa200, 0x8838, - 0x817e, 0x842a, 0x84a0, 0x3806, 0x8839, 0x28c2, 0x9cc3, 0xa805, - 0x0864, 0xa83b, 0x3008, 0x28c1, 0x9cc3, 0xa201, 0x300c, 0x2847, - 0x8161, 0x846a, 0x8000, 0x84a4, 0x1856, 0x883a, 0xa808, 0x28e2, - 0x9ca0, 0xa8f3, 0x0864, 0xa829, 0x300c, 0xa801, 0x3008, 0x28e1, - 0x9ca0, 0x280d, 0xa204, 0x64c0, 0x67a0, 0x6fc0, 0x1814, 0x883b, - 0x7023, 0x8576, 0x8677, 0xa80f, 0x786e, 0x883e, 0xa80c, 0x282b, - 0xa205, 0x64a0, 0x67a0, 0x6fc0, 0x1814, 0x883b, 0x7023, 0x8576, - 0x8677, 0xa801, 0x883e, 0x2069, 0x28c1, 0x9cc3, 0x2044, 0x2103, - 0x20a2, 0x2081, 0xa8dc, 0xa207, 0x0014, 0xa203, 0x8000, 0x84a8, - 0x85a4, 0x1872, 0x849a, 0x883c, 0x1fe2, 0xf601, 0xa208, 0x856e, - 0x866f, 0x0704, 0x3008, 0x9ca0, 0x0014, 0xa202, 0x8000, 0x85a4, - 0x3009, 0x84a8, 0x19e2, 0xf848, 0x8174, 0x86eb, 0x85eb, 0x872e, - 0x87a9, 0x883f, 0x08e6, 0xa8f1, 0xf861, 0xa8e8, 0xf801, 0x0014, - 0xf881, 0x0016, 0x85b2, 0x80f0, 0x9532, 0xfaa2, 0x1de2, 0x0014, - 0x8532, 0xf221, 0x0014, 0x1de2, 0x84a8, 0xd6e0, 0x1fe6, 0x0014, - 0xa206, 0x6865, 0x817f, 0x842a, 0x1dc1, 0x8823, 0x0016, 0x6042, - 0x8008, 0xa8fa, 0x8000, 0x84a4, 0x8160, 0x842a, 0xf021, 0x3008, - 0x84a8, 0x1dc6, 0x20d7, 0x8822, 0x0016, 0x8000, 0x2848, 0x1011, - 0xa8fc, 0x3008, 0x8000, 0xa000, 0x2802, 0x1011, 0xa8fd, 0xa887, - 0x3008, 0x283d, 0x1011, 0xa8fd, 0xa209, 0x0017, 0x300c, 0x8000, - 0x85a4, 0x1de2, 0xdac1, 0x0014, 0x26e0, 0x873a, 0xfaa2, 0x19f2, - 0x1fe2, 0x0014, 0xa20b, 0x0014, 0xa20d, 0x817e, 0x842a, 0x84a0, - 0x3806, 0x0210, 0x9ccd, 0x0704, 0x0000, 0x127e, 0x2091, 0x2200, - 0x2049, 0x314d, 0x7000, 0x7204, 0xa205, 0x720c, 0xa215, 0x7008, - 0xa084, 0xfffd, 0xa205, 0x0040, 0x315f, 0x0078, 0x3164, 0x7003, - 0x0000, 0x127f, 0x2000, 0x007c, 0x7000, 0xa084, 0x0001, 0x00c0, - 0x3192, 0x7108, 0x8104, 0x00c8, 0x3171, 0x1078, 0x322e, 0x0078, - 0x3169, 0x700c, 0xa08c, 0x007f, 0x0040, 0x3192, 0x7004, 0x8004, - 0x00c8, 0x3189, 0x7014, 0xa005, 0x00c0, 0x3185, 0x7010, 0xa005, - 0x0040, 0x3189, 0xa102, 0x00c8, 0x3169, 0x7007, 0x0010, 0x0078, - 0x3192, 0x8aff, 0x0040, 0x3192, 0x1078, 0x33eb, 0x00c0, 0x318c, - 0x0040, 0x3169, 0x1078, 0x31dc, 0x7003, 0x0000, 0x127f, 0x2000, - 0x007c, 0x6424, 0x84ff, 0x0040, 0x31b6, 0x2c70, 0x2039, 0x31bb, - 0x2704, 0xae68, 0x680c, 0xa630, 0x6808, 0xa529, 0x8421, 0x0040, - 0x31b6, 0x8738, 0x2704, 0xa005, 0x00c0, 0x31a1, 0x7098, 0xa075, - 0x0040, 0x31b6, 0x2039, 0x31b8, 0x0078, 0x31a0, 0x007c, 0x0000, - 0x0004, 0x0008, 0x000c, 0x0010, 0x0014, 0x0018, 0x001c, 0x0000, - 0x127e, 0x2091, 0x2200, 0x2079, 0x3800, 0x2071, 0x0010, 0x7007, - 0x000a, 0x7007, 0x0002, 0x7003, 0x0000, 0x2071, 0x0020, 0x7007, - 0x000a, 0x7007, 0x0002, 0x7003, 0x0000, 0x2049, 0x0000, 0x78b7, - 0x0000, 0x127f, 0x2000, 0x007c, 0x2049, 0x31dc, 0x7004, 0x8004, - 0x00c8, 0x3208, 0x7007, 0x0012, 0x7108, 0x7008, 0xa106, 0x00c0, - 0x31e4, 0xa184, 0x0030, 0x0040, 0x31f1, 0xa086, 0x0030, 0x00c0, - 0x31e4, 0x7000, 0xa084, 0x0001, 0x00c0, 0x3208, 0x7008, 0xa084, - 0x000c, 0x00c0, 0x3206, 0x710c, 0xa184, 0x0300, 0x00c0, 0x3206, - 0xa184, 0x007f, 0x00c0, 0x31dc, 0x0078, 0x3208, 0x6817, 0x0003, - 0x7007, 0x0012, 0x7007, 0x0008, 0x7004, 0xa084, 0x0008, 0x00c0, - 0x320c, 0x7007, 0x0012, 0x7108, 0x8104, 0x0048, 0x3211, 0x78b7, - 0x0000, 0x7003, 0x0000, 0x2049, 0x0000, 0x007c, 0x107e, 0x007e, - 0x127e, 0x157e, 0x2091, 0x2200, 0x7108, 0x1078, 0x322e, 0x157f, - 0x127f, 0x2091, 0x8001, 0x007f, 0x107f, 0x007c, 0x7204, 0x2118, - 0x7108, 0x700c, 0xa084, 0x0300, 0x00c0, 0x3270, 0xa184, 0x000c, - 0x00c0, 0x3270, 0x8213, 0x8213, 0x8213, 0x8213, 0xa284, 0x0100, - 0xa10d, 0x810b, 0x810b, 0x810f, 0xa184, 0x0007, 0x0079, 0x3248, - 0x3252, 0x3262, 0x3270, 0x3262, 0x3284, 0x3284, 0x3270, 0x3282, - 0x1078, 0x1ce7, 0x7007, 0x0002, 0x8aff, 0x00c0, 0x325b, 0x2049, - 0x0000, 0x0078, 0x325f, 0x1078, 0x33eb, 0x00c0, 0x325b, 0x78b7, - 0x0000, 0x007c, 0x7007, 0x0002, 0x8aff, 0x00c0, 0x3269, 0x0078, - 0x326d, 0x1078, 0x33eb, 0x00c0, 0x3269, 0x78b7, 0x0000, 0x007c, - 0x7007, 0x0002, 0x1078, 0x31dc, 0x1078, 0x2f2b, 0x6814, 0xa084, - 0x8000, 0x0040, 0x327d, 0x6817, 0x0002, 0x007c, 0x1078, 0x1ce7, - 0x1078, 0x1ce7, 0x1078, 0x32d6, 0x7210, 0x7114, 0x700c, 0xa09c, - 0x007f, 0x2800, 0xa300, 0xa211, 0xa189, 0x0000, 0x78b4, 0xa005, - 0x0040, 0x3296, 0x78b7, 0x0000, 0x0078, 0x32b9, 0x1078, 0x32d6, - 0x2704, 0x2c58, 0xac60, 0x630c, 0x2200, 0xa322, 0x6308, 0x2100, - 0xa31b, 0x2400, 0xa305, 0x0040, 0x32af, 0x00c8, 0x32af, 0x8412, - 0x8210, 0x830a, 0xa189, 0x0000, 0x2b60, 0x0078, 0x3296, 0x2b60, - 0x8a07, 0xa7ba, 0x31b8, 0xa73d, 0x2c00, 0x6882, 0x6f86, 0x6c8e, - 0x6b8a, 0x7007, 0x0012, 0x1078, 0x31dc, 0x007c, 0x8738, 0x2704, - 0xa005, 0x00c0, 0x32ca, 0x6098, 0xa005, 0x0040, 0x32d3, 0x2060, - 0x2039, 0x31b8, 0x8a51, 0x0040, 0x32d2, 0x7008, 0xa084, 0x00c0, - 0xa086, 0x00c0, 0x007c, 0x2051, 0x0000, 0x007c, 0x8a50, 0x8739, - 0x2704, 0xa004, 0x00c0, 0x32e3, 0x2039, 0x31be, 0x6000, 0xa064, - 0x00c0, 0x32e3, 0x2d60, 0x007c, 0x127e, 0x0d7e, 0x2091, 0x2200, - 0x0d7f, 0x6880, 0x2060, 0x6884, 0x6b88, 0x6c8c, 0x8057, 0xaad4, - 0x00ff, 0xa084, 0x00ff, 0xa0b8, 0x31b8, 0x7e08, 0xa6b5, 0x000c, - 0x6818, 0xa084, 0x0040, 0x0040, 0x32ff, 0xa6b5, 0x0001, 0x0f7e, - 0x2079, 0x0100, 0x7858, 0x0f7f, 0xa084, 0x0040, 0x0040, 0x330e, - 0xa684, 0x0001, 0x00c0, 0x330e, 0xa6b5, 0x0001, 0x7007, 0x0004, - 0x7004, 0xa084, 0x0004, 0x00c0, 0x3310, 0x7000, 0xa005, 0x0040, - 0x331b, 0x1078, 0x1ce7, 0x2400, 0xa305, 0x00c0, 0x3321, 0x0078, - 0x335e, 0x2c58, 0x2704, 0xac60, 0x6004, 0xa400, 0x007e, 0x701a, - 0x6000, 0xa301, 0x701e, 0x2009, 0x04fd, 0x2104, 0xa086, 0x04fd, - 0x007f, 0x00c0, 0x334e, 0xa084, 0x0001, 0x0040, 0x334e, 0xa684, - 0x0001, 0x00c0, 0x334e, 0x7013, 0x0001, 0x7017, 0x0000, 0x7602, - 0x7007, 0x0001, 0x78b7, 0x0001, 0xa4a0, 0x0001, 0xa399, 0x0000, - 0x6004, 0xa400, 0x701a, 0x6000, 0xa301, 0x701e, 0x620c, 0x2400, - 0xa202, 0x7012, 0x6208, 0x2300, 0xa203, 0x7016, 0x7602, 0x7007, - 0x0001, 0x2b60, 0x1078, 0x32be, 0x0078, 0x3360, 0x1078, 0x33eb, - 0x00c0, 0x335e, 0x127f, 0x2000, 0x007c, 0x127e, 0x0d7e, 0x2091, - 0x2200, 0x0d7f, 0x7007, 0x0004, 0x7004, 0xa084, 0x0004, 0x00c0, - 0x336c, 0x7003, 0x0008, 0x127f, 0x2000, 0x007c, 0x127e, 0x0d7e, - 0x2091, 0x2200, 0x0d7f, 0x2049, 0x3376, 0x7007, 0x0004, 0x7004, - 0xa084, 0x0004, 0x00c0, 0x337f, 0x7e08, 0xa6b5, 0x000c, 0x6818, - 0xa084, 0x0040, 0x0040, 0x338e, 0xa6b5, 0x0001, 0x6824, 0xa005, - 0x0040, 0x339a, 0x2050, 0x2039, 0x31bb, 0x2d60, 0x1078, 0x33eb, - 0x00c0, 0x3396, 0x127f, 0x2000, 0x007c, 0x127e, 0x007e, 0x017e, - 0x0d7e, 0x2091, 0x2200, 0x0d7f, 0x037f, 0x047f, 0x7e08, 0xa6b5, - 0x000c, 0x6818, 0xa084, 0x0040, 0x0040, 0x33b0, 0xa6b5, 0x0001, - 0x2049, 0x339d, 0x6824, 0xa055, 0x0040, 0x33e8, 0x2d70, 0x2e60, - 0x2039, 0x31bb, 0x2704, 0xae68, 0x680c, 0xa422, 0x6808, 0xa31b, - 0x0048, 0x33d5, 0x8a51, 0x00c0, 0x33c7, 0x1078, 0x1ce7, 0x8738, - 0x2704, 0xa005, 0x00c0, 0x33bb, 0x7098, 0xa075, 0x2060, 0x0040, - 0x33e8, 0x2039, 0x31b8, 0x0078, 0x33ba, 0x8422, 0x8420, 0x831a, - 0xa399, 0x0000, 0x690c, 0x2400, 0xa122, 0x6908, 0x2300, 0xa11b, - 0x00c8, 0x33e4, 0x1078, 0x1ce7, 0x2071, 0x0020, 0x0078, 0x330e, - 0x127f, 0x2000, 0x007c, 0x7008, 0xa084, 0x00c0, 0xa086, 0x00c0, - 0x0040, 0x3413, 0x2704, 0xac08, 0x2104, 0x701e, 0x8108, 0x2104, - 0x701a, 0x8108, 0x2104, 0x7016, 0x8108, 0x2104, 0x7012, 0x0f7e, - 0x2079, 0x0100, 0x7858, 0x0f7f, 0xa084, 0x0040, 0x0040, 0x340e, - 0xa684, 0x0001, 0x00c0, 0x340e, 0xa6b5, 0x0001, 0x7602, 0x7007, - 0x0001, 0x1078, 0x32be, 0x007c, 0x127e, 0x007e, 0x0d7e, 0x2091, - 0x2200, 0x2049, 0x3414, 0x0d7f, 0x087f, 0x7108, 0xa184, 0x00c0, - 0x00c0, 0x342a, 0x6824, 0xa005, 0x0040, 0x343a, 0x0078, 0x3164, - 0x0078, 0x343a, 0x7108, 0x8104, 0x00c8, 0x3432, 0x1078, 0x322e, - 0x0078, 0x341d, 0x7007, 0x0010, 0x7108, 0x8104, 0x00c8, 0x3434, - 0x1078, 0x322e, 0x7008, 0xa086, 0x0002, 0x00c0, 0x341d, 0x7000, - 0xa005, 0x00c0, 0x341d, 0x7003, 0x0000, 0x2049, 0x0000, 0x127f, - 0x2000, 0x007c, 0x127e, 0x147e, 0x137e, 0x157e, 0x0d7e, 0x2091, - 0x2200, 0x0d7f, 0x2049, 0x344a, 0xad80, 0x0010, 0x20a0, 0x2099, - 0x0031, 0x700c, 0xa084, 0x007f, 0x6826, 0x7007, 0x0008, 0x7007, - 0x0002, 0x7003, 0x0001, 0x0040, 0x3468, 0x8000, 0x80ac, 0x53a5, - 0x7007, 0x0004, 0x7004, 0xa084, 0x0004, 0x00c0, 0x346a, 0x2049, - 0x0000, 0x7003, 0x0000, 0x157f, 0x137f, 0x147f, 0x127f, 0x2000, - 0x007c, 0x127e, 0x007e, 0x0d7e, 0x2091, 0x2200, 0x0d7f, 0x2049, - 0x3479, 0x6880, 0x2060, 0x6884, 0x6b88, 0x6c8c, 0x8057, 0xaad4, - 0x00ff, 0xa084, 0x00ff, 0xa0b8, 0x31b8, 0x7e08, 0xa6b5, 0x0004, - 0x7007, 0x0004, 0x7004, 0xa084, 0x0004, 0x00c0, 0x3492, 0x2c58, - 0x2704, 0xac60, 0x6004, 0xa400, 0x701a, 0x6000, 0xa301, 0x701e, - 0x7013, 0x0001, 0x7017, 0x0000, 0x7602, 0x7007, 0x0001, 0x007f, - 0x8007, 0x2009, 0x0031, 0x200a, 0x00a0, 0x34ac, 0x7108, 0x7007, - 0x0002, 0x810c, 0x00c8, 0x34ac, 0x810c, 0x0048, 0x34b9, 0x0078, - 0x3270, 0xa4a0, 0x0001, 0xa399, 0x0000, 0x6b8a, 0x6c8e, 0x7007, - 0x0004, 0x2049, 0x0000, 0x7003, 0x0000, 0x127f, 0x2000, 0x007c, - 0x20a9, 0x0010, 0xa006, 0x8004, 0x8086, 0x818e, 0x00c8, 0x34d1, - 0xa200, 0x00f0, 0x34cc, 0x8086, 0x818e, 0x007c, 0x157e, 0x20a9, - 0x0010, 0xa005, 0x0040, 0x34f7, 0xa11a, 0x00c8, 0x34f7, 0x8213, - 0x818d, 0x0048, 0x34ea, 0xa11a, 0x00c8, 0x34eb, 0x00f0, 0x34df, - 0x0078, 0x34ef, 0xa11a, 0x2308, 0x8210, 0x00f0, 0x34df, 0x007e, - 0x3200, 0xa084, 0xf7ff, 0x2080, 0x007f, 0x157f, 0x007c, 0x007e, - 0x3200, 0xa085, 0x0800, 0x0078, 0x34f3, 0x00e0, 0x3563, 0x2091, - 0x6000, 0x7820, 0x8001, 0x7822, 0x00c0, 0x355b, 0x7824, 0x7822, - 0x2009, 0x3834, 0x2104, 0xa005, 0x00c0, 0x3510, 0x2001, 0x0010, - 0x8001, 0x200a, 0x077e, 0x803f, 0x1078, 0x2f11, 0x077f, 0x20a9, - 0x0020, 0x601f, 0x0064, 0xace0, 0x0010, 0x00f0, 0x3519, 0x2091, - 0x8000, 0x2069, 0x3840, 0x6800, 0xa084, 0x0007, 0x0040, 0x3538, - 0xa086, 0x0002, 0x0040, 0x3538, 0x6830, 0xa00d, 0x0040, 0x3538, - 0x2104, 0xa005, 0x0040, 0x3538, 0x8001, 0x200a, 0x0040, 0x3640, - 0x2061, 0x3b00, 0x2009, 0x0002, 0x20a9, 0x0100, 0x603c, 0xa005, - 0x0040, 0x354e, 0x8001, 0x603e, 0x00c0, 0x354e, 0x6010, 0xa005, - 0x0040, 0x354e, 0x017e, 0x1078, 0x1b49, 0x017f, 0xace0, 0x0010, - 0x0070, 0x3554, 0x0078, 0x353e, 0x8109, 0x0040, 0x355b, 0x20a9, - 0x0100, 0x0078, 0x353e, 0x1078, 0x3578, 0x1078, 0x3566, 0x1078, - 0x359d, 0x1078, 0x3707, 0x2091, 0x8001, 0x007c, 0x783c, 0x8001, - 0x783e, 0x00c0, 0x3577, 0x7840, 0x783e, 0x7848, 0xa005, 0x0040, - 0x3577, 0x8001, 0x784a, 0x00c0, 0x3577, 0x1078, 0x1b49, 0x007c, - 0x7834, 0x8001, 0x7836, 0x00c0, 0x359c, 0x7838, 0x7836, 0x2091, - 0x8000, 0x7844, 0xa005, 0x00c0, 0x3587, 0x2001, 0x0101, 0x8001, - 0x7846, 0xa080, 0x5b00, 0x2040, 0x2004, 0xa065, 0x0040, 0x359c, - 0x6020, 0xa005, 0x0040, 0x3598, 0x8001, 0x6022, 0x0040, 0x35cc, - 0x6000, 0x2c40, 0x0078, 0x358d, 0x007c, 0x7828, 0x8001, 0x782a, - 0x00c0, 0x35cb, 0x782c, 0x782a, 0x7830, 0xa005, 0x00c0, 0x35aa, - 0x2001, 0x0200, 0x8001, 0x7832, 0x8003, 0x8003, 0x8003, 0x8003, - 0xa090, 0x3b00, 0xa298, 0x0002, 0x2304, 0xa084, 0x0008, 0x0040, - 0x35cb, 0xa290, 0x0009, 0x2204, 0xa005, 0x0040, 0x35c3, 0x8001, - 0x2012, 0x00c0, 0x35cb, 0x2304, 0xa084, 0xfff7, 0xa085, 0x0080, - 0x201a, 0x1078, 0x1b49, 0x007c, 0x2069, 0x3840, 0x6800, 0xa005, - 0x0040, 0x35d6, 0x683c, 0xac06, 0x0040, 0x3640, 0x6710, 0x6fb6, - 0x1078, 0x1758, 0x6808, 0xa084, 0x0020, 0x00c0, 0x363d, 0x2009, - 0x382b, 0x2104, 0xa005, 0x0040, 0x35e9, 0x6023, 0x0001, 0x0078, - 0x363d, 0x6808, 0xa084, 0xffef, 0xa085, 0x0021, 0x6017, 0x0006, - 0x60b0, 0xa084, 0x3f00, 0x601a, 0x601c, 0xa084, 0x00ff, 0xa085, - 0x0060, 0x601e, 0x6000, 0x2042, 0x6710, 0x6fb6, 0x1078, 0x1758, - 0x6818, 0xa005, 0x0040, 0x3606, 0x8001, 0x681a, 0x6808, 0xa084, - 0xffef, 0x680a, 0x6810, 0x8001, 0x00d0, 0x3610, 0x1078, 0x1ce7, - 0x6812, 0x602f, 0x0000, 0x602b, 0x0000, 0x2c68, 0x1078, 0x18b6, - 0x2069, 0x3840, 0x6710, 0xa784, 0x0f00, 0x68b6, 0x2001, 0x0002, - 0x1078, 0x1b44, 0x2041, 0x0021, 0x2049, 0x0005, 0x2051, 0x0030, - 0x1078, 0x1765, 0x2011, 0x3835, 0x2214, 0x6a3e, 0x8738, 0xa784, - 0x001f, 0x00c0, 0x3622, 0x2009, 0x382b, 0x200b, 0x0008, 0x2009, - 0x382c, 0x2069, 0x3840, 0x68b4, 0x200a, 0x2091, 0x8001, 0x007c, - 0x2009, 0x384f, 0x2164, 0x2069, 0x0100, 0x1078, 0x1c97, 0x6017, - 0x0006, 0x6858, 0xa084, 0x3f00, 0x601a, 0x601c, 0xa084, 0x00ff, - 0xa085, 0x0048, 0x601e, 0x602f, 0x0000, 0x602b, 0x0000, 0x6830, - 0xa084, 0x0040, 0x0040, 0x367c, 0x684b, 0x0004, 0x20a9, 0x0014, - 0x6848, 0xa084, 0x0004, 0x0040, 0x3669, 0x0070, 0x3669, 0x0078, - 0x3660, 0x684b, 0x0009, 0x20a9, 0x0014, 0x6848, 0xa084, 0x0001, - 0x0040, 0x3676, 0x0070, 0x3676, 0x0078, 0x366d, 0x20a9, 0x00fa, - 0x0070, 0x367c, 0x0078, 0x3678, 0x6808, 0xa084, 0xfffd, 0x680a, - 0x681b, 0x0046, 0x2009, 0x3868, 0x200b, 0x0007, 0x784c, 0x784a, - 0x2091, 0x8001, 0x007c, 0x2079, 0x3800, 0x1078, 0x36de, 0x1078, - 0x36a6, 0x1078, 0x36b4, 0x1078, 0x36c9, 0x1078, 0x36f3, 0x2009, - 0x3833, 0x200b, 0x0000, 0x2009, 0x3834, 0x200b, 0x0000, 0x7833, - 0x0000, 0x7847, 0x0000, 0x784b, 0x0000, 0x007c, 0x2019, 0x0003, - 0x2011, 0x3846, 0x2204, 0xa086, 0x003c, 0x0040, 0x36b1, 0x2019, - 0x0002, 0x7b2a, 0x7b2e, 0x007c, 0x2019, 0x0030, 0x2011, 0x3846, - 0x2204, 0xa086, 0x0032, 0x0040, 0x36c6, 0x2019, 0x0039, 0x2204, - 0xa086, 0x003c, 0x0040, 0x36c6, 0x2019, 0x0027, 0x7b36, 0x7b3a, - 0x007c, 0x2019, 0x000f, 0x2011, 0x3846, 0x2204, 0xa086, 0x003c, - 0x0040, 0x36db, 0x2019, 0x000d, 0x2204, 0xa086, 0x0032, 0x0040, - 0x36db, 0x2019, 0x000a, 0x7b3e, 0x7b42, 0x007c, 0x2019, 0x2faf, - 0x2011, 0x3846, 0x2204, 0xa086, 0x0032, 0x0040, 0x36f0, 0x2019, - 0x3971, 0x2204, 0xa086, 0x003c, 0x0040, 0x36f0, 0x2019, 0x2626, - 0x7b22, 0x7b26, 0x007c, 0x2019, 0x0001, 0x2011, 0x3846, 0x2204, - 0xa086, 0x003c, 0x0040, 0x36fe, 0x2019, 0x0001, 0x017e, 0x2009, - 0x3831, 0x230a, 0x2009, 0x3832, 0x230a, 0x017f, 0x007c, 0x2009, - 0x3831, 0x2104, 0x8001, 0x200a, 0xa005, 0x00c0, 0x3755, 0x2009, - 0x3832, 0x2104, 0x2009, 0x3831, 0x200a, 0x2009, 0x3833, 0x2104, - 0xa005, 0x00c0, 0x371d, 0x2001, 0x0200, 0x8001, 0x200a, 0x8003, - 0x8003, 0x8003, 0x8003, 0xa090, 0x3b00, 0x2208, 0xa298, 0x0002, - 0x2304, 0xa084, 0x0200, 0x0040, 0x3755, 0xa290, 0x000e, 0x2204, - 0xa005, 0x0040, 0x3740, 0x8001, 0x0040, 0x3740, 0x8001, 0x0040, - 0x3740, 0x8001, 0x0040, 0x3740, 0x8001, 0x2012, 0x00c0, 0x3755, - 0x2012, 0x2304, 0xa084, 0xfdff, 0xa085, 0x0400, 0x201a, 0xa188, - 0x000c, 0x2104, 0x007e, 0xa084, 0x00ff, 0x8001, 0x027f, 0xa294, - 0xff00, 0xa205, 0x200a, 0x1078, 0x1b49, 0x007c, 0x6ed0 -}; diff --git a/sys/dev/ispfw/ispfw.c b/sys/dev/ispfw/ispfw.c index 3c963663939df9..2fface805a63ac 100644 --- a/sys/dev/ispfw/ispfw.c +++ b/sys/dev/ispfw/ispfw.c @@ -39,9 +39,6 @@ __FBSDID("$FreeBSD$"); #include #if defined(ISP_ALL) || !defined(KLD_MODULE) -#ifdef __sparc64__ -#define ISP_1000 1 -#endif #define ISP_1040 1 #define ISP_1040_IT 1 #define ISP_1080 1 @@ -60,13 +57,6 @@ __FBSDID("$FreeBSD$"); #define MODULE_NAME "ispfw" #endif -#if defined(ISP_1000) -#ifdef __sparc64__ -#include -#else -#error "firmware not compatible with this platform" -#endif -#endif #if defined(ISP_1040) || defined(ISP_1040_IT) #include #endif @@ -95,9 +85,6 @@ __FBSDID("$FreeBSD$"); #include #endif -#if defined(ISP_1000) -static int isp_1000_loaded; -#endif #if defined(ISP_1040) static int isp_1040_loaded; #endif @@ -152,9 +139,6 @@ static int do_load_fw(void) { -#if defined(ISP_1000) - RMACRO(isp_1000); -#endif #if defined(ISP_1040) RMACRO(isp_1040); #endif @@ -190,9 +174,6 @@ do_unload_fw(void) { int error = 0; -#if defined(ISP_1000) - UMACRO(isp_1000); -#endif #if defined(ISP_1040) UMACRO(isp_1040); #endif @@ -240,8 +221,6 @@ static moduledata_t ispfw_mod = { }; #if defined(ISP_ALL) || !defined(KLD_MODULE) DECLARE_MODULE(ispfw, ispfw_mod, SI_SUB_DRIVERS, SI_ORDER_THIRD); -#elif defined(ISP_1000) -DECLARE_MODULE(isp_1000, ispfw_mod, SI_SUB_DRIVERS, SI_ORDER_THIRD); #elif defined(ISP_1040) DECLARE_MODULE(isp_1040, ispfw_mod, SI_SUB_DRIVERS, SI_ORDER_THIRD); #elif defined(ISP_1080) diff --git a/sys/dev/le/if_le_lebuffer.c b/sys/dev/le/if_le_lebuffer.c deleted file mode 100644 index 630a47a921fba6..00000000000000 --- a/sys/dev/le/if_le_lebuffer.c +++ /dev/null @@ -1,393 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-NetBSD - * - * Copyright (c) 2006 Marius Strobl - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include -#include - -#include -#include -#include - -#include -#include -#include -#include - -/* - * LANCE registers - */ -#define LEREG1_RDP 0 /* Register Data port */ -#define LEREG1_RAP 2 /* Register Address port */ - -struct le_lebuffer_softc { - struct am7990_softc sc_am7990; /* glue to MI code */ - - struct resource *sc_bres; - - struct resource *sc_rres; - - struct resource *sc_ires; - void *sc_ih; -}; - -static devclass_t le_lebuffer_devclass; - -static device_probe_t le_lebuffer_probe; -static device_attach_t le_lebuffer_attach; -static device_detach_t le_lebuffer_detach; -static device_resume_t le_buffer_resume; -static device_suspend_t le_buffer_suspend; - -static device_method_t le_lebuffer_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, le_lebuffer_probe), - DEVMETHOD(device_attach, le_lebuffer_attach), - DEVMETHOD(device_detach, le_lebuffer_detach), - /* We can just use the suspend method here. */ - DEVMETHOD(device_shutdown, le_buffer_suspend), - DEVMETHOD(device_suspend, le_buffer_suspend), - DEVMETHOD(device_resume, le_buffer_resume), - - { 0, 0 } -}; - -DEFINE_CLASS_0(le, le_lebuffer_driver, le_lebuffer_methods, - sizeof(struct le_lebuffer_softc)); -DRIVER_MODULE(le, lebuffer, le_lebuffer_driver, le_lebuffer_devclass, 0, 0); -MODULE_DEPEND(le, ether, 1, 1, 1); -MODULE_DEPEND(le, lebuffer, 1, 1, 1); - -/* - * Media types supported - */ -static const int le_lebuffer_media[] = { - IFM_MAKEWORD(IFM_ETHER, IFM_10_T, 0, 0) -}; -#define NLEMEDIA nitems(le_lebuffer_media) - -static void le_lebuffer_wrcsr(struct lance_softc *, uint16_t, uint16_t); -static uint16_t le_lebuffer_rdcsr(struct lance_softc *, uint16_t); -static void le_lebuffer_copytodesc(struct lance_softc *, void *, int, int); -static void le_lebuffer_copyfromdesc(struct lance_softc *, void *, int, int); -static void le_lebuffer_copytobuf(struct lance_softc *, void *, int, int); -static void le_lebuffer_copyfrombuf(struct lance_softc *, void *, int, int); -static void le_lebuffer_zerobuf(struct lance_softc *, int, int); - -static void -le_lebuffer_wrcsr(struct lance_softc *sc, uint16_t port, uint16_t val) -{ - struct le_lebuffer_softc *lesc = (struct le_lebuffer_softc *)sc; - - bus_write_2(lesc->sc_rres, LEREG1_RAP, port); - bus_barrier(lesc->sc_rres, LEREG1_RAP, 2, BUS_SPACE_BARRIER_WRITE); - bus_write_2(lesc->sc_rres, LEREG1_RDP, val); -} - -static uint16_t -le_lebuffer_rdcsr(struct lance_softc *sc, uint16_t port) -{ - struct le_lebuffer_softc *lesc = (struct le_lebuffer_softc *)sc; - - bus_write_2(lesc->sc_rres, LEREG1_RAP, port); - bus_barrier(lesc->sc_rres, LEREG1_RAP, 2, BUS_SPACE_BARRIER_WRITE); - return (bus_read_2(lesc->sc_rres, LEREG1_RDP)); -} - -/* - * It turns out that using bus_space(9) to access the buffers and the - * descriptors yields way more throughput than accessing them via the - * KVA returned by rman_get_virtual(9). The descriptor rings can be - * accessed using 8-bit up to 64-bit operations while the buffers can - * be only accessed using 8-bit and 16-bit operations. - * NB: For whatever reason setting LE_C3_BSWP has no effect with at - * least the 501-2981 (although their 'busmaster-regval' property - * indicates to set LE_C3_BSWP also for these cards), so we need - * to manually byte swap access to the buffers, i.e. the accesses - * going through the RX/TX FIFOs. - */ - -static void -le_lebuffer_copytodesc(struct lance_softc *sc, void *fromv, int off, int len) -{ - struct le_lebuffer_softc *lesc = (struct le_lebuffer_softc *)sc; - caddr_t from = fromv; - - for (; len >= 8; len -= 8, off += 8, from += 8) - bus_write_8(lesc->sc_bres, off, be64dec(from)); - for (; len >= 4; len -= 4, off += 4, from += 4) - bus_write_4(lesc->sc_bres, off, be32dec(from)); - for (; len >= 2; len -= 2, off += 2, from += 2) - bus_write_2(lesc->sc_bres, off, be16dec(from)); - if (len == 1) - bus_write_1(lesc->sc_bres, off, *from); -} - -static void -le_lebuffer_copyfromdesc(struct lance_softc *sc, void *tov, int off, int len) -{ - struct le_lebuffer_softc *lesc = (struct le_lebuffer_softc *)sc; - caddr_t to = tov; - - for (; len >= 8; len -= 8, off += 8, to += 8) - be64enc(to, - bus_read_8(lesc->sc_bres, off)); - for (; len >= 4; len -= 4, off += 4, to += 4) - be32enc(to, - bus_read_4(lesc->sc_bres, off)); - for (; len >= 2; len -= 2, off += 2, to += 2) - be16enc(to, - bus_read_2(lesc->sc_bres, off)); - if (len == 1) - *to = bus_read_1(lesc->sc_bres, off); -} - -static void -le_lebuffer_copytobuf(struct lance_softc *sc, void *fromv, int off, int len) -{ - struct le_lebuffer_softc *lesc = (struct le_lebuffer_softc *)sc; - caddr_t from = fromv; - - for (; len >= 2; len -= 2, off += 2, from += 2) - bus_write_2(lesc->sc_bres, off, le16dec(from)); - if (len == 1) - bus_write_1(lesc->sc_bres, off + 1, *from); -} - -static void -le_lebuffer_copyfrombuf(struct lance_softc *sc, void *tov, int off, int len) -{ - struct le_lebuffer_softc *lesc = (struct le_lebuffer_softc *)sc; - caddr_t to = tov; - - for (; len >= 2; len -= 2, off += 2, to += 2) - le16enc(to, - bus_read_2(lesc->sc_bres, off)); - if (len == 1) - *to = bus_read_1(lesc->sc_bres, off + 1); -} - -static void -le_lebuffer_zerobuf(struct lance_softc *sc, int off, int len) -{ - struct le_lebuffer_softc *lesc = (struct le_lebuffer_softc *)sc; - - for (; len >= 2; len -= 2, off += 2) - bus_write_2(lesc->sc_bres, off, 0); - if (len == 1) - bus_write_1(lesc->sc_bres, off + 1, 0); -} - -static int -le_lebuffer_probe(device_t dev) -{ - - if (strcmp(ofw_bus_get_name(dev), "le") == 0) { - device_set_desc(dev, "LANCE Ethernet"); - return (BUS_PROBE_DEFAULT); - } - return (ENXIO); -} - -static int -le_lebuffer_attach(device_t dev) -{ - struct le_lebuffer_softc *lesc; - struct lance_softc *sc; - int error, i; - - lesc = device_get_softc(dev); - sc = &lesc->sc_am7990.lsc; - - LE_LOCK_INIT(sc, device_get_nameunit(dev)); - - /* - * The "register space" of the parent is just a buffer where the - * the LANCE descriptor rings and the RX/TX buffers can be stored. - */ - i = 0; - lesc->sc_bres = bus_alloc_resource_any(device_get_parent(dev), - SYS_RES_MEMORY, &i, RF_ACTIVE); - if (lesc->sc_bres == NULL) { - device_printf(dev, "cannot allocate LANCE buffer\n"); - error = ENXIO; - goto fail_mtx; - } - - /* Allocate LANCE registers. */ - i = 0; - lesc->sc_rres = bus_alloc_resource_any(dev, SYS_RES_MEMORY, - &i, RF_ACTIVE); - if (lesc->sc_rres == NULL) { - device_printf(dev, "cannot allocate LANCE registers\n"); - error = ENXIO; - goto fail_bres; - } - - /* Allocate LANCE interrupt. */ - i = 0; - if ((lesc->sc_ires = bus_alloc_resource_any(dev, SYS_RES_IRQ, - &i, RF_SHAREABLE | RF_ACTIVE)) == NULL) { - device_printf(dev, "cannot allocate interrupt\n"); - error = ENXIO; - goto fail_rres; - } - - /* - * LANCE view is offset by buffer location. - * Note that we don't use sc->sc_mem. - */ - sc->sc_addr = 0; - sc->sc_memsize = rman_get_size(lesc->sc_bres); - sc->sc_flags = 0; - - /* That old black magic... */ - if (OF_getprop(ofw_bus_get_node(dev), "busmaster-regval", - &sc->sc_conf3, sizeof(sc->sc_conf3)) == -1) - sc->sc_conf3 = LE_C3_ACON | LE_C3_BCON; - /* - * Make sure LE_C3_BSWP is cleared so that for cards where - * that flag actually works le_lebuffer_copy{from,to}buf() - * don't fail... - */ - sc->sc_conf3 &= ~LE_C3_BSWP; - - OF_getetheraddr(dev, sc->sc_enaddr); - - sc->sc_copytodesc = le_lebuffer_copytodesc; - sc->sc_copyfromdesc = le_lebuffer_copyfromdesc; - sc->sc_copytobuf = le_lebuffer_copytobuf; - sc->sc_copyfrombuf = le_lebuffer_copyfrombuf; - sc->sc_zerobuf = le_lebuffer_zerobuf; - - sc->sc_rdcsr = le_lebuffer_rdcsr; - sc->sc_wrcsr = le_lebuffer_wrcsr; - sc->sc_hwreset = NULL; - sc->sc_hwinit = NULL; - sc->sc_hwintr = NULL; - sc->sc_nocarrier = NULL; - sc->sc_mediachange = NULL; - sc->sc_mediastatus = NULL; - sc->sc_supmedia = le_lebuffer_media; - sc->sc_nsupmedia = NLEMEDIA; - sc->sc_defaultmedia = le_lebuffer_media[0]; - - error = am7990_config(&lesc->sc_am7990, device_get_name(dev), - device_get_unit(dev)); - if (error != 0) { - device_printf(dev, "cannot attach Am7990\n"); - goto fail_ires; - } - - error = bus_setup_intr(dev, lesc->sc_ires, INTR_TYPE_NET | INTR_MPSAFE, - NULL, am7990_intr, sc, &lesc->sc_ih); - if (error != 0) { - device_printf(dev, "cannot set up interrupt\n"); - goto fail_am7990; - } - - return (0); - - fail_am7990: - am7990_detach(&lesc->sc_am7990); - fail_ires: - bus_release_resource(dev, SYS_RES_IRQ, - rman_get_rid(lesc->sc_ires), lesc->sc_ires); - fail_rres: - bus_release_resource(dev, SYS_RES_MEMORY, - rman_get_rid(lesc->sc_rres), lesc->sc_rres); - fail_bres: - bus_release_resource(device_get_parent(dev), SYS_RES_MEMORY, - rman_get_rid(lesc->sc_bres), lesc->sc_bres); - fail_mtx: - LE_LOCK_DESTROY(sc); - return (error); -} - -static int -le_lebuffer_detach(device_t dev) -{ - struct le_lebuffer_softc *lesc; - struct lance_softc *sc; - - lesc = device_get_softc(dev); - sc = &lesc->sc_am7990.lsc; - - bus_teardown_intr(dev, lesc->sc_ires, lesc->sc_ih); - am7990_detach(&lesc->sc_am7990); - bus_release_resource(dev, SYS_RES_IRQ, - rman_get_rid(lesc->sc_ires), lesc->sc_ires); - bus_release_resource(dev, SYS_RES_MEMORY, - rman_get_rid(lesc->sc_rres), lesc->sc_rres); - bus_release_resource(device_get_parent(dev), SYS_RES_MEMORY, - rman_get_rid(lesc->sc_bres), lesc->sc_bres); - LE_LOCK_DESTROY(sc); - - return (0); -} - -static int -le_buffer_suspend(device_t dev) -{ - struct le_lebuffer_softc *lesc; - - lesc = device_get_softc(dev); - - lance_suspend(&lesc->sc_am7990.lsc); - - return (0); -} - -static int -le_buffer_resume(device_t dev) -{ - struct le_lebuffer_softc *lesc; - - lesc = device_get_softc(dev); - - lance_resume(&lesc->sc_am7990.lsc); - - return (0); -} diff --git a/sys/dev/le/if_le_ledma.c b/sys/dev/le/if_le_ledma.c deleted file mode 100644 index 482c2341038cc3..00000000000000 --- a/sys/dev/le/if_le_ledma.c +++ /dev/null @@ -1,496 +0,0 @@ -/* $NetBSD: if_le_ledma.c,v 1.26 2005/12/11 12:23:44 christos Exp $ */ - -/*- - * SPDX-License-Identifier: BSD-2-Clause-NetBSD - * - * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Charles M. Hannum; Jason R. Thorpe of the Numerical Aerospace - * Simulation Facility, NASA Ames Research Center; Paul Kranenburg. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include -#include - -#include -#include -#include -#include - -#include -#include - -#include -#include -#include - -#define LEDMA_ALIGNMENT 8 /* ring desc. alignmet for NCR92C990 */ -#define LEDMA_BOUNDARY (16*1024*1024) /* must not cross 16MB boundary */ -#define LEDMA_MEMSIZE (16*1024) /* LANCE memory size */ -#define LEREG1_RDP 0 /* Register Data Port */ -#define LEREG1_RAP 2 /* Register Address Port */ - -struct le_dma_softc { - struct am7990_softc sc_am7990; /* glue to MI code */ - - struct resource *sc_rres; - - struct resource *sc_ires; - void *sc_ih; - - bus_dma_tag_t sc_dmat; - bus_dmamap_t sc_dmam; - bus_addr_t sc_laddr; /* LANCE DMA address */ - - struct lsi64854_softc *sc_dma; /* pointer to DMA engine */ -}; - -static device_probe_t le_dma_probe; -static device_attach_t le_dma_attach; -static device_detach_t le_dma_detach; -static device_resume_t le_dma_resume; -static device_suspend_t le_dma_suspend; - -static device_method_t le_dma_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, le_dma_probe), - DEVMETHOD(device_attach, le_dma_attach), - DEVMETHOD(device_detach, le_dma_detach), - /* We can just use the suspend method here. */ - DEVMETHOD(device_shutdown, le_dma_suspend), - DEVMETHOD(device_suspend, le_dma_suspend), - DEVMETHOD(device_resume, le_dma_resume), - - { 0, 0 } -}; - -DEFINE_CLASS_0(le, le_dma_driver, le_dma_methods, sizeof(struct le_dma_softc)); -DRIVER_MODULE(le, dma, le_dma_driver, le_devclass, 0, 0); -MODULE_DEPEND(le, dma, 1, 1, 1); -MODULE_DEPEND(le, ether, 1, 1, 1); - -/* - * Media types supported - */ -static const int le_dma_supmedia[] = { - IFM_MAKEWORD(IFM_ETHER, IFM_AUTO, 0, 0), - IFM_MAKEWORD(IFM_ETHER, IFM_10_T, 0, 0), - IFM_MAKEWORD(IFM_ETHER, IFM_10_5, 0, 0) -}; - -static void le_dma_wrcsr(struct lance_softc *, uint16_t, uint16_t); -static uint16_t le_dma_rdcsr(struct lance_softc *, uint16_t); -static void le_dma_setutp(struct lance_softc *); -static void le_dma_setaui(struct lance_softc *); -static int le_dma_supmediachange(struct lance_softc *); -static void le_dma_supmediastatus(struct lance_softc *, struct ifmediareq *); -static void le_dma_hwreset(struct lance_softc *); -static int le_dma_hwintr(struct lance_softc *); -static void le_dma_nocarrier(struct lance_softc *); -static bus_dmamap_callback_t le_dma_dma_callback; - -static void -le_dma_wrcsr(struct lance_softc *sc, uint16_t port, uint16_t val) -{ - struct le_dma_softc *lesc = (struct le_dma_softc *)sc; - - bus_write_2(lesc->sc_rres, LEREG1_RAP, port); - bus_barrier(lesc->sc_rres, LEREG1_RAP, 2, BUS_SPACE_BARRIER_WRITE); - bus_write_2(lesc->sc_rres, LEREG1_RDP, val); -} - -static uint16_t -le_dma_rdcsr(struct lance_softc *sc, uint16_t port) -{ - struct le_dma_softc *lesc = (struct le_dma_softc *)sc; - - bus_write_2(lesc->sc_rres, LEREG1_RAP, port); - bus_barrier(lesc->sc_rres, LEREG1_RAP, 2, BUS_SPACE_BARRIER_WRITE); - return (bus_read_2(lesc->sc_rres, LEREG1_RDP)); -} - -static void -le_dma_setutp(struct lance_softc *sc) -{ - struct lsi64854_softc *dma = ((struct le_dma_softc *)sc)->sc_dma; - - L64854_SCSR(dma, L64854_GCSR(dma) | E_TP_AUI); - DELAY(20000); /* We must not touch the LANCE chip for 20ms. */ -} - -static void -le_dma_setaui(struct lance_softc *sc) -{ - struct lsi64854_softc *dma = ((struct le_dma_softc *)sc)->sc_dma; - - L64854_SCSR(dma, L64854_GCSR(dma) & ~E_TP_AUI); - DELAY(20000); /* We must not touch the LANCE chip for 20ms. */ -} - -static int -le_dma_supmediachange(struct lance_softc *sc) -{ - struct ifmedia *ifm = &sc->sc_media; - - if (IFM_TYPE(ifm->ifm_media) != IFM_ETHER) - return (EINVAL); - - /* - * Switch to the selected media. If autoselect is set, we don't - * really have to do anything. We'll switch to the other media - * when we detect loss of carrier. - */ - switch (IFM_SUBTYPE(ifm->ifm_media)) { - case IFM_10_T: - le_dma_setutp(sc); - break; - - case IFM_10_5: - le_dma_setaui(sc); - break; - - case IFM_AUTO: - break; - - default: - return (EINVAL); - } - - return (0); -} - -static void -le_dma_supmediastatus(struct lance_softc *sc, struct ifmediareq *ifmr) -{ - struct lsi64854_softc *dma = ((struct le_dma_softc *)sc)->sc_dma; - - /* - * Notify the world which media we're currently using. - */ - if (L64854_GCSR(dma) & E_TP_AUI) - ifmr->ifm_active = IFM_MAKEWORD(IFM_ETHER, IFM_10_T, 0, 0); - else - ifmr->ifm_active = IFM_MAKEWORD(IFM_ETHER, IFM_10_5, 0, 0); -} - -static void -le_dma_hwreset(struct lance_softc *sc) -{ - struct le_dma_softc *lesc = (struct le_dma_softc *)sc; - struct lsi64854_softc *dma = lesc->sc_dma; - uint32_t aui_bit, csr; - - /* - * Reset DMA channel. - */ - csr = L64854_GCSR(dma); - aui_bit = csr & E_TP_AUI; - DMA_RESET(dma); - - /* Write bits 24-31 of Lance address. */ - bus_write_4(dma->sc_res, L64854_REG_ENBAR, - lesc->sc_laddr & 0xff000000); - - DMA_ENINTR(dma); - - /* - * Disable E-cache invalidates on chip writes. - * Retain previous cable selection bit. - */ - csr = L64854_GCSR(dma); - csr |= (E_DSBL_WR_INVAL | aui_bit); - L64854_SCSR(dma, csr); - DELAY(20000); /* We must not touch the LANCE chip for 20ms. */ -} - -static int -le_dma_hwintr(struct lance_softc *sc) -{ - struct le_dma_softc *lesc = (struct le_dma_softc *)sc; - struct lsi64854_softc *dma = lesc->sc_dma; - - return (DMA_INTR(dma)); -} - -static void -le_dma_nocarrier(struct lance_softc *sc) -{ - struct le_dma_softc *lesc = (struct le_dma_softc *)sc; - - /* - * Check if the user has requested a certain cable type, and - * if so, honor that request. - */ - - if (L64854_GCSR(lesc->sc_dma) & E_TP_AUI) { - switch (IFM_SUBTYPE(sc->sc_media.ifm_media)) { - case IFM_10_5: - case IFM_AUTO: - if_printf(sc->sc_ifp, "lost carrier on UTP port, " - "switching to AUI port\n"); - le_dma_setaui(sc); - } - } else { - switch (IFM_SUBTYPE(sc->sc_media.ifm_media)) { - case IFM_10_T: - case IFM_AUTO: - if_printf(sc->sc_ifp, "lost carrier on AUI port, " - "switching to UTP port\n"); - le_dma_setutp(sc); - } - } -} - -static void -le_dma_dma_callback(void *xsc, bus_dma_segment_t *segs, int nsegs, int error) -{ - struct le_dma_softc *lesc = (struct le_dma_softc *)xsc; - - if (error != 0) - return; - KASSERT(nsegs == 1, ("%s: bad DMA segment count", __func__)); - lesc->sc_laddr = segs[0].ds_addr; -} - -static int -le_dma_probe(device_t dev) -{ - - if (strcmp(ofw_bus_get_name(dev), "le") == 0) { - device_set_desc(dev, "LANCE Ethernet"); - return (BUS_PROBE_DEFAULT); - } - return (ENXIO); -} - -static int -le_dma_attach(device_t dev) -{ - struct le_dma_softc *lesc; - struct lsi64854_softc *dma; - struct lance_softc *sc; - int error, i; - - lesc = device_get_softc(dev); - sc = &lesc->sc_am7990.lsc; - - LE_LOCK_INIT(sc, device_get_nameunit(dev)); - - /* - * Establish link to `ledma' device. - * XXX hackery. - */ - dma = (struct lsi64854_softc *)device_get_softc(device_get_parent(dev)); - lesc->sc_dma = dma; - lesc->sc_dma->sc_client = lesc; - - i = 0; - lesc->sc_rres = bus_alloc_resource_any(dev, SYS_RES_MEMORY, - &i, RF_ACTIVE); - if (lesc->sc_rres == NULL) { - device_printf(dev, "cannot allocate registers\n"); - error = ENXIO; - goto fail_mtx; - } - - i = 0; - if ((lesc->sc_ires = bus_alloc_resource_any(dev, SYS_RES_IRQ, - &i, RF_SHAREABLE | RF_ACTIVE)) == NULL) { - device_printf(dev, "cannot allocate interrupt\n"); - error = ENXIO; - goto fail_rres; - } - - /* Attach the DMA engine. */ - error = lsi64854_attach(dma); - if (error != 0) { - device_printf(dev, "lsi64854_attach failed\n"); - goto fail_ires; - } - - sc->sc_memsize = LEDMA_MEMSIZE; - error = bus_dma_tag_create( - dma->sc_parent_dmat, /* parent */ - LEDMA_ALIGNMENT, /* alignment */ - LEDMA_BOUNDARY, /* boundary */ - BUS_SPACE_MAXADDR_32BIT, /* lowaddr */ - BUS_SPACE_MAXADDR, /* highaddr */ - NULL, NULL, /* filter, filterarg */ - sc->sc_memsize, /* maxsize */ - 1, /* nsegments */ - sc->sc_memsize, /* maxsegsize */ - 0, /* flags */ - NULL, NULL, /* lockfunc, lockarg */ - &lesc->sc_dmat); - if (error != 0) { - device_printf(dev, "cannot allocate buffer DMA tag\n"); - goto fail_lsi; - } - - error = bus_dmamem_alloc(lesc->sc_dmat, (void **)&sc->sc_mem, - BUS_DMA_WAITOK | BUS_DMA_COHERENT, &lesc->sc_dmam); - if (error != 0) { - device_printf(dev, "cannot allocate DMA buffer memory\n"); - goto fail_dtag; - } - - lesc->sc_laddr = 0; - error = bus_dmamap_load(lesc->sc_dmat, lesc->sc_dmam, sc->sc_mem, - sc->sc_memsize, le_dma_dma_callback, lesc, 0); - if (error != 0 || lesc->sc_laddr == 0) { - device_printf(dev, "cannot load DMA buffer map\n"); - goto fail_dmem; - } - - sc->sc_addr = lesc->sc_laddr & 0xffffff; - sc->sc_flags = 0; - sc->sc_conf3 = LE_C3_BSWP | LE_C3_ACON | LE_C3_BCON; - - sc->sc_mediachange = le_dma_supmediachange; - sc->sc_mediastatus = le_dma_supmediastatus; - sc->sc_supmedia = le_dma_supmedia; - sc->sc_nsupmedia = nitems(le_dma_supmedia); - sc->sc_defaultmedia = le_dma_supmedia[0]; - - OF_getetheraddr(dev, sc->sc_enaddr); - - sc->sc_copytodesc = lance_copytobuf_contig; - sc->sc_copyfromdesc = lance_copyfrombuf_contig; - sc->sc_copytobuf = lance_copytobuf_contig; - sc->sc_copyfrombuf = lance_copyfrombuf_contig; - sc->sc_zerobuf = lance_zerobuf_contig; - - sc->sc_rdcsr = le_dma_rdcsr; - sc->sc_wrcsr = le_dma_wrcsr; - sc->sc_hwreset = le_dma_hwreset; - sc->sc_hwintr = le_dma_hwintr; - sc->sc_nocarrier = le_dma_nocarrier; - - error = am7990_config(&lesc->sc_am7990, device_get_name(dev), - device_get_unit(dev)); - if (error != 0) { - device_printf(dev, "cannot attach Am7990\n"); - goto fail_dmap; - } - - error = bus_setup_intr(dev, lesc->sc_ires, INTR_TYPE_NET | INTR_MPSAFE, - NULL, am7990_intr, sc, &lesc->sc_ih); - if (error != 0) { - device_printf(dev, "cannot set up interrupt\n"); - goto fail_am7990; - } - - return (0); - - fail_am7990: - am7990_detach(&lesc->sc_am7990); - fail_dmap: - bus_dmamap_unload(lesc->sc_dmat, lesc->sc_dmam); - fail_dmem: - bus_dmamem_free(lesc->sc_dmat, sc->sc_mem, lesc->sc_dmam); - fail_dtag: - bus_dma_tag_destroy(lesc->sc_dmat); - fail_lsi: - lsi64854_detach(dma); - fail_ires: - bus_release_resource(dev, SYS_RES_IRQ, rman_get_rid(lesc->sc_ires), - lesc->sc_ires); - fail_rres: - bus_release_resource(dev, SYS_RES_MEMORY, rman_get_rid(lesc->sc_rres), - lesc->sc_rres); - fail_mtx: - LE_LOCK_DESTROY(sc); - return (error); -} - -static int -le_dma_detach(device_t dev) -{ - struct le_dma_softc *lesc; - struct lance_softc *sc; - int error; - - lesc = device_get_softc(dev); - sc = &lesc->sc_am7990.lsc; - - bus_teardown_intr(dev, lesc->sc_ires, lesc->sc_ih); - am7990_detach(&lesc->sc_am7990); - bus_dmamap_unload(lesc->sc_dmat, lesc->sc_dmam); - bus_dmamem_free(lesc->sc_dmat, sc->sc_mem, lesc->sc_dmam); - bus_dma_tag_destroy(lesc->sc_dmat); - error = lsi64854_detach(lesc->sc_dma); - if (error != 0) - return (error); - bus_release_resource(dev, SYS_RES_IRQ, rman_get_rid(lesc->sc_ires), - lesc->sc_ires); - bus_release_resource(dev, SYS_RES_MEMORY, rman_get_rid(lesc->sc_rres), - lesc->sc_rres); - LE_LOCK_DESTROY(sc); - - return (0); -} - -static int -le_dma_suspend(device_t dev) -{ - struct le_dma_softc *lesc; - - lesc = device_get_softc(dev); - - lance_suspend(&lesc->sc_am7990.lsc); - - return (0); -} - -static int -le_dma_resume(device_t dev) -{ - struct le_dma_softc *lesc; - - lesc = device_get_softc(dev); - - lance_resume(&lesc->sc_am7990.lsc); - - return (0); -} diff --git a/sys/dev/le/lebuffer_sbus.c b/sys/dev/le/lebuffer_sbus.c deleted file mode 100644 index f40aca1b6830bf..00000000000000 --- a/sys/dev/le/lebuffer_sbus.c +++ /dev/null @@ -1,305 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2006 Marius Strobl - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include - -#include -#include -#include - -struct lebuffer_devinfo { - struct ofw_bus_devinfo ldi_obdinfo; - struct resource_list ldi_rl; -}; - -static devclass_t lebuffer_devclass; - -static device_probe_t lebuffer_probe; -static device_attach_t lebuffer_attach; -static device_detach_t lebuffer_detach; -static bus_print_child_t lebuffer_print_child; -static bus_probe_nomatch_t lebuffer_probe_nomatch; -static bus_get_resource_list_t lebuffer_get_resource_list; -static ofw_bus_get_devinfo_t lebuffer_get_devinfo; - -static struct lebuffer_devinfo *lebuffer_setup_dinfo(device_t, phandle_t); -static void lebuffer_destroy_dinfo(struct lebuffer_devinfo *); -static int lebuffer_print_res(struct lebuffer_devinfo *); - -static device_method_t lebuffer_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, lebuffer_probe), - DEVMETHOD(device_attach, lebuffer_attach), - DEVMETHOD(device_detach, lebuffer_detach), - DEVMETHOD(device_shutdown, bus_generic_shutdown), - DEVMETHOD(device_suspend, bus_generic_suspend), - DEVMETHOD(device_resume, bus_generic_resume), - - /* Bus interface */ - DEVMETHOD(bus_print_child, lebuffer_print_child), - DEVMETHOD(bus_probe_nomatch, lebuffer_probe_nomatch), - DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), - DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), - DEVMETHOD(bus_alloc_resource, bus_generic_rl_alloc_resource), - DEVMETHOD(bus_adjust_resource, bus_generic_adjust_resource), - DEVMETHOD(bus_release_resource, bus_generic_rl_release_resource), - DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), - DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), - DEVMETHOD(bus_get_resource_list, lebuffer_get_resource_list), - DEVMETHOD(bus_get_resource, bus_generic_rl_get_resource), - - /* ofw_bus interface */ - DEVMETHOD(ofw_bus_get_devinfo, lebuffer_get_devinfo), - DEVMETHOD(ofw_bus_get_compat, ofw_bus_gen_get_compat), - DEVMETHOD(ofw_bus_get_model, ofw_bus_gen_get_model), - DEVMETHOD(ofw_bus_get_name, ofw_bus_gen_get_name), - DEVMETHOD(ofw_bus_get_node, ofw_bus_gen_get_node), - DEVMETHOD(ofw_bus_get_type, ofw_bus_gen_get_type), - - { 0, 0 } -}; - -DEFINE_CLASS_0(lebuffer, lebuffer_driver, lebuffer_methods, 1); -DRIVER_MODULE(lebuffer, sbus, lebuffer_driver, lebuffer_devclass, 0, 0); -MODULE_DEPEND(lebuffer, sbus, 1, 1, 1); -MODULE_VERSION(lebuffer, 1); - -static int -lebuffer_probe(device_t dev) -{ - const char *name; - - name = ofw_bus_get_name(dev); - if (strcmp(name, "lebuffer") == 0) { - device_set_desc_copy(dev, name); - return (0); - } - return (ENXIO); -} - -static int -lebuffer_attach(device_t dev) -{ - struct lebuffer_devinfo *ldi; - device_t cdev; - phandle_t child; - int children; - - children = 0; - for (child = OF_child(ofw_bus_get_node(dev)); child != 0; - child = OF_peer(child)) { - if ((ldi = lebuffer_setup_dinfo(dev, child)) == NULL) - continue; - if (children != 0) { - device_printf(dev, - "<%s>: only one child per buffer supported\n", - ldi->ldi_obdinfo.obd_name); - lebuffer_destroy_dinfo(ldi); - continue; - } - if ((cdev = device_add_child(dev, NULL, -1)) == NULL) { - device_printf(dev, "<%s>: device_add_child failed\n", - ldi->ldi_obdinfo.obd_name); - lebuffer_destroy_dinfo(ldi); - continue; - } - device_set_ivars(cdev, ldi); - children++; - } - return (bus_generic_attach(dev)); -} - -static int -lebuffer_detach(device_t dev) -{ - device_t *children; - int i, nchildren; - - bus_generic_detach(dev); - if (device_get_children(dev, &children, &nchildren) == 0) { - for (i = 0; i < nchildren; i++) { - lebuffer_destroy_dinfo(device_get_ivars(children[i])); - device_delete_child(dev, children[i]); - } - free(children, M_TEMP); - } - return (0); -} - -static struct lebuffer_devinfo * -lebuffer_setup_dinfo(device_t dev, phandle_t node) -{ - struct lebuffer_devinfo *ldi; - struct sbus_regs *reg; - uint32_t base, iv, *intr; - int i, nreg, nintr, slot, rslot; - - ldi = malloc(sizeof(*ldi), M_DEVBUF, M_WAITOK | M_ZERO); - if (ofw_bus_gen_setup_devinfo(&ldi->ldi_obdinfo, node) != 0) { - free(ldi, M_DEVBUF); - return (NULL); - } - resource_list_init(&ldi->ldi_rl); - slot = -1; - nreg = OF_getprop_alloc_multi(node, "reg", sizeof(*reg), (void **)®); - if (nreg == -1) { - device_printf(dev, "<%s>: incomplete\n", - ldi->ldi_obdinfo.obd_name); - goto fail; - } - for (i = 0; i < nreg; i++) { - base = reg[i].sbr_offset; - if (SBUS_ABS(base)) { - rslot = SBUS_ABS_TO_SLOT(base); - base = SBUS_ABS_TO_OFFSET(base); - } else - rslot = reg[i].sbr_slot; - if (slot != -1 && slot != rslot) { - device_printf(dev, "<%s>: multiple slots\n", - ldi->ldi_obdinfo.obd_name); - OF_prop_free(reg); - goto fail; - } - slot = rslot; - - resource_list_add(&ldi->ldi_rl, SYS_RES_MEMORY, i, base, - base + reg[i].sbr_size, reg[i].sbr_size); - } - OF_prop_free(reg); - if (slot != sbus_get_slot(dev)) { - device_printf(dev, "<%s>: parent and child slot do not match\n", - ldi->ldi_obdinfo.obd_name); - goto fail; - } - - /* - * The `interrupts' property contains the SBus interrupt level. - */ - nintr = OF_getprop_alloc_multi(node, "interrupts", sizeof(*intr), - (void **)&intr); - if (nintr != -1) { - for (i = 0; i < nintr; i++) { - iv = intr[i]; - /* - * SBus card devices need the slot number encoded into - * the vector as this is generally not done. - */ - if ((iv & INTMAP_OBIO_MASK) == 0) - iv |= slot << 3; - /* Set the IGN as appropriate. */ - iv |= sbus_get_ign(dev) << INTMAP_IGN_SHIFT; - resource_list_add(&ldi->ldi_rl, SYS_RES_IRQ, i, - iv, iv, 1); - } - OF_prop_free(intr); - } - return (ldi); - - fail: - lebuffer_destroy_dinfo(ldi); - return (NULL); -} - -static void -lebuffer_destroy_dinfo(struct lebuffer_devinfo *dinfo) -{ - - resource_list_free(&dinfo->ldi_rl); - ofw_bus_gen_destroy_devinfo(&dinfo->ldi_obdinfo); - free(dinfo, M_DEVBUF); -} - -static int -lebuffer_print_child(device_t dev, device_t child) -{ - int rv; - - rv = bus_print_child_header(dev, child); - rv += lebuffer_print_res(device_get_ivars(child)); - rv += bus_print_child_footer(dev, child); - return (rv); -} - -static void -lebuffer_probe_nomatch(device_t dev, device_t child) -{ - const char *type; - - device_printf(dev, "<%s>", ofw_bus_get_name(child)); - lebuffer_print_res(device_get_ivars(child)); - type = ofw_bus_get_type(child); - printf(" type %s (no driver attached)\n", - type != NULL ? type : "unknown"); -} - -static struct resource_list * -lebuffer_get_resource_list(device_t dev, device_t child) -{ - struct lebuffer_devinfo *ldi; - - ldi = device_get_ivars(child); - return (&ldi->ldi_rl); -} - -static const struct ofw_bus_devinfo * -lebuffer_get_devinfo(device_t bus, device_t child) -{ - struct lebuffer_devinfo *ldi; - - ldi = device_get_ivars(child); - return (&ldi->ldi_obdinfo); -} - -static int -lebuffer_print_res(struct lebuffer_devinfo *ldi) -{ - int rv; - - rv = 0; - rv += resource_list_print_type(&ldi->ldi_rl, "mem", SYS_RES_MEMORY, - "%#jx"); - rv += resource_list_print_type(&ldi->ldi_rl, "irq", SYS_RES_IRQ, "%jd"); - return (rv); -} diff --git a/sys/dev/mpt/mpt.h b/sys/dev/mpt/mpt.h index 1bff77e3758cc6..8c9000a03e683c 100644 --- a/sys/dev/mpt/mpt.h +++ b/sys/dev/mpt/mpt.h @@ -122,11 +122,6 @@ #include #include -#ifdef __sparc64__ -#include -#include -#endif - #include #include diff --git a/sys/dev/mpt/mpt_pci.c b/sys/dev/mpt/mpt_pci.c index 2adaa95df32a48..94c568c4c20502 100644 --- a/sys/dev/mpt/mpt_pci.c +++ b/sys/dev/mpt/mpt_pci.c @@ -372,10 +372,6 @@ mpt_pci_attach(device_t dev) mpt->verbose = MPT_PRT_NONE; mpt->role = MPT_ROLE_NONE; mpt->mpt_ini_id = MPT_INI_ID_NONE; -#ifdef __sparc64__ - if (mpt->is_spi) - mpt->mpt_ini_id = OF_getscsinitid(dev); -#endif mpt_set_options(mpt); if (mpt->verbose == MPT_PRT_NONE) { mpt->verbose = MPT_PRT_WARN; diff --git a/sys/dev/mthca/mthca_srq.c b/sys/dev/mthca/mthca_srq.c index d22f970480c0ee..579c23a7365447 100644 --- a/sys/dev/mthca/mthca_srq.c +++ b/sys/dev/mthca/mthca_srq.c @@ -115,16 +115,10 @@ static void mthca_arbel_init_srq_context(struct mthca_dev *dev, struct mthca_srq *srq, struct mthca_arbel_srq_context *context) { - int logsize, max; + int logsize; memset(context, 0, sizeof *context); - - /* - * Put max in a temporary variable to work around gcc bug - * triggered by ilog2() on sparc64. - */ - max = srq->max; - logsize = ilog2(max); + logsize = ilog2(srq->max); context->state_logsize_srqn = cpu_to_be32(logsize << 24 | srq->srqn); context->lkey = cpu_to_be32(srq->mr.ibmr.lkey); context->db_index = cpu_to_be32(srq->db_index); diff --git a/sys/dev/mxge/if_mxge_var.h b/sys/dev/mxge/if_mxge_var.h index dd9ec3ff2612d2..0c3950b5e005d7 100644 --- a/sys/dev/mxge/if_mxge_var.h +++ b/sys/dev/mxge/if_mxge_var.h @@ -325,27 +325,6 @@ struct mxge_pkt_info { }; -/* implement our own memory barriers, since bus_space_barrier - cannot handle write-combining regions */ - -#if __FreeBSD_version < 800053 - -#if defined (__GNUC__) - #if #cpu(i386) || defined __i386 || defined i386 || defined __i386__ || #cpu(x86_64) || defined __x86_64__ - #define wmb() __asm__ __volatile__ ("sfence;": : :"memory") - #elif #cpu(sparc64) || defined sparc64 || defined __sparcv9 - #define wmb() __asm__ __volatile__ ("membar #MemIssue": : :"memory") - #elif #cpu(sparc) || defined sparc || defined __sparc__ - #define wmb() __asm__ __volatile__ ("stbar;": : :"memory") - #else - #define wmb() /* XXX just to make this compile */ - #endif -#else - #error "unknown compiler" -#endif - -#endif - static inline void mxge_pio_copy(volatile void *to_v, void *from_v, size_t size) { diff --git a/sys/dev/ofw/openfirm.h b/sys/dev/ofw/openfirm.h index 1f3f4bd0b25584..53c8cdf88df8d2 100644 --- a/sys/dev/ofw/openfirm.h +++ b/sys/dev/ofw/openfirm.h @@ -178,13 +178,10 @@ int OF_interpret(const char *cmd, int nreturns, ...); /* * Decode the Nth register property of the given device node and create a bus * space tag and handle for accessing it. This is for use in setting up things - * like early console output before newbus is available. The implementation is - * machine-dependent, and sparc uses a different function signature as well. + * like early console output before newbus is available. */ -#ifndef __sparc64__ int OF_decode_addr(phandle_t dev, int regno, bus_space_tag_t *ptag, bus_space_handle_t *phandle, bus_size_t *sz); -#endif #endif /* _KERNEL */ #endif /* _DEV_OPENFIRM_H_ */ diff --git a/sys/dev/pcf/envctrl.c b/sys/dev/pcf/envctrl.c deleted file mode 100644 index 1d57b36e000e72..00000000000000 --- a/sys/dev/pcf/envctrl.c +++ /dev/null @@ -1,194 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2004 Joerg Wunsch - * - * derived from sys/i386/isa/pcf.c which is: - * - * Copyright (c) 1998 Nicolas Souchu, Marc Bouget - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ -#include -__FBSDID("$FreeBSD$"); - -/* - * Device specific driver for the SUNW,envctrl device found on some - * UltraSPARC Sun systems. This device is a Philips PCF8584 sitting - * on the Ebus2. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include - -#include - -#include -#include -#include -#include "iicbus_if.h" - -#undef PCF_DEFAULT_ADDR -#define PCF_DEFAULT_ADDR 0x55 /* SUNW,pcf default */ - -static int envctrl_probe(device_t); -static int envctrl_attach(device_t); -static int envctrl_detach(device_t); - -static device_method_t envctrl_methods[] = { - /* device interface */ - DEVMETHOD(device_probe, envctrl_probe), - DEVMETHOD(device_attach, envctrl_attach), - DEVMETHOD(device_detach, envctrl_detach), - - /* iicbus interface */ - DEVMETHOD(iicbus_callback, iicbus_null_callback), - DEVMETHOD(iicbus_repeated_start, pcf_repeated_start), - DEVMETHOD(iicbus_start, pcf_start), - DEVMETHOD(iicbus_stop, pcf_stop), - DEVMETHOD(iicbus_write, pcf_write), - DEVMETHOD(iicbus_read, pcf_read), - DEVMETHOD(iicbus_reset, pcf_rst_card), - { 0, 0 } -}; - -static devclass_t envctrl_devclass; - -static driver_t envctrl_driver = { - "envctrl", - envctrl_methods, - sizeof(struct pcf_softc), -}; - -static int -envctrl_probe(device_t dev) -{ - - if (strcmp("SUNW,envctrl", ofw_bus_get_name(dev)) == 0) { - device_set_desc(dev, "EBus SUNW,envctrl"); - return (0); - } - return (ENXIO); -} - -static int -envctrl_attach(device_t dev) -{ - struct pcf_softc *sc; - int rv = ENXIO; - - sc = DEVTOSOFTC(dev); - mtx_init(&sc->pcf_lock, device_get_nameunit(dev), "pcf", MTX_DEF); - - /* IO port is mandatory */ - sc->res_ioport = bus_alloc_resource_any(dev, SYS_RES_MEMORY, - &sc->rid_ioport, RF_ACTIVE); - if (sc->res_ioport == 0) { - device_printf(dev, "cannot reserve I/O port range\n"); - goto error; - } - - sc->pcf_flags = device_get_flags(dev); - - if (!(sc->pcf_flags & IIC_POLLED)) { - sc->res_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &sc->rid_irq, - RF_ACTIVE); - if (sc->res_irq == 0) { - device_printf(dev, "can't reserve irq, polled mode.\n"); - sc->pcf_flags |= IIC_POLLED; - } - } - - /* reset the chip */ - pcf_rst_card(dev, IIC_FASTEST, PCF_DEFAULT_ADDR, NULL); - - rv = bus_setup_intr(dev, sc->res_irq, - INTR_TYPE_NET | INTR_MPSAFE /* | INTR_ENTROPY */, - NULL, pcf_intr, sc, &sc->intr_cookie); - if (rv) { - device_printf(dev, "could not setup IRQ\n"); - goto error; - } - - if ((sc->iicbus = device_add_child(dev, "iicbus", -1)) == NULL) - device_printf(dev, "could not allocate iicbus instance\n"); - - /* probe and attach the iicbus */ - bus_generic_attach(dev); - - return (0); - -error: - if (sc->res_irq != 0) { - bus_release_resource(dev, SYS_RES_IRQ, sc->rid_irq, - sc->res_irq); - } - if (sc->res_ioport != 0) { - bus_release_resource(dev, SYS_RES_MEMORY, sc->rid_ioport, - sc->res_ioport); - } - mtx_destroy(&sc->pcf_lock); - return (rv); -} - -static int -envctrl_detach(device_t dev) -{ - struct pcf_softc *sc; - int rv; - - sc = DEVTOSOFTC(dev); - - if ((rv = bus_generic_detach(dev)) != 0) - return (rv); - - if ((rv = device_delete_child(dev, sc->iicbus)) != 0) - return (rv); - - if (sc->res_irq != 0) { - bus_teardown_intr(dev, sc->res_irq, sc->intr_cookie); - bus_release_resource(dev, SYS_RES_IRQ, sc->rid_irq, sc->res_irq); - } - - bus_release_resource(dev, SYS_RES_MEMORY, sc->rid_ioport, sc->res_ioport); - mtx_destroy(&sc->pcf_lock); - - return (0); -} - -DRIVER_MODULE(envctrl, ebus, envctrl_driver, envctrl_devclass, 0, 0); -DRIVER_MODULE(iicbus, envctrl, iicbus_driver, iicbus_devclass, 0, 0); diff --git a/sys/dev/pcf/pcf_ebus.c b/sys/dev/pcf/pcf_ebus.c deleted file mode 100644 index 3fa0be6b26ccee..00000000000000 --- a/sys/dev/pcf/pcf_ebus.c +++ /dev/null @@ -1,256 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2004 Marius Strobl, Joerg Wunsch - * - * derived from sys/i386/isa/pcf.c which is: - * - * Copyright (c) 1998 Nicolas Souchu, Marc Bouget - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ -#include -__FBSDID("$FreeBSD$"); - -/* - * Device specific driver for the EBus i2c devices found on some sun4u - * systems. On systems not having a boot-bus controller the i2c devices - * are PCF8584. - * - * Known onboard slave devices on the primary bus are: - * - * AXe: - * 0x40 PCF8574 I/O fan status (CPU fans 1+2) - * 0x9e PCF8591 A/D temperature (CPU + hotspot) - * - * AXmp: - * 0x70 PCF8574 I/O fan status (fans 1-4) - * 0x78 PCF8574 I/O fan fail interrupt - * 0x9a PCF8591 A/D voltage (CPU core) - * 0x9c PCF8591 A/D temperature (hotspots 1+2, aux. analog 1+2) - * 0x9e PCF8591 A/D temperature (CPUs 1-4) - * - * CP1400: - * 0x70 PCF8574 I/O reserved for factory use - * 0x9e PCF8591 A/D temperature (CPU) - * - * CP1500: - * 0x70 PCF8574 I/O reserved for factory use - * 0x72 PCF8574 I/O geographic address + power supply status lines - * 0x9e PCF8591 A/D temperature (CPU) - * 0xa0 AT24C01A hostid - * - * For AXmp, CP1400 and CP1500 these are described in more detail in: - * http://www.sun.com/oem/products/manuals/805-7581-04.pdf - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include - -#include - -#include -#include -#include "iicbus_if.h" - -#define PCF_NAME "pcf" - -static int pcf_ebus_probe(device_t); -static int pcf_ebus_attach(device_t); -static int pcf_ebus_detach(device_t); - -static device_method_t pcf_ebus_methods[] = { - /* device interface */ - DEVMETHOD(device_probe, pcf_ebus_probe), - DEVMETHOD(device_attach, pcf_ebus_attach), - DEVMETHOD(device_detach, pcf_ebus_detach), - - /* iicbus interface */ - DEVMETHOD(iicbus_callback, iicbus_null_callback), - DEVMETHOD(iicbus_repeated_start, pcf_repeated_start), - DEVMETHOD(iicbus_start, pcf_start), - DEVMETHOD(iicbus_stop, pcf_stop), - DEVMETHOD(iicbus_write, pcf_write), - DEVMETHOD(iicbus_read, pcf_read), - DEVMETHOD(iicbus_reset, pcf_rst_card), - { 0, 0 } -}; - -static devclass_t pcf_ebus_devclass; - -static driver_t pcf_ebus_driver = { - PCF_NAME, - pcf_ebus_methods, - sizeof(struct pcf_softc), -}; - -static int -pcf_ebus_probe(device_t dev) -{ - const char *compat; - - /* - * We must not attach to this i2c device if this is a system with - * a boot-bus controller. Additionally testing the compatibility - * property will hopefully take care of this. - */ - if (strcmp("i2c", ofw_bus_get_name(dev)) == 0) { - compat = ofw_bus_get_compat(dev); - if (compat != NULL && strcmp("i2cpcf,8584", compat) == 0) { - device_set_desc(dev, "PCF8584 I2C bus controller"); - return (0); - } - } - return (ENXIO); -} - -static int -pcf_ebus_attach(device_t dev) -{ - struct pcf_softc *sc; - int rv = ENXIO; - phandle_t node; - uint64_t own_addr; - - sc = DEVTOSOFTC(dev); - mtx_init(&sc->pcf_lock, device_get_nameunit(dev), "pcf", MTX_DEF); - - /* get OFW node of the pcf */ - if ((node = ofw_bus_get_node(dev)) == -1) { - device_printf(dev, "cannot get OFW node\n"); - goto error; - } - - /* IO port is mandatory */ - sc->res_ioport = bus_alloc_resource_any(dev, SYS_RES_MEMORY, - &sc->rid_ioport, RF_ACTIVE); - if (sc->res_ioport == 0) { - device_printf(dev, "cannot reserve I/O port range\n"); - goto error; - } - - sc->pcf_flags = device_get_flags(dev); - - /* - * XXX use poll-mode property? - */ - if (!(sc->pcf_flags & IIC_POLLED)) { - sc->res_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, - &sc->rid_irq, RF_ACTIVE); - if (sc->res_irq == 0) { - device_printf(dev, "can't reserve irq, polled mode.\n"); - sc->pcf_flags |= IIC_POLLED; - } - } - - /* - * XXX on AXmp there's probably a second IRQ which is the fan fail - * interrupt genererated by the PCF8574 at 0x78. - */ - - /* get address of the pcf */ - if (OF_getprop(node, "own-address", &own_addr, sizeof(own_addr)) == - -1) { - device_printf(dev, "cannot get own address\n"); - goto error; - } - if (bootverbose) - device_printf(dev, "PCF8584 address: 0x%08llx\n", (unsigned - long long)own_addr); - - /* reset the chip */ - pcf_rst_card(dev, IIC_FASTEST, own_addr, NULL); - - if (sc->res_irq) { - rv = bus_setup_intr(dev, sc->res_irq, - INTR_TYPE_NET /* | INTR_ENTROPY */, NULL, pcf_intr, sc, - &sc->intr_cookie); - if (rv) { - device_printf(dev, "could not setup IRQ\n"); - goto error; - } - } - - if ((sc->iicbus = device_add_child(dev, "iicbus", -1)) == NULL) - device_printf(dev, "could not allocate iicbus instance\n"); - - /* probe and attach the iicbus */ - bus_generic_attach(dev); - - return (0); - -error: - if (sc->res_irq != 0) { - bus_release_resource(dev, SYS_RES_IRQ, sc->rid_irq, - sc->res_irq); - } - if (sc->res_ioport != 0) { - bus_release_resource(dev, SYS_RES_MEMORY, sc->rid_ioport, - sc->res_ioport); - } - mtx_destroy(&sc->pcf_lock); - return (rv); -} - -static int -pcf_ebus_detach(device_t dev) -{ - struct pcf_softc *sc; - int rv; - - sc = DEVTOSOFTC(dev); - - if ((rv = bus_generic_detach(dev)) != 0) - return (rv); - - if ((rv = device_delete_child(dev, sc->iicbus)) != 0) - return (rv); - - if (sc->res_irq != 0) { - bus_teardown_intr(dev, sc->res_irq, - sc->intr_cookie); - bus_release_resource(dev, SYS_RES_IRQ, sc->rid_irq, - sc->res_irq); - } - - bus_release_resource(dev, SYS_RES_MEMORY, sc->rid_ioport, - sc->res_ioport); - mtx_destroy(&sc->pcf_lock); - - return (0); -} - -DRIVER_MODULE(pcf_ebus, ebus, pcf_ebus_driver, pcf_ebus_devclass, 0, 0); diff --git a/sys/dev/proto/proto_core.c b/sys/dev/proto/proto_core.c index 404ba498f09d69..44199bdd7b8fd4 100644 --- a/sys/dev/proto/proto_core.c +++ b/sys/dev/proto/proto_core.c @@ -507,9 +507,7 @@ proto_mmap(struct cdev *cdev, vm_ooffset_t offset, vm_paddr_t *paddr, if (offset >= r->r_size) return (EINVAL); *paddr = rman_get_start(r->r_d.res) + offset; -#ifndef __sparc64__ *memattr = VM_MEMATTR_UNCACHEABLE; -#endif break; case PROTO_RES_BUSDMA: if (!proto_busdma_mmap_allowed(r->r_d.busdma, offset)) diff --git a/sys/dev/scc/scc_bfe_ebus.c b/sys/dev/scc/scc_bfe_ebus.c deleted file mode 100644 index 365eb28444ee0c..00000000000000 --- a/sys/dev/scc/scc_bfe_ebus.c +++ /dev/null @@ -1,99 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2004-2006 Marcel Moolenaar - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include -#include - -#include - -#include -#include -#include - -#include - -#define EBUS_REGSHFT 0 -#define EBUS_RCLK 29491200 - -static int -scc_ebus_probe(device_t dev) -{ - struct scc_softc *sc; - const char *cmpt, *nm; - - sc = device_get_softc(dev); - nm = ofw_bus_get_name(dev); - cmpt = ofw_bus_get_compat(dev); - if (cmpt == NULL) - cmpt = ""; - if (!strcmp(nm, "se") || !strcmp(nm, "FJSV,se") || - !strcmp(cmpt, "sab82532")) { - device_set_desc(dev, "Siemens SAB 82532 dual channel SCC"); - sc->sc_class = &scc_sab82532_class; - return (scc_bfe_probe(dev, EBUS_REGSHFT, EBUS_RCLK, 0)); - } - return (ENXIO); -} - -static int -scc_ebus_attach(device_t dev) -{ - - return (scc_bfe_attach(dev, 0)); -} - -static device_method_t scc_ebus_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, scc_ebus_probe), - DEVMETHOD(device_attach, scc_ebus_attach), - DEVMETHOD(device_detach, scc_bfe_detach), - - DEVMETHOD(bus_alloc_resource, scc_bus_alloc_resource), - DEVMETHOD(bus_release_resource, scc_bus_release_resource), - DEVMETHOD(bus_get_resource, scc_bus_get_resource), - DEVMETHOD(bus_read_ivar, scc_bus_read_ivar), - DEVMETHOD(bus_setup_intr, scc_bus_setup_intr), - DEVMETHOD(bus_teardown_intr, scc_bus_teardown_intr), - - DEVMETHOD_END -}; - -static driver_t scc_ebus_driver = { - scc_driver_name, - scc_ebus_methods, - sizeof(struct scc_softc), -}; - -DRIVER_MODULE(scc, ebus, scc_ebus_driver, scc_devclass, NULL, NULL); diff --git a/sys/dev/scc/scc_bfe_sbus.c b/sys/dev/scc/scc_bfe_sbus.c deleted file mode 100644 index b6f0f1a0e8b808..00000000000000 --- a/sys/dev/scc/scc_bfe_sbus.c +++ /dev/null @@ -1,96 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2004-2006 Marcel Moolenaar - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include -#include - -#include - -#include -#include -#include - -#include - -#define SBUS_REGSHFT 1 -#define SBUS_RCLK 307200 - -static int -scc_sbus_probe(device_t dev) -{ - struct scc_softc *sc; - const char *nm; - - sc = device_get_softc(dev); - nm = ofw_bus_get_name(dev); - if (!strcmp(nm, "zs")) { - device_set_desc(dev, "Zilog Z8530 dual channel SCC"); - sc->sc_class = &scc_z8530_class; - return (scc_bfe_probe(dev, SBUS_REGSHFT, SBUS_RCLK, 0)); - } - return (ENXIO); -} - -static int -scc_sbus_attach(device_t dev) -{ - - return (scc_bfe_attach(dev, 0)); -} - -static device_method_t scc_sbus_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, scc_sbus_probe), - DEVMETHOD(device_attach, scc_sbus_attach), - DEVMETHOD(device_detach, scc_bfe_detach), - - DEVMETHOD(bus_alloc_resource, scc_bus_alloc_resource), - DEVMETHOD(bus_release_resource, scc_bus_release_resource), - DEVMETHOD(bus_get_resource, scc_bus_get_resource), - DEVMETHOD(bus_read_ivar, scc_bus_read_ivar), - DEVMETHOD(bus_setup_intr, scc_bus_setup_intr), - DEVMETHOD(bus_teardown_intr, scc_bus_teardown_intr), - - DEVMETHOD_END -}; - -static driver_t scc_sbus_driver = { - scc_driver_name, - scc_sbus_methods, - sizeof(struct scc_softc), -}; - -DRIVER_MODULE(scc, fhc, scc_sbus_driver, scc_devclass, NULL, NULL); -DRIVER_MODULE(scc, sbus, scc_sbus_driver, scc_devclass, NULL, NULL); diff --git a/sys/dev/sfxge/common/efsys.h b/sys/dev/sfxge/common/efsys.h index 1d9ec6a0f228d5..09825cd23565fa 100644 --- a/sys/dev/sfxge/common/efsys.h +++ b/sys/dev/sfxge/common/efsys.h @@ -130,26 +130,6 @@ prefetch_read_once(void *addr) : : "r" (addr)); } -#elif defined(__sparc64__) -static __inline void -prefetch_read_many(void *addr) -{ - - __asm__( - "prefetch [%0], 0" - : - : "r" (addr)); -} - -static __inline void -prefetch_read_once(void *addr) -{ - - __asm__( - "prefetch [%0], 1" - : - : "r" (addr)); -} #else static __inline void prefetch_read_many(void *addr) diff --git a/sys/dev/sound/pci/t4dwave.c b/sys/dev/sound/pci/t4dwave.c index a7c5cd2be6b908..f046b8a47e217f 100644 --- a/sys/dev/sound/pci/t4dwave.c +++ b/sys/dev/sound/pci/t4dwave.c @@ -829,11 +829,6 @@ tr_pci_attach(device_t dev) bus_addr_t lowaddr; int i, dacn; char status[SND_STATUSLEN]; -#ifdef __sparc64__ - device_t *children; - int nchildren; - u_int32_t data; -#endif tr = malloc(sizeof(*tr), M_DEVBUF, M_WAITOK | M_ZERO); tr->type = pci_get_devid(dev); @@ -900,34 +895,9 @@ tr_pci_attach(device_t dev) * using a low address of BUS_SPACE_MAXADDR_32BIT for both * we might end up with the play buffer being in the 32-bit * range while the record buffer isn't or vice versa. So we - * limit enabling the 31st bit to sparc64, where the IOMMU - * guarantees that we're using a 32-bit address (and in turn - * requires it). + * don't enabling the 31st bit. */ lowaddr = ALI_MAXADDR; -#ifdef __sparc64__ - if (device_get_children(device_get_parent(dev), &children, - &nchildren) == 0) { - for (i = 0; i < nchildren; i++) { - if (pci_get_devid(children[i]) == 0x153310b9) { - lowaddr = BUS_SPACE_MAXADDR_32BIT; - data = pci_read_config(children[i], - 0x7e, 1); - if (bootverbose) - device_printf(dev, - "M1533 0x7e: 0x%x -> ", - data); - data |= 0x1; - if (bootverbose) - printf("0x%x\n", data); - pci_write_config(children[i], 0x7e, - data, 1); - break; - } - } - } - free(children, M_TEMP); -#endif tr->hwchns = ALI_MAXHWCH; tr->bufsz = ALI_BUFSZ; } else { diff --git a/sys/dev/sound/sbus/apcdmareg.h b/sys/dev/sound/sbus/apcdmareg.h deleted file mode 100644 index 719da7d09d121a..00000000000000 --- a/sys/dev/sound/sbus/apcdmareg.h +++ /dev/null @@ -1,116 +0,0 @@ -/* $FreeBSD$ */ -/* $OpenBSD: apcdmareg.h,v 1.2 2003/06/02 18:53:18 jason Exp $ */ - -/*- - * SPDX-License-Identifier: BSD-2-Clause - * - * Copyright (c) 2001 Jason L. Wright (jason@thought.net) - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * Definitions for Sun APC DMA controller. - */ - -/* APC DMA registers */ -#define APC_CSR 0x0010 /* control/status */ -#define APC_CVA 0x0020 /* capture virtual address */ -#define APC_CC 0x0024 /* capture count */ -#define APC_CNVA 0x0028 /* capture next virtual address */ -#define APC_CNC 0x002c /* capture next count */ -#define APC_PVA 0x0030 /* playback virtual address */ -#define APC_PC 0x0034 /* playback count */ -#define APC_PNVA 0x0038 /* playback next virtual address */ -#define APC_PNC 0x003c /* playback next count */ - -/* - * APC DMA Register definitions - */ -#define APC_CSR_RESET 0x00000001 /* reset */ -#define APC_CSR_CDMA_GO 0x00000004 /* capture dma go */ -#define APC_CSR_PDMA_GO 0x00000008 /* playback dma go */ -#define APC_CSR_CODEC_RESET 0x00000020 /* codec reset */ -#define APC_CSR_CPAUSE 0x00000040 /* capture dma pause */ -#define APC_CSR_PPAUSE 0x00000080 /* playback dma pause */ -#define APC_CSR_CMIE 0x00000100 /* capture pipe empty enb */ -#define APC_CSR_CMI 0x00000200 /* capture pipe empty intr */ -#define APC_CSR_CD 0x00000400 /* capture nva dirty */ -#define APC_CSR_CM 0x00000800 /* capture data lost */ -#define APC_CSR_PMIE 0x00001000 /* pb pipe empty intr enable */ -#define APC_CSR_PD 0x00002000 /* pb nva dirty */ -#define APC_CSR_PM 0x00004000 /* pb pipe empty */ -#define APC_CSR_PMI 0x00008000 /* pb pipe empty interrupt */ -#define APC_CSR_EIE 0x00010000 /* error interrupt enable */ -#define APC_CSR_CIE 0x00020000 /* capture intr enable */ -#define APC_CSR_PIE 0x00040000 /* playback intr enable */ -#define APC_CSR_GIE 0x00080000 /* general intr enable */ -#define APC_CSR_EI 0x00100000 /* error interrupt */ -#define APC_CSR_CI 0x00200000 /* capture interrupt */ -#define APC_CSR_PI 0x00400000 /* playback interrupt */ -#define APC_CSR_GI 0x00800000 /* general interrupt */ - -#define APC_CSR_PLAY ( \ - APC_CSR_EI | \ - APC_CSR_GIE | \ - APC_CSR_PIE | \ - APC_CSR_EIE | \ - APC_CSR_PDMA_GO | \ - APC_CSR_PMIE ) - -#define APC_CSR_CAPTURE ( \ - APC_CSR_EI | \ - APC_CSR_GIE | \ - APC_CSR_CIE | \ - APC_CSR_EIE | \ - APC_CSR_CDMA_GO ) - -#define APC_CSR_PLAY_PAUSE (~( \ - APC_CSR_PPAUSE | \ - APC_CSR_GI | \ - APC_CSR_PI | \ - APC_CSR_CI | \ - APC_CSR_EI | \ - APC_CSR_PMI | \ - APC_CSR_PMIE | \ - APC_CSR_CMI | \ - APC_CSR_CMIE ) ) - -#define APC_CSR_CAPTURE_PAUSE (~( \ - APC_CSR_PPAUSE | \ - APC_CSR_GI | \ - APC_CSR_PI | \ - APC_CSR_CI | \ - APC_CSR_EI | \ - APC_CSR_PMI | \ - APC_CSR_PMIE | \ - APC_CSR_CMI | \ - APC_CSR_CMIE ) ) - -#define APC_CSR_INTR_MASK ( \ - APC_CSR_GI | \ - APC_CSR_PI | \ - APC_CSR_CI | \ - APC_CSR_EI | \ - APC_CSR_PMI | \ - APC_CSR_CMI ) diff --git a/sys/dev/sound/sbus/cs4231.c b/sys/dev/sound/sbus/cs4231.c deleted file mode 100644 index 0fb7164d0f5138..00000000000000 --- a/sys/dev/sound/sbus/cs4231.c +++ /dev/null @@ -1,1566 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 1999 Jason L. Wright (jason@thought.net) - * Copyright (c) 2004 Pyun YongHyeon - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * Effort sponsored in part by the Defense Advanced Research Projects - * Agency (DARPA) and Air Force Research Laboratory, Air Force - * Materiel Command, USAF, under agreement number F30602-01-2-0537. - * - * from: OpenBSD: cs4231.c,v 1.21 2003/07/03 20:36:07 jason Exp - */ - -/* - * Driver for CS4231 based audio found in some sun4m systems (cs4231) - * based on ideas from the S/Linux project and the NetBSD project. - */ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#ifdef HAVE_KERNEL_OPTION_HEADERS -#include "opt_snd.h" -#endif - -#include -#include -#include - -#include -#include - -#include "mixer_if.h" - -/* - * The driver supports CS4231A audio chips found on Sbus/Ebus based - * UltraSPARCs. Though, CS4231A says it supports full-duplex mode, I - * doubt it due to the lack of independent sampling frequency register - * for playback/capture. - * Since I couldn't find any documentation for APCDMA programming - * information, I guessed the usage of APCDMA from that of OpenBSD's - * driver. The EBDMA information of PCIO can be obtained from - * http://solutions.sun.com/embedded/databook/web/microprocessors/pcio.html - * And CS4231A datasheet can also be obtained from - * ftp://ftp.alsa-project.org/pub/manuals/cirrus/4231a.pdf - * - * Audio capture(recording) was not tested at all and may have bugs. - * Sorry, I don't have microphone. Don't try to use full-duplex mode. - * It wouldn't work. - */ -#define CS_TIMEOUT 90000 - -#define CS4231_MIN_BUF_SZ (16*1024) -#define CS4231_DEFAULT_BUF_SZ (32*1024) -#define CS4231_MAX_BUF_SZ (64*1024) -#define CS4231_MAX_BLK_SZ (8*1024) -#define CS4231_MAX_APC_DMA_SZ (8*1024) - - -#undef CS4231_DEBUG -#ifdef CS4231_DEBUG -#define DPRINTF(x) printf x -#else -#define DPRINTF(x) -#endif -#define CS4231_AUTO_CALIBRATION - -struct cs4231_softc; - -struct cs4231_channel { - struct cs4231_softc *parent; - struct pcm_channel *channel; - struct snd_dbuf *buffer; - u_int32_t format; - u_int32_t speed; - u_int32_t nextaddr; - u_int32_t togo; - int dir; - int locked; -}; - -#define CS4231_RES_MEM_MAX 4 -#define CS4231_RES_IRQ_MAX 2 -struct cs4231_softc { - device_t sc_dev; - int sc_rid[CS4231_RES_MEM_MAX]; - struct resource *sc_res[CS4231_RES_MEM_MAX]; - bus_space_handle_t sc_regh[CS4231_RES_MEM_MAX]; - bus_space_tag_t sc_regt[CS4231_RES_MEM_MAX]; - - int sc_irqrid[CS4231_RES_IRQ_MAX]; - struct resource *sc_irqres[CS4231_RES_IRQ_MAX]; - void *sc_ih[CS4231_RES_IRQ_MAX]; - bus_dma_tag_t sc_dmat[CS4231_RES_IRQ_MAX]; - int sc_burst; - - u_int32_t sc_bufsz; - struct cs4231_channel sc_pch; - struct cs4231_channel sc_rch; - int sc_enabled; - int sc_nmres; - int sc_nires; - int sc_codecv; - int sc_chipvid; - int sc_flags; -#define CS4231_SBUS 0x01 -#define CS4231_EBUS 0x02 - - struct mtx *sc_lock; -}; - -struct mix_table { - u_int32_t reg:8; - u_int32_t bits:8; - u_int32_t mute:8; - u_int32_t shift:4; - u_int32_t neg:1; - u_int32_t avail:1; - u_int32_t recdev:1; -}; - -static int cs4231_bus_probe(device_t); -static int cs4231_sbus_attach(device_t); -static int cs4231_ebus_attach(device_t); -static int cs4231_attach_common(struct cs4231_softc *); -static int cs4231_bus_detach(device_t); -static int cs4231_bus_suspend(device_t); -static int cs4231_bus_resume(device_t); -static void cs4231_getversion(struct cs4231_softc *); -static void cs4231_free_resource(struct cs4231_softc *); -static void cs4231_ebdma_reset(struct cs4231_softc *); -static void cs4231_power_reset(struct cs4231_softc *, int); -static int cs4231_enable(struct cs4231_softc *, int); -static void cs4231_disable(struct cs4231_softc *); -static void cs4231_write(struct cs4231_softc *, u_int8_t, u_int8_t); -static u_int8_t cs4231_read(struct cs4231_softc *, u_int8_t); -static void cs4231_sbus_intr(void *); -static void cs4231_ebus_pintr(void *arg); -static void cs4231_ebus_cintr(void *arg); -static int cs4231_mixer_init(struct snd_mixer *); -static void cs4231_mixer_set_value(struct cs4231_softc *, - const struct mix_table *, u_int8_t); -static int cs4231_mixer_set(struct snd_mixer *, u_int32_t, u_int32_t, - u_int32_t); -static u_int32_t cs4231_mixer_setrecsrc(struct snd_mixer *, u_int32_t); -static void *cs4231_chan_init(kobj_t, void *, struct snd_dbuf *, - struct pcm_channel *, int); -static int cs4231_chan_setformat(kobj_t, void *, u_int32_t); -static u_int32_t cs4231_chan_setspeed(kobj_t, void *, u_int32_t); -static void cs4231_chan_fs(struct cs4231_softc *, int, u_int8_t); -static u_int32_t cs4231_chan_setblocksize(kobj_t, void *, u_int32_t); -static int cs4231_chan_trigger(kobj_t, void *, int); -static u_int32_t cs4231_chan_getptr(kobj_t, void *); -static struct pcmchan_caps * - cs4231_chan_getcaps(kobj_t, void *); -static void cs4231_trigger(struct cs4231_channel *); -static void cs4231_apcdma_trigger(struct cs4231_softc *, - struct cs4231_channel *); -static void cs4231_ebdma_trigger(struct cs4231_softc *, - struct cs4231_channel *); -static void cs4231_halt(struct cs4231_channel *); - -#define CS4231_LOCK(sc) snd_mtxlock(sc->sc_lock) -#define CS4231_UNLOCK(sc) snd_mtxunlock(sc->sc_lock) -#define CS4231_LOCK_ASSERT(sc) snd_mtxassert(sc->sc_lock) - -#define CS_WRITE(sc,r,v) \ - bus_space_write_1((sc)->sc_regt[0], (sc)->sc_regh[0], (r) << 2, (v)) -#define CS_READ(sc,r) \ - bus_space_read_1((sc)->sc_regt[0], (sc)->sc_regh[0], (r) << 2) - -#define APC_WRITE(sc,r,v) \ - bus_space_write_4(sc->sc_regt[0], sc->sc_regh[0], r, v) -#define APC_READ(sc,r) \ - bus_space_read_4(sc->sc_regt[0], sc->sc_regh[0], r) - -#define EBDMA_P_WRITE(sc,r,v) \ - bus_space_write_4((sc)->sc_regt[1], (sc)->sc_regh[1], (r), (v)) -#define EBDMA_P_READ(sc,r) \ - bus_space_read_4((sc)->sc_regt[1], (sc)->sc_regh[1], (r)) - -#define EBDMA_C_WRITE(sc,r,v) \ - bus_space_write_4((sc)->sc_regt[2], (sc)->sc_regh[2], (r), (v)) -#define EBDMA_C_READ(sc,r) \ - bus_space_read_4((sc)->sc_regt[2], (sc)->sc_regh[2], (r)) - -#define AUXIO_CODEC 0x00 -#define AUXIO_WRITE(sc,r,v) \ - bus_space_write_4((sc)->sc_regt[3], (sc)->sc_regh[3], (r), (v)) -#define AUXIO_READ(sc,r) \ - bus_space_read_4((sc)->sc_regt[3], (sc)->sc_regh[3], (r)) - -#define CODEC_WARM_RESET 0 -#define CODEC_COLD_RESET 1 - -/* SBus */ -static device_method_t cs4231_sbus_methods[] = { - DEVMETHOD(device_probe, cs4231_bus_probe), - DEVMETHOD(device_attach, cs4231_sbus_attach), - DEVMETHOD(device_detach, cs4231_bus_detach), - DEVMETHOD(device_suspend, cs4231_bus_suspend), - DEVMETHOD(device_resume, cs4231_bus_resume), - - DEVMETHOD_END -}; - -static driver_t cs4231_sbus_driver = { - "pcm", - cs4231_sbus_methods, - PCM_SOFTC_SIZE -}; - -DRIVER_MODULE(snd_audiocs, sbus, cs4231_sbus_driver, pcm_devclass, 0, 0); - -/* EBus */ -static device_method_t cs4231_ebus_methods[] = { - DEVMETHOD(device_probe, cs4231_bus_probe), - DEVMETHOD(device_attach, cs4231_ebus_attach), - DEVMETHOD(device_detach, cs4231_bus_detach), - DEVMETHOD(device_suspend, cs4231_bus_suspend), - DEVMETHOD(device_resume, cs4231_bus_resume), - - DEVMETHOD_END -}; - -static driver_t cs4231_ebus_driver = { - "pcm", - cs4231_ebus_methods, - PCM_SOFTC_SIZE -}; - -DRIVER_MODULE(snd_audiocs, ebus, cs4231_ebus_driver, pcm_devclass, 0, 0); -MODULE_DEPEND(snd_audiocs, sound, SOUND_MINVER, SOUND_PREFVER, SOUND_MAXVER); -MODULE_VERSION(snd_audiocs, 1); - - -static u_int32_t cs4231_fmt[] = { - SND_FORMAT(AFMT_U8, 1, 0), - SND_FORMAT(AFMT_U8, 2, 0), - SND_FORMAT(AFMT_MU_LAW, 1, 0), - SND_FORMAT(AFMT_MU_LAW, 2, 0), - SND_FORMAT(AFMT_A_LAW, 1, 0), - SND_FORMAT(AFMT_A_LAW, 2, 0), - SND_FORMAT(AFMT_IMA_ADPCM, 1, 0), - SND_FORMAT(AFMT_IMA_ADPCM, 2, 0), - SND_FORMAT(AFMT_S16_LE, 1, 0), - SND_FORMAT(AFMT_S16_LE, 2, 0), - SND_FORMAT(AFMT_S16_BE, 1, 0), - SND_FORMAT(AFMT_S16_BE, 2, 0), - 0 -}; - -static struct pcmchan_caps cs4231_caps = {5510, 48000, cs4231_fmt, 0}; - -/* - * sound(4) channel interface - */ -static kobj_method_t cs4231_chan_methods[] = { - KOBJMETHOD(channel_init, cs4231_chan_init), - KOBJMETHOD(channel_setformat, cs4231_chan_setformat), - KOBJMETHOD(channel_setspeed, cs4231_chan_setspeed), - KOBJMETHOD(channel_setblocksize, cs4231_chan_setblocksize), - KOBJMETHOD(channel_trigger, cs4231_chan_trigger), - KOBJMETHOD(channel_getptr, cs4231_chan_getptr), - KOBJMETHOD(channel_getcaps, cs4231_chan_getcaps), - KOBJMETHOD_END -}; -CHANNEL_DECLARE(cs4231_chan); - -/* - * sound(4) mixer interface - */ -static kobj_method_t cs4231_mixer_methods[] = { - KOBJMETHOD(mixer_init, cs4231_mixer_init), - KOBJMETHOD(mixer_set, cs4231_mixer_set), - KOBJMETHOD(mixer_setrecsrc, cs4231_mixer_setrecsrc), - KOBJMETHOD_END -}; -MIXER_DECLARE(cs4231_mixer); - -static int -cs4231_bus_probe(device_t dev) -{ - const char *compat, *name; - - compat = ofw_bus_get_compat(dev); - name = ofw_bus_get_name(dev); - if (strcmp("SUNW,CS4231", name) == 0 || - (compat != NULL && strcmp("SUNW,CS4231", compat) == 0)) { - device_set_desc(dev, "Sun Audiocs"); - return (BUS_PROBE_DEFAULT); - } - return (ENXIO); -} - -static int -cs4231_sbus_attach(device_t dev) -{ - struct cs4231_softc *sc; - int burst; - - sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK | M_ZERO); - sc->sc_dev = dev; - /* - * XXX - * No public documentation exists on programming burst size of APCDMA. - */ - burst = sbus_get_burstsz(sc->sc_dev); - if ((burst & SBUS_BURST_64)) - sc->sc_burst = 64; - else if ((burst & SBUS_BURST_32)) - sc->sc_burst = 32; - else if ((burst & SBUS_BURST_16)) - sc->sc_burst = 16; - else - sc->sc_burst = 0; - sc->sc_flags = CS4231_SBUS; - sc->sc_nmres = 1; - sc->sc_nires = 1; - return cs4231_attach_common(sc); -} - -static int -cs4231_ebus_attach(device_t dev) -{ - struct cs4231_softc *sc; - - sc = malloc(sizeof(struct cs4231_softc), M_DEVBUF, M_NOWAIT | M_ZERO); - if (sc == NULL) { - device_printf(dev, "cannot allocate softc\n"); - return (ENOMEM); - } - sc->sc_dev = dev; - sc->sc_burst = EBDCSR_BURST_1; - sc->sc_nmres = CS4231_RES_MEM_MAX; - sc->sc_nires = CS4231_RES_IRQ_MAX; - sc->sc_flags = CS4231_EBUS; - return cs4231_attach_common(sc); -} - -static int -cs4231_attach_common(struct cs4231_softc *sc) -{ - char status[SND_STATUSLEN]; - driver_intr_t *ihandler; - int i; - - sc->sc_lock = snd_mtxcreate(device_get_nameunit(sc->sc_dev), - "snd_cs4231 softc"); - - for (i = 0; i < sc->sc_nmres; i++) { - sc->sc_rid[i] = i; - if ((sc->sc_res[i] = bus_alloc_resource_any(sc->sc_dev, - SYS_RES_MEMORY, &sc->sc_rid[i], RF_ACTIVE)) == NULL) { - device_printf(sc->sc_dev, - "cannot map register %d\n", i); - goto fail; - } - sc->sc_regt[i] = rman_get_bustag(sc->sc_res[i]); - sc->sc_regh[i] = rman_get_bushandle(sc->sc_res[i]); - } - for (i = 0; i < sc->sc_nires; i++) { - sc->sc_irqrid[i] = i; - if ((sc->sc_irqres[i] = bus_alloc_resource_any(sc->sc_dev, - SYS_RES_IRQ, &sc->sc_irqrid[i], RF_SHAREABLE | RF_ACTIVE)) - == NULL) { - if ((sc->sc_flags & CS4231_SBUS) != 0) - device_printf(sc->sc_dev, - "cannot allocate interrupt\n"); - else - device_printf(sc->sc_dev, "cannot allocate %s " - "interrupt\n", i == 0 ? "capture" : - "playback"); - goto fail; - } - } - - ihandler = cs4231_sbus_intr; - for (i = 0; i < sc->sc_nires; i++) { - if ((sc->sc_flags & CS4231_EBUS) != 0) { - if (i == 0) - ihandler = cs4231_ebus_cintr; - else - ihandler = cs4231_ebus_pintr; - } - if (snd_setup_intr(sc->sc_dev, sc->sc_irqres[i], INTR_MPSAFE, - ihandler, sc, &sc->sc_ih[i])) { - if ((sc->sc_flags & CS4231_SBUS) != 0) - device_printf(sc->sc_dev, - "cannot set up interrupt\n"); - else - device_printf(sc->sc_dev, "cannot set up %s " - " interrupt\n", i == 0 ? "capture" : - "playback"); - goto fail; - } - } - - sc->sc_bufsz = pcm_getbuffersize(sc->sc_dev, CS4231_MIN_BUF_SZ, - CS4231_DEFAULT_BUF_SZ, CS4231_MAX_BUF_SZ); - for (i = 0; i < sc->sc_nires; i++) { - if (bus_dma_tag_create( - bus_get_dma_tag(sc->sc_dev),/* parent */ - 64, 0, /* alignment, boundary */ - BUS_SPACE_MAXADDR_32BIT, /* lowaddr */ - BUS_SPACE_MAXADDR, /* highaddr */ - NULL, NULL, /* filtfunc, filtfuncarg */ - sc->sc_bufsz, /* maxsize */ - 1, /* nsegments */ - sc->sc_bufsz, /* maxsegsz */ - BUS_DMA_ALLOCNOW, /* flags */ - NULL, /* lockfunc */ - NULL, /* lockfuncarg */ - &sc->sc_dmat[i])) { - if ((sc->sc_flags & CS4231_SBUS) != 0) - device_printf(sc->sc_dev, - "cannot allocate DMA tag\n"); - else - device_printf(sc->sc_dev, "cannot allocate %s " - "DMA tag\n", i == 0 ? "capture" : - "playback"); - goto fail; - } - } - cs4231_enable(sc, CODEC_WARM_RESET); - cs4231_getversion(sc); - if (mixer_init(sc->sc_dev, &cs4231_mixer_class, sc) != 0) - goto fail; - if (pcm_register(sc->sc_dev, sc, 1, 1)) { - device_printf(sc->sc_dev, "cannot register to pcm\n"); - goto fail; - } - if (pcm_addchan(sc->sc_dev, PCMDIR_REC, &cs4231_chan_class, sc) != 0) - goto chan_fail; - if (pcm_addchan(sc->sc_dev, PCMDIR_PLAY, &cs4231_chan_class, sc) != 0) - goto chan_fail; - if ((sc->sc_flags & CS4231_SBUS) != 0) - snprintf(status, SND_STATUSLEN, "at mem 0x%lx irq %ld bufsz %u", - rman_get_start(sc->sc_res[0]), - rman_get_start(sc->sc_irqres[0]), sc->sc_bufsz); - else - snprintf(status, SND_STATUSLEN, "at io 0x%lx 0x%lx 0x%lx 0x%lx " - "irq %ld %ld bufsz %u", rman_get_start(sc->sc_res[0]), - rman_get_start(sc->sc_res[1]), - rman_get_start(sc->sc_res[2]), - rman_get_start(sc->sc_res[3]), - rman_get_start(sc->sc_irqres[0]), - rman_get_start(sc->sc_irqres[1]), sc->sc_bufsz); - pcm_setstatus(sc->sc_dev, status); - return (0); - -chan_fail: - pcm_unregister(sc->sc_dev); -fail: - cs4231_free_resource(sc); - return (ENXIO); -} - -static int -cs4231_bus_detach(device_t dev) -{ - struct cs4231_softc *sc; - struct cs4231_channel *pch, *rch; - int error; - - sc = pcm_getdevinfo(dev); - CS4231_LOCK(sc); - pch = &sc->sc_pch; - rch = &sc->sc_pch; - if (pch->locked || rch->locked) { - CS4231_UNLOCK(sc); - return (EBUSY); - } - /* - * Since EBDMA requires valid DMA buffer to drain its FIFO, we need - * real DMA buffer for draining. - */ - if ((sc->sc_flags & CS4231_EBUS) != 0) - cs4231_ebdma_reset(sc); - CS4231_UNLOCK(sc); - error = pcm_unregister(dev); - if (error) - return (error); - cs4231_free_resource(sc); - return (0); -} - -static int -cs4231_bus_suspend(device_t dev) -{ - - return (ENXIO); -} - -static int -cs4231_bus_resume(device_t dev) -{ - - return (ENXIO); -} - -static void -cs4231_getversion(struct cs4231_softc *sc) -{ - u_int8_t v; - - v = cs4231_read(sc, CS_MISC_INFO); - sc->sc_codecv = v & CS_CODEC_ID_MASK; - v = cs4231_read(sc, CS_VERSION_ID); - v &= (CS_VERSION_NUMBER | CS_VERSION_CHIPID); - sc->sc_chipvid = v; - switch(v) { - case 0x80: - device_printf(sc->sc_dev, "\n", - sc->sc_codecv); - break; - case 0xa0: - device_printf(sc->sc_dev, "\n", - sc->sc_codecv); - break; - case 0x82: - device_printf(sc->sc_dev, "\n", - sc->sc_codecv); - break; - default: - device_printf(sc->sc_dev, - "sc_codecv); - break; - } -} - -static void -cs4231_ebdma_reset(struct cs4231_softc *sc) -{ - int i; - - /* playback */ - EBDMA_P_WRITE(sc, EBDMA_DCSR, - EBDMA_P_READ(sc, EBDMA_DCSR) & ~(EBDCSR_INTEN | EBDCSR_NEXTEN)); - EBDMA_P_WRITE(sc, EBDMA_DCSR, EBDCSR_RESET); - for (i = CS_TIMEOUT; - i && EBDMA_P_READ(sc, EBDMA_DCSR) & EBDCSR_DRAIN; i--) - DELAY(1); - if (i == 0) - device_printf(sc->sc_dev, - "timeout waiting for playback DMA reset\n"); - EBDMA_P_WRITE(sc, EBDMA_DCSR, sc->sc_burst); - /* capture */ - EBDMA_C_WRITE(sc, EBDMA_DCSR, - EBDMA_C_READ(sc, EBDMA_DCSR) & ~(EBDCSR_INTEN | EBDCSR_NEXTEN)); - EBDMA_C_WRITE(sc, EBDMA_DCSR, EBDCSR_RESET); - for (i = CS_TIMEOUT; - i && EBDMA_C_READ(sc, EBDMA_DCSR) & EBDCSR_DRAIN; i--) - DELAY(1); - if (i == 0) - device_printf(sc->sc_dev, - "timeout waiting for capture DMA reset\n"); - EBDMA_C_WRITE(sc, EBDMA_DCSR, sc->sc_burst); -} - -static void -cs4231_power_reset(struct cs4231_softc *sc, int how) -{ - u_int32_t v; - int i; - - if ((sc->sc_flags & CS4231_SBUS) != 0) { - APC_WRITE(sc, APC_CSR, APC_CSR_RESET); - DELAY(10); - APC_WRITE(sc, APC_CSR, 0); - DELAY(10); - APC_WRITE(sc, - APC_CSR, APC_READ(sc, APC_CSR) | APC_CSR_CODEC_RESET); - DELAY(20); - APC_WRITE(sc, - APC_CSR, APC_READ(sc, APC_CSR) & (~APC_CSR_CODEC_RESET)); - } else { - v = AUXIO_READ(sc, AUXIO_CODEC); - if (how == CODEC_WARM_RESET && v != 0) { - AUXIO_WRITE(sc, AUXIO_CODEC, 0); - DELAY(20); - } else if (how == CODEC_COLD_RESET){ - AUXIO_WRITE(sc, AUXIO_CODEC, 1); - DELAY(20); - AUXIO_WRITE(sc, AUXIO_CODEC, 0); - DELAY(20); - } - cs4231_ebdma_reset(sc); - } - - for (i = CS_TIMEOUT; - i && CS_READ(sc, CS4231_IADDR) == CS_IN_INIT; i--) - DELAY(10); - if (i == 0) - device_printf(sc->sc_dev, "timeout waiting for reset\n"); - - /* turn on cs4231 mode */ - cs4231_write(sc, CS_MISC_INFO, - cs4231_read(sc, CS_MISC_INFO) | CS_MODE2); - /* enable interrupts & clear CSR */ - cs4231_write(sc, CS_PIN_CONTROL, - cs4231_read(sc, CS_PIN_CONTROL) | INTERRUPT_ENABLE); - CS_WRITE(sc, CS4231_STATUS, 0); - /* enable DAC output */ - cs4231_write(sc, CS_LEFT_OUTPUT_CONTROL, - cs4231_read(sc, CS_LEFT_OUTPUT_CONTROL) & ~OUTPUT_MUTE); - cs4231_write(sc, CS_RIGHT_OUTPUT_CONTROL, - cs4231_read(sc, CS_RIGHT_OUTPUT_CONTROL) & ~OUTPUT_MUTE); - /* mute AUX1 since it generates noises */ - cs4231_write(sc, CS_LEFT_AUX1_CONTROL, - cs4231_read(sc, CS_LEFT_AUX1_CONTROL) | AUX_INPUT_MUTE); - cs4231_write(sc, CS_RIGHT_AUX1_CONTROL, - cs4231_read(sc, CS_RIGHT_AUX1_CONTROL) | AUX_INPUT_MUTE); - /* protect buffer underrun and set output level to 0dB */ - cs4231_write(sc, CS_ALT_FEATURE1, - cs4231_read(sc, CS_ALT_FEATURE1) | CS_DAC_ZERO | CS_OUTPUT_LVL); - /* enable high pass filter, dual xtal was disabled due to noises */ - cs4231_write(sc, CS_ALT_FEATURE2, - cs4231_read(sc, CS_ALT_FEATURE2) | CS_HPF_ENABLE); -} - -static int -cs4231_enable(struct cs4231_softc *sc, int how) -{ - cs4231_power_reset(sc, how); - sc->sc_enabled = 1; - return (0); -} - -static void -cs4231_disable(struct cs4231_softc *sc) -{ - u_int8_t v; - - CS4231_LOCK_ASSERT(sc); - - if (sc->sc_enabled == 0) - return; - sc->sc_enabled = 0; - CS4231_UNLOCK(sc); - cs4231_halt(&sc->sc_pch); - cs4231_halt(&sc->sc_rch); - CS4231_LOCK(sc); - v = cs4231_read(sc, CS_PIN_CONTROL) & ~INTERRUPT_ENABLE; - cs4231_write(sc, CS_PIN_CONTROL, v); - - if ((sc->sc_flags & CS4231_SBUS) != 0) { - APC_WRITE(sc, APC_CSR, APC_CSR_RESET); - DELAY(10); - APC_WRITE(sc, APC_CSR, 0); - DELAY(10); - } else - cs4231_ebdma_reset(sc); -} - -static void -cs4231_free_resource(struct cs4231_softc *sc) -{ - int i; - - CS4231_LOCK(sc); - cs4231_disable(sc); - CS4231_UNLOCK(sc); - for (i = 0; i < sc->sc_nires; i++) { - if (sc->sc_irqres[i]) { - if (sc->sc_ih[i]) { - bus_teardown_intr(sc->sc_dev, sc->sc_irqres[i], - sc->sc_ih[i]); - sc->sc_ih[i] = NULL; - } - bus_release_resource(sc->sc_dev, SYS_RES_IRQ, - sc->sc_irqrid[i], sc->sc_irqres[i]); - sc->sc_irqres[i] = NULL; - } - } - for (i = 0; i < sc->sc_nires; i++) { - if (sc->sc_dmat[i]) - bus_dma_tag_destroy(sc->sc_dmat[i]); - } - for (i = 0; i < sc->sc_nmres; i++) { - if (sc->sc_res[i]) - bus_release_resource(sc->sc_dev, SYS_RES_MEMORY, - sc->sc_rid[i], sc->sc_res[i]); - } - snd_mtxfree(sc->sc_lock); - free(sc, M_DEVBUF); -} - -static void -cs4231_write(struct cs4231_softc *sc, u_int8_t r, u_int8_t v) -{ - CS_WRITE(sc, CS4231_IADDR, r); - CS_WRITE(sc, CS4231_IDATA, v); -} - -static u_int8_t -cs4231_read(struct cs4231_softc *sc, u_int8_t r) -{ - CS_WRITE(sc, CS4231_IADDR, r); - return (CS_READ(sc, CS4231_IDATA)); -} - -static void -cs4231_sbus_intr(void *arg) -{ - struct cs4231_softc *sc; - struct cs4231_channel *pch, *rch; - u_int32_t csr; - u_int8_t status; - - sc = arg; - CS4231_LOCK(sc); - - csr = APC_READ(sc, APC_CSR); - if ((csr & APC_CSR_GI) == 0) { - CS4231_UNLOCK(sc); - return; - } - APC_WRITE(sc, APC_CSR, csr); - - if ((csr & APC_CSR_EIE) && (csr & APC_CSR_EI)) { - status = cs4231_read(sc, CS_TEST_AND_INIT); - device_printf(sc->sc_dev, - "apc error interrupt : stat = 0x%x\n", status); - } - - pch = rch = NULL; - if ((csr & APC_CSR_PMIE) && (csr & APC_CSR_PMI)) { - u_long nextaddr, saddr; - u_int32_t togo; - - pch = &sc->sc_pch; - togo = pch->togo; - saddr = sndbuf_getbufaddr(pch->buffer); - nextaddr = pch->nextaddr + togo; - if (nextaddr >= saddr + sndbuf_getsize(pch->buffer)) - nextaddr = saddr; - APC_WRITE(sc, APC_PNVA, nextaddr); - APC_WRITE(sc, APC_PNC, togo); - pch->nextaddr = nextaddr; - } - - if ((csr & APC_CSR_CIE) && (csr & APC_CSR_CI) && (csr & APC_CSR_CD)) { - u_long nextaddr, saddr; - u_int32_t togo; - - rch = &sc->sc_rch; - togo = rch->togo; - saddr = sndbuf_getbufaddr(rch->buffer); - nextaddr = rch->nextaddr + togo; - if (nextaddr >= saddr + sndbuf_getsize(rch->buffer)) - nextaddr = saddr; - APC_WRITE(sc, APC_CNVA, nextaddr); - APC_WRITE(sc, APC_CNC, togo); - rch->nextaddr = nextaddr; - } - CS4231_UNLOCK(sc); - if (pch) - chn_intr(pch->channel); - if (rch) - chn_intr(rch->channel); -} - -/* playback interrupt handler */ -static void -cs4231_ebus_pintr(void *arg) -{ - struct cs4231_softc *sc; - struct cs4231_channel *ch; - u_int32_t csr; - u_int8_t status; - - sc = arg; - CS4231_LOCK(sc); - - csr = EBDMA_P_READ(sc, EBDMA_DCSR); - if ((csr & EBDCSR_INT) == 0) { - CS4231_UNLOCK(sc); - return; - } - - if ((csr & EBDCSR_ERR)) { - status = cs4231_read(sc, CS_TEST_AND_INIT); - device_printf(sc->sc_dev, - "ebdma error interrupt : stat = 0x%x\n", status); - } - EBDMA_P_WRITE(sc, EBDMA_DCSR, csr | EBDCSR_TC); - - ch = NULL; - if (csr & EBDCSR_TC) { - u_long nextaddr, saddr; - u_int32_t togo; - - ch = &sc->sc_pch; - togo = ch->togo; - saddr = sndbuf_getbufaddr(ch->buffer); - nextaddr = ch->nextaddr + togo; - if (nextaddr >= saddr + sndbuf_getsize(ch->buffer)) - nextaddr = saddr; - /* - * EBDMA_DCNT is loaded automatically - * EBDMA_P_WRITE(sc, EBDMA_DCNT, togo); - */ - EBDMA_P_WRITE(sc, EBDMA_DADDR, nextaddr); - ch->nextaddr = nextaddr; - } - CS4231_UNLOCK(sc); - if (ch) - chn_intr(ch->channel); -} - -/* capture interrupt handler */ -static void -cs4231_ebus_cintr(void *arg) -{ - struct cs4231_softc *sc; - struct cs4231_channel *ch; - u_int32_t csr; - u_int8_t status; - - sc = arg; - CS4231_LOCK(sc); - - csr = EBDMA_C_READ(sc, EBDMA_DCSR); - if ((csr & EBDCSR_INT) == 0) { - CS4231_UNLOCK(sc); - return; - } - if ((csr & EBDCSR_ERR)) { - status = cs4231_read(sc, CS_TEST_AND_INIT); - device_printf(sc->sc_dev, - "dma error interrupt : stat = 0x%x\n", status); - } - EBDMA_C_WRITE(sc, EBDMA_DCSR, csr | EBDCSR_TC); - - ch = NULL; - if (csr & EBDCSR_TC) { - u_long nextaddr, saddr; - u_int32_t togo; - - ch = &sc->sc_rch; - togo = ch->togo; - saddr = sndbuf_getbufaddr(ch->buffer); - nextaddr = ch->nextaddr + togo; - if (nextaddr >= saddr + sndbuf_getblksz(ch->buffer)) - nextaddr = saddr; - /* - * EBDMA_DCNT is loaded automatically - * EBDMA_C_WRITE(sc, EBDMA_DCNT, togo); - */ - EBDMA_C_WRITE(sc, EBDMA_DADDR, nextaddr); - ch->nextaddr = nextaddr; - } - CS4231_UNLOCK(sc); - if (ch) - chn_intr(ch->channel); -} - -static const struct mix_table cs4231_mix_table[SOUND_MIXER_NRDEVICES][2] = { - [SOUND_MIXER_PCM] = { - { CS_LEFT_OUTPUT_CONTROL, 6, OUTPUT_MUTE, 0, 1, 1, 0 }, - { CS_RIGHT_OUTPUT_CONTROL, 6, OUTPUT_MUTE, 0, 1, 1, 0 } - }, - [SOUND_MIXER_SPEAKER] = { - { CS_MONO_IO_CONTROL, 4, MONO_OUTPUT_MUTE, 0, 1, 1, 0 }, - { CS_REG_NONE, 0, 0, 0, 0, 1, 0 } - }, - [SOUND_MIXER_LINE] = { - { CS_LEFT_LINE_CONTROL, 5, LINE_INPUT_MUTE, 0, 1, 1, 1 }, - { CS_RIGHT_LINE_CONTROL, 5, LINE_INPUT_MUTE, 0, 1, 1, 1 } - }, - /* - * AUX1 : removed intentionally since it generates noises - * AUX2 : Ultra1/Ultra2 has no internal CD-ROM audio in - */ - [SOUND_MIXER_CD] = { - { CS_LEFT_AUX2_CONTROL, 5, LINE_INPUT_MUTE, 0, 1, 1, 1 }, - { CS_RIGHT_AUX2_CONTROL, 5, LINE_INPUT_MUTE, 0, 1, 1, 1 } - }, - [SOUND_MIXER_MIC] = { - { CS_LEFT_INPUT_CONTROL, 4, 0, 0, 0, 1, 1 }, - { CS_RIGHT_INPUT_CONTROL, 4, 0, 0, 0, 1, 1 } - }, - [SOUND_MIXER_IGAIN] = { - { CS_LEFT_INPUT_CONTROL, 4, 0, 0, 1, 0 }, - { CS_RIGHT_INPUT_CONTROL, 4, 0, 0, 1, 0 } - } -}; - -static int -cs4231_mixer_init(struct snd_mixer *m) -{ - u_int32_t v; - int i; - - v = 0; - for (i = 0; i < SOUND_MIXER_NRDEVICES; i++) - if (cs4231_mix_table[i][0].avail != 0) - v |= (1 << i); - mix_setdevs(m, v); - v = 0; - for (i = 0; i < SOUND_MIXER_NRDEVICES; i++) - if (cs4231_mix_table[i][0].recdev != 0) - v |= (1 << i); - mix_setrecdevs(m, v); - return (0); -} - -static void -cs4231_mixer_set_value(struct cs4231_softc *sc, const struct mix_table *mt, - u_int8_t v) -{ - u_int8_t mask, reg; - u_int8_t old, shift, val; - - if (mt->avail == 0 || mt->reg == CS_REG_NONE) - return; - reg = mt->reg; - if (mt->neg != 0) - val = 100 - v; - else - val = v; - mask = (1 << mt->bits) - 1; - val = ((val * mask) + 50) / 100; - shift = mt->shift; - val <<= shift; - if (v == 0) - val |= mt->mute; - old = cs4231_read(sc, reg); - old &= ~(mt->mute | (mask << shift)); - val |= old; - if (reg == CS_LEFT_INPUT_CONTROL || reg == CS_RIGHT_INPUT_CONTROL) { - if ((val & (mask << shift)) != 0) - val |= ADC_INPUT_GAIN_ENABLE; - else - val &= ~ADC_INPUT_GAIN_ENABLE; - } - cs4231_write(sc, reg, val); -} - -static int -cs4231_mixer_set(struct snd_mixer *m, u_int32_t dev, u_int32_t left, - u_int32_t right) -{ - struct cs4231_softc *sc; - - sc = mix_getdevinfo(m); - CS4231_LOCK(sc); - cs4231_mixer_set_value(sc, &cs4231_mix_table[dev][0], left); - cs4231_mixer_set_value(sc, &cs4231_mix_table[dev][1], right); - CS4231_UNLOCK(sc); - - return (left | (right << 8)); -} - -static u_int32_t -cs4231_mixer_setrecsrc(struct snd_mixer *m, u_int32_t src) -{ - struct cs4231_softc *sc; - u_int8_t v; - - sc = mix_getdevinfo(m); - switch (src) { - case SOUND_MASK_LINE: - v = CS_IN_LINE; - break; - - case SOUND_MASK_CD: - v = CS_IN_DAC; - break; - - case SOUND_MASK_MIC: - default: - v = CS_IN_MIC; - src = SOUND_MASK_MIC; - break; - } - CS4231_LOCK(sc); - cs4231_write(sc, CS_LEFT_INPUT_CONTROL, - (cs4231_read(sc, CS_LEFT_INPUT_CONTROL) & CS_IN_MASK) | v); - cs4231_write(sc, CS_RIGHT_INPUT_CONTROL, - (cs4231_read(sc, CS_RIGHT_INPUT_CONTROL) & CS_IN_MASK) | v); - CS4231_UNLOCK(sc); - - return (src); -} - -static void * -cs4231_chan_init(kobj_t obj, void *dev, struct snd_dbuf *b, - struct pcm_channel *c, int dir) -{ - struct cs4231_softc *sc; - struct cs4231_channel *ch; - bus_dma_tag_t dmat; - - sc = dev; - ch = (dir == PCMDIR_PLAY) ? &sc->sc_pch : &sc->sc_rch; - ch->parent = sc; - ch->channel = c; - ch->dir = dir; - ch->buffer = b; - if ((sc->sc_flags & CS4231_SBUS) != 0) - dmat = sc->sc_dmat[0]; - else { - if (dir == PCMDIR_PLAY) - dmat = sc->sc_dmat[1]; - else - dmat = sc->sc_dmat[0]; - } - if (sndbuf_alloc(ch->buffer, dmat, 0, sc->sc_bufsz) != 0) - return (NULL); - DPRINTF(("%s channel addr: 0x%lx\n", dir == PCMDIR_PLAY ? "playback" : - "capture", sndbuf_getbufaddr(ch->buffer))); - - return (ch); -} - -static int -cs4231_chan_setformat(kobj_t obj, void *data, u_int32_t format) -{ - struct cs4231_softc *sc; - struct cs4231_channel *ch; - u_int32_t encoding; - u_int8_t fs, v; - - ch = data; - sc = ch->parent; - - CS4231_LOCK(sc); - if (ch->format == format) { - CS4231_UNLOCK(sc); - return (0); - } - - encoding = AFMT_ENCODING(format); - fs = 0; - switch (encoding) { - case AFMT_U8: - fs = CS_AFMT_U8; - break; - case AFMT_MU_LAW: - fs = CS_AFMT_MU_LAW; - break; - case AFMT_S16_LE: - fs = CS_AFMT_S16_LE; - break; - case AFMT_A_LAW: - fs = CS_AFMT_A_LAW; - break; - case AFMT_IMA_ADPCM: - fs = CS_AFMT_IMA_ADPCM; - break; - case AFMT_S16_BE: - fs = CS_AFMT_S16_BE; - break; - default: - fs = CS_AFMT_U8; - format = AFMT_U8; - break; - } - - if (AFMT_CHANNEL(format) > 1) - fs |= CS_AFMT_STEREO; - - DPRINTF(("FORMAT: %s : 0x%x\n", ch->dir == PCMDIR_PLAY ? "playback" : - "capture", format)); - v = cs4231_read(sc, CS_CLOCK_DATA_FORMAT); - v &= CS_CLOCK_DATA_FORMAT_MASK; - fs |= v; - cs4231_chan_fs(sc, ch->dir, fs); - ch->format = format; - CS4231_UNLOCK(sc); - - return (0); -} - -static u_int32_t -cs4231_chan_setspeed(kobj_t obj, void *data, u_int32_t speed) -{ - typedef struct { - u_int32_t speed; - u_int8_t bits; - } speed_struct; - - const static speed_struct speed_table[] = { - {5510, (0 << 1) | CLOCK_XTAL2}, - {5510, (0 << 1) | CLOCK_XTAL2}, - {6620, (7 << 1) | CLOCK_XTAL2}, - {8000, (0 << 1) | CLOCK_XTAL1}, - {9600, (7 << 1) | CLOCK_XTAL1}, - {11025, (1 << 1) | CLOCK_XTAL2}, - {16000, (1 << 1) | CLOCK_XTAL1}, - {18900, (2 << 1) | CLOCK_XTAL2}, - {22050, (3 << 1) | CLOCK_XTAL2}, - {27420, (2 << 1) | CLOCK_XTAL1}, - {32000, (3 << 1) | CLOCK_XTAL1}, - {33075, (6 << 1) | CLOCK_XTAL2}, - {33075, (4 << 1) | CLOCK_XTAL2}, - {44100, (5 << 1) | CLOCK_XTAL2}, - {48000, (6 << 1) | CLOCK_XTAL1}, - }; - - struct cs4231_softc *sc; - struct cs4231_channel *ch; - int i, n, sel; - u_int8_t fs; - - ch = data; - sc = ch->parent; - CS4231_LOCK(sc); - if (ch->speed == speed) { - CS4231_UNLOCK(sc); - return (speed); - } - n = sizeof(speed_table) / sizeof(speed_struct); - - for (i = 1, sel =0; i < n - 1; i++) - if (abs(speed - speed_table[i].speed) < - abs(speed - speed_table[sel].speed)) - sel = i; - DPRINTF(("SPEED: %s : %dHz -> %dHz\n", ch->dir == PCMDIR_PLAY ? - "playback" : "capture", speed, speed_table[sel].speed)); - speed = speed_table[sel].speed; - - fs = cs4231_read(sc, CS_CLOCK_DATA_FORMAT); - fs &= ~CS_CLOCK_DATA_FORMAT_MASK; - fs |= speed_table[sel].bits; - cs4231_chan_fs(sc, ch->dir, fs); - ch->speed = speed; - CS4231_UNLOCK(sc); - - return (speed); -} - -static void -cs4231_chan_fs(struct cs4231_softc *sc, int dir, u_int8_t fs) -{ - int i, doreset; -#ifdef CS4231_AUTO_CALIBRATION - u_int8_t v; -#endif - - CS4231_LOCK_ASSERT(sc); - - /* set autocalibration */ - doreset = 0; -#ifdef CS4231_AUTO_CALIBRATION - v = cs4231_read(sc, CS_INTERFACE_CONFIG) | AUTO_CAL_ENABLE; - CS_WRITE(sc, CS4231_IADDR, MODE_CHANGE_ENABLE); - CS_WRITE(sc, CS4231_IADDR, MODE_CHANGE_ENABLE | CS_INTERFACE_CONFIG); - CS_WRITE(sc, CS4231_IDATA, v); -#endif - - /* - * We always need to write CS_CLOCK_DATA_FORMAT register since - * the clock frequency is shared with playback/capture. - */ - CS_WRITE(sc, CS4231_IADDR, MODE_CHANGE_ENABLE | CS_CLOCK_DATA_FORMAT); - CS_WRITE(sc, CS4231_IDATA, fs); - CS_READ(sc, CS4231_IDATA); - CS_READ(sc, CS4231_IDATA); - for (i = CS_TIMEOUT; - i && CS_READ(sc, CS4231_IADDR) == CS_IN_INIT; i--) - DELAY(10); - if (i == 0) { - device_printf(sc->sc_dev, "timeout setting playback speed\n"); - doreset++; - } - - /* - * capture channel - * cs4231 doesn't allow separate fs setup for playback/capture. - * I believe this will break full-duplex operation. - */ - if (dir == PCMDIR_REC) { - CS_WRITE(sc, CS4231_IADDR, MODE_CHANGE_ENABLE | CS_REC_FORMAT); - CS_WRITE(sc, CS4231_IDATA, fs); - CS_READ(sc, CS4231_IDATA); - CS_READ(sc, CS4231_IDATA); - for (i = CS_TIMEOUT; - i && CS_READ(sc, CS4231_IADDR) == CS_IN_INIT; i--) - DELAY(10); - if (i == 0) { - device_printf(sc->sc_dev, - "timeout setting capture format\n"); - doreset++; - } - } - - CS_WRITE(sc, CS4231_IADDR, 0); - for (i = CS_TIMEOUT; - i && CS_READ(sc, CS4231_IADDR) == CS_IN_INIT; i--) - DELAY(10); - if (i == 0) { - device_printf(sc->sc_dev, "timeout waiting for !MCE\n"); - doreset++; - } - -#ifdef CS4231_AUTO_CALIBRATION - CS_WRITE(sc, CS4231_IADDR, CS_TEST_AND_INIT); - for (i = CS_TIMEOUT; - i && CS_READ(sc, CS4231_IDATA) & AUTO_CAL_IN_PROG; i--) - DELAY(10); - if (i == 0) { - device_printf(sc->sc_dev, - "timeout waiting for autocalibration\n"); - doreset++; - } -#endif - if (doreset) { - /* - * Maybe the last resort to avoid a dreadful message like - * "pcm0:play:0: play interrupt timeout, channel dead" would - * be hardware reset. - */ - device_printf(sc->sc_dev, "trying to hardware reset\n"); - cs4231_disable(sc); - cs4231_enable(sc, CODEC_COLD_RESET); - CS4231_UNLOCK(sc); /* XXX */ - if (mixer_reinit(sc->sc_dev) != 0) - device_printf(sc->sc_dev, - "unable to reinitialize the mixer\n"); - CS4231_LOCK(sc); - } -} - -static u_int32_t -cs4231_chan_setblocksize(kobj_t obj, void *data, u_int32_t blocksize) -{ - struct cs4231_softc *sc; - struct cs4231_channel *ch; - int nblks, error; - - ch = data; - sc = ch->parent; - - if (blocksize > CS4231_MAX_BLK_SZ) - blocksize = CS4231_MAX_BLK_SZ; - nblks = sc->sc_bufsz / blocksize; - error = sndbuf_resize(ch->buffer, nblks, blocksize); - if (error != 0) - device_printf(sc->sc_dev, - "unable to block size, blksz = %d, error = %d\n", - blocksize, error); - - return (blocksize); -} - -static int -cs4231_chan_trigger(kobj_t obj, void *data, int go) -{ - struct cs4231_channel *ch; - - ch = data; - switch (go) { - case PCMTRIG_EMLDMAWR: - case PCMTRIG_EMLDMARD: - break; - case PCMTRIG_START: - cs4231_trigger(ch); - break; - case PCMTRIG_ABORT: - case PCMTRIG_STOP: - cs4231_halt(ch); - break; - default: - break; - } - - return (0); -} - -static u_int32_t -cs4231_chan_getptr(kobj_t obj, void *data) -{ - struct cs4231_softc *sc; - struct cs4231_channel *ch; - u_int32_t cur, ptr, sz; - - ch = data; - sc = ch->parent; - - CS4231_LOCK(sc); - if ((sc->sc_flags & CS4231_SBUS) != 0) - cur = (ch->dir == PCMDIR_PLAY) ? APC_READ(sc, APC_PVA) : - APC_READ(sc, APC_CVA); - else - cur = (ch->dir == PCMDIR_PLAY) ? EBDMA_P_READ(sc, EBDMA_DADDR) : - EBDMA_C_READ(sc, EBDMA_DADDR); - sz = sndbuf_getsize(ch->buffer); - ptr = cur - sndbuf_getbufaddr(ch->buffer) + sz; - CS4231_UNLOCK(sc); - - ptr %= sz; - return (ptr); -} - -static struct pcmchan_caps * -cs4231_chan_getcaps(kobj_t obj, void *data) -{ - - return (&cs4231_caps); -} - -static void -cs4231_trigger(struct cs4231_channel *ch) -{ - struct cs4231_softc *sc; - - sc = ch->parent; - if ((sc->sc_flags & CS4231_SBUS) != 0) - cs4231_apcdma_trigger(sc, ch); - else - cs4231_ebdma_trigger(sc, ch); -} - -static void -cs4231_apcdma_trigger(struct cs4231_softc *sc, struct cs4231_channel *ch) -{ - u_int32_t csr, togo; - u_int32_t nextaddr; - - CS4231_LOCK(sc); - if (ch->locked) { - device_printf(sc->sc_dev, "%s channel already triggered\n", - ch->dir == PCMDIR_PLAY ? "playback" : "capture"); - CS4231_UNLOCK(sc); - return; - } - - nextaddr = sndbuf_getbufaddr(ch->buffer); - togo = sndbuf_getsize(ch->buffer) / 2; - if (togo > CS4231_MAX_APC_DMA_SZ) - togo = CS4231_MAX_APC_DMA_SZ; - ch->togo = togo; - if (ch->dir == PCMDIR_PLAY) { - DPRINTF(("TRG: PNVA = 0x%x, togo = 0x%x\n", nextaddr, togo)); - - cs4231_read(sc, CS_TEST_AND_INIT); /* clear pending error */ - csr = APC_READ(sc, APC_CSR); - APC_WRITE(sc, APC_PNVA, nextaddr); - APC_WRITE(sc, APC_PNC, togo); - - if ((csr & APC_CSR_PDMA_GO) == 0 || - (csr & APC_CSR_PPAUSE) != 0) { - APC_WRITE(sc, APC_CSR, APC_READ(sc, APC_CSR) & - ~(APC_CSR_PIE | APC_CSR_PPAUSE)); - APC_WRITE(sc, APC_CSR, APC_READ(sc, APC_CSR) | - APC_CSR_GIE | APC_CSR_PIE | APC_CSR_EIE | - APC_CSR_EI | APC_CSR_PMIE | APC_CSR_PDMA_GO); - cs4231_write(sc, CS_INTERFACE_CONFIG, - cs4231_read(sc, CS_INTERFACE_CONFIG) | - PLAYBACK_ENABLE); - } - /* load next address */ - if (APC_READ(sc, APC_CSR) & APC_CSR_PD) { - nextaddr += togo; - APC_WRITE(sc, APC_PNVA, nextaddr); - APC_WRITE(sc, APC_PNC, togo); - } - } else { - DPRINTF(("TRG: CNVA = 0x%x, togo = 0x%x\n", nextaddr, togo)); - - cs4231_read(sc, CS_TEST_AND_INIT); /* clear pending error */ - APC_WRITE(sc, APC_CNVA, nextaddr); - APC_WRITE(sc, APC_CNC, togo); - csr = APC_READ(sc, APC_CSR); - if ((csr & APC_CSR_CDMA_GO) == 0 || - (csr & APC_CSR_CPAUSE) != 0) { - csr &= APC_CSR_CPAUSE; - csr |= APC_CSR_GIE | APC_CSR_CMIE | APC_CSR_CIE | - APC_CSR_EI | APC_CSR_CDMA_GO; - APC_WRITE(sc, APC_CSR, csr); - cs4231_write(sc, CS_INTERFACE_CONFIG, - cs4231_read(sc, CS_INTERFACE_CONFIG) | - CAPTURE_ENABLE); - } - /* load next address */ - if (APC_READ(sc, APC_CSR) & APC_CSR_CD) { - nextaddr += togo; - APC_WRITE(sc, APC_CNVA, nextaddr); - APC_WRITE(sc, APC_CNC, togo); - } - } - ch->nextaddr = nextaddr; - ch->locked = 1; - CS4231_UNLOCK(sc); -} - -static void -cs4231_ebdma_trigger(struct cs4231_softc *sc, struct cs4231_channel *ch) -{ - u_int32_t csr, togo; - u_int32_t nextaddr; - - CS4231_LOCK(sc); - if (ch->locked) { - device_printf(sc->sc_dev, "%s channel already triggered\n", - ch->dir == PCMDIR_PLAY ? "playback" : "capture"); - CS4231_UNLOCK(sc); - return; - } - - nextaddr = sndbuf_getbufaddr(ch->buffer); - togo = sndbuf_getsize(ch->buffer) / 2; - if (togo % 64 == 0) - sc->sc_burst = EBDCSR_BURST_16; - else if (togo % 32 == 0) - sc->sc_burst = EBDCSR_BURST_8; - else if (togo % 16 == 0) - sc->sc_burst = EBDCSR_BURST_4; - else - sc->sc_burst = EBDCSR_BURST_1; - ch->togo = togo; - DPRINTF(("TRG: DNAR = 0x%x, togo = 0x%x\n", nextaddr, togo)); - if (ch->dir == PCMDIR_PLAY) { - cs4231_read(sc, CS_TEST_AND_INIT); /* clear pending error */ - csr = EBDMA_P_READ(sc, EBDMA_DCSR); - - if (csr & EBDCSR_DMAEN) { - EBDMA_P_WRITE(sc, EBDMA_DCNT, togo); - EBDMA_P_WRITE(sc, EBDMA_DADDR, nextaddr); - } else { - EBDMA_P_WRITE(sc, EBDMA_DCSR, EBDCSR_RESET); - EBDMA_P_WRITE(sc, EBDMA_DCSR, sc->sc_burst); - EBDMA_P_WRITE(sc, EBDMA_DCNT, togo); - EBDMA_P_WRITE(sc, EBDMA_DADDR, nextaddr); - - EBDMA_P_WRITE(sc, EBDMA_DCSR, sc->sc_burst | - EBDCSR_DMAEN | EBDCSR_INTEN | EBDCSR_CNTEN | - EBDCSR_NEXTEN); - cs4231_write(sc, CS_INTERFACE_CONFIG, - cs4231_read(sc, CS_INTERFACE_CONFIG) | - PLAYBACK_ENABLE); - } - /* load next address */ - if (EBDMA_P_READ(sc, EBDMA_DCSR) & EBDCSR_A_LOADED) { - nextaddr += togo; - EBDMA_P_WRITE(sc, EBDMA_DCNT, togo); - EBDMA_P_WRITE(sc, EBDMA_DADDR, nextaddr); - } - } else { - cs4231_read(sc, CS_TEST_AND_INIT); /* clear pending error */ - csr = EBDMA_C_READ(sc, EBDMA_DCSR); - - if (csr & EBDCSR_DMAEN) { - EBDMA_C_WRITE(sc, EBDMA_DCNT, togo); - EBDMA_C_WRITE(sc, EBDMA_DADDR, nextaddr); - } else { - EBDMA_C_WRITE(sc, EBDMA_DCSR, EBDCSR_RESET); - EBDMA_C_WRITE(sc, EBDMA_DCSR, sc->sc_burst); - EBDMA_C_WRITE(sc, EBDMA_DCNT, togo); - EBDMA_C_WRITE(sc, EBDMA_DADDR, nextaddr); - - EBDMA_C_WRITE(sc, EBDMA_DCSR, sc->sc_burst | - EBDCSR_WRITE | EBDCSR_DMAEN | EBDCSR_INTEN | - EBDCSR_CNTEN | EBDCSR_NEXTEN); - cs4231_write(sc, CS_INTERFACE_CONFIG, - cs4231_read(sc, CS_INTERFACE_CONFIG) | - CAPTURE_ENABLE); - } - /* load next address */ - if (EBDMA_C_READ(sc, EBDMA_DCSR) & EBDCSR_A_LOADED) { - nextaddr += togo; - EBDMA_C_WRITE(sc, EBDMA_DCNT, togo); - EBDMA_C_WRITE(sc, EBDMA_DADDR, nextaddr); - } - } - ch->nextaddr = nextaddr; - ch->locked = 1; - CS4231_UNLOCK(sc); -} - -static void -cs4231_halt(struct cs4231_channel *ch) -{ - struct cs4231_softc *sc; - u_int8_t status; - int i; - - sc = ch->parent; - CS4231_LOCK(sc); - if (ch->locked == 0) { - CS4231_UNLOCK(sc); - return; - } - - if (ch->dir == PCMDIR_PLAY ) { - if ((sc->sc_flags & CS4231_SBUS) != 0) { - /* XXX Kills some capture bits */ - APC_WRITE(sc, APC_CSR, APC_READ(sc, APC_CSR) & - ~(APC_CSR_EI | APC_CSR_GIE | APC_CSR_PIE | - APC_CSR_EIE | APC_CSR_PDMA_GO | APC_CSR_PMIE)); - } else { - EBDMA_P_WRITE(sc, EBDMA_DCSR, - EBDMA_P_READ(sc, EBDMA_DCSR) & ~EBDCSR_DMAEN); - } - /* Waiting for playback FIFO to empty */ - status = cs4231_read(sc, CS_TEST_AND_INIT); - for (i = CS_TIMEOUT; - i && (status & PLAYBACK_UNDERRUN) == 0; i--) { - DELAY(5); - status = cs4231_read(sc, CS_TEST_AND_INIT); - } - if (i == 0) - device_printf(sc->sc_dev, "timeout waiting for " - "playback FIFO drain\n"); - cs4231_write(sc, CS_INTERFACE_CONFIG, - cs4231_read(sc, CS_INTERFACE_CONFIG) & (~PLAYBACK_ENABLE)); - } else { - if ((sc->sc_flags & CS4231_SBUS) != 0) { - /* XXX Kills some playback bits */ - APC_WRITE(sc, APC_CSR, APC_CSR_CAPTURE_PAUSE); - } else { - EBDMA_C_WRITE(sc, EBDMA_DCSR, - EBDMA_C_READ(sc, EBDMA_DCSR) & ~EBDCSR_DMAEN); - } - /* Waiting for capture FIFO to empty */ - status = cs4231_read(sc, CS_TEST_AND_INIT); - for (i = CS_TIMEOUT; - i && (status & CAPTURE_OVERRUN) == 0; i--) { - DELAY(5); - status = cs4231_read(sc, CS_TEST_AND_INIT); - } - if (i == 0) - device_printf(sc->sc_dev, "timeout waiting for " - "capture FIFO drain\n"); - cs4231_write(sc, CS_INTERFACE_CONFIG, - cs4231_read(sc, CS_INTERFACE_CONFIG) & (~CAPTURE_ENABLE)); - } - ch->locked = 0; - CS4231_UNLOCK(sc); -} diff --git a/sys/dev/sound/sbus/cs4231.h b/sys/dev/sound/sbus/cs4231.h deleted file mode 100644 index 717e7792712eef..00000000000000 --- a/sys/dev/sound/sbus/cs4231.h +++ /dev/null @@ -1,243 +0,0 @@ -/* $FreeBSD$ */ -/*- - * SPDX-License-Identifier: BSD-2-Clause-NetBSD - * - * Copyright (c) 1996 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Ken Hornstein and John Kohl. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -/** - * Register defs for Crystal Semiconductor CS4231 Audio Codec/mixer - * chip, used on Gravis UltraSound MAX cards. - * - * Block diagram: - * +----------------------------------------------------+ - * | | - * | +----------------------------------------------+ | - * | |mixed in +-+ | | - * | +------------>--| | | | - * | mic in | | | | - * Mic --+-->| --------- GAIN ->-| | | | - * | | AUX 1 in |M| | | - * GF1 --)-->| -------------+-->-|U| | | - * | | Line in | |X|---- GAIN ----------+ | | - * Line --)-->| ---------+---)-->-| | | | | - * | | | | | | | | | - * | | | | +-+ ADC | | - * | | | | | | | - * | | | | | | | - * | | | +--- L/M --\ | | | AMP--> - * | | | \ | | | | - * | | | \ | | | | - * | | +---- L/M -------O-->--+--------)-------+-|--+-> line - * | | mono in /| | | | - * +---|-->------------ L/M -----/ | | | | - * | AUX 2 in | | | | - * CD --------|-->------------ L/M -------+ L/M | | - * | | v | - * | | | | - * | DAC | | - * | | | | - * +----------------------------------------------------+ - * | | - * | | - * v v - * Pc BUS (DISK) ??? - * - * Documentation for this chip can be found at: - * http://www.cirrus.com/products/overviews/cs4231.html - */ - -/* - * This file was merged from two header files.(ad1848reg.h and cs4231reg.h) - * And the suffix AD1848 and SP was changed to CS4231 and CS respectively. - */ -/* CS4231 direct registers */ -#define CS4231_IADDR 0x00 -#define CS4231_IDATA 0x01 -#define CS4231_STATUS 0x02 -#define CS4231_PIO 0x03 - -/* Index address register */ -#define CS_IN_INIT 0x80 -#define MODE_CHANGE_ENABLE 0x40 -#define TRANSFER_DISABLE 0x20 -#define ADDRESS_MASK 0xe0 - -/* Status bits */ -#define INTERRUPT_STATUS 0x01 -#define PLAYBACK_READY 0x02 -#define PLAYBACK_LEFT 0x04 -/* pbright is not left */ -#define PLAYBACK_UPPER 0x08 -/* bplower is not upper */ -#define SAMPLE_ERROR 0x10 -#define CAPTURE_READY 0x20 -#define CAPTURE_LEFT 0x40 -/* cpright is not left */ -#define CAPTURE_UPPER 0x80 -/* cplower is not upper */ - -/* CS4231 indirect mapped registers */ -#define CS_LEFT_INPUT_CONTROL 0x00 -#define CS_RIGHT_INPUT_CONTROL 0x01 -#define CS_LEFT_AUX1_CONTROL 0x02 -#define CS_RIGHT_AUX1_CONTROL 0x03 -#define CS_LEFT_AUX2_CONTROL 0x04 -#define CS_RIGHT_AUX2_CONTROL 0x05 -#define CS_LEFT_OUTPUT_CONTROL 0x06 -#define CS_RIGHT_OUTPUT_CONTROL 0x07 -#define CS_CLOCK_DATA_FORMAT 0x08 -#define CS_INTERFACE_CONFIG 0x09 -#define CS_PIN_CONTROL 0x0a -#define CS_TEST_AND_INIT 0x0b -#define CS_MISC_INFO 0x0c -#define CS_DIGITAL_MIX 0x0d -#define CS_UPPER_BASE_COUNT 0x0e -#define CS_LOWER_BASE_COUNT 0x0f -/* CS4231/AD1845 mode2 registers; added to AD1848 registers */ -#define CS_ALT_FEATURE1 0x10 -#define CS_ALT_FEATURE2 0x11 -#define CS_LEFT_LINE_CONTROL 0x12 -#define CS_RIGHT_LINE_CONTROL 0x13 -#define CS_TIMER_LOW 0x14 -#define CS_TIMER_HIGH 0x15 -#define CS_UPPER_FREQUENCY_SEL 0x16 -#define CS_LOWER_FREQUENCY_SEL 0x17 -#define CS_IRQ_STATUS 0x18 -#define CS_VERSION_ID 0x19 -#define CS_MONO_IO_CONTROL 0x1a -#define CS_POWERDOWN_CONTROL 0x1b -#define CS_REC_FORMAT 0x1c -#define CS_XTAL_SELECT 0x1d -#define CS_UPPER_REC_CNT 0x1e -#define CS_LOWER_REC_CNT 0x1f -#define CS_REG_NONE 0xff - -#define CS_IN_MASK 0x2f -#define CS_IN_LINE 0x00 -#define CS_IN_AUX1 0x40 -#define CS_IN_MIC 0x80 -#define CS_IN_DAC 0xc0 -#define CS_MIC_GAIN_ENABLE 0x20 -#define CS_IN_GAIN_MASK 0xf0 - -/* ADC input control - registers I0 (channel 1,left); I1 (channel 1,right) */ -#define ADC_INPUT_ATTEN_BITS 0x0f -#define ADC_INPUT_GAIN_ENABLE 0x20 - -/* Aux input control - registers I2 (channel 1,left); I3 (channel 1,right) - I4 (channel 2,left); I5 (channel 2,right) */ -#define AUX_INPUT_ATTEN_BITS 0x1f -#define AUX_INPUT_ATTEN_MASK 0xe0 -#define AUX_INPUT_MUTE 0x80 - -/* Output bits - registers I6,I7*/ -#define OUTPUT_MUTE 0x80 -#define OUTPUT_ATTEN_BITS 0x3f -#define OUTPUT_ATTEN_MASK (~OUTPUT_ATTEN_BITS & 0xff) - -/* Clock and Data format reg bits (some also Capture Data format) - reg I8 */ -#define CS_CLOCK_DATA_FORMAT_MASK 0x0f -#define CLOCK_XTAL1 0x00 -#define CLOCK_XTAL2 0x01 -#define CLOCK_FREQ_MASK 0xf1 -#define CS_AFMT_STEREO 0x10 -#define CS_AFMT_U8 0x00 -#define CS_AFMT_MU_LAW 0x20 -#define CS_AFMT_S16_LE 0x40 -#define CS_AFMT_A_LAW 0x60 -#define CS_AFMT_IMA_ADPCM 0xa0 -#define CS_AFMT_S16_BE 0xc0 - -/* Interface Configuration reg bits - register I9 */ -#define PLAYBACK_ENABLE 0x01 -#define CAPTURE_ENABLE 0x02 -#define DUAL_DMA 0x00 -#define SINGLE_DMA 0x04 -#define AUTO_CAL_ENABLE 0x08 -#define PLAYBACK_PIO_ENABLE 0x40 -#define CAPTURE_PIO_ENABLE 0x80 - -/* Pin control bits - register I10 */ -#define INTERRUPT_ENABLE 0x02 -#define XCTL0_ENABLE 0x40 -#define XCTL1_ENABLE 0x80 - -/* Test and init reg bits - register I11 (read-only) */ -#define OVERRANGE_LEFT_MASK 0xfc -#define OVERRANGE_RIGHT_MASK 0xf3 -#define DATA_REQUEST_STATUS 0x10 -#define AUTO_CAL_IN_PROG 0x20 -#define PLAYBACK_UNDERRUN 0x40 -#define CAPTURE_OVERRUN 0x80 - -/* Miscellaneous Control reg bits - register I12 */ -#define CS_ID_MASK 0x70 -#define CS_MODE2 0x40 -#define CS_CODEC_ID_MASK 0x0f - -/* Digital Mix Control reg bits - register I13 */ -#define DIGITAL_MIX1_ENABLE 0x01 -#define MIX_ATTEN_MASK 0x03 - -/* Alternate Feature Enable I - register I16 */ -#define CS_DAC_ZERO 0x01 -#define CS_PMC_ENABLE 0x10 -#define CS_CMC_ENABLE 0x20 -#define CS_OUTPUT_LVL 0x80 - -/* Alternate Feature Enable II - register I17 */ -#define CS_HPF_ENABLE 0x01 -#define DUAL_XTAL_ENABLE 0x02 - -/* alternate feature status(I24) */ -#define CS_AFS_TI 0x40 /* timer interrupt */ -#define CS_AFS_CI 0x20 /* capture interrupt */ -#define CS_AFS_PI 0x10 /* playback interrupt */ -#define CS_AFS_CU 0x08 /* capture underrun */ -#define CS_AFS_CO 0x04 /* capture overrun */ -#define CS_AFS_PO 0x02 /* playback overrun */ -#define CS_AFS_PU 0x01 /* playback underrun */ - -/* Version - register I25 */ -#define CS_VERSION_NUMBER 0xe0 -#define CS_VERSION_CHIPID 0x07 - -/* Miscellaneous Control reg bits */ -#define CS_MODE2 0x40 - -#define MONO_INPUT_ATTEN_BITS 0x0f -#define MONO_INPUT_ATTEN_MASK 0xf0 -#define MONO_OUTPUT_MUTE 0x40 -#define MONO_INPUT_MUTE 0x80 -#define MONO_INPUT_MUTE_MASK 0x7f - -#define LINE_INPUT_ATTEN_BITS 0x1f -#define LINE_INPUT_ATTEN_MASK 0xe0 -#define LINE_INPUT_MUTE 0x80 -#define LINE_INPUT_MUTE_MASK 0x7f diff --git a/sys/dev/sym/sym_hipd.c b/sys/dev/sym/sym_hipd.c index c338053ad6faf8..9b9798d8c57d46 100644 --- a/sys/dev/sym/sym_hipd.c +++ b/sys/dev/sym/sym_hipd.c @@ -90,11 +90,6 @@ __FBSDID("$FreeBSD$"); #include #include -#ifdef __sparc64__ -#include -#include -#endif - #include #include @@ -134,8 +129,6 @@ typedef u_int32_t u32; #define MEMORY_BARRIER() do { ; } while(0) #elif defined __powerpc__ #define MEMORY_BARRIER() __asm__ volatile("eieio; sync" : : : "memory") -#elif defined __sparc64__ -#define MEMORY_BARRIER() __asm__ volatile("membar #Sync" : : : "memory") #elif defined __arm__ #define MEMORY_BARRIER() dmb() #elif defined __aarch64__ @@ -2652,9 +2645,6 @@ static int sym_prepare_setting(hcb_p np, struct sym_nvram *nvram) */ np->myaddr = 255; sym_nvram_setup_host (np, nvram); -#ifdef __sparc64__ - np->myaddr = OF_getscsinitid(np->device); -#endif /* * Get SCSI addr of host adapter (set by bios?). diff --git a/sys/dev/syscons/scgfbrndr.c b/sys/dev/syscons/scgfbrndr.c index 190da5254546c2..2dc4f503854e67 100644 --- a/sys/dev/syscons/scgfbrndr.c +++ b/sys/dev/syscons/scgfbrndr.c @@ -107,38 +107,11 @@ sc_rndr_sw_t grrndrsw = { #endif /* SC_NO_MODE_CHANGE */ #ifndef SC_NO_CUTPASTE -#ifdef __sparc64__ -static u_char mouse_pointer[22 * 2] = { - 0x00, 0x00, /* ............ */ - 0x80, 0x00, /* *........... */ - 0xc0, 0x00, /* **.......... */ - 0xe0, 0x00, /* ***......... */ - 0xf0, 0x00, /* ****........ */ - 0xf8, 0x00, /* *****....... */ - 0xfc, 0x00, /* ******...... */ - 0xfe, 0x00, /* *******..... */ - 0xff, 0x00, /* ********.... */ - 0xff, 0x80, /* *********... */ - 0xfc, 0xc0, /* ******..**.. */ - 0xdc, 0x00, /* **.***...... */ - 0x8e, 0x00, /* *...***..... */ - 0x0e, 0x00, /* ....***..... */ - 0x07, 0x00, /* .....***.... */ - 0x04, 0x00, /* .....*...... */ - 0x00, 0x00, /* ............ */ - 0x00, 0x00, /* ............ */ - 0x00, 0x00, /* ............ */ - 0x00, 0x00, /* ............ */ - 0x00, 0x00, /* ............ */ - 0x00, 0x00 /* ............ */ -}; -#else static u_char mouse_pointer[16] = { 0x00, 0x40, 0x60, 0x70, 0x78, 0x7c, 0x7e, 0x68, 0x0c, 0x0c, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00 }; #endif -#endif static void gfb_nop(scr_stat *scp) @@ -241,7 +214,7 @@ gfb_cursor_shape(scr_stat *scp, int base, int height, int blink) static int pxlblinkrate = 0; -#if defined(__sparc64__) || defined(SC_OFWFB) +#if defined(SC_OFWFB) static void gfb_cursor(scr_stat *scp, int at, int blink, int on, int flip) { @@ -336,17 +309,12 @@ gfb_blink(scr_stat *scp, int at, int flip) static void gfb_mouse(scr_stat *scp, int x, int y, int on) { -#ifdef __sparc64__ - vidd_putm(scp->sc->adp, x, y, mouse_pointer, - on ? 0xffffffff : 0x0, 22, 12); -#else if (on) { vidd_putm(scp->sc->adp, x, y, mouse_pointer, 0xffffffff, 16, 8); } else { /* XXX: removal is incomplete for h/w cursors and borders. */ } -#endif } #endif /* SC_NO_CUTPASTE */ diff --git a/sys/dev/syscons/schistory.c b/sys/dev/syscons/schistory.c index 8da242c8a9f883..64f662b5a7f4f5 100644 --- a/sys/dev/syscons/schistory.c +++ b/sys/dev/syscons/schistory.c @@ -44,8 +44,7 @@ __FBSDID("$FreeBSD$"); #include #include -#if defined(__arm__) || defined(__mips__) || \ - defined(__powerpc__) || defined(__sparc64__) +#if defined(__arm__) || defined(__mips__) || defined(__powerpc__) #include #else #include diff --git a/sys/dev/syscons/scterm-dumb.c b/sys/dev/syscons/scterm-dumb.c index b888897d5437eb..3011b0de8f5292 100644 --- a/sys/dev/syscons/scterm-dumb.c +++ b/sys/dev/syscons/scterm-dumb.c @@ -35,8 +35,7 @@ __FBSDID("$FreeBSD$"); #include #include -#if defined(__arm__) || defined(__mips__) || \ - defined(__powerpc__) || defined(__sparc64__) +#if defined(__arm__) || defined(__mips__) || defined(__powerpc__) #include #else #include diff --git a/sys/dev/syscons/scterm-sc.c b/sys/dev/syscons/scterm-sc.c index 52ba50714f9d5b..de46827b58379f 100644 --- a/sys/dev/syscons/scterm-sc.c +++ b/sys/dev/syscons/scterm-sc.c @@ -36,8 +36,7 @@ __FBSDID("$FreeBSD$"); #include #include -#if defined(__arm__) || defined(__mips__) || \ - defined(__powerpc__) || defined(__sparc64__) +#if defined(__arm__) || defined(__mips__) || defined(__powerpc__) #include #else #include diff --git a/sys/dev/syscons/scterm-teken.c b/sys/dev/syscons/scterm-teken.c index ae231f01d29453..b575b4ec3119e3 100644 --- a/sys/dev/syscons/scterm-teken.c +++ b/sys/dev/syscons/scterm-teken.c @@ -42,8 +42,7 @@ __FBSDID("$FreeBSD$"); #include #include -#if defined(__arm__) || defined(__mips__) || \ - defined(__powerpc__) || defined(__sparc64__) +#if defined(__arm__) || defined(__mips__) || defined(__powerpc__) #include #else #include diff --git a/sys/dev/syscons/scvtb.c b/sys/dev/syscons/scvtb.c index 44b667b8ab82ec..28ea4b41666c71 100644 --- a/sys/dev/syscons/scvtb.c +++ b/sys/dev/syscons/scvtb.c @@ -76,12 +76,10 @@ sc_vtb_init(sc_vtb_t *vtb, int type, int cols, int rows, void *buf, int wait) } vtb->vtb_flags |= VTB_VALID; break; -#ifndef __sparc64__ case VTB_FRAMEBUFFER: vtb->vtb_buffer = (vm_offset_t)buf; vtb->vtb_flags |= VTB_VALID; break; -#endif default: break; } @@ -121,44 +119,36 @@ sc_vtb_size(int cols, int rows) int sc_vtb_getc(sc_vtb_t *vtb, int at) { -#ifndef __sparc64__ if (vtb->vtb_type == VTB_FRAMEBUFFER) return (readw(sc_vtb_pointer(vtb, at)) & 0x00ff); else -#endif return (*(u_int16_t *)sc_vtb_pointer(vtb, at) & 0x00ff); } int sc_vtb_geta(sc_vtb_t *vtb, int at) { -#ifndef __sparc64__ if (vtb->vtb_type == VTB_FRAMEBUFFER) return (readw(sc_vtb_pointer(vtb, at)) & 0xff00); else -#endif return (*(u_int16_t *)sc_vtb_pointer(vtb, at) & 0xff00); } void sc_vtb_putc(sc_vtb_t *vtb, int at, int c, int a) { -#ifndef __sparc64__ if (vtb->vtb_type == VTB_FRAMEBUFFER) writew(sc_vtb_pointer(vtb, at), a | c); else -#endif *(u_int16_t *)sc_vtb_pointer(vtb, at) = a | c; } vm_offset_t sc_vtb_putchar(sc_vtb_t *vtb, vm_offset_t p, int c, int a) { -#ifndef __sparc64__ if (vtb->vtb_type == VTB_FRAMEBUFFER) writew(p, a | c); else -#endif *(u_int16_t *)p = a | c; return (p + sizeof(u_int16_t)); } @@ -178,18 +168,15 @@ sc_vtb_pos(sc_vtb_t *vtb, int pos, int offset) void sc_vtb_clear(sc_vtb_t *vtb, int c, int attr) { -#ifndef __sparc64__ if (vtb->vtb_type == VTB_FRAMEBUFFER) fillw_io(attr | c, sc_vtb_pointer(vtb, 0), vtb->vtb_size); else -#endif fillw(attr | c, (void *)sc_vtb_pointer(vtb, 0), vtb->vtb_size); } void sc_vtb_copy(sc_vtb_t *vtb1, int from, sc_vtb_t *vtb2, int to, int count) { -#ifndef __sparc64__ /* XXX if both are VTB_VRAMEBUFFER... */ if (vtb2->vtb_type == VTB_FRAMEBUFFER) bcopy_toio(sc_vtb_pointer(vtb1, from), @@ -200,7 +187,6 @@ sc_vtb_copy(sc_vtb_t *vtb1, int from, sc_vtb_t *vtb2, int to, int count) sc_vtb_pointer(vtb2, to), count*sizeof(u_int16_t)); else -#endif bcopy((void *)sc_vtb_pointer(vtb1, from), (void *)sc_vtb_pointer(vtb2, to), count*sizeof(u_int16_t)); @@ -216,13 +202,11 @@ sc_vtb_append(sc_vtb_t *vtb1, int from, sc_vtb_t *vtb2, int count) while (count > 0) { len = imin(count, vtb2->vtb_size - vtb2->vtb_tail); -#ifndef __sparc64__ if (vtb1->vtb_type == VTB_FRAMEBUFFER) bcopy_fromio(sc_vtb_pointer(vtb1, from), sc_vtb_pointer(vtb2, vtb2->vtb_tail), len*sizeof(u_int16_t)); else -#endif bcopy((void *)sc_vtb_pointer(vtb1, from), (void *)sc_vtb_pointer(vtb2, vtb2->vtb_tail), len*sizeof(u_int16_t)); @@ -243,11 +227,9 @@ sc_vtb_erase(sc_vtb_t *vtb, int at, int count, int c, int attr) { if (at + count > vtb->vtb_size) count = vtb->vtb_size - at; -#ifndef __sparc64__ if (vtb->vtb_type == VTB_FRAMEBUFFER) fillw_io(attr | c, sc_vtb_pointer(vtb, at), count); else -#endif fillw(attr | c, (void *)sc_vtb_pointer(vtb, at), count); } @@ -260,12 +242,10 @@ sc_vtb_move(sc_vtb_t *vtb, int from, int to, int count) count = vtb->vtb_size - to; if (count <= 0) return; -#ifndef __sparc64__ if (vtb->vtb_type == VTB_FRAMEBUFFER) bcopy_io(sc_vtb_pointer(vtb, from), sc_vtb_pointer(vtb, to), count*sizeof(u_int16_t)); else -#endif bcopy((void *)sc_vtb_pointer(vtb, from), (void *)sc_vtb_pointer(vtb, to), count*sizeof(u_int16_t)); } @@ -279,23 +259,19 @@ sc_vtb_delete(sc_vtb_t *vtb, int at, int count, int c, int attr) count = vtb->vtb_size - at; len = vtb->vtb_size - at - count; if (len > 0) { -#ifndef __sparc64__ if (vtb->vtb_type == VTB_FRAMEBUFFER) bcopy_io(sc_vtb_pointer(vtb, at + count), sc_vtb_pointer(vtb, at), len*sizeof(u_int16_t)); else -#endif bcopy((void *)sc_vtb_pointer(vtb, at + count), (void *)sc_vtb_pointer(vtb, at), len*sizeof(u_int16_t)); } -#ifndef __sparc64__ if (vtb->vtb_type == VTB_FRAMEBUFFER) fillw_io(attr | c, sc_vtb_pointer(vtb, at + len), vtb->vtb_size - at - len); else -#endif fillw(attr | c, (void *)sc_vtb_pointer(vtb, at + len), vtb->vtb_size - at - len); } @@ -306,21 +282,17 @@ sc_vtb_ins(sc_vtb_t *vtb, int at, int count, int c, int attr) if (at + count > vtb->vtb_size) count = vtb->vtb_size - at; else { -#ifndef __sparc64__ if (vtb->vtb_type == VTB_FRAMEBUFFER) bcopy_io(sc_vtb_pointer(vtb, at), sc_vtb_pointer(vtb, at + count), (vtb->vtb_size - at - count)*sizeof(u_int16_t)); else -#endif bcopy((void *)sc_vtb_pointer(vtb, at), (void *)sc_vtb_pointer(vtb, at + count), (vtb->vtb_size - at - count)*sizeof(u_int16_t)); } -#ifndef __sparc64__ if (vtb->vtb_type == VTB_FRAMEBUFFER) fillw_io(attr | c, sc_vtb_pointer(vtb, at), count); else -#endif fillw(attr | c, (void *)sc_vtb_pointer(vtb, at), count); } diff --git a/sys/dev/syscons/syscons.c b/sys/dev/syscons/syscons.c index 06d4e525e834f5..d822820e13a010 100644 --- a/sys/dev/syscons/syscons.c +++ b/sys/dev/syscons/syscons.c @@ -65,8 +65,7 @@ __FBSDID("$FreeBSD$"); #include #include -#if defined(__arm__) || defined(__mips__) || defined(__powerpc__) || \ - defined(__sparc64__) +#if defined(__arm__) || defined(__mips__) || defined(__powerpc__) #include #else #include @@ -536,10 +535,8 @@ sc_set_vesa_mode(scr_stat *scp, sc_softc_t *sc, int unit) scp->end = 0; scp->cursor_pos = scp->cursor_oldpos = scp->xsize * scp->xsize; scp->mode = sc->initial_mode = vmode; -#ifndef __sparc64__ sc_vtb_init(&scp->scr, VTB_FRAMEBUFFER, scp->xsize, scp->ysize, (void *)sc->adp->va_window, FALSE); -#endif sc_alloc_scr_buffer(scp, FALSE, FALSE); sc_init_emulator(scp, NULL); #ifndef SC_NO_CUTPASTE @@ -725,9 +722,7 @@ sctty_open(struct tty *tp) int unit = scdevtounit(tp); sc_softc_t *sc; scr_stat *scp; -#ifndef __sparc64__ keyarg_t key; -#endif DPRINTF(5, ("scopen: dev:%s, unit:%d, vty:%d\n", devtoname(tp->t_dev), unit, @@ -741,13 +736,11 @@ sctty_open(struct tty *tp) if (!tty_opened(tp)) { /* Use the current setting of the <-- key as default VERASE. */ /* If the Delete key is preferable, an stty is necessary */ -#ifndef __sparc64__ if (sc->kbd != NULL) { key.keynum = KEYCODE_BS; (void)kbdd_ioctl(sc->kbd, GIO_KEYMAPENT, (caddr_t)&key); tp->t_termios.c_cc[VERASE] = key.key.map[0]; } -#endif } scp = sc_get_stat(tp); @@ -789,9 +782,7 @@ sctty_close(struct tty *tp) scp->smode.mode = VT_AUTO; } else { sc_vtb_destroy(&scp->vtb); -#ifndef __sparc64__ sc_vtb_destroy(&scp->scr); -#endif sc_free_history_buffer(scp, scp->ysize); SC_STAT(tp) = NULL; free(scp, M_DEVBUF); @@ -3003,11 +2994,9 @@ exchange_scr(sc_softc_t *sc) scp = sc->cur_scp = sc->new_scp; if (sc->old_scp->mode != scp->mode || ISUNKNOWNSC(sc->old_scp)) set_mode(scp); -#ifndef __sparc64__ else sc_vtb_init(&scp->scr, VTB_FRAMEBUFFER, scp->xsize, scp->ysize, (void *)sc->adp->va_window, FALSE); -#endif scp->status |= MOUSE_HIDDEN; sc_move_cursor(scp, scp->xpos, scp->ypos); if (!ISGRAPHSC(scp)) @@ -3334,14 +3323,12 @@ scinit(int unit, int flags) } sc->cur_scp = scp; -#ifndef __sparc64__ /* copy screen to temporary buffer */ sc_vtb_init(&scp->scr, VTB_FRAMEBUFFER, scp->xsize, scp->ysize, (void *)scp->sc->adp->va_window, FALSE); if (ISTEXTSC(scp)) sc_vtb_copy(&scp->scr, 0, &scp->vtb, 0, scp->xsize * scp->ysize); -#endif /* Sync h/w cursor position to s/w (sc and teken). */ if (col >= scp->xsize) @@ -3666,9 +3653,7 @@ init_scp(sc_softc_t *sc, int vty, scr_stat *scp) #endif sc_vtb_init(&scp->vtb, VTB_MEMORY, 0, 0, NULL, FALSE); -#ifndef __sparc64__ sc_vtb_init(&scp->scr, VTB_FRAMEBUFFER, 0, 0, NULL, FALSE); -#endif scp->xoff = scp->yoff = 0; scp->xpos = scp->ypos = 0; scp->start = scp->xsize * scp->ysize - 1; @@ -4192,10 +4177,8 @@ set_mode(scr_stat *scp) /* setup video hardware for the given mode */ vidd_set_mode(scp->sc->adp, scp->mode); scp->rndr->init(scp); -#ifndef __sparc64__ sc_vtb_init(&scp->scr, VTB_FRAMEBUFFER, scp->xsize, scp->ysize, (void *)scp->sc->adp->va_window, FALSE); -#endif update_font(scp); diff --git a/sys/dev/syscons/syscons.h b/sys/dev/syscons/syscons.h index 405e5ba4293220..21060352f76765 100644 --- a/sys/dev/syscons/syscons.h +++ b/sys/dev/syscons/syscons.h @@ -88,15 +88,7 @@ #define DPRINTF(l, p) if (SC_DEBUG_LEVEL >= (l)) printf p -#ifndef __sparc64__ #define SC_DRIVER_NAME "sc" -#else -/* - * Use a different driver name on sparc64 so it does not get confused - * with the system controller devices which are also termed 'sc' in OFW. - */ -#define SC_DRIVER_NAME "syscons" -#endif #define SC_VTY(dev) (((sc_ttysoftc *)tty_softc(tp))->st_index) #define SC_DEV(sc, vty) ((sc)->dev[(vty) - (sc)->first_vty]) #define SC_STAT(tp) (*((scr_stat **)&((sc_ttysoftc *)tty_softc(tp))->st_stat)) @@ -287,9 +279,7 @@ typedef struct scr_stat { int index; /* index of this vty */ struct sc_softc *sc; /* pointer to softc */ struct sc_rndr_sw *rndr; /* renderer */ -#ifndef __sparc64__ sc_vtb_t scr; -#endif sc_vtb_t vtb; int xpos; /* current X position */ diff --git a/sys/dev/uart/uart_bus_ebus.c b/sys/dev/uart/uart_bus_ebus.c deleted file mode 100644 index dd50ff83596f31..00000000000000 --- a/sys/dev/uart/uart_bus_ebus.c +++ /dev/null @@ -1,108 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2001 by Thomas Moestl . - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include - -#include - -#include -#include -#include -#include - -#include -#include -#include - -static int uart_ebus_probe(device_t dev); - -static device_method_t uart_ebus_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, uart_ebus_probe), - DEVMETHOD(device_attach, uart_bus_attach), - DEVMETHOD(device_detach, uart_bus_detach), - { 0, 0 } -}; - -static driver_t uart_ebus_driver = { - uart_driver_name, - uart_ebus_methods, - sizeof(struct uart_softc), -}; - -static int -uart_ebus_probe(device_t dev) -{ - const char *nm, *cmpt; - struct uart_softc *sc; - struct uart_devinfo dummy; - - sc = device_get_softc(dev); - sc->sc_class = NULL; - - nm = ofw_bus_get_name(dev); - cmpt = ofw_bus_get_compat(dev); - if (cmpt == NULL) - cmpt = ""; - if (!strcmp(nm, "lom-console") || !strcmp(nm, "su") || - !strcmp(nm, "su_pnp") || !strcmp(cmpt, "rsc-console") || - !strcmp(cmpt, "rsc-control") || !strcmp(cmpt, "su") || - !strcmp(cmpt, "su16550") || !strcmp(cmpt, "su16552")) { - /* - * On AXi and AXmp boards the NS16550 (used to connect - * keyboard/mouse) share their IRQ lines with the i8042. - * Any IRQ activity (typically during attach) of the - * NS16550 used to connect the keyboard when actually the - * PS/2 keyboard is selected in OFW causes interaction - * with the OBP i8042 driver resulting in a hang and vice - * versa. As RS232 keyboards and mice obviously aren't - * meant to be used in parallel with PS/2 ones on these - * boards don't attach to the NS16550 in case the RS232 - * keyboard isn't selected in order to prevent such hangs. - */ - if ((!strcmp(sparc64_model, "SUNW,UltraAX-MP") || - !strcmp(sparc64_model, "SUNW,UltraSPARC-IIi-Engine")) && - uart_cpu_getdev(UART_DEV_KEYBOARD, &dummy)) { - device_disable(dev); - return (ENXIO); - } - sc->sc_class = &uart_ns8250_class; - return (uart_bus_probe(dev, 0, 0, 0, 0, 0, 0)); - } - - return (ENXIO); -} - -DRIVER_MODULE(uart, ebus, uart_ebus_driver, uart_devclass, 0, 0); diff --git a/sys/dev/uart/uart_cpu_sparc64.c b/sys/dev/uart/uart_cpu_sparc64.c deleted file mode 100644 index 17a2ca84bb6c68..00000000000000 --- a/sys/dev/uart/uart_cpu_sparc64.c +++ /dev/null @@ -1,307 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2003, 2004 Marcel Moolenaar - * Copyright (c) 2004 - 2006 Marius Strobl - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include - -#include -#include - -#include -#include - -#include -#include - -bus_space_tag_t uart_bus_space_io; -bus_space_tag_t uart_bus_space_mem; - -static struct bus_space_tag bst_store[3]; - -/* - * Determine which channel of a SCC a device referenced by a full device - * path or as an alias is (in the latter case we try to look up the device - * path via the /aliases node). - * Only the device paths of devices which are used for TTYs really allow - * to do this as they look like these (taken from /aliases nodes): - * ttya: '/central/fhc/zs@0,902000:a' - * ttyc: '/pci@1f,0/pci@1,1/ebus@1/se@14,400000:a' - * Additionally, for device paths of SCCs which are connected to a RSC - * (Remote System Control) device we can hardcode the appropriate channel. - * Such device paths look like these: - * rsc: '/pci@1f,4000/ebus@1/se@14,200000:ssp' - * ttyc: '/pci@1f,4000/ebus@1/se@14,200000:ssp' - */ -static int -uart_cpu_channel(char *dev) -{ - char alias[64]; - phandle_t aliases; - int len; - const char *p; - - strcpy(alias, dev); - if ((aliases = OF_finddevice("/aliases")) != -1) - (void)OF_getprop(aliases, dev, alias, sizeof(alias)); - len = strlen(alias); - if ((p = strrchr(alias, ':')) == NULL) - return (0); - p++; - if (p - alias == len - 1 && (*p == 'a' || *p == 'b')) - return (*p - 'a' + 1); - if (strcmp(p, "ssp") == 0) - return (1); - return (0); -} - -int -uart_cpu_eqres(struct uart_bas *b1, struct uart_bas *b2) -{ - - return ((b1->bsh == b2->bsh) ? 1 : 0); -} - -/* - * Get the package handle of the UART that is selected as the console, if - * the console is an UART of course. Note that we enforce that both input - * and output are selected. - * Note that the currently active console (i.e. /chosen/stdout and - * /chosen/stdin) may not be the same as the device selected in the - * environment (ie /options/output-device and /options/input-device) because - * keyboard and screen were selected but the keyboard was unplugged or the - * user has changed the environment. In the latter case I would assume that - * the user expects that FreeBSD uses the new console setting. - * For weirder configurations, use ofw_console(4). - */ -static phandle_t -uart_cpu_getdev_console(phandle_t options, char *dev, size_t devsz) -{ - char buf[sizeof("serial")]; - ihandle_t inst; - phandle_t chosen, input, output; - - if (OF_getprop(options, "input-device", dev, devsz) == -1) - return (-1); - input = OF_finddevice(dev); - if (OF_getprop(options, "output-device", dev, devsz) == -1) - return (-1); - output = OF_finddevice(dev); - if (input == -1 || output == -1 || - OF_getproplen(input, "keyboard") >= 0) { - if ((chosen = OF_finddevice("/chosen")) == -1) - return (-1); - if (OF_getprop(chosen, "stdin", &inst, sizeof(inst)) == -1) - return (-1); - if ((input = OF_instance_to_package(inst)) == -1) - return (-1); - if (OF_getprop(chosen, "stdout", &inst, sizeof(inst)) == -1) - return (-1); - if ((output = OF_instance_to_package(inst)) == -1) - return (-1); - snprintf(dev, devsz, "ttya"); - } - if (input != output) - return (-1); - if (OF_getprop(input, "device_type", buf, sizeof(buf)) == -1) - return (-1); - if (strcmp(buf, "serial") != 0) - return (-1); - /* For a Serengeti console device point to the bootbus controller. */ - if (OF_getprop(input, "name", buf, sizeof(buf)) > 0 && - !strcmp(buf, "sgcn")) { - if ((chosen = OF_finddevice("/chosen")) == -1) - return (-1); - if (OF_getprop(chosen, "iosram", &input, sizeof(input)) == -1) - return (-1); - } - return (input); -} - -/* - * Get the package handle of the UART that's selected as the debug port. - * Since there's no place for this in the OF, we use the kernel environment - * variable "hw.uart.dbgport". Note however that the variable is not a - * list of attributes. It's single device name or alias, as known by - * the OF. - */ -static phandle_t -uart_cpu_getdev_dbgport(char *dev, size_t devsz) -{ - char buf[sizeof("serial")]; - phandle_t input; - - if (!getenv_string("hw.uart.dbgport", dev, devsz)) - return (-1); - if ((input = OF_finddevice(dev)) == -1) - return (-1); - if (OF_getprop(input, "device_type", buf, sizeof(buf)) == -1) - return (-1); - if (strcmp(buf, "serial") != 0) - return (-1); - return (input); -} - -/* - * Get the package handle of the UART that is selected as the keyboard port, - * if it's actually used to connect the keyboard according to the OF. I.e. - * this will return the UART used to connect the keyboard regardless whether - * it's stdin or not, however not in case the user or the OF gave preference - * to e.g. a PS/2 keyboard by setting /aliases/keyboard accordingly. - */ -static phandle_t -uart_cpu_getdev_keyboard(char *dev, size_t devsz) -{ - char buf[sizeof("serial")]; - phandle_t input; - - if ((input = OF_finddevice("keyboard")) == -1) - return (-1); - if (OF_getprop(input, "device_type", buf, sizeof(buf)) == -1) - return (-1); - if (strcmp(buf, "serial") != 0) - return (-1); - if (OF_getprop(input, "name", dev, devsz) == -1) - return (-1); - /* - * So far this also matched PS/2 keyboard nodes so make sure it's - * one of the SCCs/UARTs known to be used to connect keyboards. - */ - if (strcmp(dev, "su") && strcmp(dev, "su_pnp") && strcmp(dev, "zs")) - return (-1); - return (input); -} - -int -uart_cpu_getdev(int devtype, struct uart_devinfo *di) -{ - char buf[32], compat[32], dev[64]; - struct uart_class *class; - phandle_t input, options; - bus_addr_t addr; - int baud, bits, error, range, space, stop; - char flag, par; - - if ((options = OF_finddevice("/options")) == -1) - return (ENXIO); - switch (devtype) { - case UART_DEV_CONSOLE: - input = uart_cpu_getdev_console(options, dev, sizeof(dev)); - break; - case UART_DEV_DBGPORT: - input = uart_cpu_getdev_dbgport(dev, sizeof(dev)); - break; - case UART_DEV_KEYBOARD: - input = uart_cpu_getdev_keyboard(dev, sizeof(dev)); - break; - default: - input = -1; - break; - } - if (input == -1) - return (ENXIO); - error = OF_decode_addr(input, 0, &space, &addr); - if (error) - return (error); - - /* Get the device class. */ - if (OF_getprop(input, "name", buf, sizeof(buf)) == -1) - return (ENXIO); - if (OF_getprop(input, "compatible", compat, sizeof(compat)) == -1) - compat[0] = '\0'; - di->bas.regshft = 0; - di->bas.rclk = 0; - class = NULL; - if (!strcmp(buf, "se") || !strcmp(buf, "FJSV,se") || - !strcmp(compat, "sab82532")) { - class = &uart_sab82532_class; - /* SAB82532 are only known to be used for TTYs. */ - if ((di->bas.chan = uart_cpu_channel(dev)) == 0) - return (ENXIO); - addr += uart_getrange(class) * (di->bas.chan - 1); - } else if (!strcmp(buf, "zs")) { - class = &uart_z8530_class; - if ((di->bas.chan = uart_cpu_channel(dev)) == 0) { - /* - * There's no way to determine from OF which - * channel has the keyboard. Should always be - * on channel 1 however. - */ - if (devtype == UART_DEV_KEYBOARD) - di->bas.chan = 1; - else - return (ENXIO); - } - di->bas.regshft = 1; - range = uart_getrange(class) << di->bas.regshft; - addr += range - range * (di->bas.chan - 1); - } else if (!strcmp(buf, "lom-console") || !strcmp(buf, "su") || - !strcmp(buf, "su_pnp") || !strcmp(compat, "rsc-console") || - !strcmp(compat, "su") || !strcmp(compat, "su16550") || - !strcmp(compat, "su16552")) { - class = &uart_ns8250_class; - di->bas.chan = 0; - } else if (!strcmp(compat, "sgsbbc")) { - class = &uart_sbbc_class; - di->bas.chan = 0; - } - if (class == NULL) - return (ENXIO); - - /* Fill in the device info. */ - di->ops = uart_getops(class); - di->bas.bst = &bst_store[devtype]; - di->bas.bsh = sparc64_fake_bustag(space, addr, di->bas.bst); - - /* Get the line settings. */ - if (devtype == UART_DEV_KEYBOARD) - di->baudrate = 1200; - else if (!strcmp(compat, "rsc-console")) - di->baudrate = 115200; - else - di->baudrate = 9600; - di->databits = 8; - di->stopbits = 1; - di->parity = UART_PARITY_NONE; - snprintf(buf, sizeof(buf), "%s-mode", dev); - if (OF_getprop(options, buf, buf, sizeof(buf)) == -1 && - OF_getprop(input, "ssp-console-modes", buf, sizeof(buf)) == -1) - return (0); - if (sscanf(buf, "%d,%d,%c,%d,%c", &baud, &bits, &par, &stop, &flag) - != 5) - return (0); - di->baudrate = baud; - di->databits = bits; - di->stopbits = stop; - di->parity = (par == 'n') ? UART_PARITY_NONE : - (par == 'o') ? UART_PARITY_ODD : UART_PARITY_EVEN; - return (0); -} diff --git a/sys/dev/uart/uart_kbd_sun.c b/sys/dev/uart/uart_kbd_sun.c deleted file mode 100644 index 5c9d7555f186ed..00000000000000 --- a/sys/dev/uart/uart_kbd_sun.c +++ /dev/null @@ -1,869 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2003 Jake Burkholder. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -__FBSDID("$FreeBSD$"); - -#include "opt_kbd.h" -#include "opt_sunkbd.h" - -#if (defined(SUNKBD_EMULATE_ATKBD) && defined(SUNKBD_DFLT_KEYMAP)) || \ - !defined(SUNKBD_EMULATE_ATKBD) -#define KBD_DFLT_KEYMAP -#endif - -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include - -#include -#include -#include - -#include -#if !defined(SUNKBD_EMULATE_ATKBD) -#include -#endif - -#if defined(SUNKBD_EMULATE_ATKBD) && defined(SUNKBD_DFLT_KEYMAP) -#include "sunkbdmap.h" -#endif -#include "uart_if.h" - -#define SUNKBD_DRIVER_NAME "sunkbd" - -#define TODO printf("%s: unimplemented", __func__) - -struct sunkbd_softc { - keyboard_t sc_kbd; - struct uart_softc *sc_uart; - struct uart_devinfo *sc_sysdev; - - struct callout sc_repeat_callout; - int sc_repeat_key; - - int sc_accents; - int sc_composed_char; - int sc_flags; -#define KPCOMPOSE (1 << 0) - int sc_mode; - int sc_polling; - int sc_repeating; - int sc_state; - -#if defined(SUNKBD_EMULATE_ATKBD) - int sc_buffered_char[2]; -#endif -}; - -static int sunkbd_configure(int flags); -static int sunkbd_probe_keyboard(struct uart_devinfo *di); - -static int sunkbd_probe(int unit, void *arg, int flags); -static int sunkbd_init(int unit, keyboard_t **kbdp, void *arg, int flags); -static int sunkbd_term(keyboard_t *kbd); -static int sunkbd_intr(keyboard_t *kbd, void *arg); -static int sunkbd_test_if(keyboard_t *kbd); -static int sunkbd_enable(keyboard_t *kbd); -static int sunkbd_disable(keyboard_t *kbd); -static int sunkbd_read(keyboard_t *kbd, int wait); -static int sunkbd_check(keyboard_t *kbd); -static u_int sunkbd_read_char(keyboard_t *kbd, int wait); -static int sunkbd_check_char(keyboard_t *kbd); -static int sunkbd_ioctl(keyboard_t *kbd, u_long cmd, caddr_t data); -static int sunkbd_lock(keyboard_t *kbd, int lock); -static void sunkbd_clear_state(keyboard_t *kbd); -static int sunkbd_get_state(keyboard_t *kbd, void *buf, size_t len); -static int sunkbd_set_state(keyboard_t *kbd, void *buf, size_t len); -static int sunkbd_poll_mode(keyboard_t *kbd, int on); -static void sunkbd_diag(keyboard_t *kbd, int level); - -static void sunkbd_repeat(void *v); -#if defined(SUNKBD_EMULATE_ATKBD) -static int keycode2scancode(int keycode, int shift, int up); -#endif - -static keyboard_switch_t sunkbdsw = { - .probe = sunkbd_probe, - .init = sunkbd_init, - .term = sunkbd_term, - .intr = sunkbd_intr, - .test_if = sunkbd_test_if, - .enable = sunkbd_enable, - .disable = sunkbd_disable, - .read = sunkbd_read, - .check = sunkbd_check, - .read_char = sunkbd_read_char, - .check_char = sunkbd_check_char, - .ioctl = sunkbd_ioctl, - .lock = sunkbd_lock, - .clear_state = sunkbd_clear_state, - .get_state = sunkbd_get_state, - .set_state = sunkbd_set_state, - .poll = sunkbd_poll_mode, - .diag = sunkbd_diag -}; - -KEYBOARD_DRIVER(sunkbd, sunkbdsw, sunkbd_configure); - -static struct sunkbd_softc sunkbd_softc; -static struct uart_devinfo uart_keyboard; - -#if defined(SUNKBD_EMULATE_ATKBD) - -#define SCAN_PRESS 0x000 -#define SCAN_RELEASE 0x080 -#define SCAN_PREFIX_E0 0x100 -#define SCAN_PREFIX_E1 0x200 -#define SCAN_PREFIX_CTL 0x400 -#define SCAN_PREFIX_SHIFT 0x800 -#define SCAN_PREFIX (SCAN_PREFIX_E0 | SCAN_PREFIX_E1 | \ - SCAN_PREFIX_CTL | SCAN_PREFIX_SHIFT) - -#define NOTR 0x0 /* no translation */ - -static const uint8_t sunkbd_trtab[] = { - NOTR, 0x6d, 0x78, 0x6e, 0x79, 0x3b, 0x3c, 0x44, /* 0x00 - 0x07 */ - 0x3d, 0x57, 0x3e, 0x58, 0x3f, 0x5d, 0x40, NOTR, /* 0x08 - 0x0f */ - 0x41, 0x42, 0x43, 0x38, 0x5f, 0x68, 0x5c, 0x46, /* 0x10 - 0x17 */ - 0x61, 0x6f, 0x70, 0x64, 0x62, 0x01, 0x02, 0x03, /* 0x18 - 0x1f */ - 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, /* 0x20 - 0x27 */ - 0x0c, 0x0d, 0x29, 0x0e, 0x66, 0x77, 0x5b, 0x37, /* 0x28 - 0x2f */ - 0x7a, 0x71, 0x53, 0x74, 0x5e, 0x0f, 0x10, 0x11, /* 0x30 - 0x37 */ - 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, /* 0x38 - 0x3f */ - 0x1a, 0x1b, 0x67, 0x6b, 0x47, 0x48, 0x49, 0x4a, /* 0x40 - 0x47 */ - 0x73, 0x72, 0x63, NOTR, 0x1d, 0x1e, 0x1f, 0x20, /* 0x48 - 0x4f */ - 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, /* 0x50 - 0x57 */ - 0x2b, 0x1c, 0x59, 0x4b, 0x4c, 0x4d, 0x52, 0x75, /* 0x58 - 0x5f */ - 0x60, 0x76, 0x45, 0x2a, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x60 - 0x67 */ - 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, NOTR, /* 0x68 - 0x6f */ - 0x4f, 0x50, 0x51, NOTR, NOTR, NOTR, 0x6c, 0x3a, /* 0x70 - 0x77 */ - 0x69, 0x39, 0x6a, 0x65, 0x56, 0x4e, NOTR, NOTR /* 0x78 - 0x7f */ -}; - -#endif - -static int -sunkbd_probe_keyboard(struct uart_devinfo *di) -{ - int c, id, ltries, tries; - - for (tries = 5; tries != 0; tries--) { - uart_putc(di, SKBD_CMD_RESET); - for (ltries = 1000; ltries != 0; ltries--) { - if (uart_poll(di) == SKBD_RSP_RESET) - break; - DELAY(1000); - } - if (ltries == 0) - continue; - id = -1; - for (ltries = 1000; ltries != 0; ltries--) { - switch (c = uart_poll(di)) { - case -1: - break; - case SKBD_RSP_IDLE: - return (id); - default: - id = c; - } - DELAY(1000); - } - } - return (-1); -} - -static int sunkbd_attach(struct uart_softc *sc); -static void sunkbd_uart_intr(void *arg); - -static int -sunkbd_configure(int flags) -{ - struct sunkbd_softc *sc; - - /* - * We are only prepared to be used for the high-level console - * when the keyboard is both configured and attached. - */ - if (!(flags & KB_CONF_PROBE_ONLY)) { - if (KBD_IS_INITIALIZED(&sunkbd_softc.sc_kbd)) - goto found; - else - return (0); - } - - if (uart_cpu_getdev(UART_DEV_KEYBOARD, &uart_keyboard)) - return (0); - if (uart_probe(&uart_keyboard)) - return (0); - uart_init(&uart_keyboard); - - uart_keyboard.type = UART_DEV_KEYBOARD; - uart_keyboard.attach = sunkbd_attach; - uart_add_sysdev(&uart_keyboard); - - if (sunkbd_probe_keyboard(&uart_keyboard) != KB_SUN4) - return (0); - - sc = &sunkbd_softc; - callout_init(&sc->sc_repeat_callout, 0); - sunkbd_clear_state(&sc->sc_kbd); - -#if defined(SUNKBD_EMULATE_ATKBD) - kbd_init_struct(&sc->sc_kbd, SUNKBD_DRIVER_NAME, KB_101, 0, 0, 0, 0); - kbd_set_maps(&sc->sc_kbd, &key_map, &accent_map, fkey_tab, - sizeof(fkey_tab) / sizeof(fkey_tab[0])); -#else - kbd_init_struct(&sc->sc_kbd, SUNKBD_DRIVER_NAME, KB_OTHER, 0, 0, 0, 0); - kbd_set_maps(&sc->sc_kbd, &keymap_sun_us_unix_kbd, - &accentmap_sun_us_unix_kbd, fkey_tab, - sizeof(fkey_tab) / sizeof(fkey_tab[0])); -#endif - sc->sc_mode = K_XLATE; - kbd_register(&sc->sc_kbd); - - sc->sc_sysdev = &uart_keyboard; - - found: - /* Return number of found keyboards. */ - return (1); -} - -static int -sunkbd_attach(struct uart_softc *sc) -{ - - /* - * Don't attach if we didn't probe the keyboard. Note that - * the UART is still marked as a system device in that case. - */ - if (sunkbd_softc.sc_sysdev == NULL) { - device_printf(sc->sc_dev, "keyboard not present\n"); - return (0); - } - - if (sc->sc_sysdev != NULL) { - sunkbd_softc.sc_uart = sc; - -#ifdef KBD_INSTALL_CDEV - kbd_attach(&sunkbd_softc.sc_kbd); -#endif - sunkbd_enable(&sunkbd_softc.sc_kbd); - - swi_add(&tty_intr_event, uart_driver_name, sunkbd_uart_intr, - &sunkbd_softc, SWI_TTY, INTR_TYPE_TTY, &sc->sc_softih); - - sc->sc_opened = 1; - KBD_INIT_DONE(&sunkbd_softc.sc_kbd); - } - - return (0); -} - -static void -sunkbd_uart_intr(void *arg) -{ - struct sunkbd_softc *sc = arg; - int pend; - - if (sc->sc_uart->sc_leaving) - return; - - pend = atomic_readandclear_32(&sc->sc_uart->sc_ttypend); - if (!(pend & SER_INT_MASK)) - return; - - if (pend & SER_INT_RXREADY) { - if (KBD_IS_ACTIVE(&sc->sc_kbd) && KBD_IS_BUSY(&sc->sc_kbd)) { - sc->sc_kbd.kb_callback.kc_func(&sc->sc_kbd, - KBDIO_KEYINPUT, sc->sc_kbd.kb_callback.kc_arg); - } - } -} - -static int -sunkbd_probe(int unit, void *arg, int flags) -{ - - TODO; - return (0); -} - -static int -sunkbd_init(int unit, keyboard_t **kbdp, void *arg, int flags) -{ - - TODO; - return (0); -} - -static int -sunkbd_term(keyboard_t *kbd) -{ - - TODO; - return (0); -} - -static int -sunkbd_intr(keyboard_t *kbd, void *arg) -{ - - TODO; - return (0); -} - -static int -sunkbd_test_if(keyboard_t *kbd) -{ - - TODO; - return (0); -} - -static int -sunkbd_enable(keyboard_t *kbd) -{ - - KBD_ACTIVATE(kbd); - return (0); -} - -static int -sunkbd_disable(keyboard_t *kbd) -{ - - KBD_DEACTIVATE(kbd); - return (0); -} - -static int -sunkbd_read(keyboard_t *kbd, int wait) -{ - - TODO; - return (0); -} - -static int -sunkbd_check(keyboard_t *kbd) -{ - struct sunkbd_softc *sc; - - if (!KBD_IS_ACTIVE(kbd)) - return (FALSE); - - sc = (struct sunkbd_softc *)kbd; - -#if defined(SUNKBD_EMULATE_ATKBD) - if (sc->sc_buffered_char[0]) - return (TRUE); -#endif - - if (sc->sc_repeating) - return (TRUE); - - if (sc->sc_uart != NULL && !uart_rx_empty(sc->sc_uart)) - return (TRUE); - - if (sc->sc_polling != 0 && sc->sc_sysdev != NULL && - uart_rxready(sc->sc_sysdev)) - return (TRUE); - - return (FALSE); -} - -static u_int -sunkbd_read_char(keyboard_t *kbd, int wait) -{ - struct sunkbd_softc *sc; - int key, release, repeated, suncode; - - sc = (struct sunkbd_softc *)kbd; - -#if defined(SUNKBD_EMULATE_ATKBD) - if (sc->sc_mode == K_RAW && sc->sc_buffered_char[0]) { - key = sc->sc_buffered_char[0]; - if (key & SCAN_PREFIX) { - sc->sc_buffered_char[0] = key & ~SCAN_PREFIX; - return ((key & SCAN_PREFIX_E0) ? 0xe0 : 0xe1); - } else { - sc->sc_buffered_char[0] = sc->sc_buffered_char[1]; - sc->sc_buffered_char[1] = 0; - return (key); - } - } -#endif - - repeated = 0; - if (sc->sc_repeating) { - repeated = 1; - sc->sc_repeating = 0; - callout_reset(&sc->sc_repeat_callout, hz / 10, - sunkbd_repeat, sc); - suncode = sc->sc_repeat_key; - goto process_code; - } - - for (;;) { - next_code: - if (!(sc->sc_flags & KPCOMPOSE) && (sc->sc_composed_char > 0)) { - key = sc->sc_composed_char; - sc->sc_composed_char = 0; - if (key > UCHAR_MAX) - return (ERRKEY); - return (key); - } - - if (sc->sc_uart != NULL && !uart_rx_empty(sc->sc_uart)) { - suncode = uart_rx_get(sc->sc_uart); - } else if (sc->sc_polling != 0 && sc->sc_sysdev != NULL) { - if (wait) - suncode = uart_getc(sc->sc_sysdev); - else if ((suncode = uart_poll(sc->sc_sysdev)) == -1) - return (NOKEY); - } else { - return (NOKEY); - } - - switch (suncode) { - case SKBD_RSP_IDLE: - break; - default: - process_code: - ++kbd->kb_count; - key = SKBD_KEY_CHAR(suncode); - release = suncode & SKBD_KEY_RELEASE; - if (!repeated) { - if (release == 0) { - callout_reset(&sc->sc_repeat_callout, - hz / 2, sunkbd_repeat, sc); - sc->sc_repeat_key = suncode; - } else if (sc->sc_repeat_key == key) { - callout_stop(&sc->sc_repeat_callout); - sc->sc_repeat_key = -1; - } - } - -#if defined(SUNKBD_EMULATE_ATKBD) - key = sunkbd_trtab[key]; - if (key == NOTR) - return (NOKEY); - - if (!repeated) { - switch (key) { - case 0x1d: /* ctrl */ - if (release != 0) - sc->sc_flags &= ~CTLS; - else - sc->sc_flags |= CTLS; - break; - case 0x2a: /* left shift */ - case 0x36: /* right shift */ - if (release != 0) - sc->sc_flags &= ~SHIFTS; - else - sc->sc_flags |= SHIFTS; - break; - case 0x38: /* alt */ - case 0x5d: /* altgr */ - if (release != 0) - sc->sc_flags &= ~ALTS; - else - sc->sc_flags |= ALTS; - break; - } - } - if (sc->sc_mode == K_RAW) { - key = keycode2scancode(key, sc->sc_flags, - release); - if (key & SCAN_PREFIX) { - if (key & SCAN_PREFIX_CTL) { - sc->sc_buffered_char[0] = - 0x1d | (key & SCAN_RELEASE); - sc->sc_buffered_char[1] = - key & ~SCAN_PREFIX; - } else if (key & SCAN_PREFIX_SHIFT) { - sc->sc_buffered_char[0] = - 0x2a | (key & SCAN_RELEASE); - sc->sc_buffered_char[1] = - key & ~SCAN_PREFIX_SHIFT; - } else { - sc->sc_buffered_char[0] = - key & ~SCAN_PREFIX; - sc->sc_buffered_char[1] = 0; - } - return ((key & SCAN_PREFIX_E0) ? - 0xe0 : 0xe1); - } - return (key); - } - switch (key) { - case 0x5c: /* print screen */ - if (sc->sc_flags & ALTS) - key = 0x54; /* sysrq */ - break; - case 0x68: /* pause/break */ - if (sc->sc_flags & CTLS) - key = 0x6c; /* break */ - break; - } - - if (sc->sc_mode == K_CODE) - return (key | release); -#else - if (sc->sc_mode == K_RAW || sc->sc_mode == K_CODE) - return (suncode); -#endif - -#if defined(SUNKBD_EMULATE_ATKBD) - if (key == 0x38) { /* left alt (KP compose key) */ -#else - if (key == 0x13) { /* left alt (KP compose key) */ -#endif - if (release != 0) { - if (sc->sc_flags & KPCOMPOSE) { - sc->sc_flags &= ~KPCOMPOSE; - if (sc->sc_composed_char > - UCHAR_MAX) - sc->sc_composed_char = - 0; - } - } else { - if (!(sc->sc_flags & KPCOMPOSE)) { - sc->sc_flags |= KPCOMPOSE; - sc->sc_composed_char = 0; - } - } - } - if (sc->sc_flags & KPCOMPOSE) { - switch (suncode) { - case 0x44: /* KP 7 */ - case 0x45: /* KP 8 */ - case 0x46: /* KP 9 */ - sc->sc_composed_char *= 10; - sc->sc_composed_char += suncode - 0x3d; - if (sc->sc_composed_char > UCHAR_MAX) - return (ERRKEY); - goto next_code; - case 0x5b: /* KP 4 */ - case 0x5c: /* KP 5 */ - case 0x5d: /* KP 6 */ - sc->sc_composed_char *= 10; - sc->sc_composed_char += suncode - 0x58; - if (sc->sc_composed_char > UCHAR_MAX) - return (ERRKEY); - goto next_code; - case 0x70: /* KP 1 */ - case 0x71: /* KP 2 */ - case 0x72: /* KP 3 */ - sc->sc_composed_char *= 10; - sc->sc_composed_char += suncode - 0x6f; - if (sc->sc_composed_char > UCHAR_MAX) - return (ERRKEY); - goto next_code; - case 0x5e: /* KP 0 */ - sc->sc_composed_char *= 10; - if (sc->sc_composed_char > UCHAR_MAX) - return (ERRKEY); - goto next_code; - - case 0x44 | SKBD_KEY_RELEASE: /* KP 7 */ - case 0x45 | SKBD_KEY_RELEASE: /* KP 8 */ - case 0x46 | SKBD_KEY_RELEASE: /* KP 9 */ - case 0x5b | SKBD_KEY_RELEASE: /* KP 4 */ - case 0x5c | SKBD_KEY_RELEASE: /* KP 5 */ - case 0x5d | SKBD_KEY_RELEASE: /* KP 6 */ - case 0x70 | SKBD_KEY_RELEASE: /* KP 1 */ - case 0x71 | SKBD_KEY_RELEASE: /* KP 2 */ - case 0x72 | SKBD_KEY_RELEASE: /* KP 3 */ - case 0x5e | SKBD_KEY_RELEASE: /* KP 0 */ - goto next_code; - default: - if (sc->sc_composed_char > 0) { - sc->sc_flags &= ~KPCOMPOSE; - sc->sc_composed_char = 0; - return (ERRKEY); - } - } - } - - key = genkbd_keyaction(kbd, key, release, - &sc->sc_state, &sc->sc_accents); - if (key != NOKEY || repeated) - return (key); - } - } - return (0); -} - -static int -sunkbd_check_char(keyboard_t *kbd) -{ - struct sunkbd_softc *sc; - - if (!KBD_IS_ACTIVE(kbd)) - return (FALSE); - - sc = (struct sunkbd_softc *)kbd; - if (!(sc->sc_flags & KPCOMPOSE) && (sc->sc_composed_char > 0)) - return (TRUE); - - return (sunkbd_check(kbd)); -} - -static int -sunkbd_ioctl(keyboard_t *kbd, u_long cmd, caddr_t data) -{ - struct sunkbd_softc *sc; - int c, error; -#if defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD5) - int ival; -#endif - - sc = (struct sunkbd_softc *)kbd; - error = 0; - switch (cmd) { - case KDGKBMODE: - *(int *)data = sc->sc_mode; - break; -#if defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD5) - case _IO('K', 7): - ival = IOCPARM_IVAL(data); - data = (caddr_t)&ival; - /* FALLTHROUGH */ -#endif - case KDSKBMODE: - switch (*(int *)data) { - case K_XLATE: - if (sc->sc_mode != K_XLATE) { - /* make lock key state and LED state match */ - sc->sc_state &= ~LOCK_MASK; - sc->sc_state |= KBD_LED_VAL(kbd); - } - /* FALLTHROUGH */ - case K_RAW: - case K_CODE: - if (sc->sc_mode != *(int *)data) { - sunkbd_clear_state(kbd); - sc->sc_mode = *(int *)data; - } - break; - default: - error = EINVAL; - break; - } - break; - case KDGETLED: - *(int *)data = KBD_LED_VAL(kbd); - break; -#if defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD5) - case _IO('K', 66): - ival = IOCPARM_IVAL(data); - data = (caddr_t)&ival; - /* FALLTHROUGH */ -#endif - case KDSETLED: - if (*(int *)data & ~LOCK_MASK) { - error = EINVAL; - break; - } - if (sc->sc_sysdev == NULL) - break; - c = 0; - if (*(int *)data & CLKED) - c |= SKBD_LED_CAPSLOCK; - if (*(int *)data & NLKED) - c |= SKBD_LED_NUMLOCK; - if (*(int *)data & SLKED) - c |= SKBD_LED_SCROLLLOCK; - uart_lock(sc->sc_sysdev->hwmtx); - sc->sc_sysdev->ops->putc(&sc->sc_sysdev->bas, SKBD_CMD_SETLED); - sc->sc_sysdev->ops->putc(&sc->sc_sysdev->bas, c); - uart_unlock(sc->sc_sysdev->hwmtx); - KBD_LED_VAL(kbd) = *(int *)data; - break; - case KDGKBSTATE: - *(int *)data = sc->sc_state & LOCK_MASK; - break; -#if defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD5) - case _IO('K', 20): - ival = IOCPARM_IVAL(data); - data = (caddr_t)&ival; - /* FALLTHROUGH */ -#endif - case KDSKBSTATE: - if (*(int *)data & ~LOCK_MASK) { - error = EINVAL; - break; - } - sc->sc_state &= ~LOCK_MASK; - sc->sc_state |= *(int *)data; - /* set LEDs and quit */ - return (sunkbd_ioctl(kbd, KDSETLED, data)); - case KDSETREPEAT: - case KDSETRAD: - break; - case PIO_KEYMAP: - case OPIO_KEYMAP: - case PIO_KEYMAPENT: - case PIO_DEADKEYMAP: - default: - return (genkbd_commonioctl(kbd, cmd, data)); - } - return (error); -} - -static int -sunkbd_lock(keyboard_t *kbd, int lock) -{ - - TODO; - return (0); -} - -static void -sunkbd_clear_state(keyboard_t *kbd) -{ - struct sunkbd_softc *sc; - - sc = (struct sunkbd_softc *)kbd; - sc->sc_repeat_key = -1; - sc->sc_accents = 0; - sc->sc_composed_char = 0; - sc->sc_flags = 0; - sc->sc_polling = 0; - sc->sc_repeating = 0; - sc->sc_state &= LOCK_MASK; /* Preserve locking key state. */ - -#if defined(SUNKBD_EMULATE_ATKBD) - sc->sc_buffered_char[0] = 0; - sc->sc_buffered_char[1] = 0; -#endif -} - -static int -sunkbd_get_state(keyboard_t *kbd, void *buf, size_t len) -{ - - TODO; - return (0); -} - -static int -sunkbd_set_state(keyboard_t *kbd, void *buf, size_t len) -{ - - TODO; - return (0); -} - -static int -sunkbd_poll_mode(keyboard_t *kbd, int on) -{ - struct sunkbd_softc *sc; - - sc = (struct sunkbd_softc *)kbd; - if (on) - sc->sc_polling++; - else - sc->sc_polling--; - return (0); -} - -static void -sunkbd_diag(keyboard_t *kbd, int level) -{ - - TODO; -} - -static void -sunkbd_repeat(void *v) -{ - struct sunkbd_softc *sc = v; - - if (KBD_IS_ACTIVE(&sc->sc_kbd) && KBD_IS_BUSY(&sc->sc_kbd)) { - if (sc->sc_repeat_key != -1) { - sc->sc_repeating = 1; - sc->sc_kbd.kb_callback.kc_func(&sc->sc_kbd, - KBDIO_KEYINPUT, sc->sc_kbd.kb_callback.kc_arg); - } - } -} - -#if defined(SUNKBD_EMULATE_ATKBD) -static int -keycode2scancode(int keycode, int shift, int up) -{ - static const int scan[] = { - /* KP enter, right ctrl, KP divide */ - 0x1c , 0x1d , 0x35 , - /* print screen */ - 0x37 | SCAN_PREFIX_SHIFT, - /* right alt, home, up, page up, left, right, end */ - 0x38, 0x47, 0x48, 0x49, 0x4b, 0x4d, 0x4f, - /* down, page down, insert, delete */ - 0x50, 0x51, 0x52, 0x53, - /* pause/break (see also below) */ - 0x46, - /* - * MS: left window, right window, menu - * also Sun: left meta, right meta, compose - */ - 0x5b, 0x5c, 0x5d, - /* Sun type 6 USB */ - /* help, stop, again, props, undo, front, copy */ - 0x68, 0x5e, 0x5f, 0x60, 0x61, 0x62, 0x63, - /* open, paste, find, cut, audiomute, audiolower, audioraise */ - 0x64, 0x65, 0x66, 0x67, 0x25, 0x1f, 0x1e, - /* power */ - 0x20 - }; - int scancode; - - scancode = keycode; - if ((keycode >= 89) && (keycode < 89 + nitems(scan))) - scancode = scan[keycode - 89] | SCAN_PREFIX_E0; - /* pause/break */ - if ((keycode == 104) && !(shift & CTLS)) - scancode = 0x45 | SCAN_PREFIX_E1 | SCAN_PREFIX_CTL; - if (shift & SHIFTS) - scancode &= ~SCAN_PREFIX_SHIFT; - return (scancode | (up ? SCAN_RELEASE : SCAN_PRESS)); -} -#endif diff --git a/sys/dev/uart/uart_kbd_sun.h b/sys/dev/uart/uart_kbd_sun.h deleted file mode 100644 index 05a4597930f9d1..00000000000000 --- a/sys/dev/uart/uart_kbd_sun.h +++ /dev/null @@ -1,70 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-4-Clause - * - * Copyright (c) 2002 Jason L. Wright (jason@thought.net) - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Jason L. Wright - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * Effort sponsored in part by the Defense Advanced Research Projects - * Agency (DARPA) and Air Force Research Laboratory, Air Force - * Materiel Command, USAF, under agreement number F30602-01-2-0537. - * - * $FreeBSD$ - */ - -/* keyboard commands (host->kbd) */ -#define SKBD_CMD_RESET 0x01 -#define SKBD_CMD_BELLON 0x02 -#define SKBD_CMD_BELLOFF 0x03 -#define SKBD_CMD_CLICKON 0x0a -#define SKBD_CMD_CLICKOFF 0x0b -#define SKBD_CMD_SETLED 0x0e -#define SKBD_CMD_LAYOUT 0x0f - -/* keyboard responses (kbd->host) */ -#define SKBD_RSP_RESET_OK 0x04 /* normal reset status for type 4/5/6 */ -#define SKBD_RSP_IDLE 0x7f /* no keys down */ -#define SKBD_RSP_LAYOUT 0xfe /* layout follows */ -#define SKBD_RSP_RESET 0xff /* reset status follows */ - -#define SKBD_LED_NUMLOCK 0x01 -#define SKBD_LED_COMPOSE 0x02 -#define SKBD_LED_SCROLLLOCK 0x04 -#define SKBD_LED_CAPSLOCK 0x08 - -#define SKBD_STATE_RESET 0 -#define SKBD_STATE_LAYOUT 1 -#define SKBD_STATE_GETKEY 2 - -/* keyboard types */ -#define KB_SUN2 2 /* type 2 keyboard */ -#define KB_SUN3 3 /* type 3 keyboard */ -#define KB_SUN4 4 /* type 4/5/6 keyboard */ - -#define SKBD_KEY_RELEASE 0x80 -#define SKBD_KEY_CHAR(c) ((c) & 0x7f) diff --git a/sys/dev/uart/uart_kbd_sun_tables.h b/sys/dev/uart/uart_kbd_sun_tables.h deleted file mode 100644 index e7dc6120510433..00000000000000 --- a/sys/dev/uart/uart_kbd_sun_tables.h +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Automatically generated from sun.us.unix.kbd. - * DO NOT EDIT! - * - * $FreeBSD$ - */ -static keymap_t keymap_sun_us_unix_kbd = { 0x80, { -/* alt - * scan cntrl alt alt cntrl - * code base shift cntrl shift alt shift cntrl shift spcl flgs - * --------------------------------------------------------------------------- - */ -/*00*/{{ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, }, 0xFF,0x00 }, -/*01*/{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }, 0x00,0x00 }, -/*02*/{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }, 0x00,0x00 }, -/*03*/{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }, 0x00,0x00 }, -/*04*/{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }, 0x00,0x00 }, -/*05*/{{ F( 1), F(13), F(25), F(37), S( 1), S(11), S( 1), S(11),}, 0xFF,0x00 }, -/*06*/{{ F( 2), F(14), F(26), F(38), S( 2), S(12), S( 2), S(12),}, 0xFF,0x00 }, -/*07*/{{ F(10), F(22), F(34), F(46), S(10), S(10), S(10), S(10),}, 0xFF,0x00 }, -/*08*/{{ F( 3), F(15), F(27), F(39), S( 3), S(13), S( 3), S(13),}, 0xFF,0x00 }, -/*09*/{{ F(11), F(23), F(35), F(47), S(11), S(11), S(11), S(11),}, 0xFF,0x00 }, -/*0a*/{{ F( 4), F(16), F(28), F(40), S( 4), S(14), S( 4), S(14),}, 0xFF,0x00 }, -/*0b*/{{ F(12), F(24), F(36), F(48), S(12), S(12), S(12), S(12),}, 0xFF,0x00 }, -/*0c*/{{ F( 5), F(17), F(29), F(41), S( 5), S(15), S( 5), S(15),}, 0xFF,0x00 }, -/*0d*/{{ RALT, RALT, RALT, RALT, RALT, RALT, RALT, RALT, }, 0xFF,0x00 }, -/*0e*/{{ F( 6), F(18), F(30), F(42), S( 6), S(16), S( 6), S(16),}, 0xFF,0x00 }, -/*0f*/{{ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, }, 0xFF,0x00 }, -/*10*/{{ F( 7), F(19), F(31), F(43), S( 7), S( 7), S( 7), S( 7),}, 0xFF,0x00 }, -/*11*/{{ F( 8), F(20), F(32), F(44), S( 8), S( 8), S( 8), S( 8),}, 0xFF,0x00 }, -/*12*/{{ F( 9), F(21), F(33), F(45), S( 9), S( 9), S( 9), S( 9),}, 0xFF,0x00 }, -/*13*/{{ LALT, LALT, LALT, LALT, LALT, LALT, LALT, LALT, }, 0xFF,0x00 }, -/*14*/{{ F(50), F(50), F(50), F(50), F(50), F(50), F(50), F(50),}, 0xFF,0x00 }, -/*15*/{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }, 0x00,0x00 }, -/*16*/{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }, 0x00,0x00 }, -/*17*/{{ SLK, SPSC, SLK, SPSC, SUSP, NOP, SUSP, NOP, }, 0xFF,0x00 }, -/*18*/{{ F(53), F(53), F(53), F(53), F(53), F(53), F(53), F(53),}, 0xFF,0x00 }, -/*19*/{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }, 0x00,0x00 }, -/*1a*/{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }, 0x00,0x00 }, -/*1b*/{{ F(58), F(58), F(58), F(58), F(58), F(58), F(58), F(58),}, 0xFF,0x00 }, -/*1c*/{{ F(55), F(55), F(55), F(55), F(55), F(55), F(55), F(55),}, 0xFF,0x00 }, -/*1d*/{{ 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, DBG, 0x1B, }, 0x02,0x00 }, -/*1e*/{{ '1', '!', NOP, NOP, '1', '!', NOP, NOP, }, 0x33,0x00 }, -/*1f*/{{ '2', '@', 0x00, 0x00, '2', '@', 0x00, 0x00, }, 0x00,0x00 }, -/*20*/{{ '3', '#', NOP, NOP, '3', '#', NOP, NOP, }, 0x33,0x00 }, -/*21*/{{ '4', '$', NOP, NOP, '4', '$', NOP, NOP, }, 0x33,0x00 }, -/*22*/{{ '5', '%', NOP, NOP, '5', '%', NOP, NOP, }, 0x33,0x00 }, -/*23*/{{ '6', '^', 0x1E, 0x1E, '6', '^', 0x1E, 0x1E, }, 0x00,0x00 }, -/*24*/{{ '7', '&', NOP, NOP, '7', '&', NOP, NOP, }, 0x33,0x00 }, -/*25*/{{ '8', '*', NOP, NOP, '8', '*', NOP, NOP, }, 0x33,0x00 }, -/*26*/{{ '9', '(', NOP, NOP, '9', '(', NOP, NOP, }, 0x33,0x00 }, -/*27*/{{ '0', ')', NOP, NOP, '0', ')', NOP, NOP, }, 0x33,0x00 }, -/*28*/{{ '-', '_', 0x1F, 0x1F, '-', '_', 0x1F, 0x1F, }, 0x00,0x00 }, -/*29*/{{ '=', '+', NOP, NOP, '=', '+', NOP, NOP, }, 0x33,0x00 }, -/*2a*/{{ '`', '~', NOP, NOP, '`', '~', DBG, NOP, }, 0x33,0x00 }, -/*2b*/{{ 0x7F, 0x7F, 0x08, 0x08, 0x7F, 0x7F, 0x08, 0x08, }, 0x00,0x00 }, -/*2c*/{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }, 0x00,0x00 }, -/*2d*/{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }, 0x00,0x00 }, -/*2e*/{{ '/', '/', '/', '/', '/', '/', '/', '/', }, 0x00,0x02 }, -/*2f*/{{ '*', '*', '*', '*', '*', '*', '*', '*', }, 0x00,0x00 }, -/*30*/{{ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, }, 0xFF,0x00 }, -/*31*/{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }, 0x00,0x00 }, -/*32*/{{ 0x08, '.', '.', '.', '.', '.', RBT, RBT, }, 0x03,0x02 }, -/*33*/{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }, 0x00,0x00 }, -/*34*/{{ F(49), F(49), F(49), F(49), F(49), F(49), F(49), F(49),}, 0xFF,0x00 }, -/*35*/{{ 0x09, BTAB, NOP, NOP, 0x09, BTAB, NOP, NOP, }, 0x77,0x00 }, -/*36*/{{ 'q', 'Q', 0x11, 0x11, 'q', 'Q', 0x11, 0x11, }, 0x00,0x01 }, -/*37*/{{ 'w', 'W', 0x17, 0x17, 'w', 'W', 0x17, 0x17, }, 0x00,0x01 }, -/*38*/{{ 'e', 'E', 0x05, 0x05, 'e', 'E', 0x05, 0x05, }, 0x00,0x01 }, -/*39*/{{ 'r', 'R', 0x12, 0x12, 'r', 'R', 0x12, 0x12, }, 0x00,0x01 }, -/*3a*/{{ 't', 'T', 0x14, 0x14, 't', 'T', 0x14, 0x14, }, 0x00,0x01 }, -/*3b*/{{ 'y', 'Y', 0x19, 0x19, 'y', 'Y', 0x19, 0x19, }, 0x00,0x01 }, -/*3c*/{{ 'u', 'U', 0x15, 0x15, 'u', 'U', 0x15, 0x15, }, 0x00,0x01 }, -/*3d*/{{ 'i', 'I', 0x09, 0x09, 'i', 'I', 0x09, 0x09, }, 0x00,0x01 }, -/*3e*/{{ 'o', 'O', 0x0F, 0x0F, 'o', 'O', 0x0F, 0x0F, }, 0x00,0x01 }, -/*3f*/{{ 'p', 'P', 0x10, 0x10, 'p', 'P', 0x10, 0x10, }, 0x00,0x01 }, -/*40*/{{ '[', '{', 0x1B, 0x1B, '[', '{', 0x1B, 0x1B, }, 0x00,0x00 }, -/*41*/{{ ']', '}', 0x1D, 0x1D, ']', '}', 0x1D, 0x1D, }, 0x00,0x00 }, -/*42*/{{ 0x7F, 0x7F, 0x08, 0x08, 0x7F, 0x7F, 0x08, 0x08, }, 0x00,0x00 }, -/*43*/{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }, 0x00,0x00 }, -/*44*/{{ F(49), '7', '7', '7', '7', '7', '7', '7', }, 0x80,0x02 }, -/*45*/{{ F(50), '8', '8', '8', '8', '8', '8', '8', }, 0x80,0x02 }, -/*46*/{{ F(51), '9', '9', '9', '9', '9', '9', '9', }, 0x80,0x02 }, -/*47*/{{ F(52), '-', '-', '-', '-', '-', '-', '-', }, 0x80,0x02 }, -/*48*/{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }, 0x00,0x00 }, -/*49*/{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }, 0x00,0x00 }, -/*4a*/{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }, 0x00,0x00 }, -/*4b*/{{ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, }, 0xFF,0x00 }, -/*4c*/{{ LCTR, LCTR, LCTR, LCTR, LCTR, LCTR, LCTR, LCTR, }, 0xFF,0x00 }, -/*4d*/{{ 'a', 'A', 0x01, 0x01, 'a', 'A', 0x01, 0x01, }, 0x00,0x01 }, -/*4e*/{{ 's', 'S', 0x13, 0x13, 's', 'S', 0x13, 0x13, }, 0x00,0x01 }, -/*4f*/{{ 'd', 'D', 0x04, 0x04, 'd', 'D', 0x04, 0x04, }, 0x00,0x01 }, -/*50*/{{ 'f', 'F', 0x06, 0x06, 'f', 'F', 0x06, 0x06, }, 0x00,0x01 }, -/*51*/{{ 'g', 'G', 0x07, 0x07, 'g', 'G', 0x07, 0x07, }, 0x00,0x01 }, -/*52*/{{ 'h', 'H', 0x08, 0x08, 'h', 'H', 0x08, 0x08, }, 0x00,0x01 }, -/*53*/{{ 'j', 'J', 0x0A, 0x0A, 'j', 'J', 0x0A, 0x0A, }, 0x00,0x01 }, -/*54*/{{ 'k', 'K', 0x0B, 0x0B, 'k', 'K', 0x0B, 0x0B, }, 0x00,0x01 }, -/*55*/{{ 'l', 'L', 0x0C, 0x0C, 'l', 'L', 0x0C, 0x0C, }, 0x00,0x01 }, -/*56*/{{ ';', ':', NOP, NOP, ';', ':', NOP, NOP, }, 0x33,0x00 }, -/*57*/{{ '\'', '"', NOP, NOP, '\'', '"', NOP, NOP, }, 0x33,0x00 }, -/*58*/{{ '\\', '|', 0x1C, 0x1C, '\\', '|', 0x1C, 0x1C, }, 0x00,0x00 }, -/*59*/{{ 0x0D, 0x0D, 0x0A, 0x0A, 0x0D, 0x0D, 0x0A, 0x0A, }, 0x00,0x00 }, -/*5a*/{{ 0x0D, 0x0D, 0x0A, 0x0A, 0x0D, 0x0D, 0x0A, 0x0A, }, 0x00,0x00 }, -/*5b*/{{ F(53), '4', '4', '4', '4', '4', '4', '4', }, 0x80,0x02 }, -/*5c*/{{ F(54), '5', '5', '5', '5', '5', '5', '5', }, 0x80,0x02 }, -/*5d*/{{ F(55), '6', '6', '6', '6', '6', '6', '6', }, 0x80,0x02 }, -/*5e*/{{ F(60), '0', '0', '0', '0', '0', '0', '0', }, 0x80,0x02 }, -/*5f*/{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }, 0x00,0x00 }, -/*60*/{{ F(51), F(51), F(51), F(51), F(51), F(51), F(51), F(51),}, 0xFF,0x00 }, -/*61*/{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }, 0x00,0x00 }, -/*62*/{{ NLK, NLK, NLK, NLK, NLK, NLK, NLK, NLK, }, 0xFF,0x00 }, -/*63*/{{ LSH, LSH, LSH, LSH, LSH, LSH, LSH, LSH, }, 0xFF,0x00 }, -/*64*/{{ 'z', 'Z', 0x1A, 0x1A, 'z', 'Z', 0x1A, 0x1A, }, 0x00,0x01 }, -/*65*/{{ 'x', 'X', 0x18, 0x18, 'x', 'X', 0x18, 0x18, }, 0x00,0x01 }, -/*66*/{{ 'c', 'C', 0x03, 0x03, 'c', 'C', 0x03, 0x03, }, 0x00,0x01 }, -/*67*/{{ 'v', 'V', 0x16, 0x16, 'v', 'V', 0x16, 0x16, }, 0x00,0x01 }, -/*68*/{{ 'b', 'B', 0x02, 0x02, 'b', 'B', 0x02, 0x02, }, 0x00,0x01 }, -/*69*/{{ 'n', 'N', 0x0E, 0x0E, 'n', 'N', 0x0E, 0x0E, }, 0x00,0x01 }, -/*6a*/{{ 'm', 'M', 0x0D, 0x0D, 'm', 'M', 0x0D, 0x0D, }, 0x00,0x01 }, -/*6b*/{{ ',', '<', NOP, NOP, ',', '<', NOP, NOP, }, 0x33,0x00 }, -/*6c*/{{ '.', '>', NOP, NOP, '.', '>', NOP, NOP, }, 0x33,0x00 }, -/*6d*/{{ '/', '?', NOP, NOP, '/', '?', NOP, NOP, }, 0x33,0x00 }, -/*6e*/{{ RSH, RSH, RSH, RSH, RSH, RSH, RSH, RSH, }, 0xFF,0x00 }, -/*6f*/{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }, 0x00,0x00 }, -/*70*/{{ F(57), '1', '1', '1', '1', '1', '1', '1', }, 0x80,0x02 }, -/*71*/{{ F(58), '2', '2', '2', '2', '2', '2', '2', }, 0x80,0x02 }, -/*72*/{{ F(59), '3', '3', '3', '3', '3', '3', '3', }, 0x80,0x02 }, -/*73*/{{ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, }, 0xFF,0x00 }, -/*74*/{{ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, }, 0xFF,0x00 }, -/*75*/{{ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, }, 0xFF,0x00 }, -/*76*/{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }, 0x00,0x00 }, -/*77*/{{ CLK, CLK, CLK, CLK, CLK, CLK, CLK, CLK, }, 0xFF,0x00 }, -/*78*/{{ META, META, META, META, META, META, META, META, }, 0xFF,0x00 }, -/*79*/{{ ' ', ' ', 0x00, ' ', ' ', ' ', SUSP, ' ', }, 0x02,0x00 }, -/*7a*/{{ META, META, META, META, META, META, META, META, }, 0xFF,0x00 }, -/*7b*/{{ F(59), F(59), F(59), F(59), F(59), F(59), F(59), F(59),}, 0xFF,0x00 }, -/*7c*/{{ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, }, 0xFF,0x00 }, -/*7d*/{{ F(56), '+', '+', '+', '+', '+', '+', '+', }, 0x80,0x02 }, -/*7e*/{{ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, }, 0xFF,0x00 }, -/*7f*/{{ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, }, 0xFF,0x00 }, -} }; - -static accentmap_t accentmap_sun_us_unix_kbd = { 0 }; - diff --git a/sys/dev/vt/hw/fb/vt_early_fb.c b/sys/dev/vt/hw/fb/vt_early_fb.c index e538ace2c052cb..12db4368d9198b 100644 --- a/sys/dev/vt/hw/fb/vt_early_fb.c +++ b/sys/dev/vt/hw/fb/vt_early_fb.c @@ -233,10 +233,6 @@ vt_efb_init(struct vt_device *vd) sc->sc_memt = &bs_be_tag; bus_space_map(sc->sc_memt, info->fb_pbase, info->fb_size, BUS_SPACE_MAP_PREFETCHABLE, &info->fb_vbase); - #elif defined(__sparc64__) - OF_decode_addr(node, 0, &space, &phys); - sc->sc_memt = &vt_efb_memt[0]; - info->addr = sparc64_fake_bustag(space, fb_phys, sc->sc_memt); #else bus_space_map(fdtbus_bs_tag, info->fb_pbase, info->fb_size, BUS_SPACE_MAP_PREFETCHABLE, @@ -274,11 +270,6 @@ vt_efb_init(struct vt_device *vd) #if defined(__powerpc__) OF_decode_addr(node, info->fb_pbase, &sc->sc_memt, &info->fb_vbase); - #elif defined(__sparc64__) - OF_decode_addr(node, info->fb_pbase, &space, &info->fb_pbase); - sc->sc_memt = &vt_efb_memt[0]; - info->fb_vbase = sparc64_fake_bustag(space, info->fb_pbase, - sc->sc_memt); #else bus_space_map(fdtbus_bs_tag, info->fb_pbase, info->fb_size, BUS_SPACE_MAP_PREFETCHABLE, diff --git a/sys/dev/vt/hw/ofwfb/ofwfb.c b/sys/dev/vt/hw/ofwfb/ofwfb.c index 77e1ac68731475..24c907ad9063ce 100644 --- a/sys/dev/vt/hw/ofwfb/ofwfb.c +++ b/sys/dev/vt/hw/ofwfb/ofwfb.c @@ -1,4 +1,4 @@ -/*- +e/*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2011 Nathan Whitehorn @@ -42,9 +42,6 @@ __FBSDID("$FreeBSD$"); #include #include -#ifdef __sparc64__ -#include -#endif #include #include @@ -366,11 +363,6 @@ ofwfb_init(struct vt_device *vd) uint32_t depth, height, width, stride; uint32_t fb_phys; int i, len; -#ifdef __sparc64__ - static struct bus_space_tag ofwfb_memt[1]; - bus_addr_t phys; - int space; -#endif /* Initialize softc */ vd->vd_softc = sc = &ofwfb_conssoftc; @@ -445,11 +437,6 @@ ofwfb_init(struct vt_device *vd) sc->sc_memt = &bs_be_tag; bus_space_map(sc->sc_memt, fb_phys, sc->fb.fb_size, BUS_SPACE_MAP_PREFETCHABLE, &sc->fb.fb_vbase); - #elif defined(__sparc64__) - OF_decode_addr(node, 0, &space, &phys); - sc->sc_memt = &ofwfb_memt[0]; - sc->fb.fb_vbase = - sparc64_fake_bustag(space, fb_phys, sc->sc_memt); #elif defined(__arm__) sc->sc_memt = fdtbus_bs_tag; bus_space_map(sc->sc_memt, sc->fb.fb_pbase, sc->fb.fb_size, diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c index 54584a10cddfcc..d3adc9604ab4d7 100644 --- a/sys/kern/kern_exit.c +++ b/sys/kern/kern_exit.c @@ -217,6 +217,7 @@ exit1(struct thread *td, int rval, int signo) * XXX in case we're rebooting we just let init die in order to * work around an unsolved stack overflow seen very late during * shutdown on sparc64 when the gmirror worker process exists. + * XXX what to do now that sparc64 is gone... remove if? */ if (p == initproc && rebooting == 0) { printf("init died (signal %d, exit %d)\n", signo, rval); diff --git a/sys/kern/kern_malloc.c b/sys/kern/kern_malloc.c index cf98ca8c2ff7dd..3ecac176ac02f3 100644 --- a/sys/kern/kern_malloc.c +++ b/sys/kern/kern_malloc.c @@ -930,9 +930,7 @@ reallocf(void *addr, size_t size, struct malloc_type *mtp, int flags) return (mem); } -#ifndef __sparc64__ CTASSERT(VM_KMEM_SIZE_SCALE >= 1); -#endif /* * Initialize the kernel memory (kmem) arena. diff --git a/sys/kern/subr_param.c b/sys/kern/subr_param.c index 92d1066da38308..61119dd2f34c3a 100644 --- a/sys/kern/subr_param.c +++ b/sys/kern/subr_param.c @@ -166,7 +166,7 @@ void init_param1(void) { -#if !defined(__mips__) && !defined(__arm64__) && !defined(__sparc64__) +#if !defined(__mips__) && !defined(__arm64__) TUNABLE_INT_FETCH("kern.kstack_pages", &kstack_pages); #endif hz = -1; diff --git a/sys/kern/subr_uio.c b/sys/kern/subr_uio.c index 5d98e8fbc69faa..04c5fb1624054c 100644 --- a/sys/kern/subr_uio.c +++ b/sys/kern/subr_uio.c @@ -501,77 +501,6 @@ copyout_unmap(struct thread *td, vm_offset_t addr, size_t sz) return (0); } -#ifdef NO_FUEWORD -/* - * XXXKIB The temporal implementation of fue*() functions which do not - * handle usermode -1 properly, mixing it with the fault code. Keep - * this until MD code is written. Currently sparc64 does not have a - * proper implementation. - */ - -int -fueword(volatile const void *base, long *val) -{ - long res; - - res = fuword(base); - if (res == -1) - return (-1); - *val = res; - return (0); -} - -int -fueword32(volatile const void *base, int32_t *val) -{ - int32_t res; - - res = fuword32(base); - if (res == -1) - return (-1); - *val = res; - return (0); -} - -#ifdef _LP64 -int -fueword64(volatile const void *base, int64_t *val) -{ - int64_t res; - - res = fuword64(base); - if (res == -1) - return (-1); - *val = res; - return (0); -} -#endif - -int -casueword32(volatile uint32_t *base, uint32_t oldval, uint32_t *oldvalp, - uint32_t newval) -{ - int32_t ov; - - ov = casuword32(base, oldval, newval); - if (ov == -1) - return (-1); - *oldvalp = ov; - return (0); -} - -int -casueword(volatile u_long *p, u_long oldval, u_long *oldvalp, u_long newval) -{ - u_long ov; - - ov = casuword(p, oldval, newval); - if (ov == -1) - return (-1); - *oldvalp = ov; - return (0); -} -#else /* NO_FUEWORD */ int32_t fuword32(volatile const void *addr) { @@ -623,5 +552,3 @@ casuword(volatile u_long *addr, u_long old, u_long new) rv = casueword(addr, old, &val, new); return (rv == -1 ? -1 : val); } - -#endif /* NO_FUEWORD */ diff --git a/sys/kern/subr_witness.c b/sys/kern/subr_witness.c index bf87e908ed8ff7..f48095fc22eac8 100644 --- a/sys/kern/subr_witness.c +++ b/sys/kern/subr_witness.c @@ -656,10 +656,6 @@ static struct witness_order_list_entry order_lists[] = { { "sio", &lock_class_mtx_spin }, #ifdef __i386__ { "cy", &lock_class_mtx_spin }, -#endif -#ifdef __sparc64__ - { "pcib_mtx", &lock_class_mtx_spin }, - { "rtc_mtx", &lock_class_mtx_spin }, #endif { "scc_hwmtx", &lock_class_mtx_spin }, { "uart_hwmtx", &lock_class_mtx_spin }, @@ -692,9 +688,6 @@ static struct witness_order_list_entry order_lists[] = { */ { "intrcnt", &lock_class_mtx_spin }, { "icu", &lock_class_mtx_spin }, -#if defined(SMP) && defined(__sparc64__) - { "ipi", &lock_class_mtx_spin }, -#endif #ifdef __i386__ { "allpmaps", &lock_class_mtx_spin }, { "descriptor tables", &lock_class_mtx_spin }, diff --git a/sys/modules/Makefile b/sys/modules/Makefile index 952255b32fde94..6055587fa0c683 100644 --- a/sys/modules/Makefile +++ b/sys/modules/Makefile @@ -57,7 +57,6 @@ SUBDIR= \ ath_rate \ ath_pci \ ${_autofs} \ - ${_auxio} \ ${_bce} \ ${_bcm283x_clkman} \ ${_bcm283x_pwm} \ @@ -110,7 +109,6 @@ SUBDIR= \ ${_efirt} \ ${_em} \ ${_ena} \ - ${_epic} \ esp \ ${_et} \ evdev \ @@ -397,8 +395,7 @@ _autofs= autofs .if ${MK_CDDL} != "no" || defined(ALL_MODULES) .if (${MACHINE_CPUARCH} != "arm" || ${MACHINE_ARCH:Marmv[67]*} != "") && \ - ${MACHINE_CPUARCH} != "mips" && \ - ${MACHINE_CPUARCH} != "sparc64" + ${MACHINE_CPUARCH} != "mips" SUBDIR+= dtrace .endif SUBDIR+= opensolaris @@ -771,12 +768,6 @@ _nvram= opal_nvram _nvram+= powermac_nvram .endif -.if ${MACHINE_CPUARCH} == "sparc64" -_auxio= auxio -_em= em -_epic= epic -.endif - .if (${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "amd64" || \ ${MACHINE_ARCH:Marmv[67]*} != "" || ${MACHINE_CPUARCH} == "i386") _cloudabi32= cloudabi32 diff --git a/sys/modules/auxio/Makefile b/sys/modules/auxio/Makefile deleted file mode 100644 index f46f438accc553..00000000000000 --- a/sys/modules/auxio/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -# $FreeBSD$ - -.PATH: ${SRCTOP}/sys/dev/auxio - -KMOD= auxio - -SRCS= auxio.c -SRCS+= device_if.h bus_if.h ofw_bus_if.h - -.include diff --git a/sys/modules/bge/Makefile b/sys/modules/bge/Makefile index 53e3364f0e3aa3..9a197e8fab3f63 100644 --- a/sys/modules/bge/Makefile +++ b/sys/modules/bge/Makefile @@ -5,8 +5,4 @@ KMOD= if_bge SRCS= if_bge.c miibus_if.h miidevs.h device_if.h bus_if.h pci_if.h -.if ${MACHINE_CPUARCH} == sparc64 -SRCS+= ofw_bus_if.h -.endif - .include diff --git a/sys/modules/cas/Makefile b/sys/modules/cas/Makefile index 2e6fcfb4cb45ae..ef53564f93568c 100644 --- a/sys/modules/cas/Makefile +++ b/sys/modules/cas/Makefile @@ -5,7 +5,7 @@ KMOD= if_cas SRCS= bus_if.h device_if.h if_cas.c miibus_if.h pci_if.h ${ofw_bus_if} -.if ${MACHINE_CPUARCH} == "powerpc" || ${MACHINE_ARCH} == "sparc64" +.if ${MACHINE_CPUARCH} == "powerpc" ofw_bus_if= ofw_bus_if.h .endif diff --git a/sys/modules/epic/Makefile b/sys/modules/epic/Makefile deleted file mode 100644 index b791d340b8443d..00000000000000 --- a/sys/modules/epic/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -# $FreeBSD$ - -.PATH: ${SRCTOP}/sys/sparc64/ebus - -KMOD= epic -SRCS= device_if.h epic.c bus_if.h ofw_bus_if.h - -.include diff --git a/sys/modules/esp/Makefile b/sys/modules/esp/Makefile index d582a2da5dbe1a..1880d385dfb805 100644 --- a/sys/modules/esp/Makefile +++ b/sys/modules/esp/Makefile @@ -6,9 +6,4 @@ KMOD= esp SRCS= device_if.h esp_pci.c ${esp_sbus} bus_if.h ncr53c9x.c ${ofw_bus_if} SRCS+= opt_cam.h pci_if.h -.if ${MACHINE} == "sparc64" -ofw_bus_if= ofw_bus_if.h -esp_sbus= esp_sbus.c -.endif - .include diff --git a/sys/modules/gem/Makefile b/sys/modules/gem/Makefile index 54083b0de6cb19..13c9003dc38cbe 100644 --- a/sys/modules/gem/Makefile +++ b/sys/modules/gem/Makefile @@ -3,14 +3,10 @@ .PATH: ${SRCTOP}/sys/dev/gem KMOD= if_gem -SRCS= bus_if.h device_if.h if_gem.c if_gem_pci.c ${if_gem_sbus} miibus_if.h +SRCS= bus_if.h device_if.h if_gem.c if_gem_pci.c miibus_if.h SRCS+= ${ofw_bus_if} pci_if.h -.if ${MACHINE} == "sparc64" -if_gem_sbus= if_gem_sbus.c -.endif - -.if ${MACHINE_CPUARCH} == "powerpc" || ${MACHINE_CPUARCH} == "sparc64" +.if ${MACHINE_CPUARCH} == "powerpc" ofw_bus_if= ofw_bus_if.h .endif diff --git a/sys/modules/hme/Makefile b/sys/modules/hme/Makefile index 74633717bbd3f1..ab7fd5be64ee18 100644 --- a/sys/modules/hme/Makefile +++ b/sys/modules/hme/Makefile @@ -3,12 +3,7 @@ .PATH: ${SRCTOP}/sys/dev/hme KMOD= if_hme -SRCS= bus_if.h device_if.h if_hme.c if_hme_pci.c ${if_hme_sbus} miibus_if.h -SRCS+= ${ofw_bus_if} pci_if.h - -.if ${MACHINE} == "sparc64" -if_hme_sbus= if_hme_sbus.c -ofw_bus_if= ofw_bus_if.h -.endif +SRCS= bus_if.h device_if.h if_hme.c if_hme_pci.c miibus_if.h +SRCS+= pci_if.h .include diff --git a/sys/modules/hwpmc/Makefile b/sys/modules/hwpmc/Makefile index 23bd648be22902..c4500fb4a174e4 100644 --- a/sys/modules/hwpmc/Makefile +++ b/sys/modules/hwpmc/Makefile @@ -35,8 +35,4 @@ SRCS+= hwpmc_tsc.c hwpmc_x86.c hwpmc_uncore.c SRCS+= hwpmc_powerpc.c hwpmc_e500.c hwpmc_mpc7xxx.c hwpmc_ppc970.c .endif -.if ${MACHINE_CPUARCH} == "sparc64" -SRCS+= hwpmc_sparc64.c -.endif - .include diff --git a/sys/modules/i2c/controllers/pcf/Makefile b/sys/modules/i2c/controllers/pcf/Makefile index 94b4b0c22fc768..f213b0b3168e18 100644 --- a/sys/modules/i2c/controllers/pcf/Makefile +++ b/sys/modules/i2c/controllers/pcf/Makefile @@ -3,18 +3,12 @@ .PATH: ${SRCTOP}/sys/dev/pcf KMOD= pcf -SRCS= ${envctrl} pcf.c ${pcf_ebus} ${pcf_isa} -SRCS+= bus_if.h device_if.h iicbus_if.h ${isa_if} ${ofw_bus_if} +SRCS= pcf.c ${pcf_isa} +SRCS+= bus_if.h device_if.h iicbus_if.h ${isa_if} .if ${MACHINE_CPUARCH} == "i386" isa_if= isa_if.h pcf_isa= pcf_isa.c .endif -.if ${MACHINE_CPUARCH} == "sparc64" -envctrl= envctrl.c -ofw_bus_if= ofw_bus_if.h -pcf_ebus= pcf_ebus.c -.endif - .include diff --git a/sys/modules/isp/Makefile b/sys/modules/isp/Makefile index d59d54036be678..89f612f35b5526 100644 --- a/sys/modules/isp/Makefile +++ b/sys/modules/isp/Makefile @@ -7,8 +7,4 @@ SRCS= bus_if.h device_if.h pci_if.h \ opt_cam.h opt_ddb.h opt_isp.h \ isp.c isp_library.c isp_target.c isp_freebsd.c isp_pci.c -.if ${MACHINE} == sparc64 -SRCS+= isp_sbus.c ofw_bus_if.h -.endif - .include diff --git a/sys/modules/ispfw/Makefile b/sys/modules/ispfw/Makefile index fa61f172d80b99..05de489c3412e4 100644 --- a/sys/modules/ispfw/Makefile +++ b/sys/modules/ispfw/Makefile @@ -37,8 +37,5 @@ SUBDIR += isp_2300 SUBDIR += isp_2322 SUBDIR += isp_2400 SUBDIR += isp_2500 -.if ${MACHINE} == "sparc64" -SUBDIR += isp_1000 -.endif .include diff --git a/sys/modules/le/Makefile b/sys/modules/le/Makefile index 96a157c50ac9d3..b77a2e69f16101 100644 --- a/sys/modules/le/Makefile +++ b/sys/modules/le/Makefile @@ -3,20 +3,12 @@ .PATH: ${SRCTOP}/sys/dev/le KMOD= if_le -SRCS= am7990.c am79900.c ${if_le_isa} ${if_le_lebuffer} -SRCS+= ${if_le_ledma} if_le_pci.c lance.c ${lebuffer_sbus} -SRCS+= bus_if.h device_if.h ${isa_if} ${ofw_bus_if} pci_if.h +SRCS= am7990.c am79900.c ${if_le_isa} if_le_pci.c lance.c +SRCS+= bus_if.h device_if.h ${isa_if} pci_if.h .if ${MACHINE_CPUARCH} == "i386" if_le_isa= if_le_isa.c isa_if= isa_if.h .endif -.if ${MACHINE} == "sparc64" -if_le_lebuffer= if_le_lebuffer.c -if_le_ledma= if_le_ledma.c -lebuffer_sbus= lebuffer_sbus.c -ofw_bus_if= ofw_bus_if.h -.endif - .include diff --git a/sys/modules/scc/Makefile b/sys/modules/scc/Makefile index 05a67b2db85d0b..d138bcd3c8f2cc 100644 --- a/sys/modules/scc/Makefile +++ b/sys/modules/scc/Makefile @@ -2,9 +2,6 @@ .PATH: ${SRCTOP}/sys/dev/scc -.if ${MACHINE} == "sparc64" -scc_bfe= scc_bfe_ebus.c scc_bfe_sbus.c -.endif .if ${MACHINE_CPUARCH} == "powerpc" scc_bfe= scc_bfe_macio.c scc_bfe_quicc.c scc_dev_quicc.c .endif diff --git a/sys/modules/sound/driver/Makefile b/sys/modules/sound/driver/Makefile index d00ccaa1028612..8c21a719966af5 100644 --- a/sys/modules/sound/driver/Makefile +++ b/sys/modules/sound/driver/Makefile @@ -21,12 +21,6 @@ _maestro3= maestro3 SUBDIR+= cmi mss .endif -.if ${MACHINE_CPUARCH} == "sparc64" -.if ${MACHINE} == "sparc64" -SUBDIR+= audiocs -.endif -.endif - .if ${MACHINE_CPUARCH} == "powerpc" SUBDIR+= ai2s davbus .endif diff --git a/sys/modules/sound/driver/audiocs/Makefile b/sys/modules/sound/driver/audiocs/Makefile deleted file mode 100644 index 0cd516cc8bc0dc..00000000000000 --- a/sys/modules/sound/driver/audiocs/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -# $FreeBSD$ - -.PATH: ${SRCTOP}/sys/dev/sound/sbus - -KMOD= snd_audiocs -SRCS= device_if.h bus_if.h ofw_bus_if.h -SRCS+= channel_if.h feeder_if.h mixer_if.h -SRCS+= cs4231.c - -.include diff --git a/sys/modules/syscons/Makefile b/sys/modules/syscons/Makefile index 85e513d5f898b5..256cfe3ac74455 100644 --- a/sys/modules/syscons/Makefile +++ b/sys/modules/syscons/Makefile @@ -1,36 +1,22 @@ # $FreeBSD$ SUBDIR= ${_apm} \ - ${_beastie} \ + beastie \ blank \ - ${_daemon} \ - ${_dragon} \ + daemon \ + dragon \ fade \ - ${_fire} \ + fire \ green \ - ${_logo} \ - ${_plasma} \ - ${_rain} \ - ${_snake} \ - ${_star} \ - ${_warp} + logo \ + plasma \ + rain \ + snake \ + star \ + warp .if ${MACHINE_CPUARCH} == "i386" _apm= apm .endif -.if ${MACHINE_CPUARCH} != "sparc64" -_beastie= beastie -_beastie= beastie -_daemon= daemon -_dragon= dragon -_fire= fire -_logo= logo -_plasma= plasma -_rain= rain -_snake= snake -_star= star -_warp= warp -.endif - .include diff --git a/sys/modules/uart/Makefile b/sys/modules/uart/Makefile index 199440ae78dbcb..b6bba88da9caa8 100644 --- a/sys/modules/uart/Makefile +++ b/sys/modules/uart/Makefile @@ -8,13 +8,8 @@ uart_bus_acpi=uart_bus_acpi.c uart_cpu_acpi=uart_cpu_acpi.c .endif -.if ${MACHINE_CPUARCH} == "sparc64" -uart_bus_ebus= uart_bus_ebus.c -.endif - .if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "arm" || \ - ${MACHINE_CPUARCH} == "powerpc" || ${MACHINE_CPUARCH} == "riscv" || \ - ${MACHINE_CPUARCH} == "sparc64" + ${MACHINE_CPUARCH} == "powerpc" || ${MACHINE_CPUARCH} == "riscv" ofw_bus_if= ofw_bus_if.h .endif diff --git a/sys/sparc64/central/central.c b/sys/sparc64/central/central.c deleted file mode 100644 index a376fd2bee20e2..00000000000000 --- a/sys/sparc64/central/central.c +++ /dev/null @@ -1,301 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2003 Jake Burkholder. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include - -#include - -#include - -struct central_devinfo { - struct ofw_bus_devinfo cdi_obdinfo; - struct resource_list cdi_rl; -}; - -struct central_softc { - int sc_nrange; - struct sbus_ranges *sc_ranges; -}; - -static device_probe_t central_probe; -static device_attach_t central_attach; -static bus_print_child_t central_print_child; -static bus_probe_nomatch_t central_probe_nomatch; -static bus_alloc_resource_t central_alloc_resource; -static bus_adjust_resource_t central_adjust_resource; -static bus_get_resource_list_t central_get_resource_list; -static ofw_bus_get_devinfo_t central_get_devinfo; - -static int central_print_res(struct central_devinfo *); - -static device_method_t central_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, central_probe), - DEVMETHOD(device_attach, central_attach), - DEVMETHOD(device_shutdown, bus_generic_shutdown), - DEVMETHOD(device_suspend, bus_generic_suspend), - DEVMETHOD(device_resume, bus_generic_resume), - - /* Bus interface */ - DEVMETHOD(bus_print_child, central_print_child), - DEVMETHOD(bus_probe_nomatch, central_probe_nomatch), - DEVMETHOD(bus_alloc_resource, central_alloc_resource), - DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), - DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), - DEVMETHOD(bus_adjust_resource, central_adjust_resource), - DEVMETHOD(bus_release_resource, bus_generic_rl_release_resource), - DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), - DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), - DEVMETHOD(bus_get_resource, bus_generic_rl_get_resource), - DEVMETHOD(bus_get_resource_list, central_get_resource_list), - DEVMETHOD(bus_child_pnpinfo_str, ofw_bus_gen_child_pnpinfo_str), - - /* ofw_bus interface */ - DEVMETHOD(ofw_bus_get_devinfo, central_get_devinfo), - DEVMETHOD(ofw_bus_get_compat, ofw_bus_gen_get_compat), - DEVMETHOD(ofw_bus_get_model, ofw_bus_gen_get_model), - DEVMETHOD(ofw_bus_get_name, ofw_bus_gen_get_name), - DEVMETHOD(ofw_bus_get_node, ofw_bus_gen_get_node), - DEVMETHOD(ofw_bus_get_type, ofw_bus_gen_get_type), - - DEVMETHOD_END -}; - -static driver_t central_driver = { - "central", - central_methods, - sizeof(struct central_softc), -}; - -static devclass_t central_devclass; - -EARLY_DRIVER_MODULE(central, nexus, central_driver, central_devclass, 0, 0, - BUS_PASS_BUS); -MODULE_DEPEND(fhc, nexus, 1, 1, 1); -MODULE_VERSION(central, 1); - -static int -central_probe(device_t dev) -{ - - if (strcmp(ofw_bus_get_name(dev), "central") == 0) { - device_set_desc(dev, "central"); - return (0); - } - return (ENXIO); -} - -static int -central_attach(device_t dev) -{ - struct central_devinfo *cdi; - struct sbus_regs *reg; - struct central_softc *sc; - phandle_t child; - phandle_t node; - device_t cdev; - int nreg; - int i; - - sc = device_get_softc(dev); - node = ofw_bus_get_node(dev); - - sc->sc_nrange = OF_getprop_alloc_multi(node, "ranges", - sizeof(*sc->sc_ranges), (void **)&sc->sc_ranges); - if (sc->sc_nrange == -1) { - device_printf(dev, "can't get ranges\n"); - return (ENXIO); - } - - for (child = OF_child(node); child != 0; child = OF_peer(child)) { - cdi = malloc(sizeof(*cdi), M_DEVBUF, M_WAITOK | M_ZERO); - if (ofw_bus_gen_setup_devinfo(&cdi->cdi_obdinfo, child) != 0) { - free(cdi, M_DEVBUF); - continue; - } - nreg = OF_getprop_alloc_multi(child, "reg", sizeof(*reg), - (void **)®); - if (nreg == -1) { - device_printf(dev, "<%s>: incomplete\n", - cdi->cdi_obdinfo.obd_name); - ofw_bus_gen_destroy_devinfo(&cdi->cdi_obdinfo); - free(cdi, M_DEVBUF); - continue; - } - resource_list_init(&cdi->cdi_rl); - for (i = 0; i < nreg; i++) - resource_list_add(&cdi->cdi_rl, SYS_RES_MEMORY, i, - reg[i].sbr_offset, reg[i].sbr_offset + - reg[i].sbr_size, reg[i].sbr_size); - OF_prop_free(reg); - cdev = device_add_child(dev, NULL, -1); - if (cdev == NULL) { - device_printf(dev, "<%s>: device_add_child failed\n", - cdi->cdi_obdinfo.obd_name); - resource_list_free(&cdi->cdi_rl); - ofw_bus_gen_destroy_devinfo(&cdi->cdi_obdinfo); - free(cdi, M_DEVBUF); - continue; - } - device_set_ivars(cdev, cdi); - } - - return (bus_generic_attach(dev)); -} - -static int -central_adjust_resource(device_t bus __unused, device_t child __unused, - int type __unused, struct resource *r __unused, rman_res_t start __unused, - rman_res_t end __unused) -{ - - return (ENXIO); -} - -static int -central_print_child(device_t dev, device_t child) -{ - int rv; - - rv = bus_print_child_header(dev, child); - rv += central_print_res(device_get_ivars(child)); - rv += bus_print_child_footer(dev, child); - return (rv); -} - -static void -central_probe_nomatch(device_t dev, device_t child) -{ - const char *type; - - device_printf(dev, "<%s>", ofw_bus_get_name(child)); - central_print_res(device_get_ivars(child)); - type = ofw_bus_get_type(child); - printf(" type %s (no driver attached)\n", - type != NULL ? type : "unknown"); -} - -static struct resource * -central_alloc_resource(device_t bus, device_t child, int type, int *rid, - rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) -{ - struct resource_list *rl; - struct resource_list_entry *rle; - struct central_softc *sc; - struct resource *res; - bus_addr_t coffset; - bus_addr_t cend; - bus_addr_t phys; - int isdefault; - int passthrough; - int i; - - isdefault = RMAN_IS_DEFAULT_RANGE(start, end); - passthrough = (device_get_parent(child) != bus); - res = NULL; - rle = NULL; - rl = BUS_GET_RESOURCE_LIST(bus, child); - sc = device_get_softc(bus); - switch (type) { - case SYS_RES_IRQ: - return (resource_list_alloc(rl, bus, child, type, rid, start, - end, count, flags)); - case SYS_RES_MEMORY: - if (!passthrough) { - rle = resource_list_find(rl, type, *rid); - if (rle == NULL) - return (NULL); - if (rle->res != NULL) - panic("%s: resource entry is busy", __func__); - if (isdefault) { - start = rle->start; - count = ulmax(count, rle->count); - end = ulmax(rle->end, start + count - 1); - } - } - for (i = 0; i < sc->sc_nrange; i++) { - coffset = sc->sc_ranges[i].coffset; - cend = coffset + sc->sc_ranges[i].size - 1; - if (start >= coffset && end <= cend) { - start -= coffset; - end -= coffset; - phys = sc->sc_ranges[i].poffset | - ((bus_addr_t)sc->sc_ranges[i].pspace << 32); - res = bus_generic_alloc_resource(bus, child, - type, rid, phys + start, phys + end, - count, flags); - if (!passthrough) - rle->res = res; - break; - } - } - break; - } - return (res); -} - -static struct resource_list * -central_get_resource_list(device_t bus, device_t child) -{ - struct central_devinfo *cdi; - - cdi = device_get_ivars(child); - return (&cdi->cdi_rl); -} - -static const struct ofw_bus_devinfo * -central_get_devinfo(device_t bus, device_t child) -{ - struct central_devinfo *cdi; - - cdi = device_get_ivars(child); - return (&cdi->cdi_obdinfo); -} - -static int -central_print_res(struct central_devinfo *cdi) -{ - - return (resource_list_print_type(&cdi->cdi_rl, "mem", SYS_RES_MEMORY, - "%#jx")); -} diff --git a/sys/sparc64/conf/DEFAULTS b/sys/sparc64/conf/DEFAULTS deleted file mode 100644 index c99480c8f86ff8..00000000000000 --- a/sys/sparc64/conf/DEFAULTS +++ /dev/null @@ -1,23 +0,0 @@ -# -# DEFAULTS -- Default kernel configuration file for FreeBSD/sparc64 -# -# $FreeBSD$ - -machine sparc64 - -# Pseudo devices. -device mem # Memory and kernel memory devices - -# UART chips on this platform -device uart_ns8250 -device uart_sab82532 -device uart_z8530 - -# Default partitioning schemes -options GEOM_PART_BSD -options GEOM_PART_VTOC8 - -# Let sunkbd emulate an AT keyboard by default. -options SUNKBD_EMULATE_ATKBD - -options NEW_PCIB diff --git a/sys/sparc64/conf/GENERIC b/sys/sparc64/conf/GENERIC deleted file mode 100644 index 4509269c19ffef..00000000000000 --- a/sys/sparc64/conf/GENERIC +++ /dev/null @@ -1,253 +0,0 @@ -# -# GENERIC -- Generic kernel configuration file for FreeBSD/sparc64 -# -# For more information on this file, please read the config(5) manual page, -# and/or the handbook section on Kernel Configuration Files: -# -# https://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html -# -# The handbook is also available locally in /usr/share/doc/handbook -# if you've installed the doc distribution, otherwise always see the -# FreeBSD World Wide Web server (https://www.FreeBSD.org/) for the -# latest information. -# -# An exhaustive list of options and more detailed explanations of the -# device lines is also present in the ../../conf/NOTES and NOTES files. -# If you are in doubt as to the purpose or necessity of a line, check first -# in NOTES. -# -# $FreeBSD$ - -cpu SUN4U -ident GENERIC - -makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols - -# Platforms supported -# At this time all platforms are supported, as-is. - -options SCHED_ULE # ULE scheduler -options PREEMPTION # Enable kernel thread preemption -options VIMAGE # Subsystem virtualization, e.g. VNET -options INET # InterNETworking -options INET6 # IPv6 communications protocols -options IPSEC_SUPPORT # Allow kldload of ipsec and tcpmd5 -options TCP_HHOOK # hhook(9) framework for TCP -options SCTP # Stream Control Transmission Protocol -options FFS # Berkeley Fast Filesystem -options SOFTUPDATES # Enable FFS soft updates support -options UFS_ACL # Support for access control lists -options UFS_DIRHASH # Improve performance on big directories -options UFS_GJOURNAL # Enable gjournal-based UFS journaling -options QUOTA # Enable disk quotas for UFS -options MD_ROOT # MD is a potential root device -options NFSCL # Network Filesystem Client -options NFSD # Network Filesystem Server -options NFSLOCKD # Network Lock Manager -options NFS_ROOT # NFS usable as /, requires NFSCL -#options MSDOSFS # MSDOS Filesystem -options CD9660 # ISO 9660 Filesystem -options PROCFS # Process filesystem (requires PSEUDOFS) -options PSEUDOFS # Pseudo-filesystem framework -options GEOM_PART_GPT # GUID Partition Tables. -options GEOM_LABEL # Provides labelization -options COMPAT_FREEBSD5 # Compatible with FreeBSD5 -options COMPAT_FREEBSD6 # Compatible with FreeBSD6 -options COMPAT_FREEBSD7 # Compatible with FreeBSD7 -options COMPAT_FREEBSD9 # Compatible with FreeBSD9 -options COMPAT_FREEBSD10 # Compatible with FreeBSD10 -options COMPAT_FREEBSD11 # Compatible with FreeBSD11 -options COMPAT_FREEBSD12 # Compatible with FreeBSD12 -options SCSI_DELAY=5000 # Delay (in ms) before probing SCSI -options KTRACE # ktrace(1) support -options STACK # stack(9) support -options SYSVSHM # SYSV-style shared memory -options SYSVMSG # SYSV-style message queues -options SYSVSEM # SYSV-style semaphores -options _KPOSIX_PRIORITY_SCHEDULING # POSIX P1003_1B real-time extensions -options PRINTF_BUFR_SIZE=128 # Prevent printf output being interspersed. -options HWPMC_HOOKS # Necessary kernel hooks for hwpmc(4) -options AUDIT # Security event auditing -options CAPABILITY_MODE # Capsicum capability mode -options CAPABILITIES # Capsicum capabilities -options MAC # TrustedBSD MAC Framework -options INCLUDE_CONFIG_FILE # Include this file in kernel -options RACCT # Resource accounting framework -options RACCT_DEFAULT_TO_DISABLED # Set kern.racct.enable=0 by default -options RCTL # Resource limits - -# Debugging support. Always need this: -options KDB # Enable kernel debugger support. -options KDB_TRACE # Print a stack trace for a panic. -# For full debugger support use (turn off in stable branch): -options DDB # Support DDB. -options GDB # Support remote GDB. -options DEADLKRES # Enable the deadlock resolver -options INVARIANTS # Enable calls of extra sanity checking -options INVARIANT_SUPPORT # Extra sanity checks of internal structures, required by INVARIANTS -options WITNESS # Enable checks to detect deadlocks and cycles -options WITNESS_SKIPSPIN # Don't run witness on spinlocks for speed -options MALLOC_DEBUG_MAXZONES=8 # Separate malloc(9) zones -options VERBOSE_SYSINIT=0 # Support debug.verbose_sysinit, off by default - -# Kernel dump features. -options EKCD # Support for encrypted kernel dumps -options GZIO # gzip-compressed kernel and user dumps -options ZSTDIO # zstd-compressed kernel and user dumps -options DEBUGNET # debugnet networking -options NETDUMP # netdump(4) client support - -# Make an SMP-capable kernel by default -options SMP # Symmetric MultiProcessor Kernel - -# Standard busses -device ebus -device isa -device pci -device sbus -device central -device fhc - -# Floppy drives -#device fdc - -# ATA controllers -device ahci # AHCI-compatible SATA controllers -device ata # Legacy ATA/SATA controllers -device mvs # Marvell 88SX50XX/88SX60XX/88SX70XX/SoC SATA -device siis # SiliconImage SiI3124/SiI3132/SiI3531 SATA - -# SCSI Controllers -device ahc # AHA2940 and onboard AIC7xxx devices -options AHC_ALLOW_MEMIO # Attempt to use memory mapped I/O -device esp # AMD Am53C974, Sun ESP and FAS families -device isp # Qlogic family -device ispfw # Firmware module for Qlogic host adapters -device mpt # LSI-Logic MPT-Fusion -device mps # LSI-Logic MPT-Fusion 2 -device mpr # LSI-Logic MPT-Fusion 3 -device sym # NCR/Symbios/LSI Logic 53C8XX/53C1010/53C1510D - -# ATA/SCSI peripherals -device scbus # SCSI bus (required for ATA/SCSI) -device ch # SCSI media changers -device da # Direct Access (disks) -device sa # Sequential Access (tape etc) -device cd # CD -device pass # Passthrough device (direct ATA/SCSI access) -device ses # Enclosure Services (SES and SAF-TE) -#device ctl # CAM Target Layer - -# RAID controllers -#device amr # AMI MegaRAID -#device mlx # Mylex DAC960 family - -# atkbdc0 controls both the keyboard and the PS/2 mouse -device atkbdc # AT keyboard controller -device atkbd # AT keyboard -device psm # PS/2 mouse - -device kbdmux # keyboard multiplexer - -# syscons is the default console driver, resembling an SCO console -device sc -device creator # Creator, Creator3D and Elite3D framebuffers -device machfb # ATI Mach64 framebuffers -device splash # Splash screen and screen saver support -options KBD_INSTALL_CDEV # install a CDEV entry in /dev - -# vt is the new video console driver -#device vt - -# Builtin hardware -device auxio # auxiliary I/O device -device eeprom # eeprom (really a front-end for the MK48Txx) -device mk48txx # Mostek MK48Txx clocks -device rtc # rtc (really a front-end for the MC146818) -device mc146818 # Motorola MC146818 and compatible clocks -device epic # Sun Fire V215/V245 LEDs -device sbbc # Sun BootBus controller (time-of-day clock for - # Serengeti and StarCat, console for Serengeti, - # requires device uart) - -# Serial (COM) ports -device puc # Multi-channel uarts -device scc # Serial communications controllers. -device uart # Multi-uart driver - -# Parallel port -#device ppc -#device ppbus # Parallel port bus (required) -#device lpt # Printer -#device ppi # Parallel port interface device -#device vpo # Requires scbus and da - -device iflib - -# PCI Ethernet NICs. -device em # Intel PRO/1000 adapter Gigabit Ethernet Card -device le # AMD Am7900 LANCE and Am79C9xx PCnet -device ti # Alteon Networks Tigon I/II gigabit Ethernet - -# PCI Ethernet NICs that use the common MII bus controller code. -# NOTE: Be sure to keep the 'device miibus' line in order to use these NICs! -device miibus # MII bus support -#device bfe # Broadcom BCM440x 10/100 Ethernet -device bge # Broadcom BCM570xx Gigabit Ethernet -device cas # Sun Cassini/Cassini+ and NS DP83065 Saturn -device dc # DEC/Intel 21143 and various workalikes -device fxp # Intel EtherExpress PRO/100B (82557, 82558) -device gem # Sun GEM/Sun ERI/Apple GMAC -device hme # Sun HME (Happy Meal Ethernet) -device nge # NatSemi DP83820 gigabit Ethernet -device re # RealTek 8139C+/8169/8169S/8110S -device rl # RealTek 8129/8139 -device sis # Silicon Integrated Systems SiS 900/SiS 7016 -device sk # SysKonnect SK-984x & SK-982x gigabit Ethernet -device ste # Sundance ST201 (D-Link DFE-550TX) -device stge # Sundance/Tamarack TC9021 gigabit Ethernet -device vr # VIA Rhine, Rhine II -device xl # 3Com 3c90x (``Boomerang'', ``Cyclone'') - -# Wireless NIC cards -device wlan # 802.11 support -options IEEE80211_DEBUG # enable debug msgs -options IEEE80211_SUPPORT_MESH # enable 802.11s D3.0 support -device wlan_wep # 802.11 WEP support -device wlan_ccmp # 802.11 CCMP support -device wlan_tkip # 802.11 TKIP support -device wlan_amrr # AMRR transmit rate control algorithm -device ath # Atheros NICs -device ath_pci # Atheros pci/cardbus glue -device ath_hal # Atheros HAL (Hardware Access Layer) -device ath_rate_sample # SampleRate tx rate control for ath - -# Pseudo devices. -device crypto # core crypto support -device loop # Network loopback -device ether # Ethernet support -device vlan # 802.1Q VLAN support -device tuntap # Packet tunnel. -device md # Memory "disks" -device gif # IPv6 and IPv4 tunneling -device firmware # firmware assist module - -# The `bpf' device enables the Berkeley Packet Filter. -# Be aware of the administrative consequences of enabling this! -# Note that 'bpf' is required for DHCP. -device bpf # Berkeley packet filter - -# USB support -options USB_DEBUG # enable debug msgs -device uhci # UHCI PCI->USB interface -device ohci # OHCI PCI->USB interface -device ehci # EHCI PCI->USB interface (USB 2.0) -device usb # USB Bus (required) -device ukbd # Keyboard -device umass # Disks/Mass storage - Requires scbus and da - -# Sound support -device sound # Generic sound driver (required) -device snd_audiocs # Crystal Semiconductor CS4231 -device snd_es137x # Ensoniq AudioPCI ES137x -device snd_t4dwave # Acer Labs M5451 diff --git a/sys/sparc64/conf/GENERIC-NODEBUG b/sys/sparc64/conf/GENERIC-NODEBUG deleted file mode 100644 index 863c2a79194e0e..00000000000000 --- a/sys/sparc64/conf/GENERIC-NODEBUG +++ /dev/null @@ -1,38 +0,0 @@ -# -# GENERIC-NODEBUG -- WITNESS and INVARIANTS free kernel configuration file -# for FreeBSD/sparc64 -# -# This configuration file removes several debugging options, including -# WITNESS and INVARIANTS checking, which are known to have significant -# performance impact on running systems. When benchmarking new features -# this kernel should be used instead of the standard GENERIC. -# This kernel configuration should never appear outside of the HEAD -# of the FreeBSD tree. -# -# For more information on this file, please read the config(5) manual page, -# and/or the handbook section on Kernel Configuration Files: -# -# https://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html -# -# The handbook is also available locally in /usr/share/doc/handbook -# if you've installed the doc distribution, otherwise always see the -# FreeBSD World Wide Web server (https://www.FreeBSD.org/) for the -# latest information. -# -# An exhaustive list of options and more detailed explanations of the -# device lines is also present in the ../../conf/NOTES and NOTES files. -# If you are in doubt as to the purpose or necessity of a line, check first -# in NOTES. -# -# $FreeBSD$ - -include GENERIC - -ident GENERIC-NODEBUG - -nooptions INVARIANTS -nooptions INVARIANT_SUPPORT -nooptions WITNESS -nooptions WITNESS_SKIPSPIN -nooptions DEADLKRES -nooptions MALLOC_DEBUG_MAXZONES diff --git a/sys/sparc64/conf/GENERIC.hints b/sys/sparc64/conf/GENERIC.hints deleted file mode 100644 index e8c0da7a1d7eba..00000000000000 --- a/sys/sparc64/conf/GENERIC.hints +++ /dev/null @@ -1 +0,0 @@ -# $FreeBSD$ diff --git a/sys/sparc64/conf/Makefile b/sys/sparc64/conf/Makefile deleted file mode 100644 index b0b5857849c471..00000000000000 --- a/sys/sparc64/conf/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -# $FreeBSD$ - -TARGET=sparc64 - -.include "${.CURDIR}/../../conf/makeLINT.mk" diff --git a/sys/sparc64/conf/NOTES b/sys/sparc64/conf/NOTES deleted file mode 100644 index 28e2030df53622..00000000000000 --- a/sys/sparc64/conf/NOTES +++ /dev/null @@ -1,168 +0,0 @@ -# $FreeBSD$ -# -# This file contains machine dependent kernel configuration notes. For -# machine independent notes, look in /sys/conf/NOTES. - - -##################################################################### -# CPU OPTIONS - -# -# You must specify at least one CPU (the one you intend to run on); -# deleting the specification for CPUs you don't need to use may make -# parts of the system run faster. -# XXX: On the Sparc64, there is only one CPU type -cpu SUN4U - - -##################################################################### -# HARDWARE BUS CONFIGURATION - -device ebus -device isa -device sbus -device central -device fhc - - -##################################################################### -# HARDWARE DEVICE CONFIGURATION - -# -# Mandatory devices: -# - -device eeprom # eeprom (really a front-end for the MK48Txx) -device mk48txx # Mostek MK48Txx clocks -device rtc # rtc (really a front-end for the MC146818) -device mc146818 # Motorola MC146818 and compatible clocks -device sbbc # Sun BootBus controller - -# -# Optional devices: -# - -device auxio # auxiliary I/O device -device epic # Sun Fire V215/V245 LEDs -device creator # Creator, Creator3D and Elite3D framebuffers -device machfb # ATI Mach64 framebuffers - -device ofw_console # Open Firmware console device -option OFWCONS_POLL_HZ=4 # 20 or more works best on Ultra2 - -# PS/2 mouse -device psm - -# Options for psm: -options PSM_HOOKRESUME #hook the system resume event, useful - #for some laptops -options PSM_RESETAFTERSUSPEND #reset the device at the resume event - -# The keyboard controller; it controls the keyboard and the PS/2 mouse. -device atkbdc - -# The AT keyboard -device atkbd - -# Options for atkbd: -options ATKBD_DFLT_KEYMAP # specify the built-in keymap -makeoptions ATKBD_DFLT_KEYMAP=fr.dvorak - -# `flags' for atkbd: -# 0x01 Force detection of keyboard, else we always assume a keyboard -# 0x02 Don't reset keyboard, useful for some newer ThinkPads -# 0x03 Force detection and avoid reset, might help with certain -# dockingstations -# 0x04 Old-style (XT) keyboard support, useful for older ThinkPads - -# Sun type 4/5/6 RS-232@TTL keyboard -#device sunkbd - -# Options for sunkbd: -options SUNKBD_EMULATE_ATKBD # allows to use the AT keyboard maps - # in share/syscons/keymaps, required - # for SUNKBD_DFLT_KEYMAP and kbdmux -options SUNKBD_DFLT_KEYMAP # specify the built-in keymap -makeoptions SUNKBD_DFLT_KEYMAP=fr.dvorak - -# The syscons console driver (SCO color console compatible). -device sc -hint.sc.0.at="isa" -options MAXCONS=16 # number of virtual consoles -options SC_DFLT_TERM=\"sc\" # default terminal emulator -options SC_DISABLE_KDBKEY # disable `debug' key -options SC_DISABLE_REBOOT # disable reboot key sequence -options SC_HISTORY_SIZE=200 # number of history buffer lines -options SC_MOUSE_CHAR=0x3 # char code for text mode mouse cursor -options SC_PIXEL_MODE # add support for the raster text mode - -# The following options will let you change the default behavior of -# cut-n-paste feature -options SC_CUT_SPACES2TABS # convert leading spaces into tabs -options SC_CUT_SEPCHARS=\"x09\" # set of characters that delimit words - # (default is single space - \"x20\") - -# If you have a two button mouse, you may want to add the following option -# to use the right button of the mouse to paste text. -options SC_TWOBUTTON_MOUSE - -# You can selectively disable features in syscons. -options SC_NO_CUTPASTE -options SC_NO_HISTORY -options SC_NO_MODE_CHANGE -options SC_NO_SYSMOUSE -#!options SC_NO_TERM_DUMB -#!options SC_NO_TERM_SC -#!options SC_NO_TERM_SCTEKEN - -# `flags' for sc -# 0x80 Put the video card in the VESA 800x600 dots, 16 color mode -# 0x100 Probe for a keyboard device periodically if one is not present - - -##################################################################### -# Devices we don't want to deal with - -nodevice bktr -nodevice ppc -nodevice snd_ad1816 -nodevice snd_als4000 -nodevice snd_cmi -nodevice snd_cs4281 -nodevice snd_csa -nodevice snd_ds1 -nodevice snd_emu10k1 -nodevice snd_ess -nodevice snd_fm801 -nodevice snd_gusc -nodevice snd_ich -nodevice snd_maestro -nodevice snd_maestro3 -nodevice snd_mss -nodevice snd_neomagic -nodevice snd_sb16 -nodevice snd_sb8 -nodevice snd_sbc -nodevice snd_solo -nodevice snd_t4dwave -nodevice snd_via8233 -nodevice snd_via82c686 -nodevice snd_vibes -nodevice snd_uaudio - - -##################################################################### -# Options we don't want to deal with - -nooption COMPAT_FREEBSD4 -nooption SC_RENDER_DEBUG -nooption SC_DEBUG_LEVEL -nooption PPC_DEBUG -nooption PPC_PROBE_CHIPSET -nooption EXT2FS - - -##################################################################### -# Make options we don't want to deal with - -nomakeoption SC_DFLT_FONT diff --git a/sys/sparc64/ebus/ebus.c b/sys/sparc64/ebus/ebus.c deleted file mode 100644 index df9e3c29d17f4b..00000000000000 --- a/sys/sparc64/ebus/ebus.c +++ /dev/null @@ -1,730 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-NetBSD AND BSD-3-Clause - * - * Copyright (c) 1999, 2000 Matthew R. Green - * Copyright (c) 2009 by Marius Strobl - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: NetBSD: ebus.c,v 1.52 2008/05/29 14:51:26 mrg Exp - */ -/*- - * Copyright (c) 2001 Thomas Moestl - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -__FBSDID("$FreeBSD$"); - -/* - * Driver for JBus to EBus and PCI to EBus bridges - */ - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#ifndef SUN4V -#include -#endif -#include -#include - -#include -#include - -#include - -/* - * The register, interrupt map and for the PCI variant also the ranges - * properties are identical to the ISA ones. - */ -#include - -struct ebus_nexus_ranges { - uint32_t child_hi; - uint32_t child_lo; - uint32_t phys_hi; - uint32_t phys_lo; - uint32_t size; -}; - -struct ebus_devinfo { - struct ofw_bus_devinfo edi_obdinfo; - struct resource_list edi_rl; -}; - -struct ebus_rinfo { - int eri_rtype; - struct rman eri_rman; - struct resource *eri_res; -}; - -struct ebus_softc { - void *sc_range; - struct ebus_rinfo *sc_rinfo; - - u_int sc_flags; -#define EBUS_PCI (1 << 0) - - int sc_nrange; - - struct ofw_bus_iinfo sc_iinfo; - -#ifndef SUN4V - uint32_t sc_ign; -#endif -}; - -static device_probe_t ebus_nexus_probe; -static device_attach_t ebus_nexus_attach; -static device_probe_t ebus_pci_probe; -static device_attach_t ebus_pci_attach; -static bus_print_child_t ebus_print_child; -static bus_probe_nomatch_t ebus_probe_nomatch; -static bus_alloc_resource_t ebus_alloc_resource; -static bus_activate_resource_t ebus_activate_resource; -static bus_adjust_resource_t ebus_adjust_resource; -static bus_release_resource_t ebus_release_resource; -static bus_setup_intr_t ebus_setup_intr; -static bus_get_resource_list_t ebus_get_resource_list; -static ofw_bus_get_devinfo_t ebus_get_devinfo; - -static int ebus_attach(device_t dev, struct ebus_softc *sc, phandle_t node); -static struct ebus_devinfo *ebus_setup_dinfo(device_t dev, - struct ebus_softc *sc, phandle_t node); -static void ebus_destroy_dinfo(struct ebus_devinfo *edi); -static int ebus_print_res(struct ebus_devinfo *edi); - -static devclass_t ebus_devclass; - -static device_method_t ebus_nexus_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, ebus_nexus_probe), - DEVMETHOD(device_attach, ebus_nexus_attach), - DEVMETHOD(device_shutdown, bus_generic_shutdown), - DEVMETHOD(device_suspend, bus_generic_suspend), - DEVMETHOD(device_resume, bus_generic_resume), - - /* Bus interface */ - DEVMETHOD(bus_print_child, ebus_print_child), - DEVMETHOD(bus_probe_nomatch, ebus_probe_nomatch), - DEVMETHOD(bus_alloc_resource, ebus_alloc_resource), - DEVMETHOD(bus_activate_resource, ebus_activate_resource), - DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), - DEVMETHOD(bus_adjust_resource, ebus_adjust_resource), - DEVMETHOD(bus_release_resource, ebus_release_resource), - DEVMETHOD(bus_setup_intr, ebus_setup_intr), - DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), - DEVMETHOD(bus_get_resource, bus_generic_rl_get_resource), - DEVMETHOD(bus_get_resource_list, ebus_get_resource_list), - DEVMETHOD(bus_child_pnpinfo_str, ofw_bus_gen_child_pnpinfo_str), - - /* ofw_bus interface */ - DEVMETHOD(ofw_bus_get_devinfo, ebus_get_devinfo), - DEVMETHOD(ofw_bus_get_compat, ofw_bus_gen_get_compat), - DEVMETHOD(ofw_bus_get_model, ofw_bus_gen_get_model), - DEVMETHOD(ofw_bus_get_name, ofw_bus_gen_get_name), - DEVMETHOD(ofw_bus_get_node, ofw_bus_gen_get_node), - DEVMETHOD(ofw_bus_get_type, ofw_bus_gen_get_type), - - DEVMETHOD_END -}; - -static driver_t ebus_nexus_driver = { - "ebus", - ebus_nexus_methods, - sizeof(struct ebus_softc), -}; - -/* - * NB: we rely on the interrupt controllers of the accompanying PCI-Express - * bridge to be registered as the nexus variant of the EBus bridges doesn't - * employ its own one. - */ -EARLY_DRIVER_MODULE(ebus, nexus, ebus_nexus_driver, ebus_devclass, 0, 0, - BUS_PASS_BUS + 1); -MODULE_DEPEND(ebus, nexus, 1, 1, 1); - -static device_method_t ebus_pci_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, ebus_pci_probe), - DEVMETHOD(device_attach, ebus_pci_attach), - DEVMETHOD(device_shutdown, bus_generic_shutdown), - DEVMETHOD(device_suspend, bus_generic_suspend), - DEVMETHOD(device_resume, bus_generic_resume), - - /* Bus interface */ - DEVMETHOD(bus_print_child, ebus_print_child), - DEVMETHOD(bus_probe_nomatch, ebus_probe_nomatch), - DEVMETHOD(bus_alloc_resource, ebus_alloc_resource), - DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), - DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), - DEVMETHOD(bus_release_resource, ebus_release_resource), - DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), - DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), - DEVMETHOD(bus_get_resource, bus_generic_rl_get_resource), - DEVMETHOD(bus_get_resource_list, ebus_get_resource_list), - DEVMETHOD(bus_child_pnpinfo_str, ofw_bus_gen_child_pnpinfo_str), - - /* ofw_bus interface */ - DEVMETHOD(ofw_bus_get_devinfo, ebus_get_devinfo), - DEVMETHOD(ofw_bus_get_compat, ofw_bus_gen_get_compat), - DEVMETHOD(ofw_bus_get_model, ofw_bus_gen_get_model), - DEVMETHOD(ofw_bus_get_name, ofw_bus_gen_get_name), - DEVMETHOD(ofw_bus_get_node, ofw_bus_gen_get_node), - DEVMETHOD(ofw_bus_get_type, ofw_bus_gen_get_type), - - DEVMETHOD_END -}; - -static driver_t ebus_pci_driver = { - "ebus", - ebus_pci_methods, - sizeof(struct ebus_softc), -}; - -EARLY_DRIVER_MODULE(ebus, pci, ebus_pci_driver, ebus_devclass, 0, 0, - BUS_PASS_BUS); -MODULE_DEPEND(ebus, pci, 1, 1, 1); -MODULE_VERSION(ebus, 1); - -static int -ebus_nexus_probe(device_t dev) -{ - const char* compat; - - compat = ofw_bus_get_compat(dev); - if (compat != NULL && strcmp(ofw_bus_get_name(dev), "ebus") == 0 && - strcmp(compat, "jbus-ebus") == 0) { - device_set_desc(dev, "JBus-EBus bridge"); - return (BUS_PROBE_GENERIC); - } - return (ENXIO); -} - -static int -ebus_pci_probe(device_t dev) -{ - - if (pci_get_class(dev) != PCIC_BRIDGE || - pci_get_vendor(dev) != 0x108e || - strcmp(ofw_bus_get_name(dev), "ebus") != 0) - return (ENXIO); - - if (pci_get_device(dev) == 0x1000) - device_set_desc(dev, "PCI-EBus2 bridge"); - else if (pci_get_device(dev) == 0x1100) - device_set_desc(dev, "PCI-EBus3 bridge"); - else - return (ENXIO); - return (BUS_PROBE_GENERIC); -} - -static int -ebus_nexus_attach(device_t dev) -{ - struct ebus_softc *sc; - phandle_t node; - - sc = device_get_softc(dev); - node = ofw_bus_get_node(dev); - -#ifndef SUN4V - if (OF_getprop(node, "portid", &sc->sc_ign, - sizeof(sc->sc_ign)) == -1) { - device_printf(dev, "could not determine IGN"); - return (ENXIO); - } -#endif - - sc->sc_nrange = OF_getprop_alloc_multi(node, "ranges", - sizeof(struct ebus_nexus_ranges), &sc->sc_range); - if (sc->sc_nrange == -1) { - device_printf(dev, "could not get ranges property\n"); - return (ENXIO); - } - return (ebus_attach(dev, sc, node)); -} - -static int -ebus_pci_attach(device_t dev) -{ - struct ebus_softc *sc; - struct ebus_rinfo *eri; - struct resource *res; - struct isa_ranges *range; - phandle_t node; - int i, rnum, rid; - - sc = device_get_softc(dev); - sc->sc_flags |= EBUS_PCI; - - pci_write_config(dev, PCIR_COMMAND, - pci_read_config(dev, PCIR_COMMAND, 2) | PCIM_CMD_SERRESPEN | - PCIM_CMD_PERRESPEN | PCIM_CMD_BUSMASTEREN | PCIM_CMD_MEMEN, 2); - pci_write_config(dev, PCIR_CACHELNSZ, 16 /* 64 bytes */, 1); - pci_write_config(dev, PCIR_LATTIMER, 64 /* 64 PCI cycles */, 1); - - node = ofw_bus_get_node(dev); - sc->sc_nrange = OF_getprop_alloc_multi(node, "ranges", - sizeof(struct isa_ranges), &sc->sc_range); - if (sc->sc_nrange == -1) { - device_printf(dev, "could not get ranges property\n"); - return (ENXIO); - } - - sc->sc_rinfo = malloc(sizeof(*sc->sc_rinfo) * sc->sc_nrange, M_DEVBUF, - M_WAITOK | M_ZERO); - - /* For every range, there must be a matching resource. */ - for (rnum = 0; rnum < sc->sc_nrange; rnum++) { - eri = &sc->sc_rinfo[rnum]; - range = &((struct isa_ranges *)sc->sc_range)[rnum]; - eri->eri_rtype = ofw_isa_range_restype(range); - rid = PCIR_BAR(rnum); - res = bus_alloc_resource_any(dev, eri->eri_rtype, &rid, - RF_ACTIVE); - if (res == NULL) { - device_printf(dev, - "could not allocate range resource %d\n", rnum); - goto fail; - } - if (rman_get_start(res) != ISA_RANGE_PHYS(range)) { - device_printf(dev, - "mismatch in start of range %d (0x%lx/0x%lx)\n", - rnum, rman_get_start(res), ISA_RANGE_PHYS(range)); - goto fail; - } - if (rman_get_size(res) != range->size) { - device_printf(dev, - "mismatch in size of range %d (0x%lx/0x%x)\n", - rnum, rman_get_size(res), range->size); - goto fail; - } - eri->eri_res = res; - eri->eri_rman.rm_type = RMAN_ARRAY; - eri->eri_rman.rm_descr = "EBus range"; - if (rman_init_from_resource(&eri->eri_rman, res) != 0) { - device_printf(dev, - "could not initialize rman for range %d", rnum); - goto fail; - } - } - return (ebus_attach(dev, sc, node)); - - fail: - for (i = rnum; i >= 0; i--) { - eri = &sc->sc_rinfo[i]; - if (i < rnum) - rman_fini(&eri->eri_rman); - if (eri->eri_res != NULL) { - bus_release_resource(dev, eri->eri_rtype, - PCIR_BAR(rnum), eri->eri_res); - } - } - free(sc->sc_rinfo, M_DEVBUF); - OF_prop_free(sc->sc_range); - return (ENXIO); -} - -static int -ebus_attach(device_t dev, struct ebus_softc *sc, phandle_t node) -{ - struct ebus_devinfo *edi; - device_t cdev; - - ofw_bus_setup_iinfo(node, &sc->sc_iinfo, sizeof(ofw_isa_intr_t)); - - /* - * Now attach our children. - */ - for (node = OF_child(node); node > 0; node = OF_peer(node)) { - if ((edi = ebus_setup_dinfo(dev, sc, node)) == NULL) - continue; - if ((cdev = device_add_child(dev, NULL, -1)) == NULL) { - device_printf(dev, "<%s>: device_add_child failed\n", - edi->edi_obdinfo.obd_name); - ebus_destroy_dinfo(edi); - continue; - } - device_set_ivars(cdev, edi); - } - return (bus_generic_attach(dev)); -} - -static int -ebus_print_child(device_t dev, device_t child) -{ - int retval; - - retval = bus_print_child_header(dev, child); - retval += ebus_print_res(device_get_ivars(child)); - retval += bus_print_child_footer(dev, child); - return (retval); -} - -static void -ebus_probe_nomatch(device_t dev, device_t child) -{ - - device_printf(dev, "<%s>", ofw_bus_get_name(child)); - ebus_print_res(device_get_ivars(child)); - printf(" (no driver attached)\n"); -} - -static struct resource * -ebus_alloc_resource(device_t bus, device_t child, int type, int *rid, - rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) -{ - struct ebus_softc *sc; - struct resource_list *rl; - struct resource_list_entry *rle = NULL; - struct resource *res; - struct ebus_rinfo *eri; - struct ebus_nexus_ranges *enr; - uint64_t cend, cstart, offset; - int i, isdefault, passthrough, ridx; - - isdefault = RMAN_IS_DEFAULT_RANGE(start, end); - passthrough = (device_get_parent(child) != bus); - sc = device_get_softc(bus); - rl = BUS_GET_RESOURCE_LIST(bus, child); - switch (type) { - case SYS_RES_MEMORY: - KASSERT(!(isdefault && passthrough), - ("%s: passthrough of default allocation", __func__)); - if (!passthrough) { - rle = resource_list_find(rl, type, *rid); - if (rle == NULL) - return (NULL); - KASSERT(rle->res == NULL, - ("%s: resource entry is busy", __func__)); - if (isdefault) { - start = rle->start; - count = ulmax(count, rle->count); - end = ulmax(rle->end, start + count - 1); - } - } - - res = NULL; - if ((sc->sc_flags & EBUS_PCI) != 0) { - /* - * Map EBus ranges to PCI ranges. This may include - * changing the allocation type. - */ - type = ofw_isa_range_map(sc->sc_range, sc->sc_nrange, - &start, &end, &ridx); - eri = &sc->sc_rinfo[ridx]; - res = rman_reserve_resource(&eri->eri_rman, start, - end, count, flags & ~RF_ACTIVE, child); - if (res == NULL) - return (NULL); - rman_set_rid(res, *rid); - if ((flags & RF_ACTIVE) != 0 && bus_activate_resource( - child, type, *rid, res) != 0) { - rman_release_resource(res); - return (NULL); - } - } else { - /* Map EBus ranges to nexus ranges. */ - for (i = 0; i < sc->sc_nrange; i++) { - enr = &((struct ebus_nexus_ranges *) - sc->sc_range)[i]; - cstart = (((uint64_t)enr->child_hi) << 32) | - enr->child_lo; - cend = cstart + enr->size - 1; - if (start >= cstart && end <= cend) { - offset = - (((uint64_t)enr->phys_hi) << 32) | - enr->phys_lo; - start += offset - cstart; - end += offset - cstart; - res = bus_generic_alloc_resource(bus, - child, type, rid, start, end, - count, flags); - break; - } - } - } - if (!passthrough) - rle->res = res; - return (res); - case SYS_RES_IRQ: - return (resource_list_alloc(rl, bus, child, type, rid, start, - end, count, flags)); - } - return (NULL); -} - -static int -ebus_activate_resource(device_t bus, device_t child, int type, int rid, - struct resource *res) -{ - struct ebus_softc *sc; - struct ebus_rinfo *eri; - bus_space_tag_t bt; - bus_space_handle_t bh; - int i, rv; - - sc = device_get_softc(bus); - if ((sc->sc_flags & EBUS_PCI) != 0 && type != SYS_RES_IRQ) { - for (i = 0; i < sc->sc_nrange; i++) { - eri = &sc->sc_rinfo[i]; - if (rman_is_region_manager(res, &eri->eri_rman) != 0) { - bt = rman_get_bustag(eri->eri_res); - rv = bus_space_subregion(bt, - rman_get_bushandle(eri->eri_res), - rman_get_start(res) - - rman_get_start(eri->eri_res), - rman_get_size(res), &bh); - if (rv != 0) - return (rv); - rman_set_bustag(res, bt); - rman_set_bushandle(res, bh); - return (rman_activate_resource(res)); - } - } - return (EINVAL); - } - return (bus_generic_activate_resource(bus, child, type, rid, res)); -} - -static int -ebus_adjust_resource(device_t bus __unused, device_t child __unused, - int type __unused, struct resource *res __unused, rman_res_t start __unused, - rman_res_t end __unused) -{ - - return (ENXIO); -} - -static int -ebus_release_resource(device_t bus, device_t child, int type, int rid, - struct resource *res) -{ - struct ebus_softc *sc; - struct resource_list *rl; - struct resource_list_entry *rle; - int passthrough, rv; - - passthrough = (device_get_parent(child) != bus); - rl = BUS_GET_RESOURCE_LIST(bus, child); - sc = device_get_softc(bus); - if ((sc->sc_flags & EBUS_PCI) != 0 && type != SYS_RES_IRQ) { - if ((rman_get_flags(res) & RF_ACTIVE) != 0 ){ - rv = bus_deactivate_resource(child, type, rid, res); - if (rv != 0) - return (rv); - } - rv = rman_release_resource(res); - if (rv != 0) - return (rv); - if (!passthrough) { - rle = resource_list_find(rl, type, rid); - KASSERT(rle != NULL, - ("%s: resource entry not found!", __func__)); - KASSERT(rle->res != NULL, - ("%s: resource entry is not busy", __func__)); - rle->res = NULL; - } - return (0); - } - return (resource_list_release(rl, bus, child, type, rid, res)); -} - -static int -ebus_setup_intr(device_t dev, device_t child, struct resource *ires, - int flags, driver_filter_t *filt, driver_intr_t *intr, void *arg, - void **cookiep) -{ -#ifndef SUN4V - struct ebus_softc *sc; - u_long vec; - - sc = device_get_softc(dev); - if ((sc->sc_flags & EBUS_PCI) == 0) { - /* - * Make sure the vector is fully specified. This isn't - * necessarily the case with the PCI variant. - */ - vec = rman_get_start(ires); - if (INTIGN(vec) != sc->sc_ign) { - device_printf(dev, - "invalid interrupt vector 0x%lx\n", vec); - return (EINVAL); - } - - /* - * As we rely on the interrupt controllers of the - * accompanying PCI-Express bridge ensure at least - * something is registered for this vector. - */ - if (intr_vectors[vec].iv_ic == NULL) { - device_printf(dev, - "invalid interrupt controller for vector 0x%lx\n", - vec); - return (EINVAL); - } - } -#endif - return (bus_generic_setup_intr(dev, child, ires, flags, filt, intr, - arg, cookiep)); -} - -static struct resource_list * -ebus_get_resource_list(device_t dev, device_t child) -{ - struct ebus_devinfo *edi; - - edi = device_get_ivars(child); - return (&edi->edi_rl); -} - -static const struct ofw_bus_devinfo * -ebus_get_devinfo(device_t bus, device_t dev) -{ - struct ebus_devinfo *edi; - - edi = device_get_ivars(dev); - return (&edi->edi_obdinfo); -} - -static struct ebus_devinfo * -ebus_setup_dinfo(device_t dev, struct ebus_softc *sc, phandle_t node) -{ - struct isa_regs reg, *regs; - ofw_isa_intr_t intr, *intrs; - struct ebus_devinfo *edi; - uint64_t start; - uint32_t rintr; - int i, nintr, nreg, rv; - - edi = malloc(sizeof(*edi), M_DEVBUF, M_ZERO | M_WAITOK); - if (ofw_bus_gen_setup_devinfo(&edi->edi_obdinfo, node) != 0) { - free(edi, M_DEVBUF); - return (NULL); - } - resource_list_init(&edi->edi_rl); - nreg = OF_getprop_alloc_multi(node, "reg", sizeof(*regs), (void **)®s); - if (nreg == -1) { - device_printf(dev, "<%s>: incomplete\n", - edi->edi_obdinfo.obd_name); - ebus_destroy_dinfo(edi); - return (NULL); - } - for (i = 0; i < nreg; i++) { - start = ISA_REG_PHYS(regs + i); - (void)resource_list_add(&edi->edi_rl, SYS_RES_MEMORY, i, - start, start + regs[i].size - 1, regs[i].size); - } - OF_prop_free(regs); - - nintr = OF_getprop_alloc_multi(node, "interrupts", sizeof(*intrs), - (void **)&intrs); - if (nintr == -1) - return (edi); - for (i = 0; i < nintr; i++) { - rv = 0; - if ((sc->sc_flags & EBUS_PCI) != 0) { - rintr = ofw_isa_route_intr(dev, node, &sc->sc_iinfo, - intrs[i]); - } else { - intr = intrs[i]; - rv = ofw_bus_lookup_imap(node, &sc->sc_iinfo, ®, - sizeof(reg), &intr, sizeof(intr), &rintr, - sizeof(rintr), NULL); -#ifndef SUN4V - if (rv != 0) - rintr = INTMAP_VEC(sc->sc_ign, rintr); -#endif - } - if ((sc->sc_flags & EBUS_PCI) == 0 ? rv == 0 : - rintr == PCI_INVALID_IRQ) { - device_printf(dev, - "<%s>: could not map EBus interrupt %d\n", - edi->edi_obdinfo.obd_name, intrs[i]); - continue; - } - (void)resource_list_add(&edi->edi_rl, SYS_RES_IRQ, i, rintr, - rintr, 1); - } - OF_prop_free(intrs); - return (edi); -} - -static void -ebus_destroy_dinfo(struct ebus_devinfo *edi) -{ - - resource_list_free(&edi->edi_rl); - ofw_bus_gen_destroy_devinfo(&edi->edi_obdinfo); - free(edi, M_DEVBUF); -} - -static int -ebus_print_res(struct ebus_devinfo *edi) -{ - int retval; - - retval = 0; - retval += resource_list_print_type(&edi->edi_rl, "addr", SYS_RES_MEMORY, - "%#jx"); - retval += resource_list_print_type(&edi->edi_rl, "irq", SYS_RES_IRQ, - "%jd"); - return (retval); -} diff --git a/sys/sparc64/ebus/ebusreg.h b/sys/sparc64/ebus/ebusreg.h deleted file mode 100644 index 53a4cdd3dc1180..00000000000000 --- a/sys/sparc64/ebus/ebusreg.h +++ /dev/null @@ -1,91 +0,0 @@ -/* $FreeBSD$ */ -/* $OpenBSD: ebusreg.h,v 1.4 2001/10/01 18:08:04 jason Exp $ */ -/* $NetBSD: ebusreg.h,v 1.8 2008/05/29 14:51:27 mrg Exp $ */ - -/*- - * SPDX-License-Identifier: BSD-2-Clause-NetBSD - * - * Copyright (c) 1999 Matthew R. Green - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ - -/* - * UltraSPARC `ebus' - * - * The `ebus' bus is designed to plug traditional PC-ISA devices into - * an SPARC system with as few costs as possible, without sacrificing - * to performance. Typically, it is implemented in the PCIO IC from - * SME, which also implements a `hme-compatible' PCI network device - * (`network'). The ebus has 4 DMA channels, similar to the DMA seen - * in the ESP SCSI DMA. - * - * Typical UltraSPARC systems have a NatSemi SuperIO IC to provide - * serial ports for the keyboard and mouse (`se'), floppy disk - * controller (`fdthree'), parallel port controller (`bpp') connected - * to the ebus, and a PCI-IDE controller (connected directly to the - * PCI bus, of course), as well as a Siemens Nixdorf SAB82532 dual - * channel serial controller (`su' providing ttya and ttyb), an MK48T59 - * EEPROM/clock controller (also where the idprom, including the - * ethernet address, is located), the audio system (`SUNW,CS4231', same - * as other UltraSPARC and some SPARC systems), and other various - * internal devices found on traditional SPARC systems such as the - * `power', `flashprom', etc., devices. - * - * The ebus uses an interrupt mapping scheme similar to PCI, though - * the actual structures are different. - */ - -/* EBUS dma registers */ -#define EBDMA_DCSR 0x0 /* control/status */ -#define EBDMA_DADDR 0x4 /* DMA address */ -#define EBDMA_DCNT 0x8 /* DMA count */ - -/* EBUS DMA control/status (EBDMA_DCSR) */ -#define EBDCSR_INT 0x00000001 /* interrupt pending */ -#define EBDCSR_ERR 0x00000002 /* error pending */ -#define EBDCSR_DRAIN 0x00000004 /* drain */ -#define EBDCSR_INTEN 0x00000010 /* interrupt enable */ -#define EBDCSR_RESET 0x00000080 /* reset */ -#define EBDCSR_WRITE 0x00000100 /* write */ -#define EBDCSR_DMAEN 0x00000200 /* dma enable */ -#define EBDCSR_CYC 0x00000400 /* cyc pending */ -#define EBDCSR_DIAGRD 0x00000800 /* diagnostic read done */ -#define EBDCSR_DIAGWR 0x00001000 /* diagnostic write done */ -#define EBDCSR_CNTEN 0x00002000 /* count enable */ -#define EBDCSR_TC 0x00004000 /* terminal count */ -#define EBDCSR_CSRDRNDIS 0x00010000 /* disable csr drain */ -#define EBDCSR_BURSTMASK 0x000c0000 /* burst size mask */ -#define EBDCSR_BURST_1 0x00080000 /* burst 1 */ -#define EBDCSR_BURST_4 0x00000000 /* burst 4 */ -#define EBDCSR_BURST_8 0x00040000 /* burst 8 */ -#define EBDCSR_BURST_16 0x000c0000 /* burst 16 */ -#define EBDCSR_DIAGEN 0x00100000 /* enable diagnostics */ -#define EBDCSR_ERRDIS 0x00400000 /* disable error pending */ -#define EBDCSR_TCIDIS 0x00800000 /* disable TCI */ -#define EBDCSR_NEXTEN 0x01000000 /* enable next */ -#define EBDCSR_DMAON 0x02000000 /* dma on */ -#define EBDCSR_A_LOADED 0x04000000 /* address loaded */ -#define EBDCSR_NA_LOADED 0x08000000 /* next address loaded */ -#define EBDCSR_DEVMASK 0xf0000000 /* device id mask */ diff --git a/sys/sparc64/ebus/epic.c b/sys/sparc64/ebus/epic.c deleted file mode 100644 index 68634a863f1bbe..00000000000000 --- a/sys/sparc64/ebus/epic.c +++ /dev/null @@ -1,218 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2009 Marius Strobl - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include - -#define EPIC_DELAY 10000 - -#define EPIC_NREG 1 -#define EPIC_FW_LED 0 - -#define EPIC_FW_LED_DATA 0x40 -#define EPIC_FW_LED_ADDR 0x41 -#define EPIC_FW_LED_WRITE_MASK 0x80 - -#define EPIC_FW_VERSION 0x05 -#define EPIC_LED_STATE0 0x06 - -#define EPIC_LED_ALERT_MASK 0x0c -#define EPIC_LED_ALERT_OFF 0x00 -#define EPIC_LED_ALERT_ON 0x04 - -#define EPIC_LED_POWER_MASK 0x30 -#define EPIC_LED_POWER_OFF 0x00 -#define EPIC_LED_POWER_ON 0x10 -#define EPIC_LED_POWER_SB_BLINK 0x20 -#define EPIC_LED_POWER_FAST_BLINK 0x30 - -static struct resource_spec epic_res_spec[] = { - { SYS_RES_MEMORY, EPIC_FW_LED, RF_ACTIVE }, - { -1, 0 } -}; - -struct epic_softc { - struct mtx sc_mtx; - struct resource *sc_res[EPIC_NREG]; - struct cdev *sc_led_dev_alert; - struct cdev *sc_led_dev_power; -}; - -#define EPIC_FW_LED_READ(sc, off) ({ \ - uint8_t __val; \ - bus_write_1((sc)->sc_res[EPIC_FW_LED], EPIC_FW_LED_ADDR, (off));\ - bus_barrier((sc)->sc_res[EPIC_FW_LED], EPIC_FW_LED_ADDR, 1, \ - BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); \ - DELAY(EPIC_DELAY); \ - __val = bus_read_1((sc)->sc_res[EPIC_FW_LED], EPIC_FW_LED_DATA);\ - bus_barrier((sc)->sc_res[EPIC_FW_LED], EPIC_FW_LED_DATA, 1, \ - BUS_SPACE_BARRIER_READ); \ - DELAY(EPIC_DELAY); \ - __val; \ -}) - -#define EPIC_FW_LED_WRITE(sc, off, mask, val) do { \ - bus_write_1((sc)->sc_res[EPIC_FW_LED], EPIC_FW_LED_ADDR, (off));\ - bus_barrier((sc)->sc_res[EPIC_FW_LED], EPIC_FW_LED_ADDR, 1, \ - BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); \ - DELAY(EPIC_DELAY); \ - bus_write_1((sc)->sc_res[EPIC_FW_LED], EPIC_FW_LED_WRITE_MASK, \ - (mask)); \ - bus_barrier((sc)->sc_res[EPIC_FW_LED], EPIC_FW_LED_WRITE_MASK, \ - 1, BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); \ - DELAY(EPIC_DELAY); \ - bus_write_1((sc)->sc_res[EPIC_FW_LED], EPIC_FW_LED_DATA, (val));\ - bus_barrier((sc)->sc_res[EPIC_FW_LED], EPIC_FW_LED_DATA, 1, \ - BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); \ - DELAY(EPIC_DELAY); \ -} while (0) - -#define EPIC_LOCK_INIT(sc) \ - mtx_init(&(sc)->sc_mtx, "epic mtx", NULL, MTX_DEF) -#define EPIC_LOCK_DESTROY(sc) mtx_destroy(&(sc)->sc_mtx) -#define EPIC_LOCK(sc) mtx_lock(&(sc)->sc_mtx) -#define EPIC_UNLOCK(sc) mtx_unlock(&(sc)->sc_mtx) - -static device_probe_t epic_probe; -static device_attach_t epic_attach; -static device_detach_t epic_detach; - -static void epic_led_alert(void *arg, int onoff); -static void epic_led_power(void *arg, int onoff); - -static device_method_t epic_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, epic_probe), - DEVMETHOD(device_attach, epic_attach), - DEVMETHOD(device_detach, epic_detach), - - DEVMETHOD_END -}; - -static devclass_t epic_devclass; - -DEFINE_CLASS_0(epic, epic_driver, epic_methods, - sizeof(struct epic_softc)); -DRIVER_MODULE(epic, ebus, epic_driver, epic_devclass, 0, 0); - -static int -epic_probe(device_t dev) -{ - const char* compat; - - compat = ofw_bus_get_compat(dev); - if (compat != NULL && strcmp(ofw_bus_get_name(dev), - "env-monitor") == 0 && strcmp(compat, "epic") == 0) { - device_set_desc(dev, "Sun Fire V215/V245 LEDs"); - return (BUS_PROBE_DEFAULT); - } - return (ENXIO); -} - -static int -epic_attach(device_t dev) -{ - struct epic_softc *sc; - - sc = device_get_softc(dev); - if (bus_alloc_resources(dev, epic_res_spec, sc->sc_res)) { - device_printf(dev, "failed to allocate resources\n"); - bus_release_resources(dev, epic_res_spec, sc->sc_res); - return (ENXIO); - } - - EPIC_LOCK_INIT(sc); - - if (bootverbose) - device_printf(dev, "version 0x%x\n", - EPIC_FW_LED_READ(sc, EPIC_FW_VERSION)); - - sc->sc_led_dev_alert = led_create(epic_led_alert, sc, "alert"); - sc->sc_led_dev_power = led_create(epic_led_power, sc, "power"); - - return (0); -} - -static int -epic_detach(device_t dev) -{ - struct epic_softc *sc; - - sc = device_get_softc(dev); - - led_destroy(sc->sc_led_dev_alert); - led_destroy(sc->sc_led_dev_power); - - bus_release_resources(dev, epic_res_spec, sc->sc_res); - - EPIC_LOCK_DESTROY(sc); - - return (0); -} - -static void -epic_led_alert(void *arg, int onoff) -{ - struct epic_softc *sc; - - sc = (struct epic_softc *)arg; - - EPIC_LOCK(sc); - EPIC_FW_LED_WRITE(sc, EPIC_LED_STATE0, EPIC_LED_ALERT_MASK, - onoff ? EPIC_LED_ALERT_ON : EPIC_LED_ALERT_OFF); - EPIC_UNLOCK(sc); -} - -static void -epic_led_power(void *arg, int onoff) -{ - struct epic_softc *sc; - - sc = (struct epic_softc *)arg; - - EPIC_LOCK(sc); - EPIC_FW_LED_WRITE(sc, EPIC_LED_STATE0, EPIC_LED_POWER_MASK, - onoff ? EPIC_LED_POWER_ON : EPIC_LED_POWER_OFF); - EPIC_UNLOCK(sc); -} diff --git a/sys/sparc64/fhc/clkbrd.c b/sys/sparc64/fhc/clkbrd.c deleted file mode 100644 index 002030f42508d6..00000000000000 --- a/sys/sparc64/fhc/clkbrd.c +++ /dev/null @@ -1,214 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * - * Copyright (c) 2004 Jason L. Wright (jason@thought.net) - * Copyright (c) 2005 Marius Strobl - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * from: OpenBSD: clkbrd.c,v 1.5 2004/10/01 18:18:49 jason Exp - */ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include - -#include - -#define CLKBRD_NREG 3 - -#define CLKBRD_CF 0 -#define CLKBRD_CLK 1 -#define CLKBRD_CLKVER 2 - -struct clkbrd_softc { - device_t sc_dev; - struct resource *sc_res[CLKBRD_NREG]; - int sc_rid[CLKBRD_NREG]; - bus_space_tag_t sc_bt[CLKBRD_NREG]; - bus_space_handle_t sc_bh[CLKBRD_NREG]; - uint8_t sc_clk_ctrl; - struct cdev *sc_led_dev; - int sc_flags; -#define CLKBRD_HAS_CLKVER (1 << 0) -}; - -static devclass_t clkbrd_devclass; - -static device_probe_t clkbrd_probe; -static device_attach_t clkbrd_attach; -static device_detach_t clkbrd_detach; - -static void clkbrd_free_resources(struct clkbrd_softc *); -static void clkbrd_led_func(void *, int); - -static device_method_t clkbrd_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, clkbrd_probe), - DEVMETHOD(device_attach, clkbrd_attach), - DEVMETHOD(device_detach, clkbrd_detach), - - { 0, 0 } -}; - -static driver_t clkbrd_driver = { - "clkbrd", - clkbrd_methods, - sizeof(struct clkbrd_softc), -}; - -DRIVER_MODULE(clkbrd, fhc, clkbrd_driver, clkbrd_devclass, 0, 0); - -static int -clkbrd_probe(device_t dev) -{ - - if (strcmp(ofw_bus_get_name(dev), "clock-board") == 0) { - device_set_desc(dev, "Clock Board"); - return (0); - } - return (ENXIO); -} - -static int -clkbrd_attach(device_t dev) -{ - struct clkbrd_softc *sc; - int i, slots; - uint8_t r; - - sc = device_get_softc(dev); - sc->sc_dev = dev; - - for (i = CLKBRD_CF; i <= CLKBRD_CLKVER; i++) { - sc->sc_rid[i] = i; - sc->sc_res[i] = bus_alloc_resource_any(sc->sc_dev, - SYS_RES_MEMORY, &sc->sc_rid[i], RF_ACTIVE); - if (sc->sc_res[i] == NULL) { - if (i != CLKBRD_CLKVER) { - device_printf(sc->sc_dev, - "could not allocate resource %d\n", i); - goto fail; - } - continue; - } - sc->sc_bt[i] = rman_get_bustag(sc->sc_res[i]); - sc->sc_bh[i] = rman_get_bushandle(sc->sc_res[i]); - if (i == CLKBRD_CLKVER) - sc->sc_flags |= CLKBRD_HAS_CLKVER; - } - - slots = 4; - r = bus_space_read_1(sc->sc_bt[CLKBRD_CLK], sc->sc_bh[CLKBRD_CLK], - CLK_STS1); - switch (r & CLK_STS1_SLOTS_MASK) { - case CLK_STS1_SLOTS_16: - slots = 16; - break; - case CLK_STS1_SLOTS_8: - slots = 8; - break; - case CLK_STS1_SLOTS_4: - if (sc->sc_flags & CLKBRD_HAS_CLKVER) { - r = bus_space_read_1(sc->sc_bt[CLKBRD_CLKVER], - sc->sc_bh[CLKBRD_CLKVER], CLKVER_SLOTS); - if (r != 0 && - (r & CLKVER_SLOTS_MASK) == CLKVER_SLOTS_PLUS) - slots = 5; - } - } - - device_printf(sc->sc_dev, "Sun Enterprise Exx00 machine: %d slots\n", - slots); - - sc->sc_clk_ctrl = bus_space_read_1(sc->sc_bt[CLKBRD_CLK], - sc->sc_bh[CLKBRD_CLK], CLK_CTRL); - sc->sc_led_dev = led_create(clkbrd_led_func, sc, "clockboard"); - - return (0); - - fail: - clkbrd_free_resources(sc); - - return (ENXIO); -} - -static int -clkbrd_detach(device_t dev) -{ - struct clkbrd_softc *sc; - - sc = device_get_softc(dev); - - led_destroy(sc->sc_led_dev); - bus_space_write_1(sc->sc_bt[CLKBRD_CLK], sc->sc_bh[CLKBRD_CLK], - CLK_CTRL, sc->sc_clk_ctrl); - bus_space_read_1(sc->sc_bt[CLKBRD_CLK], sc->sc_bh[CLKBRD_CLK], - CLK_CTRL); - clkbrd_free_resources(sc); - - return (0); -} - -static void -clkbrd_free_resources(struct clkbrd_softc *sc) -{ - int i; - - for (i = CLKBRD_CF; i <= CLKBRD_CLKVER; i++) - if (sc->sc_res[i] != NULL) - bus_release_resource(sc->sc_dev, SYS_RES_MEMORY, - sc->sc_rid[i], sc->sc_res[i]); -} - -static void -clkbrd_led_func(void *arg, int onoff) -{ - struct clkbrd_softc *sc; - uint8_t r; - - sc = (struct clkbrd_softc *)arg; - - r = bus_space_read_1(sc->sc_bt[CLKBRD_CLK], sc->sc_bh[CLKBRD_CLK], - CLK_CTRL); - if (onoff) - r |= CLK_CTRL_RLED; - else - r &= ~CLK_CTRL_RLED; - bus_space_write_1(sc->sc_bt[CLKBRD_CLK], sc->sc_bh[CLKBRD_CLK], - CLK_CTRL, r); - bus_space_read_1(sc->sc_bt[CLKBRD_CLK], sc->sc_bh[CLKBRD_CLK], - CLK_CTRL); -} diff --git a/sys/sparc64/fhc/clkbrdreg.h b/sys/sparc64/fhc/clkbrdreg.h deleted file mode 100644 index ec5baa79142e0f..00000000000000 --- a/sys/sparc64/fhc/clkbrdreg.h +++ /dev/null @@ -1,99 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * - * Copyright (c) 2004 Jason L. Wright (jason@thought.net) - * Copyright (c) 2006 Marius Strobl - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * from: OpenBSD: clkbrdreg.h,v 1.2 2004/10/01 15:36:30 jason Exp - * - * $FreeBSD$ - */ - -#ifndef _SPARC64_FHC_CLKBRDREG_H_ -#define _SPARC64_FHC_CLKBRDREG_H_ - -/* register bank 0 */ -#define CLK_CF_REG2 0x20 /* clock frequency register 2 */ -#define CLK_CF_REG2_REN_RCONS 0x80 /* reset enable: remote console */ -#define CLK_CF_REG2_REN_GEN 0x40 /* reset enable: frequency change */ -#define CLK_CF_REG2_REN_WDOG 0x20 /* reset enable: watchdog */ -#define CLK_CF_REG2_DIV1 0x10 /* CPU module divisor bit 1 */ -#define CLK_CF_REG2_RANGE 0x0c /* clock range */ -#define CLK_CF_REG2_DIV0 0x02 /* CPU module divisor bit 0 */ -#define CLK_CF_REG2_FREQ8 0x01 /* frequency bit 8 */ - -/* register bank 1 */ -#define CLK_CTRL 0x00 /* system control register */ -#define CLK_CTRL_IEN_FAN 0x80 /* intr enable: fan failure */ -#define CLK_CTRL_IEN_DC 0x40 /* intr enable: power supply DC */ -#define CLK_CTRL_IEN_AC 0x20 /* intr enable: AC power */ -#define CLK_CTRL_IEN_BRD 0x10 /* intr enable: board insert */ -#define CLK_CTRL_POFF 0x08 /* turn off system power */ -#define CLK_CTRL_LLED 0x04 /* left led (reversed) */ -#define CLK_CTRL_MLED 0x02 /* middle led */ -#define CLK_CTRL_RLED 0x01 /* right led */ -#define CLK_STS1 0x10 /* system status register 1 */ -#define CLK_STS1_SLOTS_MASK 0xc0 /* system status 1 slots mask */ -#define CLK_STS1_SLOTS_16 0x40 /* 16 slots */ -#define CLK_STS1_SLOTS_8 0xc0 /* 8 slots */ -#define CLK_STS1_SLOTS_4 0x80 /* 4 slots */ -#define CLK_STS1_SLOTS_TESTBED 0x00 /* test machine */ -#define CLK_STS1_SECURE 0x20 /* key in position secure (reversed) */ -#define CLK_STS1_FAN 0x10 /* fan tray present (reversed) */ -#define CLK_STS1_BRD 0x08 /* board inserted (reversed) */ -#define CLK_STS1_PS0 0x04 /* power supply 0 present (reversed) */ -#define CLK_STS1_RST_WDOG 0x02 /* rst by: watchdog (reversed) */ -#define CLK_STS1_RST_GEN 0x01 /* rst by: freq change (reversed) */ -#define CLK_STS2 0x20 /* system status register 2 */ -#define CLK_STS2_RST_RCONS 0x80 /* rst by: remote console (reversed) */ -#define CLK_STS2_OK_PS0 0x40 /* ok: power supply 0 */ -#define CLK_STS2_OK_33V 0x20 /* ok: 3.3V on clock board */ -#define CLK_STS2_OK_50V 0x10 /* ok: 5.0V on clock board */ -#define CLK_STS2_FAIL_AC 0x08 /* failed: AC power */ -#define CLK_STS2_FAIL_FAN 0x04 /* failed: rack fans */ -#define CLK_STS2_OK_ACFAN 0x02 /* ok: 4 AC box fans */ -#define CLK_STS2_OK_KEYFAN 0x01 /* ok: keyswitch fans */ -#define CLK_PSTS1 0x30 /* power supply 1 status register */ -#define CLK_PSTS1_PS 0x80 /* power supply 1 present (reversed) */ -#define CLK_PPRES 0x40 /* power supply presence register */ -#define CLK_PPRES_CSHARE 0x80 /* current share backplane */ -#define CLK_PPRES_OK_MASK 0x7f /* precharge and peripheral pwr mask */ -#define CLK_PPRES_OK_P_5V 0x40 /* ok: peripheral 5V */ -#define CLK_PPRES_OK_P_12V 0x20 /* ok: peripheral 12V */ -#define CLK_PPRES_OK_AUX_5V 0x10 /* ok: auxiliary 5V */ -#define CLK_PPRES_OK_PP_5V 0x08 /* ok: peripheral 5V precharge */ -#define CLK_PPRES_OK_PP_12V 0x04 /* ok: peripheral 12V precharge */ -#define CLK_PPRES_OK_SP_3V 0x02 /* ok: system 3.3V precharge */ -#define CLK_PPRES_OK_SP_5V 0x01 /* ok: system 5V precharge */ -#define CLK_TEMP 0x50 /* temperature register */ -#define CLK_IDIAG 0x60 /* interrupt diagnostic register */ -#define CLK_PSTS2 0x70 /* power supply 2 status register */ - -/* register bank 2 */ -#define CLKVER_SLOTS 0x00 /* clock version slots register */ -#define CLKVER_SLOTS_MASK 0x80 /* clock version slots mask */ -#define CLKVER_SLOTS_PLUS 0x00 /* plus system (reversed) */ - -#endif /* !_SPARC64_FHC_CLKBRDREG_H_ */ diff --git a/sys/sparc64/fhc/fhc.c b/sys/sparc64/fhc/fhc.c deleted file mode 100644 index cc858cfc954487..00000000000000 --- a/sys/sparc64/fhc/fhc.c +++ /dev/null @@ -1,537 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2003 Jake Burkholder. - * Copyright (c) 2005 Marius Strobl - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include -#include -#include - -#include - -#include -#include - -struct fhc_devinfo { - struct ofw_bus_devinfo fdi_obdinfo; - struct resource_list fdi_rl; -}; - -struct fhc_softc { - struct resource *sc_memres[FHC_NREG]; - int sc_nrange; - struct sbus_ranges *sc_ranges; - int sc_ign; - struct cdev *sc_led_dev; -}; - -static device_probe_t fhc_probe; -static device_attach_t fhc_attach; -static bus_print_child_t fhc_print_child; -static bus_probe_nomatch_t fhc_probe_nomatch; -static bus_setup_intr_t fhc_setup_intr; -static bus_alloc_resource_t fhc_alloc_resource; -static bus_adjust_resource_t fhc_adjust_resource; -static bus_get_resource_list_t fhc_get_resource_list; -static ofw_bus_get_devinfo_t fhc_get_devinfo; - -static void fhc_intr_enable(void *); -static void fhc_intr_disable(void *); -static void fhc_intr_assign(void *); -static void fhc_intr_clear(void *); -static void fhc_led_func(void *, int); -static int fhc_print_res(struct fhc_devinfo *); - -static device_method_t fhc_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, fhc_probe), - DEVMETHOD(device_attach, fhc_attach), - DEVMETHOD(device_shutdown, bus_generic_shutdown), - DEVMETHOD(device_suspend, bus_generic_suspend), - DEVMETHOD(device_resume, bus_generic_resume), - - /* Bus interface */ - DEVMETHOD(bus_print_child, fhc_print_child), - DEVMETHOD(bus_probe_nomatch, fhc_probe_nomatch), - DEVMETHOD(bus_alloc_resource, fhc_alloc_resource), - DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), - DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), - DEVMETHOD(bus_adjust_resource, fhc_adjust_resource), - DEVMETHOD(bus_release_resource, bus_generic_rl_release_resource), - DEVMETHOD(bus_setup_intr, fhc_setup_intr), - DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), - DEVMETHOD(bus_get_resource, bus_generic_rl_get_resource), - DEVMETHOD(bus_get_resource_list, fhc_get_resource_list), - DEVMETHOD(bus_child_pnpinfo_str, ofw_bus_gen_child_pnpinfo_str), - - /* ofw_bus interface */ - DEVMETHOD(ofw_bus_get_devinfo, fhc_get_devinfo), - DEVMETHOD(ofw_bus_get_compat, ofw_bus_gen_get_compat), - DEVMETHOD(ofw_bus_get_model, ofw_bus_gen_get_model), - DEVMETHOD(ofw_bus_get_name, ofw_bus_gen_get_name), - DEVMETHOD(ofw_bus_get_node, ofw_bus_gen_get_node), - DEVMETHOD(ofw_bus_get_type, ofw_bus_gen_get_type), - - DEVMETHOD_END -}; - -static driver_t fhc_driver = { - "fhc", - fhc_methods, - sizeof(struct fhc_softc), -}; - -static devclass_t fhc_devclass; - -EARLY_DRIVER_MODULE(fhc, central, fhc_driver, fhc_devclass, 0, 0, - BUS_PASS_BUS); -MODULE_DEPEND(fhc, central, 1, 1, 1); -EARLY_DRIVER_MODULE(fhc, nexus, fhc_driver, fhc_devclass, 0, 0, - BUS_PASS_BUS); -MODULE_DEPEND(fhc, nexus, 1, 1, 1); -MODULE_VERSION(fhc, 1); - -static const struct intr_controller fhc_ic = { - fhc_intr_enable, - fhc_intr_disable, - fhc_intr_assign, - fhc_intr_clear -}; - -struct fhc_icarg { - struct fhc_softc *fica_sc; - struct resource *fica_memres; -}; - -static int -fhc_probe(device_t dev) -{ - - if (strcmp(ofw_bus_get_name(dev), "fhc") == 0) { - device_set_desc(dev, "fhc"); - return (0); - } - return (ENXIO); -} - -static int -fhc_attach(device_t dev) -{ - char ledname[sizeof("boardXX")]; - struct fhc_devinfo *fdi; - struct fhc_icarg *fica; - struct fhc_softc *sc; - struct sbus_regs *reg; - phandle_t child; - phandle_t node; - device_t cdev; - uint32_t board; - uint32_t ctrl; - uint32_t *intr; - uint32_t iv; - char *name; - int central; - int error; - int i; - int j; - - sc = device_get_softc(dev); - node = ofw_bus_get_node(dev); - - central = 0; - if (strcmp(device_get_name(device_get_parent(dev)), "central") == 0) - central = 1; - - for (i = 0; i < FHC_NREG; i++) { - j = i; - sc->sc_memres[i] = bus_alloc_resource_any(dev, SYS_RES_MEMORY, - &j, RF_ACTIVE); - if (sc->sc_memres[i] == NULL) { - device_printf(dev, "cannot allocate resource %d\n", i); - error = ENXIO; - goto fail_memres; - } - } - - if (central != 0) { - board = bus_read_4(sc->sc_memres[FHC_INTERNAL], FHC_BSR); - board = ((board >> 16) & 0x1) | ((board >> 12) & 0xe); - } else { - if (OF_getprop(node, "board#", &board, sizeof(board)) == -1) { - device_printf(dev, "cannot get board number\n"); - error = ENXIO; - goto fail_memres; - } - } - - device_printf(dev, "board %d, ", board); - if (OF_getprop_alloc(node, "board-model", (void **)&name) != -1) { - printf("model %s\n", name); - OF_prop_free(name); - } else - printf("model unknown\n"); - - for (i = FHC_FANFAIL; i <= FHC_TOD; i++) { - bus_write_4(sc->sc_memres[i], FHC_ICLR, INTCLR_IDLE); - (void)bus_read_4(sc->sc_memres[i], FHC_ICLR); - } - - sc->sc_ign = board << 1; - bus_write_4(sc->sc_memres[FHC_IGN], 0x0, sc->sc_ign); - sc->sc_ign = bus_read_4(sc->sc_memres[FHC_IGN], 0x0); - - ctrl = bus_read_4(sc->sc_memres[FHC_INTERNAL], FHC_CTRL); - if (central == 0) - ctrl |= FHC_CTRL_IXIST; - ctrl &= ~(FHC_CTRL_AOFF | FHC_CTRL_BOFF | FHC_CTRL_SLINE); - bus_write_4(sc->sc_memres[FHC_INTERNAL], FHC_CTRL, ctrl); - (void)bus_read_4(sc->sc_memres[FHC_INTERNAL], FHC_CTRL); - - sc->sc_nrange = OF_getprop_alloc_multi(node, "ranges", - sizeof(*sc->sc_ranges), (void **)&sc->sc_ranges); - if (sc->sc_nrange == -1) { - device_printf(dev, "cannot get ranges\n"); - error = ENXIO; - goto fail_memres; - } - - /* - * Apparently only the interrupt controller of boards hanging off - * of central(4) is indented to be used, otherwise we would have - * conflicts registering the interrupt controllers for all FHC - * boards as the board number and thus the IGN isn't unique. - */ - if (central == 1) { - /* - * Hunt through all the interrupt mapping regs and register - * our interrupt controller for the corresponding interrupt - * vectors. We do this early in order to be able to catch - * stray interrupts. - */ - for (i = FHC_FANFAIL; i <= FHC_TOD; i++) { - fica = malloc(sizeof(*fica), M_DEVBUF, M_NOWAIT); - if (fica == NULL) - panic("%s: could not allocate interrupt " - "controller argument", __func__); - fica->fica_sc = sc; - fica->fica_memres = sc->sc_memres[i]; -#ifdef FHC_DEBUG - device_printf(dev, "intr map %d: %#lx, clr: %#lx\n", i, - (u_long)bus_read_4(fica->fica_memres, FHC_IMAP), - (u_long)bus_read_4(fica->fica_memres, FHC_ICLR)); -#endif - /* - * XXX we only pick the INO rather than the INR - * from the IMR since the firmware may not provide - * the IGN and the IGN is constant for all devices - * on that FireHose controller. - */ - j = intr_controller_register(INTMAP_VEC(sc->sc_ign, - INTINO(bus_read_4(fica->fica_memres, FHC_IMAP))), - &fhc_ic, fica); - if (j != 0) - device_printf(dev, "could not register " - "interrupt controller for map %d (%d)\n", - i, j); - } - } else { - snprintf(ledname, sizeof(ledname), "board%d", board); - sc->sc_led_dev = led_create(fhc_led_func, sc, ledname); - } - - for (child = OF_child(node); child != 0; child = OF_peer(child)) { - fdi = malloc(sizeof(*fdi), M_DEVBUF, M_WAITOK | M_ZERO); - if (ofw_bus_gen_setup_devinfo(&fdi->fdi_obdinfo, child) != 0) { - free(fdi, M_DEVBUF); - continue; - } - i = OF_getprop_alloc_multi(child, "reg", sizeof(*reg), - (void **)®); - if (i == -1) { - device_printf(dev, "<%s>: incomplete\n", - fdi->fdi_obdinfo.obd_name); - ofw_bus_gen_destroy_devinfo(&fdi->fdi_obdinfo); - free(fdi, M_DEVBUF); - continue; - } - resource_list_init(&fdi->fdi_rl); - for (j = 0; j < i; j++) - resource_list_add(&fdi->fdi_rl, SYS_RES_MEMORY, j, - reg[j].sbr_offset, reg[j].sbr_offset + - reg[j].sbr_size, reg[j].sbr_size); - OF_prop_free(reg); - if (central == 1) { - i = OF_getprop_alloc_multi(child, "interrupts", - sizeof(*intr), (void **)&intr); - if (i != -1) { - for (j = 0; j < i; j++) { - iv = INTMAP_VEC(sc->sc_ign, intr[j]); - resource_list_add(&fdi->fdi_rl, - SYS_RES_IRQ, j, iv, iv, 1); - } - OF_prop_free(intr); - } - } - cdev = device_add_child(dev, NULL, -1); - if (cdev == NULL) { - device_printf(dev, "<%s>: device_add_child failed\n", - fdi->fdi_obdinfo.obd_name); - resource_list_free(&fdi->fdi_rl); - ofw_bus_gen_destroy_devinfo(&fdi->fdi_obdinfo); - free(fdi, M_DEVBUF); - continue; - } - device_set_ivars(cdev, fdi); - } - - return (bus_generic_attach(dev)); - - fail_memres: - for (i = 0; i < FHC_NREG; i++) - if (sc->sc_memres[i] != NULL) - bus_release_resource(dev, SYS_RES_MEMORY, - rman_get_rid(sc->sc_memres[i]), sc->sc_memres[i]); - return (error); -} - -static int -fhc_print_child(device_t dev, device_t child) -{ - int rv; - - rv = bus_print_child_header(dev, child); - rv += fhc_print_res(device_get_ivars(child)); - rv += bus_print_child_footer(dev, child); - return (rv); -} - -static void -fhc_probe_nomatch(device_t dev, device_t child) -{ - const char *type; - - device_printf(dev, "<%s>", ofw_bus_get_name(child)); - fhc_print_res(device_get_ivars(child)); - type = ofw_bus_get_type(child); - printf(" type %s (no driver attached)\n", - type != NULL ? type : "unknown"); -} - -static void -fhc_intr_enable(void *arg) -{ - struct intr_vector *iv = arg; - struct fhc_icarg *fica = iv->iv_icarg; - - bus_write_4(fica->fica_memres, FHC_IMAP, - INTMAP_ENABLE(iv->iv_vec, iv->iv_mid)); - (void)bus_read_4(fica->fica_memres, FHC_IMAP); -} - -static void -fhc_intr_disable(void *arg) -{ - struct intr_vector *iv = arg; - struct fhc_icarg *fica = iv->iv_icarg; - - bus_write_4(fica->fica_memres, FHC_IMAP, iv->iv_vec); - (void)bus_read_4(fica->fica_memres, FHC_IMAP); -} - -static void -fhc_intr_assign(void *arg) -{ - struct intr_vector *iv = arg; - struct fhc_icarg *fica = iv->iv_icarg; - - bus_write_4(fica->fica_memres, FHC_IMAP, INTMAP_TID( - bus_read_4(fica->fica_memres, FHC_IMAP), iv->iv_mid)); - (void)bus_read_4(fica->fica_memres, FHC_IMAP); -} - -static void -fhc_intr_clear(void *arg) -{ - struct intr_vector *iv = arg; - struct fhc_icarg *fica = iv->iv_icarg; - - bus_write_4(fica->fica_memres, FHC_ICLR, INTCLR_IDLE); - (void)bus_read_4(fica->fica_memres, FHC_ICLR); -} - -static int -fhc_setup_intr(device_t bus, device_t child, struct resource *r, int flags, - driver_filter_t *filt, driver_intr_t *func, void *arg, void **cookiep) -{ - struct fhc_softc *sc; - u_long vec; - - sc = device_get_softc(bus); - /* - * Make sure the vector is fully specified and we registered - * our interrupt controller for it. - */ - vec = rman_get_start(r); - if (INTIGN(vec) != sc->sc_ign || intr_vectors[vec].iv_ic != &fhc_ic) { - device_printf(bus, "invalid interrupt vector 0x%lx\n", vec); - return (EINVAL); - } - return (bus_generic_setup_intr(bus, child, r, flags, filt, func, - arg, cookiep)); -} - -static struct resource * -fhc_alloc_resource(device_t bus, device_t child, int type, int *rid, - rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) -{ - struct resource_list *rl; - struct resource_list_entry *rle; - struct fhc_softc *sc; - struct resource *res; - bus_addr_t coffset; - bus_addr_t cend; - bus_addr_t phys; - int isdefault; - int passthrough; - int i; - - isdefault = RMAN_IS_DEFAULT_RANGE(start, end); - passthrough = (device_get_parent(child) != bus); - res = NULL; - rle = NULL; - rl = BUS_GET_RESOURCE_LIST(bus, child); - sc = device_get_softc(bus); - switch (type) { - case SYS_RES_IRQ: - return (resource_list_alloc(rl, bus, child, type, rid, start, - end, count, flags)); - case SYS_RES_MEMORY: - if (!passthrough) { - rle = resource_list_find(rl, type, *rid); - if (rle == NULL) - return (NULL); - if (rle->res != NULL) - panic("%s: resource entry is busy", __func__); - if (isdefault) { - start = rle->start; - count = ulmax(count, rle->count); - end = ulmax(rle->end, start + count - 1); - } - } - for (i = 0; i < sc->sc_nrange; i++) { - coffset = sc->sc_ranges[i].coffset; - cend = coffset + sc->sc_ranges[i].size - 1; - if (start >= coffset && end <= cend) { - start -= coffset; - end -= coffset; - phys = sc->sc_ranges[i].poffset | - ((bus_addr_t)sc->sc_ranges[i].pspace << 32); - res = bus_generic_alloc_resource(bus, child, - type, rid, phys + start, phys + end, - count, flags); - if (!passthrough) - rle->res = res; - break; - } - } - break; - } - return (res); -} - -static int -fhc_adjust_resource(device_t bus __unused, device_t child __unused, - int type __unused, struct resource *r __unused, rman_res_t start __unused, - rman_res_t end __unused) -{ - - return (ENXIO); -} - -static struct resource_list * -fhc_get_resource_list(device_t bus, device_t child) -{ - struct fhc_devinfo *fdi; - - fdi = device_get_ivars(child); - return (&fdi->fdi_rl); -} - -static const struct ofw_bus_devinfo * -fhc_get_devinfo(device_t bus, device_t child) -{ - struct fhc_devinfo *fdi; - - fdi = device_get_ivars(child); - return (&fdi->fdi_obdinfo); -} - -static void -fhc_led_func(void *arg, int onoff) -{ - struct fhc_softc *sc; - uint32_t ctrl; - - sc = (struct fhc_softc *)arg; - - ctrl = bus_read_4(sc->sc_memres[FHC_INTERNAL], FHC_CTRL); - if (onoff) - ctrl |= FHC_CTRL_RLED; - else - ctrl &= ~FHC_CTRL_RLED; - ctrl &= ~(FHC_CTRL_AOFF | FHC_CTRL_BOFF | FHC_CTRL_SLINE); - bus_write_4(sc->sc_memres[FHC_INTERNAL], FHC_CTRL, ctrl); - (void)bus_read_4(sc->sc_memres[FHC_INTERNAL], FHC_CTRL); -} - -static int -fhc_print_res(struct fhc_devinfo *fdi) -{ - int rv; - - rv = 0; - rv += resource_list_print_type(&fdi->fdi_rl, "mem", SYS_RES_MEMORY, - "%#jx"); - rv += resource_list_print_type(&fdi->fdi_rl, "irq", SYS_RES_IRQ, "%jd"); - return (rv); -} diff --git a/sys/sparc64/fhc/fhcreg.h b/sys/sparc64/fhc/fhcreg.h deleted file mode 100644 index e01afe7a765149..00000000000000 --- a/sys/sparc64/fhc/fhcreg.h +++ /dev/null @@ -1,97 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD AND BSD-2-Clause - * - * Copyright (c) 2003 Jake Burkholder. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ -/*- - * Copyright (c) 2004 Jason L. Wright (jason@thought.net). - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * from: OpenBSD: fhcreg.h,v 1.3 2004/09/28 16:26:03 jason Exp - * - * $FreeBSD$ - */ - -#ifndef _SPARC64_FHC_FHCREG_H_ -#define _SPARC64_FHC_FHCREG_H_ - -#define FHC_NREG (6) - -#define FHC_INTERNAL (0) -#define FHC_IGN (1) -#define FHC_FANFAIL (2) -#define FHC_SYSTEM (3) -#define FHC_UART (4) -#define FHC_TOD (5) - -#define FHC_IMAP 0x0 -#define FHC_ICLR 0x10 - -#define FHC_ID 0x00000000 /* ID */ -#define FHC_RCS 0x00000010 /* reset ctrl/status */ -#define FHC_CTRL 0x00000020 /* control */ -#define FHC_BSR 0x00000030 /* board status */ -#define FHC_ECC 0x00000040 /* ECC control */ -#define FHC_JCTRL 0x000000f0 /* JTAG control */ - -#define FHC_CTRL_ICS 0x00100000 /* ignore centerplane sigs */ -#define FHC_CTRL_FRST 0x00080000 /* fatal error reset enable */ -#define FHC_CTRL_LFAT 0x00040000 /* AC/DC local error */ -#define FHC_CTRL_SLINE 0x00010000 /* firmware sync line */ -#define FHC_CTRL_DCD 0x00008000 /* DC/DC converter disable */ -#define FHC_CTRL_POFF 0x00004000 /* AC/DC ctlr PLL disable */ -#define FHC_CTRL_FOFF 0x00002000 /* FHC ctlr PLL disable */ -#define FHC_CTRL_AOFF 0x00001000 /* cpu a sram low pwr mode */ -#define FHC_CTRL_BOFF 0x00000800 /* cpu b sram low pwr mode */ -#define FHC_CTRL_PSOFF 0x00000400 /* disable fhc power supply */ -#define FHC_CTRL_IXIST 0x00000200 /* fhc notifies clock-board */ -#define FHC_CTRL_XMSTR 0x00000100 /* xir master enable */ -#define FHC_CTRL_LLED 0x00000040 /* left led (reversed) */ -#define FHC_CTRL_MLED 0x00000020 /* middle led */ -#define FHC_CTRL_RLED 0x00000010 /* right led */ -#define FHC_CTRL_BPINS 0x00000003 /* spare bidir pins */ - -#endif /* !_SPARC64_FHC_FHCREG_H_ */ diff --git a/sys/sparc64/include/_align.h b/sys/sparc64/include/_align.h deleted file mode 100644 index daf6de7c3524ff..00000000000000 --- a/sys/sparc64/include/_align.h +++ /dev/null @@ -1,46 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * William Jolitz. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: @(#)param.h 5.8 (Berkeley) 6/28/91 - * $FreeBSD$ - */ - -#ifndef _SPARC64_INCLUDE__ALIGN_H_ -#define _SPARC64_INCLUDE__ALIGN_H_ - -/* - * Round p (pointer or byte index) up to a correctly-aligned value - * for all data types (int, long, ...). The result is unsigned int - * and must be cast to any desired pointer type. - */ -#define _ALIGNBYTES 0xf -#define _ALIGN(p) (((u_long)(p) + _ALIGNBYTES) & ~_ALIGNBYTES) - -#endif /* !_SPARC64_INCLUDE__ALIGN_H_ */ diff --git a/sys/sparc64/include/_bus.h b/sys/sparc64/include/_bus.h deleted file mode 100644 index e6b6101b9c5435..00000000000000 --- a/sys/sparc64/include/_bus.h +++ /dev/null @@ -1,40 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2005 M. Warner Losh - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification, immediately at the beginning of the file. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef SPARC64_INCLUDE__BUS_H -#define SPARC64_INCLUDE__BUS_H - -typedef u_long bus_addr_t; -typedef u_long bus_size_t; -typedef u_long bus_space_handle_t; -typedef struct bus_space_tag *bus_space_tag_t; - -#endif /* SPARC64_INCLUDE__BUS_H */ diff --git a/sys/sparc64/include/_inttypes.h b/sys/sparc64/include/_inttypes.h deleted file mode 100644 index 46c13582d70a12..00000000000000 --- a/sys/sparc64/include/_inttypes.h +++ /dev/null @@ -1,215 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2001 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Klaus Klein. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * From: $NetBSD: int_fmtio.h,v 1.4 2008/04/28 20:23:36 martin Exp $ - * $FreeBSD$ - */ - -#ifndef _MACHINE_INTTYPES_H_ -#define _MACHINE_INTTYPES_H_ - -/* - * Macros for format specifiers. - */ - -/* fprintf(3) macros for signed integers. */ - -#define PRId8 "d" /* int8_t */ -#define PRId16 "d" /* int16_t */ -#define PRId32 "d" /* int32_t */ -#define PRId64 "ld" /* int64_t */ -#define PRIdLEAST8 "d" /* int_least8_t */ -#define PRIdLEAST16 "d" /* int_least16_t */ -#define PRIdLEAST32 "d" /* int_least32_t */ -#define PRIdLEAST64 "ld" /* int_least64_t */ -#define PRIdFAST8 "d" /* int_fast8_t */ -#define PRIdFAST16 "d" /* int_fast16_t */ -#define PRIdFAST32 "d" /* int_fast32_t */ -#define PRIdFAST64 "ld" /* int_fast64_t */ -#define PRIdMAX "jd" /* intmax_t */ -#define PRIdPTR "ld" /* intptr_t */ - -#define PRIi8 "i" /* int8_t */ -#define PRIi16 "i" /* int16_t */ -#define PRIi32 "i" /* int32_t */ -#define PRIi64 "li" /* int64_t */ -#define PRIiLEAST8 "i" /* int_least8_t */ -#define PRIiLEAST16 "i" /* int_least16_t */ -#define PRIiLEAST32 "i" /* int_least32_t */ -#define PRIiLEAST64 "li" /* int_least64_t */ -#define PRIiFAST8 "i" /* int_fast8_t */ -#define PRIiFAST16 "i" /* int_fast16_t */ -#define PRIiFAST32 "i" /* int_fast32_t */ -#define PRIiFAST64 "li" /* int_fast64_t */ -#define PRIiMAX "ji" /* intmax_t */ -#define PRIiPTR "li" /* intptr_t */ - -/* fprintf(3) macros for unsigned integers. */ - -#define PRIo8 "o" /* uint8_t */ -#define PRIo16 "o" /* uint16_t */ -#define PRIo32 "o" /* uint32_t */ -#define PRIo64 "lo" /* uint64_t */ -#define PRIoLEAST8 "o" /* uint_least8_t */ -#define PRIoLEAST16 "o" /* uint_least16_t */ -#define PRIoLEAST32 "o" /* uint_least32_t */ -#define PRIoLEAST64 "lo" /* uint_least64_t */ -#define PRIoFAST8 "o" /* uint_fast8_t */ -#define PRIoFAST16 "o" /* uint_fast16_t */ -#define PRIoFAST32 "o" /* uint_fast32_t */ -#define PRIoFAST64 "lo" /* uint_fast64_t */ -#define PRIoMAX "jo" /* uintmax_t */ -#define PRIoPTR "lo" /* uintptr_t */ - -#define PRIu8 "u" /* uint8_t */ -#define PRIu16 "u" /* uint16_t */ -#define PRIu32 "u" /* uint32_t */ -#define PRIu64 "lu" /* uint64_t */ -#define PRIuLEAST8 "u" /* uint_least8_t */ -#define PRIuLEAST16 "u" /* uint_least16_t */ -#define PRIuLEAST32 "u" /* uint_least32_t */ -#define PRIuLEAST64 "lu" /* uint_least64_t */ -#define PRIuFAST8 "u" /* uint_fast8_t */ -#define PRIuFAST16 "u" /* uint_fast16_t */ -#define PRIuFAST32 "u" /* uint_fast32_t */ -#define PRIuFAST64 "lu" /* uint_fast64_t */ -#define PRIuMAX "ju" /* uintmax_t */ -#define PRIuPTR "lu" /* uintptr_t */ - -#define PRIx8 "x" /* uint8_t */ -#define PRIx16 "x" /* uint16_t */ -#define PRIx32 "x" /* uint32_t */ -#define PRIx64 "lx" /* uint64_t */ -#define PRIxLEAST8 "x" /* uint_least8_t */ -#define PRIxLEAST16 "x" /* uint_least16_t */ -#define PRIxLEAST32 "x" /* uint_least32_t */ -#define PRIxLEAST64 "lx" /* uint_least64_t */ -#define PRIxFAST8 "x" /* uint_fast8_t */ -#define PRIxFAST16 "x" /* uint_fast16_t */ -#define PRIxFAST32 "x" /* uint_fast32_t */ -#define PRIxFAST64 "lx" /* uint_fast64_t */ -#define PRIxMAX "jx" /* uintmax_t */ -#define PRIxPTR "lx" /* uintptr_t */ - -#define PRIX8 "X" /* uint8_t */ -#define PRIX16 "X" /* uint16_t */ -#define PRIX32 "X" /* uint32_t */ -#define PRIX64 "lX" /* uint64_t */ -#define PRIXLEAST8 "X" /* uint_least8_t */ -#define PRIXLEAST16 "X" /* uint_least16_t */ -#define PRIXLEAST32 "X" /* uint_least32_t */ -#define PRIXLEAST64 "lX" /* uint_least64_t */ -#define PRIXFAST8 "X" /* uint_fast8_t */ -#define PRIXFAST16 "X" /* uint_fast16_t */ -#define PRIXFAST32 "X" /* uint_fast32_t */ -#define PRIXFAST64 "lX" /* uint_fast64_t */ -#define PRIXMAX "jX" /* uintmax_t */ -#define PRIXPTR "lX" /* uintptr_t */ - -/* fscanf(3) macros for signed integers. */ - -#define SCNd8 "hhd" /* int8_t */ -#define SCNd16 "hd" /* int16_t */ -#define SCNd32 "d" /* int32_t */ -#define SCNd64 "ld" /* int64_t */ -#define SCNdLEAST8 "hhd" /* int_least8_t */ -#define SCNdLEAST16 "hd" /* int_least16_t */ -#define SCNdLEAST32 "d" /* int_least32_t */ -#define SCNdLEAST64 "ld" /* int_least64_t */ -#define SCNdFAST8 "d" /* int_fast8_t */ -#define SCNdFAST16 "d" /* int_fast16_t */ -#define SCNdFAST32 "d" /* int_fast32_t */ -#define SCNdFAST64 "ld" /* int_fast64_t */ -#define SCNdMAX "jd" /* intmax_t */ -#define SCNdPTR "ld" /* intptr_t */ - -#define SCNi8 "hhi" /* int8_t */ -#define SCNi16 "hi" /* int16_t */ -#define SCNi32 "i" /* int32_t */ -#define SCNi64 "li" /* int64_t */ -#define SCNiLEAST8 "hhi" /* int_least8_t */ -#define SCNiLEAST16 "hi" /* int_least16_t */ -#define SCNiLEAST32 "i" /* int_least32_t */ -#define SCNiLEAST64 "li" /* int_least64_t */ -#define SCNiFAST8 "i" /* int_fast8_t */ -#define SCNiFAST16 "i" /* int_fast16_t */ -#define SCNiFAST32 "i" /* int_fast32_t */ -#define SCNiFAST64 "li" /* int_fast64_t */ -#define SCNiMAX "ji" /* intmax_t */ -#define SCNiPTR "li" /* intptr_t */ - -/* fscanf(3) macros for unsigned integers. */ - -#define SCNo8 "hho" /* uint8_t */ -#define SCNo16 "ho" /* uint16_t */ -#define SCNo32 "o" /* uint32_t */ -#define SCNo64 "lo" /* uint64_t */ -#define SCNoLEAST8 "hho" /* uint_least8_t */ -#define SCNoLEAST16 "ho" /* uint_least16_t */ -#define SCNoLEAST32 "o" /* uint_least32_t */ -#define SCNoLEAST64 "lo" /* uint_least64_t */ -#define SCNoFAST8 "o" /* uint_fast8_t */ -#define SCNoFAST16 "o" /* uint_fast16_t */ -#define SCNoFAST32 "o" /* uint_fast32_t */ -#define SCNoFAST64 "lo" /* uint_fast64_t */ -#define SCNoMAX "jo" /* uintmax_t */ -#define SCNoPTR "lo" /* uintptr_t */ - -#define SCNu8 "hhu" /* uint8_t */ -#define SCNu16 "hu" /* uint16_t */ -#define SCNu32 "u" /* uint32_t */ -#define SCNu64 "lu" /* uint64_t */ -#define SCNuLEAST8 "hhu" /* uint_least8_t */ -#define SCNuLEAST16 "hu" /* uint_least16_t */ -#define SCNuLEAST32 "u" /* uint_least32_t */ -#define SCNuLEAST64 "lu" /* uint_least64_t */ -#define SCNuFAST8 "u" /* uint_fast8_t */ -#define SCNuFAST16 "u" /* uint_fast16_t */ -#define SCNuFAST32 "u" /* uint_fast32_t */ -#define SCNuFAST64 "lu" /* uint_fast64_t */ -#define SCNuMAX "ju" /* uintmax_t */ -#define SCNuPTR "lu" /* uintptr_t */ - -#define SCNx8 "hhx" /* uint8_t */ -#define SCNx16 "hx" /* uint16_t */ -#define SCNx32 "x" /* uint32_t */ -#define SCNx64 "lx" /* uint64_t */ -#define SCNxLEAST8 "hhx" /* uint_least8_t */ -#define SCNxLEAST16 "hx" /* uint_least16_t */ -#define SCNxLEAST32 "x" /* uint_least32_t */ -#define SCNxLEAST64 "lx" /* uint_least64_t */ -#define SCNxFAST8 "x" /* uint_fast8_t */ -#define SCNxFAST16 "x" /* uint_fast16_t */ -#define SCNxFAST32 "x" /* uint_fast32_t */ -#define SCNxFAST64 "lx" /* uint_fast64_t */ -#define SCNxMAX "jx" /* uintmax_t */ -#define SCNxPTR "lx" /* uintptr_t */ - -#endif /* !_MACHINE_INTTYPES_H_ */ diff --git a/sys/sparc64/include/_limits.h b/sys/sparc64/include/_limits.h deleted file mode 100644 index 62ee07db3f6078..00000000000000 --- a/sys/sparc64/include/_limits.h +++ /dev/null @@ -1,87 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 1988, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)limits.h 8.3 (Berkeley) 1/4/94 - * $FreeBSD$ - */ - -#ifndef _MACHINE__LIMITS_H_ -#define _MACHINE__LIMITS_H_ - -/* - * According to ANSI (section 2.2.4.2), the values below must be usable by - * #if preprocessing directives. Additionally, the expression must have the - * same type as would an expression that is an object of the corresponding - * type converted according to the integral promotions. The subtraction for - * INT_MIN, etc., is so the value is not unsigned; e.g., 0x80000000 is an - * unsigned int for 32-bit two's complement ANSI compilers (section 3.1.3.2). - */ - -#define __CHAR_BIT 8 /* number of bits in a char */ - -#define __SCHAR_MAX 0x7f /* max value for a signed char */ -#define __SCHAR_MIN (-0x7f-1) /* min value for a signed char */ - -#define __UCHAR_MAX 0xff /* max value for an unsigned char */ - -#define __USHRT_MAX 0xffff /* max value for an unsigned short */ -#define __SHRT_MAX 0x7fff /* max value for a short */ -#define __SHRT_MIN (-0x7fff-1) /* min value for a short */ - -#define __UINT_MAX 0xffffffff /* max value for an unsigned int */ -#define __INT_MAX 0x7fffffff /* max value for an int */ -#define __INT_MIN (-0x7fffffff-1) /* min value for an int */ - -#define __ULONG_MAX 0xffffffffffffffff /* max for an unsigned long */ -#define __LONG_MAX 0x7fffffffffffffff /* max for a long */ -#define __LONG_MIN (-0x7fffffffffffffff-1) /* min for a long */ - -/* Long longs have the same size but not the same type as longs. */ - /* max for an unsigned long long */ -#define __ULLONG_MAX 0xffffffffffffffffULL -#define __LLONG_MAX 0x7fffffffffffffffLL /* max for a long long */ -#define __LLONG_MIN (-0x7fffffffffffffffLL-1) /* min for a long long */ - -#define __SSIZE_MAX __LONG_MAX /* max value for a ssize_t */ - -#define __SIZE_T_MAX __ULONG_MAX /* max value for a size_t */ - -#define __OFF_MAX __LONG_MAX /* max value for an off_t */ -#define __OFF_MIN __LONG_MIN /* min value for an off_t */ - -/* Quads and longs are the same size. Ensure they stay in sync. */ -#define __UQUAD_MAX (__ULONG_MAX) /* max value for a uquad_t */ -#define __QUAD_MAX (__LONG_MAX) /* max value for a quad_t */ -#define __QUAD_MIN (__LONG_MIN) /* min value for a quad_t */ - -#define __LONG_BIT 64 -#define __WORD_BIT 32 - -/* Minimum signal stack size. */ -#define __MINSIGSTKSZ (1024 * 4) - -#endif /* !_MACHINE__LIMITS_H_ */ diff --git a/sys/sparc64/include/_stdint.h b/sys/sparc64/include/_stdint.h deleted file mode 100644 index a21274ef1875b3..00000000000000 --- a/sys/sparc64/include/_stdint.h +++ /dev/null @@ -1,160 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2001, 2002 Mike Barcroft - * Copyright (c) 2001 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Klaus Klein. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE__STDINT_H_ -#define _MACHINE__STDINT_H_ - -#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) - -#define INT8_C(c) (c) -#define INT16_C(c) (c) -#define INT32_C(c) (c) -#define INT64_C(c) (c ## L) - -#define UINT8_C(c) (c) -#define UINT16_C(c) (c) -#define UINT32_C(c) (c ## U) -#define UINT64_C(c) (c ## UL) - -#define INTMAX_C(c) INT64_C(c) -#define UINTMAX_C(c) UINT64_C(c) - -#endif /* !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) */ - -#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) - -/* - * ISO/IEC 9899:1999 - * 7.18.2.1 Limits of exact-width integer types - */ -/* Minimum values of exact-width signed integer types. */ -#define INT8_MIN (-0x7f-1) -#define INT16_MIN (-0x7fff-1) -#define INT32_MIN (-0x7fffffff-1) -#define INT64_MIN (-0x7fffffffffffffffL-1) - -/* Maximum values of exact-width signed integer types. */ -#define INT8_MAX 0x7f -#define INT16_MAX 0x7fff -#define INT32_MAX 0x7fffffff -#define INT64_MAX 0x7fffffffffffffffL - -/* Maximum values of exact-width unsigned integer types. */ -#define UINT8_MAX 0xff -#define UINT16_MAX 0xffff -#define UINT32_MAX 0xffffffffU -#define UINT64_MAX 0xffffffffffffffffUL - -/* - * ISO/IEC 9899:1999 - * 7.18.2.2 Limits of minimum-width integer types - */ -/* Minimum values of minimum-width signed integer types. */ -#define INT_LEAST8_MIN INT8_MIN -#define INT_LEAST16_MIN INT16_MIN -#define INT_LEAST32_MIN INT32_MIN -#define INT_LEAST64_MIN INT64_MIN - -/* Maximum values of minimum-width signed integer types. */ -#define INT_LEAST8_MAX INT8_MAX -#define INT_LEAST16_MAX INT16_MAX -#define INT_LEAST32_MAX INT32_MAX -#define INT_LEAST64_MAX INT64_MAX - -/* Maximum values of minimum-width unsigned integer types. */ -#define UINT_LEAST8_MAX UINT8_MAX -#define UINT_LEAST16_MAX UINT16_MAX -#define UINT_LEAST32_MAX UINT32_MAX -#define UINT_LEAST64_MAX UINT64_MAX - -/* - * ISO/IEC 9899:1999 - * 7.18.2.3 Limits of fastest minimum-width integer types - */ -/* Minimum values of fastest minimum-width signed integer types. */ -#define INT_FAST8_MIN INT32_MIN -#define INT_FAST16_MIN INT32_MIN -#define INT_FAST32_MIN INT32_MIN -#define INT_FAST64_MIN INT64_MIN - -/* Maximum values of fastest minimum-width signed integer types. */ -#define INT_FAST8_MAX INT32_MAX -#define INT_FAST16_MAX INT32_MAX -#define INT_FAST32_MAX INT32_MAX -#define INT_FAST64_MAX INT64_MAX - -/* Maximum values of fastest minimum-width unsigned integer types. */ -#define UINT_FAST8_MAX UINT32_MAX -#define UINT_FAST16_MAX UINT32_MAX -#define UINT_FAST32_MAX UINT32_MAX -#define UINT_FAST64_MAX UINT64_MAX - -/* - * ISO/IEC 9899:1999 - * 7.18.2.4 Limits of integer types capable of holding object pointers - */ -#define INTPTR_MIN INT64_MIN -#define INTPTR_MAX INT64_MAX -#define UINTPTR_MAX UINT64_MAX - -/* - * ISO/IEC 9899:1999 - * 7.18.2.5 Limits of greatest-width integer types - */ -#define INTMAX_MIN INT64_MIN -#define INTMAX_MAX INT64_MAX -#define UINTMAX_MAX UINT64_MAX - -/* - * ISO/IEC 9899:1999 - * 7.18.3 Limits of other integer types - */ -/* Limits of ptrdiff_t. */ -#define PTRDIFF_MIN INT64_MIN -#define PTRDIFF_MAX INT64_MAX - -/* Limits of sig_atomic_t. */ -#define SIG_ATOMIC_MIN INT32_MIN -#define SIG_ATOMIC_MAX INT32_MAX - -/* Limit of size_t. */ -#define SIZE_MAX UINT64_MAX - -/* Limits of wint_t. */ -#define WINT_MIN INT32_MIN -#define WINT_MAX INT32_MAX - -#endif /* !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) */ - -#endif /* !_MACHINE__STDINT_H_ */ diff --git a/sys/sparc64/include/_types.h b/sys/sparc64/include/_types.h deleted file mode 100644 index 9d71fefc52ebeb..00000000000000 --- a/sys/sparc64/include/_types.h +++ /dev/null @@ -1,102 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 2002 Mike Barcroft - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * From: @(#)ansi.h 8.2 (Berkeley) 1/4/94 - * From: @(#)types.h 8.3 (Berkeley) 1/5/94 - * $FreeBSD$ - */ - -#ifndef _MACHINE__TYPES_H_ -#define _MACHINE__TYPES_H_ - -#ifndef _SYS_CDEFS_H_ -#error this file needs sys/cdefs.h as a prerequisite -#endif - -/* - * Basic types upon which most other types are built. - */ -typedef signed char __int8_t; -typedef unsigned char __uint8_t; -typedef short __int16_t; -typedef unsigned short __uint16_t; -typedef int __int32_t; -typedef unsigned int __uint32_t; -typedef long __int64_t; -typedef unsigned long __uint64_t; - -/* - * Standard type definitions. - */ -typedef __int32_t __clock_t; /* clock()... */ -typedef __int64_t __critical_t; -#ifndef _STANDALONE -typedef double __double_t; -typedef float __float_t; -#endif -typedef __int64_t __intfptr_t; -typedef __int64_t __intmax_t; -typedef __int64_t __intptr_t; -typedef __int32_t __int_fast8_t; -typedef __int32_t __int_fast16_t; -typedef __int32_t __int_fast32_t; -typedef __int64_t __int_fast64_t; -typedef __int8_t __int_least8_t; -typedef __int16_t __int_least16_t; -typedef __int32_t __int_least32_t; -typedef __int64_t __int_least64_t; -typedef __int64_t __ptrdiff_t; /* ptr1 - ptr2 */ -typedef __int64_t __register_t; -typedef __int64_t __segsz_t; /* segment size (in pages) */ -typedef __uint64_t __size_t; /* sizeof() */ -typedef __int64_t __ssize_t; /* byte count or error */ -typedef __int64_t __time_t; /* time()... */ -typedef __uint64_t __uintfptr_t; -typedef __uint64_t __uintmax_t; -typedef __uint64_t __uintptr_t; -typedef __uint32_t __uint_fast8_t; -typedef __uint32_t __uint_fast16_t; -typedef __uint32_t __uint_fast32_t; -typedef __uint64_t __uint_fast64_t; -typedef __uint8_t __uint_least8_t; -typedef __uint16_t __uint_least16_t; -typedef __uint32_t __uint_least32_t; -typedef __uint64_t __uint_least64_t; -typedef __uint64_t __u_register_t; -typedef __uint64_t __vm_offset_t; -typedef __uint64_t __vm_paddr_t; -typedef __uint64_t __vm_size_t; -typedef int ___wchar_t; - -#define __WCHAR_MIN __INT_MIN /* min value for a wchar_t */ -#define __WCHAR_MAX __INT_MAX /* max value for a wchar_t */ - -#endif /* !_MACHINE__TYPES_H_ */ diff --git a/sys/sparc64/include/asi.h b/sys/sparc64/include/asi.h deleted file mode 100644 index 2a40eb89c3579b..00000000000000 --- a/sys/sparc64/include/asi.h +++ /dev/null @@ -1,262 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1997 Berkeley Software Design, Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Berkeley Software Design Inc's name may not be used to endorse or - * promote products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY BERKELEY SOFTWARE DESIGN INC ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL BERKELEY SOFTWARE DESIGN INC BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: BSDI: asi.h,v 1.3 1997/08/08 14:31:42 torek - * $FreeBSD$ - */ - -#ifndef _MACHINE_ASI_H_ -#define _MACHINE_ASI_H_ - -/* - * Standard v9 ASIs - */ -#define ASI_N 0x4 -#define ASI_NL 0xc -#define ASI_AIUP 0x10 -#define ASI_AIUS 0x11 -#define ASI_AIUPL 0x18 -#define ASI_AIUSL 0x19 -#define ASI_P 0x80 -#define ASI_S 0x81 -#define ASI_PNF 0x82 -#define ASI_SNF 0x83 -#define ASI_PL 0x88 -#define ASI_SL 0x89 -#define ASI_PNFL 0x8a -#define ASI_SNFL 0x8b - -/* - * UltraSPARC extensions - ASIs limited to a certain family are annotated. - */ -#define ASI_PHYS_USE_EC 0x14 -#define ASI_PHYS_BYPASS_EC_WITH_EBIT 0x15 -#define ASI_PHYS_USE_EC_L 0x1c -#define ASI_PHYS_BYPASS_EC_WITH_EBIT_L 0x1d - -#define ASI_NUCLEUS_QUAD_LDD 0x24 -#define ASI_NUCLEUS_QUAD_LDD_L 0x2c - -#define ASI_PCACHE_STATUS_DATA 0x30 /* US-III Cu */ -#define ASI_PCACHE_DATA 0x31 /* US-III Cu */ -#define ASI_PCACHE_TAG 0x32 /* US-III Cu */ -#define ASI_PCACHE_SNOOP_TAG 0x33 /* US-III Cu */ - -#define ASI_ATOMIC_QUAD_LDD_PHYS 0x34 /* US-III Cu */ - -#define ASI_WCACHE_VALID_BITS 0x38 /* US-III Cu */ -#define ASI_WCACHE_DATA 0x39 /* US-III Cu */ -#define ASI_WCACHE_TAG 0x3a /* US-III Cu */ -#define ASI_WCACHE_SNOOP_TAG 0x3b /* US-III Cu */ - -#define ASI_ATOMIC_QUAD_LDD_PHYS_L 0x3c /* US-III Cu */ - -#define ASI_SRAM_FAST_INIT 0x40 /* US-III Cu */ - -#define ASI_DCACHE_INVALIDATE 0x42 /* US-III Cu */ -#define ASI_DCACHE_UTAG 0x43 /* US-III Cu */ -#define ASI_DCACHE_SNOOP_TAG 0x44 /* US-III Cu */ - -/* Named ASI_DCUCR on US-III, but is mostly identical except for added bits. */ -#define ASI_LSU_CTL_REG 0x45 /* US only */ - -#define ASI_MCNTL 0x45 /* SPARC64 only */ -#define AA_MCNTL 0x08 - -#define ASI_DCACHE_DATA 0x46 -#define ASI_DCACHE_TAG 0x47 - -#define ASI_INTR_DISPATCH_STATUS 0x48 -#define ASI_INTR_RECEIVE 0x49 -#define ASI_UPA_CONFIG_REG 0x4a /* US-I, II */ - -#define ASI_FIREPLANE_CONFIG_REG 0x4a /* US-III{,+}, IV{,+} */ -#define AA_FIREPLANE_CONFIG 0x0 /* US-III{,+}, IV{,+} */ -#define AA_FIREPLANE_ADDRESS 0x8 /* US-III{,+}, IV{,+} */ -#define AA_FIREPLANE_CONFIG_2 0x10 /* US-IV{,+} */ - -#define ASI_JBUS_CONFIG_REG 0x4a /* US-IIIi{,+} */ - -#define ASI_ESTATE_ERROR_EN_REG 0x4b -#define AA_ESTATE_CEEN 0x1 -#define AA_ESTATE_NCEEN 0x2 -#define AA_ESTATE_ISAPEN 0x4 - -#define ASI_AFSR 0x4c -#define ASI_AFAR 0x4d - -#define ASI_ECACHE_TAG_DATA 0x4e - -#define ASI_IMMU_TAG_TARGET_REG 0x50 -#define ASI_IMMU 0x50 -#define AA_IMMU_TTR 0x0 -#define AA_IMMU_SFSR 0x18 -#define AA_IMMU_TSB 0x28 -#define AA_IMMU_TAR 0x30 -#define AA_IMMU_TSB_PEXT_REG 0x48 /* US-III family */ -#define AA_IMMU_TSB_SEXT_REG 0x50 /* US-III family */ -#define AA_IMMU_TSB_NEXT_REG 0x58 /* US-III family */ - -#define ASI_IMMU_TSB_8KB_PTR_REG 0x51 -#define ASI_IMMU_TSB_64KB_PTR_REG 0x52 - -#define ASI_SERIAL_ID 0x53 /* US-III family */ - -#define ASI_ITLB_DATA_IN_REG 0x54 -/* US-III Cu: also ASI_ITLB_CAM_ADDRESS_REG */ -#define ASI_ITLB_DATA_ACCESS_REG 0x55 -#define ASI_ITLB_TAG_READ_REG 0x56 -#define ASI_IMMU_DEMAP 0x57 - -#define ASI_DMMU_TAG_TARGET_REG 0x58 -#define ASI_DMMU 0x58 -#define AA_DMMU_TTR 0x0 -#define AA_DMMU_PCXR 0x8 -#define AA_DMMU_SCXR 0x10 -#define AA_DMMU_SFSR 0x18 -#define AA_DMMU_SFAR 0x20 -#define AA_DMMU_TSB 0x28 -#define AA_DMMU_TAR 0x30 -#define AA_DMMU_VWPR 0x38 -#define AA_DMMU_PWPR 0x40 -#define AA_DMMU_TSB_PEXT_REG 0x48 -#define AA_DMMU_TSB_SEXT_REG 0x50 -#define AA_DMMU_TSB_NEXT_REG 0x58 -#define AA_DMMU_TAG_ACCESS_EXT 0x60 /* US-III family */ - -#define ASI_DMMU_TSB_8KB_PTR_REG 0x59 -#define ASI_DMMU_TSB_64KB_PTR_REG 0x5a -#define ASI_DMMU_TSB_DIRECT_PTR_REG 0x5b -#define ASI_DTLB_DATA_IN_REG 0x5c -/* US-III Cu: also ASI_DTLB_CAM_ADDRESS_REG */ -#define ASI_DTLB_DATA_ACCESS_REG 0x5d -#define ASI_DTLB_TAG_READ_REG 0x5e -#define ASI_DMMU_DEMAP 0x5f - -#define ASI_IIU_INST_TRAP 0x60 /* US-III family */ - -#define ASI_INTR_ID 0x63 /* US-IV{,+} */ -#define AA_INTR_ID 0x0 /* US-IV{,+} */ -#define AA_CORE_ID 0x10 /* US-IV{,+} */ -#define AA_CESR_ID 0x40 /* US-IV{,+} */ - -#define ASI_ICACHE_INSTR 0x66 -#define ASI_ICACHE_TAG 0x67 -#define ASI_ICACHE_SNOOP_TAG 0x68 /* US-III family */ -#define ASI_ICACHE_PRE_DECODE 0x6e /* US-I, II */ -#define ASI_ICACHE_PRE_NEXT_FIELD 0x6f /* US-I, II */ - -#define ASI_FLUSH_L1I 0x67 /* SPARC64 only */ - -#define ASI_BLK_AUIP 0x70 -#define ASI_BLK_AIUS 0x71 - -#define ASI_MCU_CONFIG_REG 0x72 /* US-III Cu */ -#define AA_MCU_TIMING1_REG 0x0 /* US-III Cu */ -#define AA_MCU_TIMING2_REG 0x8 /* US-III Cu */ -#define AA_MCU_TIMING3_REG 0x10 /* US-III Cu */ -#define AA_MCU_TIMING4_REG 0x18 /* US-III Cu */ -#define AA_MCU_DEC1_REG 0x20 /* US-III Cu */ -#define AA_MCU_DEC2_REG 0x28 /* US-III Cu */ -#define AA_MCU_DEC3_REG 0x30 /* US-III Cu */ -#define AA_MCU_DEC4_REG 0x38 /* US-III Cu */ -#define AA_MCU_ADDR_CNTL_REG 0x40 /* US-III Cu */ - -#define ASI_ECACHE_DATA 0x74 /* US-III Cu */ -#define ASI_ECACHE_CONTROL 0x75 /* US-III Cu */ -#define ASI_ECACHE_W 0x76 - -/* - * With the advent of the US-III, the numbering has changed, as additional - * registers were inserted in between. We retain the original ordering for - * now, and append an A to the inserted registers. - * Exceptions are AA_SDB_INTR_D6 and AA_SDB_INTR_D7, which were appended - * at the end. - */ -#define ASI_SDB_ERROR_W 0x77 -#define ASI_SDB_CONTROL_W 0x77 -#define ASI_SDB_INTR_W 0x77 -#define AA_SDB_ERR_HIGH 0x0 -#define AA_SDB_ERR_LOW 0x18 -#define AA_SDB_CNTL_HIGH 0x20 -#define AA_SDB_CNTL_LOW 0x38 -#define AA_SDB_INTR_D0 0x40 -#define AA_SDB_INTR_D0A 0x48 /* US-III family */ -#define AA_SDB_INTR_D1 0x50 -#define AA_SDB_INTR_D1A 0x5A /* US-III family */ -#define AA_SDB_INTR_D2 0x60 -#define AA_SDB_INTR_D2A 0x68 /* US-III family */ -#define AA_INTR_SEND 0x70 -#define AA_SDB_INTR_D6 0x80 /* US-III family */ -#define AA_SDB_INTR_D7 0x88 /* US-III family */ - -#define ASI_BLK_AIUPL 0x78 -#define ASI_BLK_AIUSL 0x79 - -#define ASI_ECACHE_R 0x7e - -/* - * These have the same registers as their corresponding write versions - * except for AA_INTR_SEND. - */ -#define ASI_SDB_ERROR_R 0x7f -#define ASI_SDB_CONTROL_R 0x7f -#define ASI_SDB_INTR_R 0x7f - -#define ASI_PST8_P 0xc0 -#define ASI_PST8_S 0xc1 -#define ASI_PST16_P 0xc2 -#define ASI_PST16_S 0xc3 -#define ASI_PST32_P 0xc4 -#define ASI_PST32_S 0xc5 - -#define ASI_PST8_PL 0xc8 -#define ASI_PST8_SL 0xc9 -#define ASI_PST16_PL 0xca -#define ASI_PST16_SL 0xcb -#define ASI_PST32_PL 0xcc -#define ASI_PST32_SL 0xcd - -#define ASI_FL8_P 0xd0 -#define ASI_FL8_S 0xd1 -#define ASI_FL16_P 0xd2 -#define ASI_FL16_S 0xd3 -#define ASI_FL8_PL 0xd8 -#define ASI_FL8_SL 0xd9 -#define ASI_FL16_PL 0xda -#define ASI_FL16_SL 0xdb - -#define ASI_BLK_COMMIT_P 0xe0 -#define ASI_BLK_COMMIT_S 0xe1 -#define ASI_BLK_P 0xf0 -#define ASI_BLK_S 0xf1 -#define ASI_BLK_PL 0xf8 -#define ASI_BLK_SL 0xf9 - -#endif /* !_MACHINE_ASI_H_ */ diff --git a/sys/sparc64/include/asm.h b/sys/sparc64/include/asm.h deleted file mode 100644 index e8ca4af257f1b4..00000000000000 --- a/sys/sparc64/include/asm.h +++ /dev/null @@ -1,128 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * William Jolitz. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: @(#)DEFS.h 5.1 (Berkeley) 4/23/90 - * from: FreeBSD: src/sys/i386/include/asm.h,v 1.7 2000/01/25 - * $FreeBSD$ - */ - -#ifndef _MACHINE_ASM_H_ -#define _MACHINE_ASM_H_ - -#define __ASM__ - -#include - -#ifdef PIC -#define PIC_PROLOGUE(r1, r2) \ - sethi %hi(_GLOBAL_OFFSET_TABLE_-4), r1 ; \ - rd %pc, r2 ; \ - or r1, %lo(_GLOBAL_OFFSET_TABLE_+4), r1 ; \ - add r2, r1, r2 -#define SET(name, r1, r2) \ - set name, r2 ; \ - ldx [r1 + r2], r2 -#else -#define PIC_PROLOGUE(r1, r2) -#define SET(name, r1, r2) \ - set name, r2 -#endif - -/* - * CNAME and HIDENAME manage the relationship between symbol names in C - * and the equivalent assembly language names. CNAME is given a name as - * it would be used in a C program. It expands to the equivalent assembly - * language name. HIDENAME is given an assembly-language name, and expands - * to a possibly-modified form that will be invisible to C programs. - */ -#define CNAME(csym) csym -#define HIDENAME(asmsym) __CONCAT(.,asmsym) - -#define CCFSZ 192 -#define SPOFF 2047 - -#define _ALIGN_TEXT .align 32 - -#define _START_ENTRY \ - .text ; \ - _ALIGN_TEXT - -/* - * Define function entry and alternate entry points. - * - * The compiler produces #function for the .type pseudo-op, but the '#' - * character has special meaning in cpp macros, so we use @function like - * other architectures. The assembler seems to accept both. - * The assembler also accepts a .proc pseudo-op, which is used by the - * peep hole optimizer, whose argument is the type code of the return - * value. Since this is difficult to predict and its expected that - * assembler code is already optimized, we leave it out. - */ - -#define _ALTENTRY(x) \ - .globl CNAME(x) ; \ - .type CNAME(x),@function ; \ -CNAME(x): - -#define _ENTRY(x) \ - _START_ENTRY ; \ - .globl CNAME(x) ; \ - .type CNAME(x),@function ; \ -CNAME(x): - -#define ALTENTRY(x) _ALTENTRY(x) -#define ENTRY(x) _ENTRY(x) -#define END(x) .size x, . - x - -/* - * WEAK_REFERENCE(): create a weak reference alias from sym. - * The macro is not a general asm macro that takes arbitrary names, - * but one that takes only C names. It does the non-null name - * translation inside the macro. - */ -#define WEAK_REFERENCE(sym, alias) \ - .weak CNAME(alias); \ - .equ CNAME(alias),CNAME(sym) - -/* - * Kernel RCS ID tag and copyright macros - */ - -#undef __FBSDID -#if !defined(lint) && !defined(STRIP_FBSDID) -#define __FBSDID(s) .ident s -#else -#define __FBSDID(s) /* nothing */ -#endif /* not lint and not STRIP_FBSDID */ - -#endif /* !_MACHINE_ASM_H_ */ diff --git a/sys/sparc64/include/asmacros.h b/sys/sparc64/include/asmacros.h deleted file mode 100644 index cb39694387e476..00000000000000 --- a/sys/sparc64/include/asmacros.h +++ /dev/null @@ -1,226 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2001 Jake Burkholder. - * Copyright (c) 2011 Marius Strobl - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_ASMACROS_H_ -#define _MACHINE_ASMACROS_H_ - -#ifdef _KERNEL - -/* - * Normal and alternate %g6 point to the pcb of the current process. Normal, - * alternate and interrupt %g7 point to per-cpu data. - */ -#define PCB_REG %g6 -#define PCPU_REG %g7 - -/* - * Alternate %g5 points to a per-cpu panic stack, which is used as a last - * resort, and for temporarily saving alternate globals. - */ -#define ASP_REG %g5 - -#ifdef LOCORE - -/* - * Atomically decrement an integer in memory. - */ -#define ATOMIC_DEC_INT(r1, r2, r3) \ - lduw [r1], r2 ; \ -9: sub r2, 1, r3 ; \ - casa [r1] ASI_N, r2, r3 ; \ - cmp r2, r3 ; \ - bne,pn %icc, 9b ; \ - mov r3, r2 - -/* - * Atomically increment an integer in memory. - */ -#define ATOMIC_INC_INT(r1, r2, r3) \ - lduw [r1], r2 ; \ -9: add r2, 1, r3 ; \ - casa [r1] ASI_N, r2, r3 ; \ - cmp r2, r3 ; \ - bne,pn %icc, 9b ; \ - mov r3, r2 - -/* - * Atomically increment a long in memory. - */ -#define ATOMIC_INC_LONG(r1, r2, r3) \ - ldx [r1], r2 ; \ -9: add r2, 1, r3 ; \ - casxa [r1] ASI_N, r2, r3 ; \ - cmp r2, r3 ; \ - bne,pn %xcc, 9b ; \ - mov r3, r2 - -/* - * Atomically clear a number of bits of an integer in memory. - */ -#define ATOMIC_CLEAR_INT(r1, r2, r3, bits) \ - lduw [r1], r2 ; \ -9: andn r2, bits, r3 ; \ - casa [r1] ASI_N, r2, r3 ; \ - cmp r2, r3 ; \ - bne,pn %icc, 9b ; \ - mov r3, r2 - -/* - * Atomically clear a number of bits of a long in memory. - */ -#define ATOMIC_CLEAR_LONG(r1, r2, r3, bits) \ - ldx [r1], r2 ; \ -9: andn r2, bits, r3 ; \ - casxa [r1] ASI_N, r2, r3 ; \ - cmp r2, r3 ; \ - bne,pn %xcc, 9b ; \ - mov r3, r2 - -/* - * Atomically load an integer from memory. - */ -#define ATOMIC_LOAD_INT(r1, val) \ - clr val ; \ - casa [r1] ASI_N, %g0, val - -/* - * Atomically load a long from memory. - */ -#define ATOMIC_LOAD_LONG(r1, val) \ - clr val ; \ - casxa [r1] ASI_N, %g0, val - -/* - * Atomically set a number of bits of an integer in memory. - */ -#define ATOMIC_SET_INT(r1, r2, r3, bits) \ - lduw [r1], r2 ; \ -9: or r2, bits, r3 ; \ - casa [r1] ASI_N, r2, r3 ; \ - cmp r2, r3 ; \ - bne,pn %icc, 9b ; \ - mov r3, r2 - -/* - * Atomically set a number of bits of a long in memory. - */ -#define ATOMIC_SET_LONG(r1, r2, r3, bits) \ - ldx [r1], r2 ; \ -9: or r2, bits, r3 ; \ - casxa [r1] ASI_N, r2, r3 ; \ - cmp r2, r3 ; \ - bne,pn %xcc, 9b ; \ - mov r3, r2 - -/* - * Atomically store an integer in memory. - */ -#define ATOMIC_STORE_INT(r1, r2, r3, val) \ - lduw [r1], r2 ; \ -9: mov val, r3 ; \ - casa [r1] ASI_N, r2, r3 ; \ - cmp r2, r3 ; \ - bne,pn %icc, 9b ; \ - mov r3, r2 - -/* - * Atomically store a long in memory. - */ -#define ATOMIC_STORE_LONG(r1, r2, r3, val) \ - ldx [r1], r2 ; \ -9: mov val, r3 ; \ - casxa [r1] ASI_N, r2, r3 ; \ - cmp r2, r3 ; \ - bne,pn %xcc, 9b ; \ - mov r3, r2 - -#define PCPU(member) PCPU_REG + PC_ ## member -#define PCPU_ADDR(member, reg) \ - add PCPU_REG, PC_ ## member, reg - -#define DEBUGGER() \ - ta %xcc, 1 - -#define PANIC(msg, r1) \ - .sect .rodata ; \ -9: .asciz msg ; \ - .previous ; \ - SET(9b, r1, %o0) ; \ - call panic ; \ - nop - -#ifdef INVARIANTS -#define KASSERT(r1, msg) \ - brnz,pt r1, 8f ; \ - nop ; \ - PANIC(msg, r1) ; \ -8: -#else -#define KASSERT(r1, msg) -#endif - -#define PUTS(msg, r1) \ - .sect .rodata ; \ -9: .asciz msg ; \ - .previous ; \ - SET(9b, r1, %o0) ; \ - call printf ; \ - nop - -#define _ALIGN_DATA .align 8 - -#define DATA(name) \ - .data ; \ - _ALIGN_DATA ; \ - .globl name ; \ - .type name, @object ; \ -name: - -#define EMPTY - -/* - * Generate atomic compare and swap, load and store instructions for the - * corresponding width and ASI (or not). Note that we want to evaluate the - * macro args before concatenating, so that EMPTY really turns into nothing. - */ -#define _LD(w, a) ld ## w ## a -#define _ST(w, a) st ## w ## a -#define _CAS(w, a) cas ## w ## a - -#define LD(w, a) _LD(w, a) -#define ST(w, a) _ST(w, a) -#define CAS(w, a) _CAS(w, a) - -#endif /* LOCORE */ - -#endif /* _KERNEL */ - -#endif /* !_MACHINE_ASMACROS_H_ */ diff --git a/sys/sparc64/include/atomic.h b/sys/sparc64/include/atomic.h deleted file mode 100644 index e98da0f5e49c4d..00000000000000 --- a/sys/sparc64/include/atomic.h +++ /dev/null @@ -1,446 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 1998 Doug Rabson. - * Copyright (c) 2001 Jake Burkholder. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: FreeBSD: src/sys/i386/include/atomic.h,v 1.20 2001/02/11 - * $FreeBSD$ - */ - -#ifndef _MACHINE_ATOMIC_H_ -#define _MACHINE_ATOMIC_H_ - -#include - -#define mb() __asm__ __volatile__ ("membar #MemIssue": : :"memory") -#define wmb() mb() -#define rmb() mb() - -#include - -/* Userland needs different ASI's. */ -#ifdef _KERNEL -#define __ASI_ATOMIC ASI_N -#else -#define __ASI_ATOMIC ASI_P -#endif - -static __inline int atomic_cmpset_8(__volatile uint8_t *, uint8_t, uint8_t); -static __inline int atomic_fcmpset_8(__volatile uint8_t *, uint8_t *, uint8_t); -static __inline int atomic_cmpset_16(__volatile uint16_t *, uint16_t, uint16_t); -static __inline int atomic_fcmpset_16(__volatile uint16_t *, uint16_t *, uint16_t); - -/* - * Various simple arithmetic on memory which is atomic in the presence - * of interrupts and multiple processors. See atomic(9) for details. - * Note that efficient hardware support exists only for the 32 and 64 - * bit variants; the 8 and 16 bit versions are not provided and should - * not be used in MI code. - * - * This implementation takes advantage of the fact that the sparc64 - * cas instruction is both a load and a store. The loop is often coded - * as follows: - * - * do { - * expect = *p; - * new = expect + 1; - * } while (cas(p, expect, new) != expect); - * - * which performs an unnnecessary load on each iteration that the cas - * operation fails. Modified as follows: - * - * expect = *p; - * for (;;) { - * new = expect + 1; - * result = cas(p, expect, new); - * if (result == expect) - * break; - * expect = result; - * } - * - * the return value of cas is used to avoid the extra reload. - * - * We only include a memory barrier in the rel variants as in total store - * order which we use for running the kernel and all of the userland atomic - * loads and stores behave as if the were followed by a membar with a mask - * of #LoadLoad | #LoadStore | #StoreStore. In order to be also sufficient - * for use of relaxed memory ordering, the atomic_cas() in the acq variants - * additionally would have to be followed by a membar #LoadLoad | #LoadStore. - * Due to the suggested assembly syntax of the membar operands containing a - * # character, they cannot be used in macros. The cmask and mmask bits thus - * are hard coded in machine/cpufunc.h and used here through macros. - * Hopefully the bit numbers won't change in the future. - */ - -#define itype(sz) uint ## sz ## _t - -#define atomic_cas_32(p, e, s) casa((p), (e), (s), __ASI_ATOMIC) -#define atomic_cas_64(p, e, s) casxa((p), (e), (s), __ASI_ATOMIC) - -#define atomic_cas(p, e, s, sz) \ - atomic_cas_ ## sz((p), (e), (s)) - -#define atomic_cas_acq(p, e, s, sz) ({ \ - itype(sz) v; \ - v = atomic_cas((p), (e), (s), sz); \ - __compiler_membar(); \ - v; \ -}) - -#define atomic_cas_rel(p, e, s, sz) ({ \ - itype(sz) v; \ - membar(LoadStore | StoreStore); \ - v = atomic_cas((p), (e), (s), sz); \ - v; \ -}) - -#define atomic_op(p, op, v, sz) ({ \ - itype(sz) e, r, s; \ - for (e = *(volatile itype(sz) *)(p);; e = r) { \ - s = e op (v); \ - r = atomic_cas_ ## sz((p), e, s); \ - if (r == e) \ - break; \ - } \ - e; \ -}) - -#define atomic_op_acq(p, op, v, sz) ({ \ - itype(sz) t; \ - t = atomic_op((p), op, (v), sz); \ - __compiler_membar(); \ - t; \ -}) - -#define atomic_op_rel(p, op, v, sz) ({ \ - itype(sz) t; \ - membar(LoadStore | StoreStore); \ - t = atomic_op((p), op, (v), sz); \ - t; \ -}) - -#define atomic_ld_acq(p, sz) ({ \ - itype(sz) v; \ - v = atomic_cas((p), 0, 0, sz); \ - __compiler_membar(); \ - v; \ -}) - -#define atomic_ld_clear(p, sz) ({ \ - itype(sz) e, r; \ - for (e = *(volatile itype(sz) *)(p);; e = r) { \ - r = atomic_cas((p), e, 0, sz); \ - if (r == e) \ - break; \ - } \ - e; \ -}) - -#define atomic_st(p, v, sz) ({ \ - itype(sz) e, r; \ - for (e = *(volatile itype(sz) *)(p);; e = r) { \ - r = atomic_cas((p), e, (v), sz); \ - if (r == e) \ - break; \ - } \ - e; \ -}) - -#define atomic_st_acq(p, v, sz) do { \ - atomic_st((p), (v), sz); \ - __compiler_membar(); \ -} while (0) - -#define atomic_st_rel(p, v, sz) do { \ - membar(LoadStore | StoreStore); \ - atomic_st((p), (v), sz); \ -} while (0) - -#define ATOMIC_GEN(name, ptype, vtype, atype, sz) \ - \ -static __inline vtype \ -atomic_add_ ## name(volatile ptype p, atype v) \ -{ \ - return ((vtype)atomic_op((p), +, (v), sz)); \ -} \ -static __inline vtype \ -atomic_add_acq_ ## name(volatile ptype p, atype v) \ -{ \ - return ((vtype)atomic_op_acq((p), +, (v), sz)); \ -} \ -static __inline vtype \ -atomic_add_rel_ ## name(volatile ptype p, atype v) \ -{ \ - return ((vtype)atomic_op_rel((p), +, (v), sz)); \ -} \ - \ -static __inline vtype \ -atomic_clear_ ## name(volatile ptype p, atype v) \ -{ \ - return ((vtype)atomic_op((p), &, ~(v), sz)); \ -} \ -static __inline vtype \ -atomic_clear_acq_ ## name(volatile ptype p, atype v) \ -{ \ - return ((vtype)atomic_op_acq((p), &, ~(v), sz)); \ -} \ -static __inline vtype \ -atomic_clear_rel_ ## name(volatile ptype p, atype v) \ -{ \ - return ((vtype)atomic_op_rel((p), &, ~(v), sz)); \ -} \ - \ -static __inline int \ -atomic_cmpset_ ## name(volatile ptype p, vtype e, vtype s) \ -{ \ - return (((vtype)atomic_cas((p), (e), (s), sz)) == (e)); \ -} \ -static __inline int \ -atomic_cmpset_acq_ ## name(volatile ptype p, vtype e, vtype s) \ -{ \ - return (((vtype)atomic_cas_acq((p), (e), (s), sz)) == (e)); \ -} \ -static __inline int \ -atomic_cmpset_rel_ ## name(volatile ptype p, vtype e, vtype s) \ -{ \ - return (((vtype)atomic_cas_rel((p), (e), (s), sz)) == (e)); \ -} \ - \ -static __inline int \ -atomic_fcmpset_ ## name(volatile ptype p, vtype *ep, vtype s) \ -{ \ - vtype t; \ - \ - t = (vtype)atomic_cas((p), (*ep), (s), sz); \ - if (t == (*ep)) \ - return (1); \ - *ep = t; \ - return (0); \ -} \ -static __inline int \ -atomic_fcmpset_acq_ ## name(volatile ptype p, vtype *ep, vtype s) \ -{ \ - vtype t; \ - \ - t = (vtype)atomic_cas_acq((p), (*ep), (s), sz); \ - if (t == (*ep)) \ - return (1); \ - *ep = t; \ - return (0); \ -} \ -static __inline int \ -atomic_fcmpset_rel_ ## name(volatile ptype p, vtype *ep, vtype s) \ -{ \ - vtype t; \ - \ - t = (vtype)atomic_cas_rel((p), (*ep), (s), sz); \ - if (t == (*ep)) \ - return (1); \ - *ep = t; \ - return (0); \ -} \ - \ -static __inline vtype \ -atomic_load_acq_ ## name(volatile ptype p) \ -{ \ - return ((vtype)atomic_cas_acq((p), 0, 0, sz)); \ -} \ - \ -static __inline vtype \ -atomic_readandclear_ ## name(volatile ptype p) \ -{ \ - return ((vtype)atomic_ld_clear((p), sz)); \ -} \ - \ -static __inline vtype \ -atomic_set_ ## name(volatile ptype p, atype v) \ -{ \ - return ((vtype)atomic_op((p), |, (v), sz)); \ -} \ -static __inline vtype \ -atomic_set_acq_ ## name(volatile ptype p, atype v) \ -{ \ - return ((vtype)atomic_op_acq((p), |, (v), sz)); \ -} \ -static __inline vtype \ -atomic_set_rel_ ## name(volatile ptype p, atype v) \ -{ \ - return ((vtype)atomic_op_rel((p), |, (v), sz)); \ -} \ - \ -static __inline vtype \ -atomic_subtract_ ## name(volatile ptype p, atype v) \ -{ \ - return ((vtype)atomic_op((p), -, (v), sz)); \ -} \ -static __inline vtype \ -atomic_subtract_acq_ ## name(volatile ptype p, atype v) \ -{ \ - return ((vtype)atomic_op_acq((p), -, (v), sz)); \ -} \ -static __inline vtype \ -atomic_subtract_rel_ ## name(volatile ptype p, atype v) \ -{ \ - return ((vtype)atomic_op_rel((p), -, (v), sz)); \ -} \ - \ -static __inline void \ -atomic_store_acq_ ## name(volatile ptype p, vtype v) \ -{ \ - atomic_st_acq((p), (v), sz); \ -} \ -static __inline void \ -atomic_store_rel_ ## name(volatile ptype p, vtype v) \ -{ \ - atomic_st_rel((p), (v), sz); \ -} \ - \ -static __inline vtype \ -atomic_swap_ ## name(volatile ptype p, vtype v) \ -{ \ - return ((vtype)atomic_st((p), (v), sz)); \ -} - -static __inline void -atomic_thread_fence_acq(void) -{ - - __compiler_membar(); -} - -static __inline void -atomic_thread_fence_rel(void) -{ - - __compiler_membar(); -} - -static __inline void -atomic_thread_fence_acq_rel(void) -{ - - __compiler_membar(); -} - -static __inline void -atomic_thread_fence_seq_cst(void) -{ - - membar(LoadLoad | LoadStore | StoreStore | StoreLoad); -} - - -ATOMIC_GEN(int, u_int *, u_int, u_int, 32); -ATOMIC_GEN(32, uint32_t *, uint32_t, uint32_t, 32); - -ATOMIC_GEN(long, u_long *, u_long, u_long, 64); -ATOMIC_GEN(64, uint64_t *, uint64_t, uint64_t, 64); - -ATOMIC_GEN(ptr, uintptr_t *, uintptr_t, uintptr_t, 64); - -#define ATOMIC_CMPSET_ACQ_REL(WIDTH) \ -static __inline int \ -atomic_cmpset_acq_##WIDTH(__volatile uint##WIDTH##_t *p, \ - uint##WIDTH##_t cmpval, uint##WIDTH##_t newval) \ -{ \ - int retval; \ - \ - retval = atomic_cmpset_##WIDTH(p, cmpval, newval); \ - mb(); \ - return (retval); \ -} \ - \ -static __inline int \ -atomic_cmpset_rel_##WIDTH(__volatile uint##WIDTH##_t *p, \ - uint##WIDTH##_t cmpval, uint##WIDTH##_t newval) \ -{ \ - mb(); \ - return (atomic_cmpset_##WIDTH(p, cmpval, newval)); \ -} - -#define ATOMIC_FCMPSET_ACQ_REL(WIDTH) \ -static __inline int \ -atomic_fcmpset_acq_##WIDTH(__volatile uint##WIDTH##_t *p, \ - uint##WIDTH##_t *cmpval, uint##WIDTH##_t newval) \ -{ \ - int retval; \ - \ - retval = atomic_fcmpset_##WIDTH(p, cmpval, newval); \ - mb(); \ - return (retval); \ -} \ - \ -static __inline int \ -atomic_fcmpset_rel_##WIDTH(__volatile uint##WIDTH##_t *p, \ - uint##WIDTH##_t *cmpval, uint##WIDTH##_t newval) \ -{ \ - mb(); \ - return (atomic_fcmpset_##WIDTH(p, cmpval, newval)); \ -} - -/* - * Atomically compare the value stored at *p with cmpval and if the - * two values are equal, update the value of *p with newval. Returns - * zero if the compare failed, nonzero otherwise. - */ -ATOMIC_CMPSET_ACQ_REL(8); -ATOMIC_CMPSET_ACQ_REL(16); -ATOMIC_FCMPSET_ACQ_REL(8); -ATOMIC_FCMPSET_ACQ_REL(16); - -#define atomic_cmpset_char atomic_cmpset_8 -#define atomic_cmpset_acq_char atomic_cmpset_acq_8 -#define atomic_cmpset_rel_char atomic_cmpset_rel_8 -#define atomic_fcmpset_acq_char atomic_fcmpset_acq_8 -#define atomic_fcmpset_rel_char atomic_fcmpset_rel_8 - -#define atomic_cmpset_short atomic_cmpset_16 -#define atomic_cmpset_acq_short atomic_cmpset_acq_16 -#define atomic_cmpset_rel_short atomic_cmpset_rel_16 -#define atomic_fcmpset_acq_short atomic_fcmpset_acq_16 -#define atomic_fcmpset_rel_short atomic_fcmpset_rel_16 - -#define atomic_fetchadd_int atomic_add_int -#define atomic_fetchadd_32 atomic_add_32 -#define atomic_fetchadd_long atomic_add_long -#define atomic_fetchadd_64 atomic_add_64 - -#undef ATOMIC_GEN -#undef atomic_cas -#undef atomic_cas_acq -#undef atomic_cas_rel -#undef atomic_op -#undef atomic_op_acq -#undef atomic_op_rel -#undef atomic_ld_acq -#undef atomic_ld_clear -#undef atomic_st -#undef atomic_st_acq -#undef atomic_st_rel - -#include - -#endif /* !_MACHINE_ATOMIC_H_ */ diff --git a/sys/sparc64/include/bus.h b/sys/sparc64/include/bus.h deleted file mode 100644 index e36c6863f80a82..00000000000000 --- a/sys/sparc64/include/bus.h +++ /dev/null @@ -1,852 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-NetBSD AND BSD-4-Clause - * - * Copyright (c) 1996, 1997, 1998, 2001 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, - * NASA Ames Research Center. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -/* - * Copyright (c) 1997-1999 Eduardo E. Horvath. All rights reserved. - * Copyright (c) 1996 Charles M. Hannum. All rights reserved. - * Copyright (c) 1996 Christopher G. Demetriou. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Christopher G. Demetriou - * for the NetBSD Project. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * from: NetBSD: bus.h,v 1.58 2008/04/28 20:23:36 martin Exp - * and - * from: FreeBSD: src/sys/alpha/include/bus.h,v 1.9 2001/01/09 - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_BUS_H_ -#define _MACHINE_BUS_H_ - -#ifdef BUS_SPACE_DEBUG -#include -#endif - -#include -#include - -/* - * Nexus and SBus spaces are non-cached and big endian - * (except for RAM and PROM) - * - * PCI spaces are non-cached and little endian - */ -#define NEXUS_BUS_SPACE 0 -#define SBUS_BUS_SPACE 1 -#define PCI_CONFIG_BUS_SPACE 2 -#define PCI_IO_BUS_SPACE 3 -#define PCI_MEMORY_BUS_SPACE 4 -#define LAST_BUS_SPACE 5 - -extern const int bus_type_asi[]; -extern const int bus_stream_asi[]; - -#define __BUS_SPACE_HAS_STREAM_METHODS 1 - -#define BUS_SPACE_MAXSIZE_24BIT 0xFFFFFF -#define BUS_SPACE_MAXSIZE_32BIT 0xFFFFFFFF -#define BUS_SPACE_MAXSIZE 0xFFFFFFFFFFFFFFFF -#define BUS_SPACE_MAXADDR_24BIT 0xFFFFFF -#define BUS_SPACE_MAXADDR_32BIT 0xFFFFFFFF -#define BUS_SPACE_MAXADDR 0xFFFFFFFFFFFFFFFF - -#define BUS_SPACE_UNRESTRICTED (~0) - -struct bus_space_tag { - void *bst_cookie; - int bst_type; -}; - -/* - * Bus space function prototypes. - */ -static void bus_space_barrier(bus_space_tag_t, bus_space_handle_t, bus_size_t, - bus_size_t, int); -static int bus_space_subregion(bus_space_tag_t, bus_space_handle_t, - bus_size_t, bus_size_t, bus_space_handle_t *); - -/* - * Map a region of device bus space into CPU virtual address space. - */ -int bus_space_map(bus_space_tag_t tag, bus_addr_t address, bus_size_t size, - int flags, bus_space_handle_t *handlep); - -/* - * Unmap a region of device bus space. - */ -void bus_space_unmap(bus_space_tag_t tag, bus_space_handle_t handle, - bus_size_t size); - -static __inline void -bus_space_barrier(bus_space_tag_t t __unused, bus_space_handle_t h __unused, - bus_size_t o __unused, bus_size_t s __unused, int f __unused) -{ - - /* - * We have lots of alternatives depending on whether we're - * synchronizing loads with loads, loads with stores, stores - * with loads, or stores with stores. The only ones that seem - * generic are #Sync and #MemIssue. We use #Sync for safety. - */ - membar(Sync); -} - -static __inline int -bus_space_subregion(bus_space_tag_t t __unused, bus_space_handle_t h, - bus_size_t o __unused, bus_size_t s __unused, bus_space_handle_t *hp) -{ - - *hp = h + o; - return (0); -} - -/* flags for bus space map functions */ -#define BUS_SPACE_MAP_CACHEABLE 0x0001 -#define BUS_SPACE_MAP_LINEAR 0x0002 -#define BUS_SPACE_MAP_READONLY 0x0004 -#define BUS_SPACE_MAP_PREFETCHABLE 0x0008 -/* placeholders for bus functions... */ -#define BUS_SPACE_MAP_BUS1 0x0100 -#define BUS_SPACE_MAP_BUS2 0x0200 -#define BUS_SPACE_MAP_BUS3 0x0400 -#define BUS_SPACE_MAP_BUS4 0x0800 - -/* flags for bus_space_barrier() */ -#define BUS_SPACE_BARRIER_READ 0x01 /* force read barrier */ -#define BUS_SPACE_BARRIER_WRITE 0x02 /* force write barrier */ - -#ifdef BUS_SPACE_DEBUG -#define KTR_BUS KTR_SPARE2 -#define __BUS_DEBUG_ACCESS(h, o, desc, sz) do { \ - CTR4(KTR_BUS, "bus space: %s %d: handle %#lx, offset %#lx", \ - (desc), (sz), (h), (o)); \ -} while (0) -#else -#define __BUS_DEBUG_ACCESS(h, o, desc, sz) -#endif - -static __inline uint8_t -bus_space_read_1(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o) -{ - - __BUS_DEBUG_ACCESS(h, o, "read", 1); - return (lduba_nc((caddr_t)(h + o), bus_type_asi[t->bst_type])); -} - -static __inline uint16_t -bus_space_read_2(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o) -{ - - __BUS_DEBUG_ACCESS(h, o, "read", 2); - return (lduha_nc((caddr_t)(h + o), bus_type_asi[t->bst_type])); -} - -static __inline uint32_t -bus_space_read_4(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o) -{ - - __BUS_DEBUG_ACCESS(h, o, "read", 4); - return (lduwa_nc((caddr_t)(h + o), bus_type_asi[t->bst_type])); -} - -static __inline uint64_t -bus_space_read_8(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o) -{ - - __BUS_DEBUG_ACCESS(h, o, "read", 8); - return (ldxa_nc((caddr_t)(h + o), bus_type_asi[t->bst_type])); -} - -static __inline void -bus_space_read_multi_1(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, - uint8_t *a, size_t c) -{ - - while (c-- > 0) - *a++ = bus_space_read_1(t, h, o); -} - -static __inline void -bus_space_read_multi_2(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, - uint16_t *a, size_t c) -{ - - while (c-- > 0) - *a++ = bus_space_read_2(t, h, o); -} - -static __inline void -bus_space_read_multi_4(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, - uint32_t *a, size_t c) -{ - - while (c-- > 0) - *a++ = bus_space_read_4(t, h, o); -} - -static __inline void -bus_space_read_multi_8(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, - uint64_t *a, size_t c) -{ - - while (c-- > 0) - *a++ = bus_space_read_8(t, h, o); -} - -static __inline void -bus_space_write_1(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, - uint8_t v) -{ - - __BUS_DEBUG_ACCESS(h, o, "write", 1); - stba_nc((caddr_t)(h + o), bus_type_asi[t->bst_type], v); -} - -static __inline void -bus_space_write_2(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, - uint16_t v) -{ - - __BUS_DEBUG_ACCESS(h, o, "write", 2); - stha_nc((caddr_t)(h + o), bus_type_asi[t->bst_type], v); -} - -static __inline void -bus_space_write_4(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, - uint32_t v) -{ - - __BUS_DEBUG_ACCESS(h, o, "write", 4); - stwa_nc((caddr_t)(h + o), bus_type_asi[t->bst_type], v); -} - -static __inline void -bus_space_write_8(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, - uint64_t v) -{ - - __BUS_DEBUG_ACCESS(h, o, "write", 8); - stxa_nc((caddr_t)(h + o), bus_type_asi[t->bst_type], v); -} - -static __inline void -bus_space_write_multi_1(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, - const uint8_t *a, size_t c) -{ - - while (c-- > 0) - bus_space_write_1(t, h, o, *a++); -} - -static __inline void -bus_space_write_multi_2(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, - const uint16_t *a, size_t c) -{ - - while (c-- > 0) - bus_space_write_2(t, h, o, *a++); -} - -static __inline void -bus_space_write_multi_4(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, - const uint32_t *a, size_t c) -{ - - while (c-- > 0) - bus_space_write_4(t, h, o, *a++); -} - -static __inline void -bus_space_write_multi_8(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, - const uint64_t *a, size_t c) -{ - - while (c-- > 0) - bus_space_write_8(t, h, o, *a++); -} - -static __inline void -bus_space_set_multi_1(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, - uint8_t v, size_t c) -{ - - while (c-- > 0) - bus_space_write_1(t, h, o, v); -} - -static __inline void -bus_space_set_multi_2(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, - uint16_t v, size_t c) -{ - - while (c-- > 0) - bus_space_write_2(t, h, o, v); -} - -static __inline void -bus_space_set_multi_4(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, - uint32_t v, size_t c) -{ - - while (c-- > 0) - bus_space_write_4(t, h, o, v); -} - -static __inline void -bus_space_set_multi_8(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, - uint64_t v, size_t c) -{ - - while (c-- > 0) - bus_space_write_8(t, h, o, v); -} - -static __inline void -bus_space_read_region_1(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, - uint8_t *a, bus_size_t c) -{ - - for (; c; a++, c--, o++) - *a = bus_space_read_1(t, h, o); -} - -static __inline void -bus_space_read_region_2(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, - uint16_t *a, bus_size_t c) -{ - - for (; c; a++, c--, o += 2) - *a = bus_space_read_2(t, h, o); -} - -static __inline void -bus_space_read_region_4(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, - uint32_t *a, bus_size_t c) -{ - - for (; c; a++, c--, o += 4) - *a = bus_space_read_4(t, h, o); -} - -static __inline void -bus_space_read_region_8(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, - uint64_t *a, bus_size_t c) -{ - - for (; c; a++, c--, o += 8) - *a = bus_space_read_8(t, h, o); -} - -static __inline void -bus_space_write_region_1(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, - const uint8_t *a, bus_size_t c) -{ - - for (; c; a++, c--, o++) - bus_space_write_1(t, h, o, *a); -} - -static __inline void -bus_space_write_region_2(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, - const uint16_t *a, bus_size_t c) -{ - - for (; c; a++, c--, o += 2) - bus_space_write_2(t, h, o, *a); -} - -static __inline void -bus_space_write_region_4(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, - const uint32_t *a, bus_size_t c) -{ - - for (; c; a++, c--, o += 4) - bus_space_write_4(t, h, o, *a); -} - -static __inline void -bus_space_write_region_8(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, - const uint64_t *a, bus_size_t c) -{ - - for (; c; a++, c--, o += 8) - bus_space_write_8(t, h, o, *a); -} - -static __inline void -bus_space_set_region_1(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, - const uint8_t v, bus_size_t c) -{ - - for (; c; c--, o++) - bus_space_write_1(t, h, o, v); -} - -static __inline void -bus_space_set_region_2(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, - const uint16_t v, bus_size_t c) -{ - - for (; c; c--, o += 2) - bus_space_write_2(t, h, o, v); -} - -static __inline void -bus_space_set_region_4(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, - const uint32_t v, bus_size_t c) -{ - - for (; c; c--, o += 4) - bus_space_write_4(t, h, o, v); -} - -static __inline void -bus_space_set_region_8(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, - const uint64_t v, bus_size_t c) -{ - - for (; c; c--, o += 8) - bus_space_write_8(t, h, o, v); -} - -static __inline void -bus_space_copy_region_1(bus_space_tag_t t, bus_space_handle_t h1, - bus_size_t o1, bus_space_handle_t h2, bus_size_t o2, bus_size_t c) -{ - - for (; c; c--, o1++, o2++) - bus_space_write_1(t, h1, o1, bus_space_read_1(t, h2, o2)); -} - -static __inline void -bus_space_copy_region_2(bus_space_tag_t t, bus_space_handle_t h1, - bus_size_t o1, bus_space_handle_t h2, bus_size_t o2, bus_size_t c) -{ - - for (; c; c--, o1 += 2, o2 += 2) - bus_space_write_2(t, h1, o1, bus_space_read_2(t, h2, o2)); -} - -static __inline void -bus_space_copy_region_4(bus_space_tag_t t, bus_space_handle_t h1, - bus_size_t o1, bus_space_handle_t h2, bus_size_t o2, bus_size_t c) -{ - - for (; c; c--, o1 += 4, o2 += 4) - bus_space_write_4(t, h1, o1, bus_space_read_4(t, h2, o2)); -} - -static __inline void -bus_space_copy_region_8(bus_space_tag_t t, bus_space_handle_t h1, - bus_size_t o1, bus_space_handle_t h2, bus_size_t o2, bus_size_t c) -{ - - for (; c; c--, o1 += 8, o2 += 8) - bus_space_write_8(t, h1, o1, bus_space_read_8(t, h2, o2)); -} - -static __inline uint8_t -bus_space_read_stream_1(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o) -{ - - __BUS_DEBUG_ACCESS(h, o, "read stream", 1); - return (lduba_nc((caddr_t)(h + o), bus_stream_asi[t->bst_type])); -} - -static __inline uint16_t -bus_space_read_stream_2(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o) -{ - - __BUS_DEBUG_ACCESS(h, o, "read stream", 2); - return (lduha_nc((caddr_t)(h + o), bus_stream_asi[t->bst_type])); -} - -static __inline uint32_t -bus_space_read_stream_4(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o) -{ - - __BUS_DEBUG_ACCESS(h, o, "read stream", 4); - return (lduwa_nc((caddr_t)(h + o), bus_stream_asi[t->bst_type])); -} - -static __inline uint64_t -bus_space_read_stream_8(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o) -{ - - __BUS_DEBUG_ACCESS(h, o, "read stream", 8); - return (ldxa_nc((caddr_t)(h + o), bus_stream_asi[t->bst_type])); -} - -static __inline void -bus_space_read_multi_stream_1(bus_space_tag_t t, bus_space_handle_t h, - bus_size_t o, uint8_t *a, size_t c) -{ - - while (c-- > 0) - *a++ = bus_space_read_stream_1(t, h, o); -} - -static __inline void -bus_space_read_multi_stream_2(bus_space_tag_t t, bus_space_handle_t h, - bus_size_t o, uint16_t *a, size_t c) -{ - - while (c-- > 0) - *a++ = bus_space_read_stream_2(t, h, o); -} - -static __inline void -bus_space_read_multi_stream_4(bus_space_tag_t t, bus_space_handle_t h, - bus_size_t o, uint32_t *a, size_t c) -{ - - while (c-- > 0) - *a++ = bus_space_read_stream_4(t, h, o); -} - -static __inline void -bus_space_read_multi_stream_8(bus_space_tag_t t, bus_space_handle_t h, - bus_size_t o, uint64_t *a, size_t c) -{ - - while (c-- > 0) - *a++ = bus_space_read_stream_8(t, h, o); -} - -static __inline void -bus_space_write_stream_1(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, - uint8_t v) -{ - - __BUS_DEBUG_ACCESS(h, o, "write stream", 1); - stba_nc((caddr_t)(h + o), bus_stream_asi[t->bst_type], v); -} - -static __inline void -bus_space_write_stream_2(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, - uint16_t v) -{ - - __BUS_DEBUG_ACCESS(h, o, "write stream", 2); - stha_nc((caddr_t)(h + o), bus_stream_asi[t->bst_type], v); -} - -static __inline void -bus_space_write_stream_4(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, - uint32_t v) -{ - - __BUS_DEBUG_ACCESS(h, o, "write stream", 4); - stwa_nc((caddr_t)(h + o), bus_stream_asi[t->bst_type], v); -} - -static __inline void -bus_space_write_stream_8(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, - uint64_t v) -{ - - __BUS_DEBUG_ACCESS(h, o, "write stream", 8); - stxa_nc((caddr_t)(h + o), bus_stream_asi[t->bst_type], v); -} - -static __inline void -bus_space_write_multi_stream_1(bus_space_tag_t t, bus_space_handle_t h, - bus_size_t o, const uint8_t *a, size_t c) -{ - - while (c-- > 0) - bus_space_write_stream_1(t, h, o, *a++); -} - -static __inline void -bus_space_write_multi_stream_2(bus_space_tag_t t, bus_space_handle_t h, - bus_size_t o, const uint16_t *a, size_t c) -{ - - while (c-- > 0) - bus_space_write_stream_2(t, h, o, *a++); -} - -static __inline void -bus_space_write_multi_stream_4(bus_space_tag_t t, bus_space_handle_t h, - bus_size_t o, const uint32_t *a, size_t c) -{ - - while (c-- > 0) - bus_space_write_stream_4(t, h, o, *a++); -} - -static __inline void -bus_space_write_multi_stream_8(bus_space_tag_t t, bus_space_handle_t h, - bus_size_t o, const uint64_t *a, size_t c) -{ - - while (c-- > 0) - bus_space_write_stream_8(t, h, o, *a++); -} - -static __inline void -bus_space_set_multi_stream_1(bus_space_tag_t t, bus_space_handle_t h, - bus_size_t o, uint8_t v, size_t c) -{ - - while (c-- > 0) - bus_space_write_stream_1(t, h, o, v); -} - -static __inline void -bus_space_set_multi_stream_2(bus_space_tag_t t, bus_space_handle_t h, - bus_size_t o, uint16_t v, size_t c) -{ - - while (c-- > 0) - bus_space_write_stream_2(t, h, o, v); -} - -static __inline void -bus_space_set_multi_stream_4(bus_space_tag_t t, bus_space_handle_t h, - bus_size_t o, uint32_t v, size_t c) -{ - - while (c-- > 0) - bus_space_write_stream_4(t, h, o, v); -} - -static __inline void -bus_space_set_multi_stream_8(bus_space_tag_t t, bus_space_handle_t h, - bus_size_t o, uint64_t v, size_t c) -{ - - while (c-- > 0) - bus_space_write_stream_8(t, h, o, v); -} - -static __inline void -bus_space_read_region_stream_1(bus_space_tag_t t, bus_space_handle_t h, - bus_size_t o, uint8_t *a, bus_size_t c) -{ - - for (; c; a++, c--, o++) - *a = bus_space_read_stream_1(t, h, o); -} - -static __inline void -bus_space_read_region_stream_2(bus_space_tag_t t, bus_space_handle_t h, - bus_size_t o, uint16_t *a, bus_size_t c) -{ - - for (; c; a++, c--, o += 2) - *a = bus_space_read_stream_2(t, h, o); -} - -static __inline void -bus_space_read_region_stream_4(bus_space_tag_t t, bus_space_handle_t h, - bus_size_t o, uint32_t *a, bus_size_t c) -{ - - for (; c; a++, c--, o += 4) - *a = bus_space_read_stream_4(t, h, o); -} - -static __inline void -bus_space_read_region_stream_8(bus_space_tag_t t, bus_space_handle_t h, - bus_size_t o, uint64_t *a, bus_size_t c) -{ - - for (; c; a++, c--, o += 8) - *a = bus_space_read_stream_8(t, h, o); -} - -static __inline void -bus_space_write_region_stream_1(bus_space_tag_t t, bus_space_handle_t h, - bus_size_t o, const uint8_t *a, bus_size_t c) -{ - - for (; c; a++, c--, o++) - bus_space_write_stream_1(t, h, o, *a); -} - -static __inline void -bus_space_write_region_stream_2(bus_space_tag_t t, bus_space_handle_t h, - bus_size_t o, const uint16_t *a, bus_size_t c) -{ - - for (; c; a++, c--, o += 2) - bus_space_write_stream_2(t, h, o, *a); -} - -static __inline void -bus_space_write_region_stream_4(bus_space_tag_t t, bus_space_handle_t h, - bus_size_t o, const uint32_t *a, bus_size_t c) -{ - - for (; c; a++, c--, o += 4) - bus_space_write_stream_4(t, h, o, *a); -} - -static __inline void -bus_space_write_region_stream_8(bus_space_tag_t t, bus_space_handle_t h, - bus_size_t o, const uint64_t *a, bus_size_t c) -{ - - for (; c; a++, c--, o += 8) - bus_space_write_stream_8(t, h, o, *a); -} - -static __inline void -bus_space_set_region_stream_1(bus_space_tag_t t, bus_space_handle_t h, - bus_size_t o, const uint8_t v, bus_size_t c) -{ - - for (; c; c--, o++) - bus_space_write_stream_1(t, h, o, v); -} - -static __inline void -bus_space_set_region_stream_2(bus_space_tag_t t, bus_space_handle_t h, - bus_size_t o, const uint16_t v, bus_size_t c) -{ - - for (; c; c--, o += 2) - bus_space_write_stream_2(t, h, o, v); -} - -static __inline void -bus_space_set_region_stream_4(bus_space_tag_t t, bus_space_handle_t h, - bus_size_t o, const uint32_t v, bus_size_t c) -{ - - for (; c; c--, o += 4) - bus_space_write_stream_4(t, h, o, v); -} - -static __inline void -bus_space_set_region_stream_8(bus_space_tag_t t, bus_space_handle_t h, - bus_size_t o, const uint64_t v, bus_size_t c) -{ - - for (; c; c--, o += 8) - bus_space_write_stream_8(t, h, o, v); -} - -static __inline void -bus_space_copy_region_stream_1(bus_space_tag_t t, bus_space_handle_t h1, - bus_size_t o1, bus_space_handle_t h2, bus_size_t o2, bus_size_t c) -{ - - for (; c; c--, o1++, o2++) - bus_space_write_stream_1(t, h1, o1, bus_space_read_stream_1(t, h2, - o2)); -} - -static __inline void -bus_space_copy_region_stream_2(bus_space_tag_t t, bus_space_handle_t h1, - bus_size_t o1, bus_space_handle_t h2, bus_size_t o2, bus_size_t c) -{ - - for (; c; c--, o1 += 2, o2 += 2) - bus_space_write_stream_2(t, h1, o1, bus_space_read_stream_2(t, h2, - o2)); -} - -static __inline void -bus_space_copy_region_stream_4(bus_space_tag_t t, bus_space_handle_t h1, - bus_size_t o1, bus_space_handle_t h2, bus_size_t o2, bus_size_t c) -{ - - for (; c; c--, o1 += 4, o2 += 4) - bus_space_write_stream_4(t, h1, o1, bus_space_read_stream_4(t, h2, - o2)); -} - -static __inline void -bus_space_copy_region_stream_8(bus_space_tag_t t, bus_space_handle_t h1, - bus_size_t o1, bus_space_handle_t h2, bus_size_t o2, bus_size_t c) -{ - - for (; c; c--, o1 += 8, o2 += 8) - bus_space_write_stream_8(t, h1, o1, bus_space_read_8(t, h2, o2)); -} - -static __inline int -bus_space_peek_1(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, - uint8_t *a) -{ - - __BUS_DEBUG_ACCESS(h, o, "peek", 1); - return (fasword8(bus_type_asi[t->bst_type], (caddr_t)(h + o), a)); -} - -static __inline int -bus_space_peek_2(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, - uint16_t *a) -{ - - __BUS_DEBUG_ACCESS(h, o, "peek", 2); - return (fasword16(bus_type_asi[t->bst_type], (caddr_t)(h + o), a)); -} - -static __inline int -bus_space_peek_4(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, - uint32_t *a) -{ - - __BUS_DEBUG_ACCESS(h, o, "peek", 4); - return (fasword32(bus_type_asi[t->bst_type], (caddr_t)(h + o), a)); -} - -#include - -#endif /* !_MACHINE_BUS_H_ */ diff --git a/sys/sparc64/include/bus_common.h b/sys/sparc64/include/bus_common.h deleted file mode 100644 index 6d04a9cbe27d78..00000000000000 --- a/sys/sparc64/include/bus_common.h +++ /dev/null @@ -1,77 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * form: @(#)sbusreg.h 8.1 (Berkeley) 6/11/93 - * from: NetBSD: iommureg.h,v 1.6 2001/07/20 00:07:13 eeh Exp - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_BUS_COMMON_H_ -#define _MACHINE_BUS_COMMON_H_ - -#define INTCLR_PENDING 0x000000003ULL /* Interrupt queued to CPU */ -#define INTCLR_RECEIVED 0x000000001ULL /* Interrupt received */ -#define INTCLR_IDLE 0x000000000ULL /* Interrupt idle */ - -#define INTMAP_V 0x080000000ULL /* Interrupt valid (enabled) */ -#define INTMAP_TID_MASK 0x07c000000ULL /* UPA target ID */ -#define INTMAP_TID_SHIFT 26 -#define INTMAP_IGN_MASK 0x0000007c0ULL /* Interrupt group no. */ -#define INTMAP_IGN_SHIFT 6 -#define INTMAP_INO_MASK 0x00000003fULL /* Interrupt number */ -#define INTMAP_INR_MASK (INTMAP_IGN_MASK | INTMAP_INO_MASK) -#define INTMAP_SBUSSLOT_MASK 0x000000018ULL /* SBus slot # */ -#define INTMAP_PCIBUS_MASK 0x000000010ULL /* PCI bus number (A or B) */ -#define INTMAP_PCISLOT_MASK 0x00000000cULL /* PCI slot # */ -#define INTMAP_PCIINT_MASK 0x000000003ULL /* PCI interrupt #A,#B,#C,#D */ -#define INTMAP_OBIO_MASK 0x000000020ULL /* Onboard device */ -#define INTIGN(x) (((x) & INTMAP_IGN_MASK) >> INTMAP_IGN_SHIFT) -#define INTVEC(x) ((x) & INTMAP_INR_MASK) -#define INTSLOT(x) (((x) >> 3) & 0x7) -#define INTPRI(x) ((x) & 0x7) -#define INTINO(x) ((x) & INTMAP_INO_MASK) -#define INTMAP_ENABLE(mr, mid) \ - (INTMAP_TID((mr), (mid)) | INTMAP_V) -#define INTMAP_TID(mr, mid) \ - (((mr) & ~INTMAP_TID_MASK) | ((mid) << INTMAP_TID_SHIFT)) -#define INTMAP_VEC(ign, ino) \ - ((((ign) << INTMAP_IGN_SHIFT) & INTMAP_IGN_MASK) | \ - ((ino) & INTMAP_INO_MASK)) - -/* counter-timer support. */ -void sparc64_counter_init(const char *name, bus_space_tag_t tag, - bus_space_handle_t handle, bus_addr_t offset); - -#endif /* !_MACHINE_BUS_COMMON_H_ */ diff --git a/sys/sparc64/include/bus_dma.h b/sys/sparc64/include/bus_dma.h deleted file mode 100644 index 0edb92860bd56e..00000000000000 --- a/sys/sparc64/include/bus_dma.h +++ /dev/null @@ -1,221 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-NetBSD AND BSD-4-Clause - * - * Copyright (c) 1996, 1997, 1998, 2001 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, - * NASA Ames Research Center. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -/* - * Copyright (c) 1997-1999 Eduardo E. Horvath. All rights reserved. - * Copyright (c) 1996 Charles M. Hannum. All rights reserved. - * Copyright (c) 1996 Christopher G. Demetriou. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Christopher G. Demetriou - * for the NetBSD Project. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * from: NetBSD: bus.h,v 1.58 2008/04/28 20:23:36 martin Exp - * and - * from: FreeBSD: src/sys/alpha/include/bus.h,v 1.9 2001/01/09 - * - * $FreeBSD$ - */ - -#ifndef _SPARC64_BUS_DMA_H -#define _SPARC64_BUS_DMA_H - -#define WANT_INLINE_DMAMAP -#include - -/* DMA support */ - -/* - * Method table for a bus_dma_tag. - */ -struct bus_dma_methods { - int (*dm_dmamap_create)(bus_dma_tag_t, int, bus_dmamap_t *); - int (*dm_dmamap_destroy)(bus_dma_tag_t, bus_dmamap_t); - int (*dm_dmamap_load_phys)(bus_dma_tag_t dmat, bus_dmamap_t map, - vm_paddr_t buf, bus_size_t buflen, int flags, - bus_dma_segment_t *segs, int *segp); - int (*dm_dmamap_load_buffer)(bus_dma_tag_t dmat, bus_dmamap_t map, - void *buf, bus_size_t buflen, struct pmap *pmap, int flags, - bus_dma_segment_t *segs, int *segp); - void (*dm_dmamap_waitok)(bus_dma_tag_t dmat, bus_dmamap_t map, - struct memdesc *mem, bus_dmamap_callback_t *callback, - void *callback_arg); - bus_dma_segment_t *(*dm_dmamap_complete)(bus_dma_tag_t dmat, - bus_dmamap_t map, bus_dma_segment_t *segs, int nsegs, int error); - void (*dm_dmamap_unload)(bus_dma_tag_t, bus_dmamap_t); - void (*dm_dmamap_sync)(bus_dma_tag_t, bus_dmamap_t, - bus_dmasync_op_t); - int (*dm_dmamem_alloc)(bus_dma_tag_t, void **, int, bus_dmamap_t *); - void (*dm_dmamem_free)(bus_dma_tag_t, void *, bus_dmamap_t); -}; - -/* - * bus_dma_tag_t - * - * A machine-dependent opaque type describing the implementation of - * DMA for a given bus. - */ -struct bus_dma_tag { - void *dt_cookie; /* cookie used in the guts */ - bus_dma_tag_t dt_parent; - bus_size_t dt_alignment; - bus_addr_t dt_boundary; - bus_addr_t dt_lowaddr; - bus_addr_t dt_highaddr; - bus_dma_filter_t *dt_filter; - void *dt_filterarg; - bus_size_t dt_maxsize; - int dt_nsegments; - bus_size_t dt_maxsegsz; - int dt_flags; - int dt_ref_count; - int dt_map_count; - bus_dma_lock_t *dt_lockfunc; - void * *dt_lockfuncarg; - bus_dma_segment_t *dt_segments; - - struct bus_dma_methods *dt_mt; -}; - -static inline int -bus_dmamap_create(bus_dma_tag_t dmat, int flags, bus_dmamap_t *mapp) -{ - - return (dmat->dt_mt->dm_dmamap_create(dmat, flags, mapp)); -} - -static inline int -bus_dmamap_destroy(bus_dma_tag_t dmat, bus_dmamap_t map) -{ - - return (dmat->dt_mt->dm_dmamap_destroy(dmat, map)); -} - -static inline void -bus_dmamap_sync(bus_dma_tag_t dmat, bus_dmamap_t map, bus_dmasync_op_t op) -{ - - dmat->dt_mt->dm_dmamap_sync(dmat, map, op); -} - -static inline void -bus_dmamap_unload(bus_dma_tag_t dmat, bus_dmamap_t map) -{ - - dmat->dt_mt->dm_dmamap_unload(dmat, map); -} - -static inline int -bus_dmamem_alloc(bus_dma_tag_t dmat, void** vaddr, int flags, bus_dmamap_t *mapp) -{ - - return (dmat->dt_mt->dm_dmamem_alloc(dmat, vaddr, flags, mapp)); -} - -static inline void -bus_dmamem_free(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map) -{ - - dmat->dt_mt->dm_dmamem_free(dmat, vaddr, map); -} - -static inline bus_dma_segment_t* -_bus_dmamap_complete(bus_dma_tag_t dmat, bus_dmamap_t map, - bus_dma_segment_t *segs, int nsegs, int error) -{ - - return (dmat->dt_mt->dm_dmamap_complete(dmat, map, segs, - nsegs, error)); -} - -static inline int -_bus_dmamap_load_buffer(bus_dma_tag_t dmat, bus_dmamap_t map, - void *buf, bus_size_t buflen, struct pmap *pmap, - int flags, bus_dma_segment_t *segs, int *segp) -{ - - return (dmat->dt_mt->dm_dmamap_load_buffer(dmat, map, buf, buflen, - pmap, flags, segs, segp)); -} - -static inline int -_bus_dmamap_load_ma(bus_dma_tag_t dmat, bus_dmamap_t map, - struct vm_page **ma, bus_size_t tlen, int ma_offs, - int flags, bus_dma_segment_t *segs, int *segp) -{ - - return (bus_dmamap_load_ma_triv(dmat, map, ma, tlen, ma_offs, flags, - segs, segp)); -} - -static inline int -_bus_dmamap_load_phys(bus_dma_tag_t dmat, bus_dmamap_t map, - vm_paddr_t paddr, bus_size_t buflen, - int flags, bus_dma_segment_t *segs, int *segp) -{ - - return (dmat->dt_mt->dm_dmamap_load_phys(dmat, map, paddr, buflen, - flags, segs, segp)); -} - -static inline void -_bus_dmamap_waitok(bus_dma_tag_t dmat, bus_dmamap_t map, - struct memdesc *mem, bus_dmamap_callback_t *callback, - void *callback_arg) -{ - - return (dmat->dt_mt->dm_dmamap_waitok(dmat, map, mem, callback, - callback_arg)); -} - -#endif /* !_SPARC64_BUS_DMA_H_ */ diff --git a/sys/sparc64/include/bus_private.h b/sys/sparc64/include/bus_private.h deleted file mode 100644 index 57f25a678c8168..00000000000000 --- a/sys/sparc64/include/bus_private.h +++ /dev/null @@ -1,82 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 1997, 1998 Justin T. Gibbs. - * Copyright (c) 2002 by Thomas Moestl . - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE - * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * from: FreeBSD: src/sys/i386/i386/busdma_machdep.c,v 1.25 2002/01/05 - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_BUS_PRIVATE_H_ -#define _MACHINE_BUS_PRIVATE_H_ - -#include - -/* - * Helpers - */ -int sparc64_bus_mem_map(bus_space_tag_t tag, bus_addr_t addr, bus_size_t size, - int flags, vm_offset_t vaddr, bus_space_handle_t *hp); -int sparc64_bus_mem_unmap(bus_space_tag_t tag, bus_space_handle_t handle, - bus_size_t size); -bus_space_tag_t sparc64_alloc_bus_tag(void *cookie, int type); -bus_space_handle_t sparc64_fake_bustag(int space, bus_addr_t addr, - struct bus_space_tag *ptag); - -struct bus_dmamap_res { - struct resource *dr_res; - bus_size_t dr_used; - SLIST_ENTRY(bus_dmamap_res) dr_link; -}; - -/* - * Callers of the bus_dma interfaces must always protect their tags and maps - * appropriately against concurrent access. However, when a map is on a LRU - * queue, there is a second access path to it; for this case, the locking rules - * are given in the parenthesized comments below: - * q - locked by the mutex protecting the queue. - * p - private to the owner of the map, no access through the queue. - * * - comment refers to pointer target. - * Only the owner of the map is allowed to insert the map into a queue. Removal - * and repositioning (i.e. temporal removal and reinsertion) is allowed to all - * if the queue lock is held. - */ -struct bus_dmamap { - TAILQ_ENTRY(bus_dmamap) dm_maplruq; /* (q) */ - SLIST_HEAD(, bus_dmamap_res) dm_reslist; /* (q, *q) */ - int dm_onq; /* (q) */ - int dm_flags; /* (p) */ -}; - -/* Flag values */ -#define DMF_LOADED (1 << 0) /* Map is loaded. */ -#define DMF_COHERENT (1 << 1) /* Coherent mapping requested. */ -#define DMF_STREAMED (1 << 2) /* Streaming cache used. */ - -int sparc64_dma_alloc_map(bus_dma_tag_t dmat, bus_dmamap_t *mapp); -void sparc64_dma_free_map(bus_dma_tag_t dmat, bus_dmamap_t map); - -#endif /* !_MACHINE_BUS_PRIVATE_H_ */ diff --git a/sys/sparc64/include/cache.h b/sys/sparc64/include/cache.h deleted file mode 100644 index a299f2e4974a22..00000000000000 --- a/sys/sparc64/include/cache.h +++ /dev/null @@ -1,129 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-4-Clause - * - * Copyright (c) 1996 - * The President and Fellows of Harvard College. All rights reserved. - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Aaron Brown and - * Harvard University. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: @(#)cache.h 8.1 (Berkeley) 6/11/93 - * from: NetBSD: cache.h,v 1.3 2000/08/01 00:28:02 eeh Exp - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_CACHE_H_ -#define _MACHINE_CACHE_H_ - -#define DCACHE_COLOR_BITS (1) -#define DCACHE_COLORS (1 << DCACHE_COLOR_BITS) -#define DCACHE_COLOR_MASK (DCACHE_COLORS - 1) -#define DCACHE_COLOR(va) (((va) >> PAGE_SHIFT) & DCACHE_COLOR_MASK) -#define DCACHE_OTHER_COLOR(color) \ - ((color) ^ DCACHE_COLOR_BITS) - -#define DC_TAG_SHIFT 2 -#define DC_VALID_SHIFT 0 - -#define DC_TAG_BITS 28 -#define DC_VALID_BITS 2 - -#define DC_TAG_MASK ((1 << DC_TAG_BITS) - 1) -#define DC_VALID_MASK ((1 << DC_VALID_BITS) - 1) - -#define IC_TAG_SHIFT 7 -#define IC_VALID_SHIFT 36 - -#define IC_TAG_BITS 28 -#define IC_VALID_BITS 1 - -#define IC_TAG_MASK ((1 << IC_TAG_BITS) - 1) -#define IC_VALID_MASK ((1 << IC_VALID_BITS) - 1) - -#ifndef LOCORE - -/* - * Cache control information - */ -struct cacheinfo { - u_int ic_size; /* instruction cache */ - u_int ic_assoc; - u_int ic_linesize; - u_int dc_size; /* data cache */ - u_int dc_assoc; - u_int dc_linesize; - u_int ec_size; /* external cache info */ - u_int ec_assoc; - u_int ec_linesize; -}; - -#ifdef _KERNEL - -extern u_int dcache_color_ignore; - -struct pcpu; - -typedef void cache_enable_t(u_int cpu_impl); -typedef void cache_flush_t(void); -typedef void dcache_page_inval_t(vm_paddr_t pa); -typedef void icache_page_inval_t(vm_paddr_t pa); - -void cache_init(struct pcpu *pcpu); - -cache_enable_t cheetah_cache_enable; -cache_flush_t cheetah_cache_flush; -dcache_page_inval_t cheetah_dcache_page_inval; -icache_page_inval_t cheetah_icache_page_inval; - -cache_enable_t spitfire_cache_enable; -cache_flush_t spitfire_cache_flush; -dcache_page_inval_t spitfire_dcache_page_inval; -icache_page_inval_t spitfire_icache_page_inval; - -cache_enable_t zeus_cache_enable; -cache_flush_t zeus_cache_flush; -dcache_page_inval_t zeus_dcache_page_inval; -icache_page_inval_t zeus_icache_page_inval; - -extern cache_enable_t *cache_enable; -extern cache_flush_t *cache_flush; -extern dcache_page_inval_t *dcache_page_inval; -extern icache_page_inval_t *icache_page_inval; - -#endif /* KERNEL */ - -#endif /* !LOCORE */ - -#endif /* !_MACHINE_CACHE_H_ */ diff --git a/sys/sparc64/include/ccr.h b/sys/sparc64/include/ccr.h deleted file mode 100644 index d370684ddd7378..00000000000000 --- a/sys/sparc64/include/ccr.h +++ /dev/null @@ -1,48 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright 2001 by Thomas Moestl . All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE - * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_CCR_H_ -#define _MACHINE_CCR_H_ - -#define ICC_SHIFT 0 -#define ICC_BITS 4 -#define ICC_MASK ((1UL << ICC_BITS) - 1) -#define ICC_C (1UL << 0) -#define ICC_V (1UL << 1) -#define ICC_Z (1UL << 2) -#define ICC_N (1UL << 3) - -#define XCC_SHIFT 4 -#define XCC_BITS 4 -#define XCC_MASK (((1UL << XCC_BITS) - 1) << XCC_SHIFT) -#define XCC_C (1UL << 4) -#define XCC_V (1UL << 5) -#define XCC_Z (1UL << 6) -#define XCC_N (1UL << 7) - -#endif /* !_MACHINE_CCR_H_ */ diff --git a/sys/sparc64/include/clock.h b/sys/sparc64/include/clock.h deleted file mode 100644 index 34b59d8c8b7790..00000000000000 --- a/sys/sparc64/include/clock.h +++ /dev/null @@ -1,10 +0,0 @@ -/*- - * This file is in the public domain. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_CLOCK_H_ -#define _MACHINE_CLOCK_H_ - -#endif /* !_MACHINE_CLOCK_H_ */ diff --git a/sys/sparc64/include/cmt.h b/sys/sparc64/include/cmt.h deleted file mode 100644 index 770f71616a8ffe..00000000000000 --- a/sys/sparc64/include/cmt.h +++ /dev/null @@ -1,41 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2010 Marius Strobl - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_CMT_H_ -#define _MACHINE_CMT_H_ - -#define INTR_ID_ID_SHIFT (0) -#define INTR_ID_ID_SIZE (10) -#define INTR_ID_ID_MASK \ - (((1 << INTR_ID_ID_SIZE) - 1) << INTR_ID_ID_SHIFT) - -#define INTR_ID_GET_ID(cr) ((cr & INTR_ID_ID_MASK) >> INTR_ID_ID_SHIFT) - -#endif /* _MACHINE_CMT_H_ */ diff --git a/sys/sparc64/include/counter.h b/sys/sparc64/include/counter.h deleted file mode 100644 index 128d5c0fce7ef5..00000000000000 --- a/sys/sparc64/include/counter.h +++ /dev/null @@ -1,98 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2012 Konstantin Belousov - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef __MACHINE_COUNTER_H__ -#define __MACHINE_COUNTER_H__ - -#include -#ifdef INVARIANTS -#include -#endif - -extern struct pcpu dummy_pcpu[]; -#define EARLY_COUNTER &dummy_pcpu[0].pc_early_dummy_counter - -#define counter_enter() critical_enter() -#define counter_exit() critical_exit() - -#ifdef IN_SUBR_COUNTER_C -static inline uint64_t -counter_u64_read_one(uint64_t *p, int cpu) -{ - - return (*(uint64_t *)((char *)p + UMA_PCPU_ALLOC_SIZE * cpu)); -} - -static inline uint64_t -counter_u64_fetch_inline(uint64_t *p) -{ - uint64_t r; - int i; - - r = 0; - for (i = 0; i < mp_ncpus; i++) - r += counter_u64_read_one((uint64_t *)p, i); - - return (r); -} - -/* XXXKIB might interrupt increment */ -static void -counter_u64_zero_one_cpu(void *arg) -{ - - *((uint64_t *)((char *)arg + UMA_PCPU_ALLOC_SIZE * - PCPU_GET(cpuid))) = 0; -} - -static inline void -counter_u64_zero_inline(counter_u64_t c) -{ - - smp_rendezvous(smp_no_rendezvous_barrier, counter_u64_zero_one_cpu, - smp_no_rendezvous_barrier, c); -} -#endif - -#define counter_u64_add_protected(c, inc) do { \ - CRITICAL_ASSERT(curthread); \ - *(uint64_t *)zpcpu_get(c) += (inc); \ -} while (0) - -static inline void -counter_u64_add(counter_u64_t c, int64_t inc) -{ - - counter_enter(); - counter_u64_add_protected(c, inc); - counter_exit(); -} - -#endif /* ! __MACHINE_COUNTER_H__ */ diff --git a/sys/sparc64/include/cpu.h b/sys/sparc64/include/cpu.h deleted file mode 100644 index a91159f6a7a217..00000000000000 --- a/sys/sparc64/include/cpu.h +++ /dev/null @@ -1,74 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * William Jolitz. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: @(#)cpu.h 5.4 (Berkeley) 5/9/91 - * from: FreeBSD: src/sys/i386/include/cpu.h,v 1.62 2001/06/29 - * $FreeBSD$ - */ - -#ifndef _MACHINE_CPU_H_ -#define _MACHINE_CPU_H_ - -#include -#include - -#define TRAPF_PC(tfp) ((tfp)->tf_tpc) -#define TRAPF_USERMODE(tfp) (((tfp)->tf_tstate & TSTATE_PRIV) == 0) - -#define cpu_getstack(td) ((td)->td_frame->tf_sp) -#define cpu_setstack(td, sp) ((td)->td_frame->tf_sp = (sp)) -#define cpu_spinwait() /* nothing */ -#define cpu_lock_delay() DELAY(1) - -#ifdef _KERNEL - -extern char btext[]; -extern char etext[]; - -void cheetah_init(u_int cpu_impl); -void cpu_halt(void) __dead2; -void cpu_reset(void) __dead2; -void fork_trampoline(void); -void swi_vm(void *v); -void zeus_init(u_int cpu_impl); - -static __inline u_int64_t -get_cyclecount(void) -{ - - return (rd(tick)); -} - -#endif - -#endif /* !_MACHINE_CPU_H_ */ diff --git a/sys/sparc64/include/cpufunc.h b/sys/sparc64/include/cpufunc.h deleted file mode 100644 index 934e671707b90b..00000000000000 --- a/sys/sparc64/include/cpufunc.h +++ /dev/null @@ -1,272 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2001 Jake Burkholder. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_CPUFUNC_H_ -#define _MACHINE_CPUFUNC_H_ - -#include -#include - -struct thread; - -/* - * Membar operand macros for use in other macros when # is a special - * character. Keep these in sync with what the hardware expects. - */ -#define C_Lookaside (0) -#define C_MemIssue (1) -#define C_Sync (2) -#define M_LoadLoad (0) -#define M_StoreLoad (1) -#define M_LoadStore (2) -#define M_StoreStore (3) - -#define CMASK_SHIFT (4) -#define MMASK_SHIFT (0) - -#define CMASK_GEN(bit) ((1 << (bit)) << CMASK_SHIFT) -#define MMASK_GEN(bit) ((1 << (bit)) << MMASK_SHIFT) - -#define Lookaside CMASK_GEN(C_Lookaside) -#define MemIssue CMASK_GEN(C_MemIssue) -#define Sync CMASK_GEN(C_Sync) -#define LoadLoad MMASK_GEN(M_LoadLoad) -#define StoreLoad MMASK_GEN(M_StoreLoad) -#define LoadStore MMASK_GEN(M_LoadStore) -#define StoreStore MMASK_GEN(M_StoreStore) - -#define casa(rs1, rs2, rd, asi) ({ \ - u_int __rd = (uint32_t)(rd); \ - __asm __volatile("casa [%2] %3, %4, %0" \ - : "+r" (__rd), "=m" (*rs1) \ - : "r" (rs1), "n" (asi), "r" (rs2), "m" (*rs1)); \ - __rd; \ -}) - -#define casxa(rs1, rs2, rd, asi) ({ \ - u_long __rd = (uint64_t)(rd); \ - __asm __volatile("casxa [%2] %3, %4, %0" \ - : "+r" (__rd), "=m" (*rs1) \ - : "r" (rs1), "n" (asi), "r" (rs2), "m" (*rs1)); \ - __rd; \ -}) - -#define flush(va) do { \ - __asm __volatile("flush %0" : : "r" (va)); \ -} while (0) - -#define flushw() do { \ - __asm __volatile("flushw" : :); \ -} while (0) - -#define mov(val, reg) do { \ - __asm __volatile("mov %0, %" __XSTRING(reg) : : "r" (val)); \ -} while (0) - -/* Generate ld*a/st*a functions for non-constant ASIs. */ -#define LDNC_GEN(tp, o) \ - static __inline tp \ - o ## _nc(caddr_t va, int asi) \ - { \ - tp r; \ - __asm __volatile("wr %2, 0, %%asi;" #o " [%1] %%asi, %0"\ - : "=r" (r) : "r" (va), "r" (asi)); \ - return (r); \ - } - -LDNC_GEN(u_char, lduba); -LDNC_GEN(u_short, lduha); -LDNC_GEN(u_int, lduwa); -LDNC_GEN(u_long, ldxa); - -#define LD_GENERIC(va, asi, op, type) ({ \ - type __r; \ - __asm __volatile(#op " [%1] %2, %0" \ - : "=r" (__r) : "r" (va), "n" (asi)); \ - __r; \ -}) - -#define lduba(va, asi) LD_GENERIC(va, asi, lduba, u_char) -#define lduha(va, asi) LD_GENERIC(va, asi, lduha, u_short) -#define lduwa(va, asi) LD_GENERIC(va, asi, lduwa, u_int) -#define ldxa(va, asi) LD_GENERIC(va, asi, ldxa, u_long) - -#define STNC_GEN(tp, o) \ - static __inline void \ - o ## _nc(caddr_t va, int asi, tp val) \ - { \ - __asm __volatile("wr %2, 0, %%asi;" #o " %0, [%1] %%asi"\ - : : "r" (val), "r" (va), "r" (asi)); \ - } - -STNC_GEN(u_char, stba); -STNC_GEN(u_short, stha); -STNC_GEN(u_int, stwa); -STNC_GEN(u_long, stxa); - -#define ST_GENERIC(va, asi, val, op) \ - __asm __volatile(#op " %0, [%1] %2" \ - : : "r" (val), "r" (va), "n" (asi)); \ - -#define stba(va, asi, val) ST_GENERIC(va, asi, val, stba) -#define stha(va, asi, val) ST_GENERIC(va, asi, val, stha) -#define stwa(va, asi, val) ST_GENERIC(va, asi, val, stwa) -#define stxa(va, asi, val) ST_GENERIC(va, asi, val, stxa) - -/* - * Attempt to read from addr, val. If a Data Access Error trap happens, - * they return -1 and the contents of val is undefined. A return of 0 - * means no trap happened, and the contents of val is valid. - */ -int fasword8(u_long asi, void *addr, uint8_t *val); -int fasword16(u_long asi, void *addr, uint16_t *val); -int fasword32(u_long asi, void *addr, uint32_t *val); - -#define membar(mask) do { \ - __asm __volatile("membar %0" : : "n" (mask) : "memory"); \ -} while (0) - -#define rd(name) ({ \ - uint64_t __sr; \ - __asm __volatile("rd %%" #name ", %0" : "=r" (__sr) :); \ - __sr; \ -}) - -#define wr(name, val, xorval) do { \ - __asm __volatile("wr %0, %1, %%" #name \ - : : "r" (val), "rI" (xorval)); \ -} while (0) - -#define rdpr(name) ({ \ - uint64_t __pr; \ - __asm __volatile("rdpr %%" #name", %0" : "=r" (__pr) :); \ - __pr; \ -}) - -#define wrpr(name, val, xorval) do { \ - __asm __volatile("wrpr %0, %1, %%" #name \ - : : "r" (val), "rI" (xorval)); \ -} while (0) - -/* - * Trick GAS/GCC into compiling access to TICK/(S)TICK_COMPARE independently - * of the selected instruction set. - */ -#define rdtickcmpr() rd(asr23) -#define rdstick() rd(asr24) -#define rdstickcmpr() rd(asr25) -#define wrtickcmpr(val, xorval) wr(asr23, (val), (xorval)) -#define wrstick(val, xorval) wr(asr24, (val), (xorval)) -#define wrstickcmpr(val, xorval) wr(asr25, (val), (xorval)) - -/* - * Macro intended to be used instead of wr(asr23, val, xorval) for writing to - * the TICK_COMPARE register in order to avoid a bug in BlackBird CPUs that - * can cause these writes to fail under certain conditions which in turn - * causes the hardclock to stop. The workaround is to read the TICK_COMPARE - * register back immediately after writing to it with these two instructions - * aligned to a quadword boundary in order to ensure that I$ misses won't - * split them up. - */ -#define wrtickcmpr_bbwar(val, xorval) ({ \ - __asm __volatile( \ - " ba,pt %%xcc, 1f ; " \ - " nop ; " \ - " .align 128 ; " \ - "1: wr %0, %1, %%asr23 ; " \ - " rd %%asr23, %%g0 ; " \ - : : "r" (val), "rI" (xorval)); \ -}) - -static __inline void -breakpoint(void) -{ - - __asm __volatile("ta %%xcc, 1" : :); -} - -static __inline register_t -intr_disable(void) -{ - register_t s; - - s = rdpr(pstate); - wrpr(pstate, s & ~PSTATE_IE, 0); - return (s); -} -#define intr_restore(s) wrpr(pstate, (s), 0) - -/* - * In some places, it is required that the store is directly followed by a - * membar #Sync. Don't trust the compiler to not insert instructions in - * between. We also need to disable interrupts completely. - */ -#define stxa_sync(va, asi, val) do { \ - register_t s; \ - s = intr_disable(); \ - __asm __volatile("stxa %0, [%1] %2; membar #Sync" \ - : : "r" (val), "r" (va), "n" (asi)); \ - intr_restore(s); \ -} while (0) - -void ascopy(u_long asi, vm_offset_t src, vm_offset_t dst, size_t len); -void ascopyfrom(u_long sasi, vm_offset_t src, caddr_t dst, size_t len); -void ascopyto(caddr_t src, u_long dasi, vm_offset_t dst, size_t len); -void aszero(u_long asi, vm_offset_t dst, size_t len); - -/* - * Ultrasparc II doesn't implement popc in hardware. - */ -#if 0 -#define HAVE_INLINE_FFS -/* - * See page 202 of the SPARC v9 Architecture Manual. - */ -static __inline int -ffs(int mask) -{ - int result; - int neg; - int tmp; - - __asm __volatile( - " neg %3, %1 ; " - " xnor %3, %1, %2 ; " - " popc %2, %0 ; " - " movrz %3, %%g0, %0 ; " - : "=r" (result), "=r" (neg), "=r" (tmp) : "r" (mask)); - return (result); -} -#endif - -#undef LDNC_GEN -#undef STNC_GEN - -#endif /* !_MACHINE_CPUFUNC_H_ */ diff --git a/sys/sparc64/include/db_machdep.h b/sys/sparc64/include/db_machdep.h deleted file mode 100644 index 73d737c739c485..00000000000000 --- a/sys/sparc64/include/db_machdep.h +++ /dev/null @@ -1,64 +0,0 @@ -/*- - * Mach Operating System - * Copyright (c) 1991,1990 Carnegie Mellon University - * All Rights Reserved. - * - * Permission to use, copy, modify and distribute this software and its - * documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR - * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie Mellon - * the rights to redistribute these changes. - * - * from: FreeBSD: src/sys/i386/include/db_machdep.h,v 1.16 1999/10/04 - * $FreeBSD$ - */ - -#ifndef _MACHINE_DB_MACHDEP_H_ -#define _MACHINE_DB_MACHDEP_H_ - -#include -#include - -typedef vm_offset_t db_addr_t; -typedef long db_expr_t; - -#define PC_REGS() ((db_addr_t)kdb_thrctx->pcb_pc) - -#define BKPT_INST (0x91d03001) -#define BKPT_SIZE (4) -#define BKPT_SET(inst) (BKPT_INST) - -#define BKPT_SKIP do { \ - kdb_frame->tf_tpc = kdb_frame->tf_tnpc + 4; \ - kdb_frame->tf_tnpc += 8; \ -} while (0) - -#define db_clear_single_step kdb_cpu_clear_singlestep -#define db_set_single_step kdb_cpu_set_singlestep - -#define IS_BREAKPOINT_TRAP(type, code) (type == T_BREAKPOINT) -#define IS_WATCHPOINT_TRAP(type, code) (0) - -#define inst_trap_return(ins) (0) -#define inst_return(ins) (0) -#define inst_call(ins) (0) -#define inst_load(ins) (0) -#define inst_store(ins) (0) - -#define DB_ELFSIZE 64 - -#endif /* !_MACHINE_DB_MACHDEP_H_ */ diff --git a/sys/sparc64/include/dcr.h b/sys/sparc64/include/dcr.h deleted file mode 100644 index f6e45d8c4d6698..00000000000000 --- a/sys/sparc64/include/dcr.h +++ /dev/null @@ -1,72 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2008 Marius Strobl - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_DCR_H_ -#define _MACHINE_DCR_H_ - -/* - * Definitions for the UltraSPARC-III Depatch Control Register (ASR 18). - */ -#define DCR_MS (1UL << 0) -#define DCR_IFPOE (1UL << 1) -#define DCR_SI (1UL << 3) -#define DCR_RPE (1UL << 4) -#define DCR_BPE (1UL << 5) - -#define DCR_OBSDATA_SHIFT 6 -#define DCR_OBSDATA_CT_BITS 8 -#define DCR_OBSDATA_CT_MASK \ - (((1UL << DCR_OBSDATA_CT_BITS) - 1) << DCR_OBSDATA_SHIFT) - -/* The following bits are valid for the UltraSPARC-III++/IV+ only. */ -#define DCR_IPE (1UL << 2) - -#define DCR_OBSDATA_CTP_BITS 6 -#define DCR_OBSDATA_CTP_MASK \ - (((1UL << DCR_OBSDATA_CTP_BITS) - 1) << DCR_OBSDATA_SHIFT) - -#define DCR_DPE (1UL << 12) - -/* The following bits are valid for the UltraSPARC-IV+ only. */ -#define DCR_BPM_SHIFT 13 -#define DCR_BPM_BITS 2 -#define DCR_BPM_MASK \ - (((1UL << DCR_BPM_BITS) - 1) << DCR_BPM_SHIFT) -#define DCR_BPM_1HIST_GSHARE (0UL << DCR_BPM_SHIFT) -#define DCR_BPM_2HIST_GSHARE (1UL << DCR_BPM_SHIFT) -#define DCR_BPM_PC (2UL << DCR_BPM_SHIFT) -#define DCR_BPM_2HIST_MIXED (3UL << DCR_BPM_SHIFT) - -#define DCR_JPE (1UL << 15) -#define DCR_ITPE (1UL << 16) -#define DCR_DTPE (1UL << 17) -#define DCR_PPE (1UL << 18) - -#endif /* _MACHINE_DCR_H_ */ diff --git a/sys/sparc64/include/dump.h b/sys/sparc64/include/dump.h deleted file mode 100644 index f1546603f6cf27..00000000000000 --- a/sys/sparc64/include/dump.h +++ /dev/null @@ -1,68 +0,0 @@ -/*- - * Copyright (c) 2014 EMC Corp. - * Author: Conrad Meyer - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_DUMP_H_ -#define _MACHINE_DUMP_H_ - -#define DUMPSYS_MD_PA_NPAIRS 128 -#define DUMPSYS_NUM_AUX_HDRS 0 -#define KERNELDUMP_ARCH_VERSION KERNELDUMP_SPARC64_VERSION -#define EM_VALUE EM_SPARCV9 - -int dumpsys(struct dumperinfo *); - -static inline struct dump_pa * -dumpsys_pa_next(struct dump_pa *p) -{ - - return (dumpsys_gen_pa_next(p)); -} - -static inline void -dumpsys_wbinv_all(void) -{ - - dumpsys_gen_wbinv_all(); -} - -static inline void -dumpsys_unmap_chunk(vm_paddr_t pa, size_t s, void *va) -{ - - dumpsys_gen_unmap_chunk(pa, s, va); -} - -static inline int -minidumpsys(struct dumperinfo *di) -{ - - return (-ENOSYS); -} - -#endif /* !_MACHINE_DUMP_H_ */ diff --git a/sys/sparc64/include/efi.h b/sys/sparc64/include/efi.h deleted file mode 100644 index 1f7ad0da18afa0..00000000000000 --- a/sys/sparc64/include/efi.h +++ /dev/null @@ -1,14 +0,0 @@ -/*- - * This file is in the public domain since it's just boilerplate. - * - * $FreeBSD$ - */ - -#ifndef __SPARC64_INCLUDE_EFI_H_ -#define __SPARC64_INCLUDE_EFI_H_ - -#define EFIABI_ATTR - -/* Note: we don't actually support this on sparc64 */ - -#endif /* __I386_INCLUDE_EFI_H_ */ diff --git a/sys/sparc64/include/elf.h b/sys/sparc64/include/elf.h deleted file mode 100644 index 4642864cda47b7..00000000000000 --- a/sys/sparc64/include/elf.h +++ /dev/null @@ -1,84 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 1996-1997 John D. Polstra. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_ELF_H_ -#define _MACHINE_ELF_H_ 1 - -/* - * ELF definitions for the sparc64 architecture. - */ - -#include /* Definitions common to all 32 bit architectures. */ -#include /* Definitions common to all 64 bit architectures. */ - -#ifndef __ELF_WORD_SIZE -#define __ELF_WORD_SIZE 64 /* Used by */ -#endif -#include - -#define ELF_ARCH EM_SPARCV9 - -#define ELF_MACHINE_OK(x) ((x) == ELF_ARCH) - -/* - * Auxiliary vector entries for passing information to the interpreter. - */ - -typedef struct { /* Auxiliary vector entry on initial stack */ - int a_type; /* Entry type. */ - union { - int a_val; /* Integer value. */ - } a_un; -} Elf32_Auxinfo; - -typedef struct { /* Auxiliary vector entry on initial stack */ - long a_type; /* Entry type. */ - union { - long a_val; /* Integer value. */ - void *a_ptr; /* Address. */ - void (*a_fcn)(void); /* Function pointer (not used). */ - } a_un; -} Elf64_Auxinfo; - -__ElfType(Auxinfo); - -/* Define "machine" characteristics */ -#if __ELF_WORD_SIZE == 32 -#define ELF_TARG_CLASS ELFCLASS32 -#else -#define ELF_TARG_CLASS ELFCLASS64 -#endif -#define ELF_TARG_DATA ELFDATA2MSB -#define ELF_TARG_MACH ELF_ARCH -#define ELF_TARG_VER 1 - -#define ET_DYN_LOAD_ADDR 0x100000 - -#endif /* !_MACHINE_ELF_H_ */ diff --git a/sys/sparc64/include/endian.h b/sys/sparc64/include/endian.h deleted file mode 100644 index f94a6df29b8968..00000000000000 --- a/sys/sparc64/include/endian.h +++ /dev/null @@ -1,126 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1987, 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)endian.h 8.1 (Berkeley) 6/10/93 - * $FreeBSD$ - */ - -#ifndef _MACHINE_ENDIAN_H_ -#define _MACHINE_ENDIAN_H_ - -#include -#include - -/* - * Define the order of 32-bit words in 64-bit words. - */ -#define _QUAD_HIGHWORD 0 -#define _QUAD_LOWWORD 1 - -/* - * Definitions for byte order, according to byte significance from low - * address to high. - */ -#define _LITTLE_ENDIAN 1234 /* LSB first: i386, vax */ -#define _BIG_ENDIAN 4321 /* MSB first: 68000, ibm, net */ -#define _PDP_ENDIAN 3412 /* LSB first in word, MSW first in long */ - -#define _BYTE_ORDER _BIG_ENDIAN - -/* - * Deprecated variants that don't have enough underscores to be useful in more - * strict namespaces. - */ -#if __BSD_VISIBLE -#define LITTLE_ENDIAN _LITTLE_ENDIAN -#define BIG_ENDIAN _BIG_ENDIAN -#define PDP_ENDIAN _PDP_ENDIAN -#define BYTE_ORDER _BYTE_ORDER -#endif - -#if defined(__GNUCLIKE_BUILTIN_CONSTANT_P) && defined(__OPTIMIZE__) -#define __is_constant(x) __builtin_constant_p(x) -#else -#define __is_constant(x) 0 -#endif - -#define __bswap16_const(x) ((((__uint16_t)(x) >> 8) & 0xff) | \ - (((__uint16_t)(x) << 8) & 0xff00)) -#define __bswap32_const(x) ((((__uint32_t)(x) >> 24) & 0xff) | \ - (((__uint32_t)(x) >> 8) & 0xff00) | \ - (((__uint32_t)(x)<< 8) & 0xff0000) | \ - (((__uint32_t)(x) << 24) & 0xff000000)) -#define __bswap64_const(x) ((((__uint64_t)(x) >> 56) & 0xff) | \ - (((__uint64_t)(x) >> 40) & 0xff00) | \ - (((__uint64_t)(x) >> 24) & 0xff0000) | \ - (((__uint64_t)(x) >> 8) & 0xff000000) | \ - (((__uint64_t)(x) << 8) & ((__uint64_t)0xff << 32)) | \ - (((__uint64_t)(x) << 24) & ((__uint64_t)0xff << 40)) | \ - (((__uint64_t)(x) << 40) & ((__uint64_t)0xff << 48)) | \ - (((__uint64_t)(x) << 56) & ((__uint64_t)0xff << 56))) - -static __inline __uint16_t -__bswap16_var(__uint16_t _x) -{ - - return ((_x >> 8) | ((_x << 8) & 0xff00)); -} - -static __inline __uint32_t -__bswap32_var(__uint32_t _x) -{ - - return ((_x >> 24) | ((_x >> 8) & 0xff00) | ((_x << 8) & 0xff0000) | - ((_x << 24) & 0xff000000)); -} - -static __inline __uint64_t -__bswap64_var(__uint64_t _x) -{ - - return ((_x >> 56) | ((_x >> 40) & 0xff00) | ((_x >> 24) & 0xff0000) | - ((_x >> 8) & 0xff000000) | ((_x << 8) & ((__uint64_t)0xff << 32)) | - ((_x << 24) & ((__uint64_t)0xff << 40)) | - ((_x << 40) & ((__uint64_t)0xff << 48)) | ((_x << 56))); -} - -#define __bswap16(x) ((__uint16_t)(__is_constant(x) ? __bswap16_const(x) : \ - __bswap16_var(x))) -#define __bswap32(x) (__is_constant(x) ? __bswap32_const(x) : \ - __bswap32_var(x)) -#define __bswap64(x) (__is_constant(x) ? __bswap64_const(x) : \ - __bswap64_var(x)) - -#define __htonl(x) ((__uint32_t)(x)) -#define __htons(x) ((__uint16_t)(x)) -#define __ntohl(x) ((__uint32_t)(x)) -#define __ntohs(x) ((__uint16_t)(x)) - -#endif /* !_MACHINE_ENDIAN_H_ */ diff --git a/sys/sparc64/include/exec.h b/sys/sparc64/include/exec.h deleted file mode 100644 index 68f933f6dd53a7..00000000000000 --- a/sys/sparc64/include/exec.h +++ /dev/null @@ -1,36 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2001 Jake Burkholder. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_EXEC_H_ -#define _MACHINE_EXEC_H_ - -#define __LDPGSZ 8192 - -#endif /* !_MACHINE_EXEC_H_ */ diff --git a/sys/sparc64/include/fireplane.h b/sys/sparc64/include/fireplane.h deleted file mode 100644 index 5a95b52bc8c9f5..00000000000000 --- a/sys/sparc64/include/fireplane.h +++ /dev/null @@ -1,42 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2010 Marius Strobl - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_FIREPLANE_H_ -#define _MACHINE_FIREPLANE_H_ - -#define FIREPLANE_CR_AID_SHIFT (17) -#define FIREPLANE_CR_AID_SIZE (10) -#define FIREPLANE_CR_AID_MASK \ - (((1 << FIREPLANE_CR_AID_SIZE) - 1) << FIREPLANE_CR_AID_SHIFT) - -#define FIREPLANE_CR_GET_AID(cr) \ - ((cr & FIREPLANE_CR_AID_MASK) >> FIREPLANE_CR_AID_SHIFT) - -#endif /* _MACHINE_FIREPLANE_H_ */ diff --git a/sys/sparc64/include/float.h b/sys/sparc64/include/float.h deleted file mode 100644 index 104fc50fd79eec..00000000000000 --- a/sys/sparc64/include/float.h +++ /dev/null @@ -1,101 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1992, 1993, 2001 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)float.h 8.1 (Berkeley) 6/11/93 - * from: NetBSD: float.h,v 1.3 2001/09/21 20:48:02 eeh Exp - * $FreeBSD$ - */ - -#ifndef _MACHINE_FLOAT_H_ -#define _MACHINE_FLOAT_H_ - -#include - -__BEGIN_DECLS -extern int __flt_rounds(void); -__END_DECLS - -#define FLT_RADIX 2 /* b */ -#define FLT_ROUNDS __flt_rounds() -#if __ISO_C_VISIBLE >= 1999 -#define FLT_EVAL_METHOD 0 /* no promotion */ -#define DECIMAL_DIG 36 /* max precision in decimal digits */ -#endif - -#define FLT_MANT_DIG 24 /* p */ -#define FLT_EPSILON 1.19209290E-7F /* b**(1-p) */ -#define FLT_DIG 6 /* floor((p-1)*log10(b))+(b == 10) */ -#define FLT_MIN_EXP (-125) /* emin */ -#define FLT_MIN 1.17549435E-38F /* b**(emin-1) */ -#define FLT_MIN_10_EXP (-37) /* ceil(log10(b**(emin-1))) */ -#define FLT_MAX_EXP 128 /* emax */ -#define FLT_MAX 3.40282347E+38F /* (1-b**(-p))*b**emax */ -#define FLT_MAX_10_EXP 38 /* floor(log10((1-b**(-p))*b**emax)) */ -#if __ISO_C_VISIBLE >= 2011 -#define FLT_TRUE_MIN 1.40129846E-45F /* b**(emin-p) */ -#define FLT_DECIMAL_DIG 9 /* ceil(1+p*log10(b)) */ -#define FLT_HAS_SUBNORM 1 -#endif /* __ISO_C_VISIBLE >= 2011 */ - -#define DBL_MANT_DIG 53 -#define DBL_EPSILON 2.2204460492503131E-16 -#define DBL_DIG 15 -#define DBL_MIN_EXP (-1021) -#define DBL_MIN 2.2250738585072014E-308 -#define DBL_MIN_10_EXP (-307) -#define DBL_MAX_EXP 1024 -#define DBL_MAX 1.7976931348623157E+308 -#define DBL_MAX_10_EXP 308 -#if __ISO_C_VISIBLE >= 2011 -#define DBL_TRUE_MIN 4.9406564584124654E-324 -#define DBL_DECIMAL_DIG 17 -#define DBL_HAS_SUBNORM 1 -#endif /* __ISO_C_VISIBLE >= 2011 */ - -#define LDBL_MANT_DIG 113 -#define LDBL_EPSILON 1.925929944387235853055977942584927319E-34L -#define LDBL_DIG 33 -#define LDBL_MIN_EXP (-16381) -#define LDBL_MIN 3.362103143112093506262677817321752603E-4932L -#define LDBL_MIN_10_EXP (-4931) -#define LDBL_MAX_EXP (+16384) -#define LDBL_MAX 1.189731495357231765085759326628007016E+4932L -#define LDBL_MAX_10_EXP (+4932) -#if __ISO_C_VISIBLE >= 2011 -#define LDBL_TRUE_MIN 6.475175119438025110924438958227646552E-4966L -#define LDBL_DECIMAL_DIG 36 -#define LDBL_HAS_SUBNORM 1 -#endif /* __ISO_C_VISIBLE >= 2011 */ - -#endif /* _MACHINE_FLOAT_H_ */ diff --git a/sys/sparc64/include/floatingpoint.h b/sys/sparc64/include/floatingpoint.h deleted file mode 100644 index d91efcebeefd67..00000000000000 --- a/sys/sparc64/include/floatingpoint.h +++ /dev/null @@ -1,39 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 2002 David O'Brien . - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the author nor the names of any co-contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY DAVID O'BRIEN AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _FLOATINGPOINT_H_ -#define _FLOATINGPOINT_H_ - -#include - -#endif /* !_FLOATINGPOINT_H_ */ diff --git a/sys/sparc64/include/fp.h b/sys/sparc64/include/fp.h deleted file mode 100644 index 67e0932880f112..00000000000000 --- a/sys/sparc64/include/fp.h +++ /dev/null @@ -1,41 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright 2001 by Thomas Moestl . All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE - * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_FP_H_ -#define _MACHINE_FP_H_ - -#ifdef _KERNEL - -/* - * Note: The pointer passed to savefpctx must be aligned on a 64 byte - * boundary. - */ -void savefpctx(uint32_t *fp); - -#endif /* _KERNEL */ -#endif /* !_MACHINE_FP_H_ */ diff --git a/sys/sparc64/include/frame.h b/sys/sparc64/include/frame.h deleted file mode 100644 index 3bb28298ad8001..00000000000000 --- a/sys/sparc64/include/frame.h +++ /dev/null @@ -1,95 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2001 Jake Burkholder. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_FRAME_H_ -#define _MACHINE_FRAME_H_ - -#define RW_SHIFT 7 -#define SPOFF 2047 -#define BIAS SPOFF /* XXX - open/netbsd compat */ - -#ifndef LOCORE - -/* - * NOTE: keep this structure in sync with struct reg and struct mcontext. - */ -struct trapframe { - uint64_t tf_global[8]; - uint64_t tf_out[8]; - uint64_t tf_fprs; - uint64_t tf_fsr; - uint64_t tf_gsr; - uint64_t tf_level; - uint64_t tf_pil; - uint64_t tf_sfar; - uint64_t tf_sfsr; - uint64_t tf_tar; - uint64_t tf_tnpc; - uint64_t tf_tpc; - uint64_t tf_tstate; - uint64_t tf_type; - uint64_t tf_y; - uint64_t tf_wstate; - uint64_t tf_pad[2]; -}; -#define tf_sp tf_out[6] - -#define TF_DONE(tf) do { \ - tf->tf_tpc = tf->tf_tnpc; \ - tf->tf_tnpc += 4; \ -} while (0) - -struct frame { - u_long fr_local[8]; - u_long fr_in[8]; - u_long fr_pad[8]; -}; -#define fr_arg fr_in -#define fr_fp fr_in[6] -#define fr_pc fr_in[7] - -#define v9next_frame(fp) ((struct frame *)(fp->fr_fp + BIAS)) - -/* - * Frame used for pcb_rw. - */ -struct rwindow { - u_long rw_local[8]; - u_long rw_in[8]; -}; - -struct thread; - -int rwindow_save(struct thread *td); -int rwindow_load(struct thread *td, struct trapframe *tf, int n); - -#endif /* !LOCORE */ - -#endif /* !_MACHINE_FRAME_H_ */ diff --git a/sys/sparc64/include/fsr.h b/sys/sparc64/include/fsr.h deleted file mode 100644 index ec8c17d91a7a54..00000000000000 --- a/sys/sparc64/include/fsr.h +++ /dev/null @@ -1,116 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright 2001 by Thomas Moestl . All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE - * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_FSR_H_ -#define _MACHINE_FSR_H_ - -#define FPRS_DL (1 << 0) -#define FPRS_DU (1 << 1) -#define FPRS_FEF (1 << 2) - -#define VIS_BLOCKSIZE 64 - -#ifndef LOCORE - -#define FSR_EXC_BITS 5 -#define FSR_EXC_MASK ((1UL << FSR_EXC_BITS) - 1) -#define FSR_CEXC_SHIFT 0 -#define FSR_CEXC_MASK (FSR_EXC_MASK << FSR_CEXC_SHIFT) -#define FSR_CEXC(b) ((unsigned long)(b) << FSR_CEXC_SHIFT) -#define FSR_GET_CEXC(x) (((x) & FSR_CEXC_MASK) >> FSR_CEXC_SHIFT) -#define FSR_AEXC_SHIFT 5 -#define FSR_AEXC_MASK (FSR_EXC_MASK << FSR_AEXC_SHIFT) -#define FSR_AEXC(b) ((unsigned long)(b) << FSR_AEXC_SHIFT) -#define FSR_GET_AEXC(x) (((x) & FSR_AEXC_MASK) >> FSR_AEXC_SHIFT) -#define FSR_QNE (1UL << 13) -#define FSR_NS (1UL << 22) -#define FSR_TEM_SHIFT 23 -#define FSR_TEM_MASK (FSR_EXC_MASK << FSR_TEM_SHIFT) -#define FSR_TEM(b) ((unsigned long)(b) << FSR_TEM_SHIFT) -#define FSR_GET_TEM(x) (((x) & FSR_TEM_MASK) >> FSR_TEM_SHIFT) -#define FSR_FCC0_SHIFT 10 -#define FSR_FCC0_BITS 2 -#define FSR_FCC0_MASK (((1UL << FSR_FCC0_BITS) - 1) << FSR_FCC0_SHIFT) -#define FSR_FCC0(x) ((unsigned long)(x) << FSR_FCC0_SHIFT) -#define FSR_GET_FCC0(x) (((x) & FSR_FCC0_MASK) >> FSR_FCC0_SHIFT) -#define FSR_FTT_SHIFT 14 -#define FSR_FTT_BITS 3 -#define FSR_FTT_MASK (((1UL << FSR_FTT_BITS) - 1) << FSR_FTT_SHIFT) -#define FSR_FTT(x) ((unsigned long)(x) << FSR_FTT_SHIFT) -#define FSR_GET_FTT(x) (((x) & FSR_FTT_MASK) >> FSR_FTT_SHIFT) -#define FSR_VER_SHIFT 17 -#define FSR_GET_VER(x) (((x) >> FSR_VER_SHIFT) & 7) -#define FSR_RD_SHIFT 30 -#define FSR_RD_BITS 2 -#define FSR_RD_MASK (((1UL << FSR_RD_BITS) - 1) << FSR_RD_SHIFT) -#define FSR_RD(x) ((unsigned long)(x) << FSR_RD_SHIFT) -#define FSR_GET_RD(x) (((x) & FSR_RD_MASK) >> FSR_RD_SHIFT) -#define FSR_FCC1_SHIFT 32 -#define FSR_FCC1_BITS 2 -#define FSR_FCC1_MASK (((1UL << FSR_FCC1_BITS) - 1) << FSR_FCC1_SHIFT) -#define FSR_FCC1(x) ((unsigned long)(x) << FSR_FCC1_SHIFT) -#define FSR_GET_FCC1(x) (((x) & FSR_FCC1_MASK) >> FSR_FCC1_SHIFT) -#define FSR_FCC2_SHIFT 34 -#define FSR_FCC2_BITS 2 -#define FSR_FCC2_MASK (((1UL << FSR_FCC2_BITS) - 1) << FSR_FCC2_SHIFT) -#define FSR_FCC2(x) ((unsigned long)(x) << FSR_FCC2_SHIFT) -#define FSR_GET_FCC2(x) (((x) & FSR_FCC2_MASK) >> FSR_FCC2_SHIFT) -#define FSR_FCC3_SHIFT 36 -#define FSR_FCC3_BITS 2 -#define FSR_FCC3_MASK (((1UL << FSR_FCC3_BITS) - 1) << FSR_FCC3_SHIFT) -#define FSR_FCC3(x) ((unsigned long)(x) << FSR_FCC3_SHIFT) -#define FSR_GET_FCC3(x) (((x) & FSR_FCC3_MASK) >> FSR_FCC3_SHIFT) - -/* CEXC/AEXC/TEM exception values */ -#define FSR_NX (1 << 0) -#define FSR_DZ (1 << 1) -#define FSR_UF (1 << 2) -#define FSR_OF (1 << 3) -#define FSR_NV (1 << 4) -/* FTT values. */ -#define FSR_FTT_NONE 0 -#define FSR_FTT_IEEE 1 -#define FSR_FTT_UNFIN 2 -#define FSR_FTT_UNIMP 3 -#define FSR_FTT_SEQERR 4 -#define FSR_FTT_HWERR 5 -#define FSR_FTT_INVREG 6 -/* RD values */ -#define FSR_RD_N 0 /* nearest */ -#define FSR_RD_Z 1 /* zero */ -#define FSR_RD_PINF 2 /* +infinity */ -#define FSR_RD_NINF 3 /* -infinity */ -/* condition codes */ -#define FSR_CC_EQ 0 /* a = b */ -#define FSR_CC_LT 1 /* a < b */ -#define FSR_CC_GT 2 /* a > b */ -#define FSR_CC_UO 3 /* unordered */ - -#endif /* !LOCORE */ - -#endif /* !_MACHINE_FSR_H_ */ diff --git a/sys/sparc64/include/gdb_machdep.h b/sys/sparc64/include/gdb_machdep.h deleted file mode 100644 index 502d0c2e347b70..00000000000000 --- a/sys/sparc64/include/gdb_machdep.h +++ /dev/null @@ -1,72 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2004 Marcel Moolenaar - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_GDB_MACHDEP_H_ -#define _MACHINE_GDB_MACHDEP_H_ - -#define GDB_BUFSZ 600 -#define GDB_NREGS 86 -#define GDB_REG_PC 80 - -static __inline size_t -gdb_cpu_regsz(int regnum) -{ - return ((regnum >= 32 && regnum < 64) ? sizeof(float) : sizeof(long)); -} - -static __inline int -gdb_cpu_query(void) -{ - return (0); -} - -static __inline int -gdb_cpu_signal(int vector, int _) -{ - return (vector); -} - -static __inline void * -gdb_begin_write(void) -{ - - return (NULL); -} - -static __inline void -gdb_end_write(void *arg __unused) -{ - -} - -void *gdb_cpu_getreg(int, size_t *); -void gdb_cpu_setreg(int, void *); - -#endif /* !_MACHINE_GDB_MACHDEP_H_ */ diff --git a/sys/sparc64/include/idprom.h b/sys/sparc64/include/idprom.h deleted file mode 100644 index 442b6b32bbffa9..00000000000000 --- a/sys/sparc64/include/idprom.h +++ /dev/null @@ -1,64 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-NetBSD - * - * Copyright (c) 1996 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Adam Glass. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * from: NetBSD: idprom.h,v 1.3 2008/04/28 20:23:58 martin Exp - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_IDPROM_H_ -#define _MACHINE_IDPROM_H_ - -/* - * ID prom format. The ``host id'' is set up by taking the machine - * ID as the top byte and the hostid field as the remaining three. - * The id_xxx0 field appears to contain some other number. The id_xxx1 - * contains a bunch of 00's and a5's on my machines, suggesting it is - * not actually used. The checksum seems to include them, however. - */ -struct idprom { - u_char id_format; /* format identifier (= 1) */ - u_char id_machine; /* machine type (see param.h) */ - u_char id_ether[6]; /* ethernet address */ - int id_date; /* date of manufacture */ - u_char id_hostid[3]; /* ``host id'' bytes */ - u_char id_checksum; /* xor of everything else */ - /* Note: The rest is excluded from the checksum! */ - char id_undef[16]; /* undefined */ -}; - -#define ID_SUN4_100 0x22 /* Sun 4/100 */ -#define ID_SUN4_200 0x21 /* Sun 4/200 */ -#define ID_SUN4_300 0x23 /* Sun 4/300 */ -#define ID_SUN4_400 0x24 /* Sun 4/400 */ - -#define IDPROM_VERSION 1 - -#endif /* !_MACHINE_IDPROM_H_ */ diff --git a/sys/sparc64/include/ieee.h b/sys/sparc64/include/ieee.h deleted file mode 100644 index 773af1356cc684..00000000000000 --- a/sys/sparc64/include/ieee.h +++ /dev/null @@ -1,139 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)ieee.h 8.1 (Berkeley) 6/11/93 - * from: NetBSD: ieee.h,v 1.1.1.1 1998/06/20 04:58:51 eeh Exp - * $FreeBSD$ - */ - -#ifndef _MACHINE_IEEE_H_ -#define _MACHINE_IEEE_H_ - -/* - * ieee.h defines the machine-dependent layout of the machine's IEEE - * floating point. It does *not* define (yet?) any of the rounding - * mode bits, exceptions, and so forth. - */ - -/* - * Define the number of bits in each fraction and exponent. - * - * k k+1 - * Note that 1.0 x 2 == 0.1 x 2 and that denorms are represented - * - * (-exp_bias+1) - * as fractions that look like 0.fffff x 2 . This means that - * - * -126 - * the number 0.10000 x 2 , for instance, is the same as the normalized - * - * -127 -128 - * float 1.0 x 2 . Thus, to represent 2 , we need one leading zero - * - * -129 - * in the fraction; to represent 2 , we need two, and so on. This - * - * (-exp_bias-fracbits+1) - * implies that the smallest denormalized number is 2 - * - * for whichever format we are talking about: for single precision, for - * - * -126 -149 - * instance, we get .00000000000000000000001 x 2 , or 1.0 x 2 , and - * - * -149 == -127 - 23 + 1. - */ -#define SNG_EXPBITS 8 -#define SNG_FRACBITS 23 - -#define DBL_EXPBITS 11 -#define DBL_FRACBITS 52 - -#ifdef notyet -#define E80_EXPBITS 15 -#define E80_FRACBITS 64 -#endif - -#define EXT_EXPBITS 15 -#define EXT_FRACBITS 112 - -struct ieee_single { - u_int sng_sign:1; - u_int sng_exp:8; - u_int sng_frac:23; -}; - -struct ieee_double { - u_int dbl_sign:1; - u_int dbl_exp:11; - u_int dbl_frach:20; - u_int dbl_fracl; -}; - -struct ieee_ext { - u_int ext_sign:1; - u_int ext_exp:15; - u_int ext_frach:16; - u_int ext_frachm; - u_int ext_fraclm; - u_int ext_fracl; -}; - -/* - * Floats whose exponent is in [1..INFNAN) (of whatever type) are - * `normal'. Floats whose exponent is INFNAN are either Inf or NaN. - * Floats whose exponent is zero are either zero (iff all fraction - * bits are zero) or subnormal values. - * - * A NaN is a `signalling NaN' if its QUIETNAN bit is clear in its - * high fraction; if the bit is set, it is a `quiet NaN'. - */ -#define SNG_EXP_INFNAN 255 -#define DBL_EXP_INFNAN 2047 -#define EXT_EXP_INFNAN 32767 - -#if 0 -#define SNG_QUIETNAN (1 << 22) -#define DBL_QUIETNAN (1 << 19) -#define EXT_QUIETNAN (1 << 15) -#endif - -/* - * Exponent biases. - */ -#define SNG_EXP_BIAS 127 -#define DBL_EXP_BIAS 1023 -#define EXT_EXP_BIAS 16383 - -#endif diff --git a/sys/sparc64/include/ieeefp.h b/sys/sparc64/include/ieeefp.h deleted file mode 100644 index bb0773730aa068..00000000000000 --- a/sys/sparc64/include/ieeefp.h +++ /dev/null @@ -1,37 +0,0 @@ -/*- - * Written by J.T. Conklin, Apr 6, 1995 - * Public domain. - * $FreeBSD$ - */ - -#ifndef _MACHINE_IEEEFP_H_ -#define _MACHINE_IEEEFP_H_ - -/* Deprecated FPU control interface */ - -#include - -typedef int fp_except_t; -#define FP_X_IMP FSR_NX /* imprecise (loss of precision) */ -#define FP_X_DZ FSR_DZ /* divide-by-zero exception */ -#define FP_X_UFL FSR_UF /* underflow exception */ -#define FP_X_OFL FSR_OF /* overflow exception */ -#define FP_X_INV FSR_NV /* invalid operation exception */ - -typedef enum { - FP_RN = FSR_RD_N, /* round to nearest representable number */ - FP_RZ = FSR_RD_Z, /* round to zero (truncate) */ - FP_RP = FSR_RD_PINF, /* round toward positive infinity */ - FP_RM = FSR_RD_NINF /* round toward negative infinity */ -} fp_rnd_t; - -__BEGIN_DECLS -extern fp_rnd_t fpgetround(void); -extern fp_rnd_t fpsetround(fp_rnd_t); -extern fp_except_t fpgetmask(void); -extern fp_except_t fpsetmask(fp_except_t); -extern fp_except_t fpgetsticky(void); -__END_DECLS - - -#endif /* _MACHINE_IEEEFP_H_ */ diff --git a/sys/sparc64/include/in_cksum.h b/sys/sparc64/include/in_cksum.h deleted file mode 100644 index 6f80d69967590a..00000000000000 --- a/sys/sparc64/include/in_cksum.h +++ /dev/null @@ -1,177 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ -/*- - * Copyright (c) 2001 by Thomas Moestl . - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE - * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * from tahoe: in_cksum.c 1.2 86/01/05 - * from: @(#)in_cksum.c 1.3 (Berkeley) 1/19/91 - * from: Id: in_cksum.c,v 1.8 1995/12/03 18:35:19 bde Exp - * from: FreeBSD: src/sys/alpha/include/in_cksum.h,v 1.5 2000/05/06 - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_IN_CKSUM_H_ -#define _MACHINE_IN_CKSUM_H_ 1 - -#include - -#define in_cksum(m, len) in_cksum_skip(m, len, 0) - -#if defined(IPVERSION) && (IPVERSION == 4) -static __inline void -in_cksum_update(struct ip *ip) -{ - int __tmp; - - __tmp = (int)ip->ip_sum + 1; - ip->ip_sum = __tmp + (__tmp >> 16); -} -#endif - -static __inline u_short -in_addword(u_short sum, u_short b) -{ - u_long __ret, __tmp; - - __asm( - "sll %2, 16, %0\n" - "sll %3, 16, %1\n" - "addcc %0, %1, %0\n" - "srl %0, 16, %0\n" - "addc %0, 0, %0\n" - : "=&r" (__ret), "=&r" (__tmp) : "r" (sum), "r" (b) : "cc"); - return (__ret); -} - -static __inline u_short -in_pseudo(u_int sum, u_int b, u_int c) -{ - u_long __tmp; - - __asm( - "addcc %0, %3, %0\n" - "addccc %0, %4, %0\n" - "addc %0, 0, %0\n" - "sll %0, 16, %1\n" - "addcc %0, %1, %0\n" - "srl %0, 16, %0\n" - "addc %0, 0, %0\n" - : "=r" (sum), "=&r" (__tmp) : "0" (sum), "r" (b), "r" (c) : "cc"); - return (sum); -} - -#if defined(IPVERSION) && (IPVERSION == 4) -static __inline u_int -in_cksum_hdr(struct ip *ip) -{ - u_long __ret, __tmp1, __tmp2, __tmp3, __tmp4; - - /* - * Use 32-bit memory accesses and additions - addition with carry only - * works for 32 bits, and fixing up alignment issues for 64 is probably - * more trouble than it's worth. - * This may read outside of the ip header, but does not cross a page - * boundary in doing so, so that should be OK. - * Actually, this specialized implementation might be overkill - using - * a generic implementation for both in_cksum_skip and in_cksum_hdr - * should not be too much more expensive. - */ -#define __LD_ADD(addr, tmp, sum, offs, mod) \ - "lduw [" #addr " + " #offs "], " #tmp "\n" \ - "add" # mod " " #sum ", " #tmp ", " #sum "\n" - - __asm( - "and %5, 3, %3\n" - "andn %5, 3, %1\n" - "brz,pt %3, 0f\n" - " lduw [%1], %0\n" - "mov 4, %4\n" - "sub %4, %3, %4\n" - "sll %4, 3, %4\n" /* fix up unaligned buffers */ - "mov 1, %2\n" - "sll %2, %4, %4\n" - "sub %4, 1, %4\n" - "lduw [%1 + 20], %2\n" - "andn %2, %4, %2\n" - "and %0, %4, %0\n" - "or %0, %2, %0\n" - "0:\n" - __LD_ADD(%1, %2, %0, 4, cc) - __LD_ADD(%1, %2, %0, 8, ccc) - __LD_ADD(%1, %2, %0, 12, ccc) - __LD_ADD(%1, %2, %0, 16, ccc) - "addc %0, 0, %0\n" /* reduce */ - "1:\n" - "sll %0, 16, %2\n" - "addcc %0, %2, %0\n" - "srl %0, 16, %0\n" - "addc %0, 0, %0\n" - "andcc %3, 1, %3\n" /* need to byte-swap? */ - "clr %3\n" - "bne,a,pn %%xcc, 1b\n" - " sll %0, 8, %0\n" - "not %0\n" - "sll %0, 16, %0\n" - "srl %0, 16, %0\n" - : "=&r" (__ret), "=r" (__tmp1), "=&r" (__tmp2), "=&r" (__tmp3), - "=&r" (__tmp4) : "1" (ip) : "cc"); -#undef __LD_ADD - return (__ret); -} -#endif - -#ifdef _KERNEL -u_short in_cksum_skip(struct mbuf *m, int len, int skip); -#endif - -#endif /* _MACHINE_IN_CKSUM_H_ */ diff --git a/sys/sparc64/include/instr.h b/sys/sparc64/include/instr.h deleted file mode 100644 index 54d2a806d93a4c..00000000000000 --- a/sys/sparc64/include/instr.h +++ /dev/null @@ -1,620 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-4-Clause - * - * Copyright (c) 1994 David S. Miller, davem@nadzieja.rutgers.edu - * Copyright (c) 1995 Paul Kranenburg - * Copyright (c) 2001 Thomas Moestl - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by David Miller. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * from: NetBSD: db_disasm.c,v 1.9 2000/08/16 11:29:42 pk Exp - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_INSTR_H_ -#define _MACHINE_INSTR_H_ - -/* - * Definitions for all instruction formats - */ -#define IF_OP_SHIFT 30 -#define IF_OP_BITS 2 -#define IF_IMM_SHIFT 0 /* Immediate/Displacement */ - -/* - * Definitions for format 2 - */ -#define IF_F2_RD_SHIFT 25 -#define IF_F2_RD_BITS 5 -#define IF_F2_A_SHIFT 29 -#define IF_F2_A_BITS 1 -#define IF_F2_COND_SHIFT 25 -#define IF_F2_COND_BITS 4 -#define IF_F2_RCOND_SHIFT 25 -#define IF_F2_RCOND_BITS 3 -#define IF_F2_OP2_SHIFT 22 -#define IF_F2_OP2_BITS 3 -#define IF_F2_CC1_SHIFT 21 -#define IF_F2_CC1_BITS 1 -#define IF_F2_CC0_SHIFT 20 -#define IF_F2_CC0_BITS 1 -#define IF_F2_CC_SHIFT 20 /* CC0 and CC1 combined. */ -#define IF_F2_CC_BITS 2 -#define IF_F2_D16HI_SHIFT 20 -#define IF_F2_D16HI_BITS 2 -#define IF_F2_P_SHIFT 19 -#define IF_F2_P_BITS 1 -#define IF_F2_RS1_SHIFT 14 -#define IF_F2_RS1_BITS 5 - -/* - * Definitions for format 3 - */ -#define IF_F3_OP3_SHIFT 19 -#define IF_F3_OP3_BITS 6 -#define IF_F3_RD_SHIFT IF_F2_RD_SHIFT -#define IF_F3_RD_BITS IF_F2_RD_BITS -#define IF_F3_FCN_SHIFT 25 -#define IF_F3_FCN_BITS 5 -#define IF_F3_CC1_SHIFT 26 -#define IF_F3_CC1_BITS 1 -#define IF_F3_CC0_SHIFT 25 -#define IF_F3_CC0_BITS 1 -#define IF_F3_CC_SHIFT 25 /* CC0 and CC1 combined. */ -#define IF_F3_CC_BITS 2 -#define IF_F3_RS1_SHIFT IF_F2_RS1_SHIFT -#define IF_F3_RS1_BITS IF_F2_RS1_BITS -#define IF_F3_I_SHIFT 13 -#define IF_F3_I_BITS 1 -#define IF_F3_X_SHIFT 12 -#define IF_F3_X_BITS 1 -#define IF_F3_RCOND_SHIFT 10 -#define IF_F3_RCOND_BITS 3 -#define IF_F3_IMM_ASI_SHIFT 5 -#define IF_F3_IMM_ASI_BITS 8 -#define IF_F3_OPF_SHIFT 5 -#define IF_F3_OPF_BITS 9 -#define IF_F3_CMASK_SHIFT 4 -#define IF_F3_CMASK_BITS 3 -#define IF_F3_RS2_SHIFT 0 -#define IF_F3_RS2_BITS 5 -#define IF_F3_SHCNT32_SHIFT 0 -#define IF_F3_SHCNT32_BITS 5 -#define IF_F3_SHCNT64_SHIFT 0 -#define IF_F3_SHCNT64_BITS 6 - -/* - * Definitions for format 4 - */ -#define IF_F4_OP3_SHIFT IF_F3_OP3_SHIFT -#define IF_F4_OP3_BITS IF_F3_OP3_BITS -#define IF_F4_RD_SHIFT IF_F2_RD_SHIFT -#define IF_F4_RD_BITS IF_F2_RD_BITS -#define IF_F4_RS1_SHIFT IF_F2_RS1_SHIFT -#define IF_F4_RS1_BITS IF_F2_RS1_BITS -#define IF_F4_TCOND_SHIFT IF_F2_COND_SHIFT /* cond for Tcc */ -#define IF_F4_TCOND_BITS IF_F2_COND_BITS -#define IF_F4_CC2_SHIFT 18 -#define IF_F4_CC2_BITS 1 -#define IF_F4_COND_SHIFT 14 -#define IF_F4_COND_BITS 4 -#define IF_F4_I_SHIFT IF_F3_I_SHIFT -#define IF_F4_I_BITS IF_F3_I_BITS -#define IF_F4_OPF_CC_SHIFT 11 -#define IF_F4_OPF_CC_BITS 3 -#define IF_F4_CC1_SHIFT 12 -#define IF_F4_CC1_BITS 1 -#define IF_F4_CC0_SHIFT 11 -#define IF_F4_CC0_BITS 1 -#define IF_F4_RCOND_SHIFT IF_F3_RCOND_SHIFT -#define IF_F4_RCOND_BITS IF_F3_RCOND_BITS -#define IF_F4_OPF_LOW_SHIFT 5 -#define IF_F4_RS2_SHIFT IF_F3_RS2_SHIFT -#define IF_F4_RS2_BITS IF_F3_RS2_BITS -#define IF_F4_SW_TRAP_SHIFT 0 -#define IF_F4_SW_TRAP_BITS 7 - -/* - * Macros to decode instructions - */ -/* Extract a field */ -#define IF_MASK(s, w) (((1 << (w)) - 1) << (s)) -#define IF_EXTRACT(x, s, w) (((x) & IF_MASK((s), (w))) >> (s)) -#define IF_DECODE(x, f) \ - IF_EXTRACT((x), IF_ ## f ## _SHIFT, IF_ ## f ## _BITS) - -/* Sign-extend a field of width W */ -#define IF_SEXT(x, w) \ - (((x) & (1L << ((w) - 1))) != 0 ? \ - (-1L - ((x) ^ ((1L << (w)) - 1))) : (x)) - -#if 0 -/* - * The following C variant is from db_disassemble.c, and surely faster, but it - * relies on behaviour that is undefined by the C standard (>> in conjunction - * with signed negative arguments). - */ -#define IF_SEXT(v, w) ((((long long)(v)) << (64 - w)) >> (64 - w)) -/* Assembler version of the above */ -#define IF_SEXT(v, w) \ - { u_long t; ( __asm __volatile("sllx %1, %2, %0; srax %0, %2, %0" : - "=r" (t) : "r" (v) : "i" (64 - w)); t)} -#endif - -/* All instruction formats */ -#define IF_OP(i) IF_DECODE(i, OP) - -/* Instruction format 2 */ -#define IF_F2_RD(i) IF_DECODE((i), F2_RD) -#define IF_F2_A(i) IF_DECODE((i), F2_A) -#define IF_F2_COND(i) IF_DECODE((i), F2_COND) -#define IF_F2_RCOND(i) IF_DECODE((i), F2_RCOND) -#define IF_F2_OP2(i) IF_DECODE((i), F2_OP2) -#define IF_F2_CC1(i) IF_DECODE((i), F2_CC1) -#define IF_F2_CC0(i) IF_DECODE((i), F2_CC0) -#define IF_F2_CC(i) IF_DECODE((i), F2_CC) -#define IF_F2_D16HI(i) IF_DECODE((i), F2_D16HI) -#define IF_F2_P(i) IF_DECODE((i), F2_P) -#define IF_F2_RS1(i) IF_DECODE((i), F2_RS1) - -/* Instruction format 3 */ -#define IF_F3_OP3(i) IF_DECODE((i), F3_OP3) -#define IF_F3_RD(i) IF_F2_RD((i)) -#define IF_F3_FCN(i) IF_DECODE((i), F3_FCN) -#define IF_F3_CC1(i) IF_DECODE((i), F3_CC1) -#define IF_F3_CC0(i) IF_DECODE((i), F3_CC0) -#define IF_F3_CC(i) IF_DECODE((i), F3_CC) -#define IF_F3_RS1(i) IF_F2_RS1((i)) -#define IF_F3_I(i) IF_DECODE((i), F3_I) -#define IF_F3_X(i) IF_DECODE((i), F3_X) -#define IF_F3_RCOND(i) IF_DECODE((i), F3_RCOND) -#define IF_F3_IMM_ASI(i) IF_DECODE((i), F3_IMM_ASI) -#define IF_F3_OPF(i) IF_DECODE((i), F3_OPF) -#define IF_F3_CMASK(i) IF_DECODE((i), F3_CMASK) -#define IF_F3_RS2(i) IF_DECODE((i), F3_RS2) -#define IF_F3_SHCNT32(i) IF_DECODE((i), F3_SHCNT32) -#define IF_F3_SHCNT64(i) IF_DECODE((i), F3_SHCNT64) - -/* Instruction format 4 */ -#define IF_F4_OP3(i) IF_F3_OP3((i)) -#define IF_F4_RD(i) IF_F3_RD((i)) -#define IF_F4_TCOND(i) IF_DECODE((i), F4_TCOND) -#define IF_F4_RS1(i) IF_F3_RS1((i)) -#define IF_F4_CC2(i) IF_DECODE((i), F4_CC2) -#define IF_F4_COND(i) IF_DECODE((i), F4_COND) -#define IF_F4_I(i) IF_F3_I((i)) -#define IF_F4_OPF_CC(i) IF_DECODE((i), F4_OPF_CC) -#define IF_F4_RCOND(i) IF_F3_RCOND((i)) -#define IF_F4_OPF_LOW(i, w) IF_EXTRACT((i), IF_F4_OPF_LOW_SHIFT, (w)) -#define IF_F4_RS2(i) IF_F3_RS2((i)) -#define IF_F4_SW_TRAP(i) IF_DECODE((i), F4_SW_TRAP) - -/* Extract an immediate from an instruction, with an without sign extension */ -#define IF_IMM(i, w) IF_EXTRACT((i), IF_IMM_SHIFT, (w)) -#define IF_SIMM(i, w) ({ u_long b = (w), x = IF_IMM((i), b); IF_SEXT((x), b); }) - -/* - * Macros to encode instructions - */ -#define IF_INSERT(x, s, w) (((x) & ((1 << (w)) - 1)) << (s)) -#define IF_ENCODE(x, f) \ - IF_INSERT((x), IF_ ## f ## _SHIFT, IF_ ## f ## _BITS) - -/* All instruction formats */ -#define EIF_OP(x) IF_ENCODE((x), OP) - -/* Instruction format 2 */ -#define EIF_F2_RD(x) IF_ENCODE((x), F2_RD) -#define EIF_F2_A(x) IF_ENCODE((x), F2_A) -#define EIF_F2_COND(x) IF_ENCODE((x), F2_COND) -#define EIF_F2_RCOND(x) IF_ENCODE((x), F2_RCOND) -#define EIF_F2_OP2(x) IF_ENCODE((x), F2_OP2) -#define EIF_F2_CC1(x) IF_ENCODE((x), F2_CC1) -#define EIF_F2_CC0(x) IF_ENCODE((x), F2_CC0) -#define EIF_F2_D16HI(x) IF_ENCODE((x), F2_D16HI) -#define EIF_F2_P(x) IF_ENCODE((x), F2_P) -#define EIF_F2_RS1(x) IF_ENCODE((x), F2_RS1) - -/* Instruction format 3 */ -#define EIF_F3_OP3(x) IF_ENCODE((x), F3_OP3) -#define EIF_F3_RD(x) EIF_F2_RD((x)) -#define EIF_F3_FCN(x) IF_ENCODE((x), F3_FCN) -#define EIF_F3_CC1(x) IF_ENCODE((x), F3_CC1) -#define EIF_F3_CC0(x) IF_ENCODE((x), F3_CC0) -#define EIF_F3_RS1(x) EIF_F2_RS1((x)) -#define EIF_F3_I(x) IF_ENCODE((x), F3_I) -#define EIF_F3_X(x) IF_ENCODE((x), F3_X) -#define EIF_F3_RCOND(x) IF_ENCODE((x), F3_RCOND) -#define EIF_F3_IMM_ASI(x) IF_ENCODE((x), F3_IMM_ASI) -#define EIF_F3_OPF(x) IF_ENCODE((x), F3_OPF) -#define EIF_F3_CMASK(x) IF_ENCODE((x), F3_CMASK) -#define EIF_F3_RS2(x) IF_ENCODE((x), F3_RS2) -#define EIF_F3_SHCNT32(x) IF_ENCODE((x), F3_SHCNT32) -#define EIF_F3_SHCNT64(x) IF_ENCODE((x), F3_SHCNT64) - -/* Instruction format 4 */ -#define EIF_F4_OP3(x) EIF_F3_OP3((x)) -#define EIF_F4_RD(x) EIF_F2_RD((x)) -#define EIF_F4_TCOND(x) IF_ENCODE((x), F4_TCOND) -#define EIF_F4_RS1(x) EIF_F2_RS1((x)) -#define EIF_F4_CC2(x) IF_ENCODE((x), F4_CC2) -#define EIF_F4_COND(x) IF_ENCODE((x), F4_COND) -#define EIF_F4_I(x) EIF_F3_I((x)) -#define EIF_F4_OPF_CC(x) IF_ENCODE((x), F4_OPF_CC) -#define EIF_F4_RCOND(x) EIF_F3_RCOND((x)) -#define EIF_F4_OPF_LOW(i, w) IF_INSERT((x), IF_F4_OPF_CC_SHIFT, (w)) -#define EIF_F4_RS2(x) EIF_F3_RS2((x)) -#define EIF_F4_SW_TRAP(x) IF_ENCODE((x), F4_SW_TRAP) - -/* Immediates */ -#define EIF_IMM(x, w) IF_INSERT((x), IF_IMM_SHIFT, (w)) -#define EIF_SIMM(x, w) IF_EIMM((x), (w)) - -/* - * OP field values (specifying the instruction format) - */ -#define IOP_FORM2 0x00 /* Format 2: sethi, branches */ -#define IOP_CALL 0x01 /* Format 1: call */ -#define IOP_MISC 0x02 /* Format 3 or 4: arith & misc */ -#define IOP_LDST 0x03 /* Format 4: loads and stores */ - -/* - * OP2/OP3 values (specifying the actual instruction) - */ -/* OP2 values for format 2 (OP = 0) */ -#define INS0_ILLTRAP 0x00 -#define INS0_BPcc 0x01 -#define INS0_Bicc 0x02 -#define INS0_BPr 0x03 -#define INS0_SETHI 0x04 /* with rd = 0 and imm22 = 0, nop */ -#define INS0_FBPfcc 0x05 -#define INS0_FBfcc 0x06 -/* undefined 0x07 */ - -/* OP3 values for Format 3 and 4 (OP = 2) */ -#define INS2_ADD 0x00 -#define INS2_AND 0x01 -#define INS2_OR 0x02 -#define INS2_XOR 0x03 -#define INS2_SUB 0x04 -#define INS2_ANDN 0x05 -#define INS2_ORN 0x06 -#define INS2_XNOR 0x07 -#define INS2_ADDC 0x08 -#define INS2_MULX 0x09 -#define INS2_UMUL 0x0a -#define INS2_SMUL 0x0b -#define INS2_SUBC 0x0c -#define INS2_UDIVX 0x0d -#define INS2_UDIV 0x0e -#define INS2_SDIV 0x0f -#define INS2_ADDcc 0x10 -#define INS2_ANDcc 0x11 -#define INS2_ORcc 0x12 -#define INS2_XORcc 0x13 -#define INS2_SUBcc 0x14 -#define INS2_ANDNcc 0x15 -#define INS2_ORNcc 0x16 -#define INS2_XNORcc 0x17 -#define INS2_ADDCcc 0x18 -/* undefined 0x19 */ -#define INS2_UMULcc 0x1a -#define INS2_SMULcc 0x1b -#define INS2_SUBCcc 0x1c -/* undefined 0x1d */ -#define INS2_UDIVcc 0x1e -#define INS2_SDIVcc 0x1f -#define INS2_TADDcc 0x20 -#define INS2_TSUBcc 0x21 -#define INS2_TADDccTV 0x22 -#define INS2_TSUBccTV 0x23 -#define INS2_MULScc 0x24 -#define INS2_SSL 0x25 /* SLLX when IF_X(i) == 1 */ -#define INS2_SRL 0x26 /* SRLX when IF_X(i) == 1 */ -#define INS2_SRA 0x27 /* SRAX when IF_X(i) == 1 */ -#define INS2_RD 0x28 /* and MEMBAR, STBAR */ -/* undefined 0x29 */ -#define INS2_RDPR 0x2a -#define INS2_FLUSHW 0x2b -#define INS2_MOVcc 0x2c -#define INS2_SDIVX 0x2d -#define INS2_POPC 0x2e /* undefined if IF_RS1(i) != 0 */ -#define INS2_MOVr 0x2f -#define INS2_WR 0x30 /* and SIR */ -#define INS2_SV_RSTR 0x31 /* saved, restored */ -#define INS2_WRPR 0x32 -/* undefined 0x33 */ -#define INS2_FPop1 0x34 /* further encoded in opf field */ -#define INS2_FPop2 0x35 /* further encoded in opf field */ -#define INS2_IMPLDEP1 0x36 -#define INS2_IMPLDEP2 0x37 -#define INS2_JMPL 0x38 -#define INS2_RETURN 0x39 -#define INS2_Tcc 0x3a -#define INS2_FLUSH 0x3b -#define INS2_SAVE 0x3c -#define INS2_RESTORE 0x3d -#define INS2_DONE_RETR 0x3e /* done, retry */ -/* undefined 0x3f */ - -/* OP3 values for format 3 (OP = 3) */ -#define INS3_LDUW 0x00 -#define INS3_LDUB 0x01 -#define INS3_LDUH 0x02 -#define INS3_LDD 0x03 -#define INS3_STW 0x04 -#define INS3_STB 0x05 -#define INS3_STH 0x06 -#define INS3_STD 0x07 -#define INS3_LDSW 0x08 -#define INS3_LDSB 0x09 -#define INS3_LDSH 0x0a -#define INS3_LDX 0x0b -/* undefined 0x0c */ -#define INS3_LDSTUB 0x0d -#define INS3_STX 0x0e -#define INS3_SWAP 0x0f -#define INS3_LDUWA 0x10 -#define INS3_LDUBA 0x11 -#define INS3_LDUHA 0x12 -#define INS3_LDDA 0x13 -#define INS3_STWA 0x14 -#define INS3_STBA 0x15 -#define INS3_STHA 0x16 -#define INS3_STDA 0x17 -#define INS3_LDSWA 0x18 -#define INS3_LDSBA 0x19 -#define INS3_LDSHA 0x1a -#define INS3_LDXA 0x1b -/* undefined 0x1c */ -#define INS3_LDSTUBA 0x1d -#define INS3_STXA 0x1e -#define INS3_SWAPA 0x1f -#define INS3_LDF 0x20 -#define INS3_LDFSR 0x21 /* and LDXFSR */ -#define INS3_LDQF 0x22 -#define INS3_LDDF 0x23 -#define INS3_STF 0x24 -#define INS3_STFSR 0x25 /* and STXFSR */ -#define INS3_STQF 0x26 -#define INS3_STDF 0x27 -/* undefined 0x28 - 0x2c */ -#define INS3_PREFETCH 0x2d -/* undefined 0x2e - 0x2f */ -#define INS3_LDFA 0x30 -/* undefined 0x31 */ -#define INS3_LDQFA 0x32 -#define INS3_LDDFA 0x33 -#define INS3_STFA 0x34 -/* undefined 0x35 */ -#define INS3_STQFA 0x36 -#define INS3_STDFA 0x37 -/* undefined 0x38 - 0x3b */ -#define INS3_CASA 0x39 -#define INS3_PREFETCHA 0x3a -#define INS3_CASXA 0x3b - -/* - * OPF values (floating point instructions, IMPLDEP) - */ -/* - * These values are or'ed to the FPop values to get the instructions. - * They describe the operand type(s). - */ -#define INSFP_i 0x000 /* 32-bit int */ -#define INSFP_s 0x001 /* 32-bit single */ -#define INSFP_d 0x002 /* 64-bit double */ -#define INSFP_q 0x003 /* 128-bit quad */ -/* FPop1. The comments give the types for which this instruction is defined. */ -#define INSFP1_FMOV 0x000 /* s, d, q */ -#define INSFP1_FNEG 0x004 /* s, d, q */ -#define INSFP1_FABS 0x008 /* s, d, q */ -#define INSFP1_FSQRT 0x028 /* s, d, q */ -#define INSFP1_FADD 0x040 /* s, d, q */ -#define INSFP1_FSUB 0x044 /* s, d, q */ -#define INSFP1_FMUL 0x048 /* s, d, q */ -#define INSFP1_FDIV 0x04c /* s, d, q */ -#define INSFP1_FsMULd 0x068 /* s */ -#define INSFP1_FdMULq 0x06c /* d */ -#define INSFP1_FTOx 0x080 /* s, d, q */ -#define INSFP1_FxTOs 0x084 /* special: i only */ -#define INSFP1_FxTOd 0x088 /* special: i only */ -#define INSFP1_FxTOq 0x08c /* special: i only */ -#define INSFP1_FTOs 0x0c4 /* i, d, q */ -#define INSFP1_FTOd 0x0c8 /* i, s, q */ -#define INSFP1_FTOq 0x0cc /* i, s, d */ -#define INSFP1_FTOi 0x0d0 /* i, s, d */ - -/* FPop2 */ -#define INSFP2_FMOV_CCMUL 0x40 -#define INSFP2_FMOV_CCOFFS 0x00 -/* Use the IFCC_* constants for cc. Operand types: s, d, q */ -#define INSFP2_FMOV_CC(cc) ((cc) * INSFP2_FMOV_CCMUL + INSFP2_FMOV_CCOFFS) -#define INSFP2_FMOV_RCMUL 0x20 -#define INSFP2_FMOV_RCOFFS 0x04 -/* Use the IRCOND_* constants for rc. Operand types: s, d, q */ -#define INSFP2_FMOV_RC(rc) ((rc) * INSFP2_FMOV_RCMUL + INSFP2_FMOV_RCOFFS) -#define INSFP2_FCMP 0x050 /* s, d, q */ -#define INSFP2_FCMPE 0x054 /* s, d, q */ - -/* Decode 5-bit register field into 6-bit number (for doubles and quads). */ -#define INSFPdq_RN(rn) (((rn) & ~1) | (((rn) & 1) << 5)) - -/* IMPLDEP1 for Sun UltraSparc */ -#define IIDP1_EDGE8 0x00 -#define IIDP1_EDGE8N 0x01 /* US-III */ -#define IIDP1_EDGE8L 0x02 -#define IIDP1_EDGE8LN 0x03 /* US-III */ -#define IIDP1_EDGE16 0x04 -#define IIDP1_EDGE16N 0x05 /* US-III */ -#define IIDP1_EDGE16L 0x06 -#define IIDP1_EDGE16LN 0x07 /* US-III */ -#define IIDP1_EDGE32 0x08 -#define IIDP1_EDGE32N 0x09 /* US-III */ -#define IIDP1_EDGE32L 0x0a -#define IIDP1_EDGE32LN 0x0b /* US-III */ -#define IIDP1_ARRAY8 0x10 -#define IIDP1_ARRAY16 0x12 -#define IIDP1_ARRAY32 0x14 -#define IIDP1_ALIGNADDRESS 0x18 -#define IIDP1_BMASK 0x19 /* US-III */ -#define IIDP1_ALIGNADDRESS_L 0x1a -#define IIDP1_FCMPLE16 0x20 -#define IIDP1_FCMPNE16 0x22 -#define IIDP1_FCMPLE32 0x24 -#define IIDP1_FCMPNE32 0x26 -#define IIDP1_FCMPGT16 0x28 -#define IIDP1_FCMPEQ16 0x2a -#define IIDP1_FCMPGT32 0x2c -#define IIDP1_FCMPEQ32 0x2e -#define IIDP1_FMUL8x16 0x31 -#define IIDP1_FMUL8x16AU 0x33 -#define IIDP1_FMUL8X16AL 0x35 -#define IIDP1_FMUL8SUx16 0x36 -#define IIDP1_FMUL8ULx16 0x37 -#define IIDP1_FMULD8SUx16 0x38 -#define IIDP1_FMULD8ULx16 0x39 -#define IIDP1_FPACK32 0x3a -#define IIDP1_FPACK16 0x3b -#define IIDP1_FPACKFIX 0x3d -#define IIDP1_PDIST 0x3e -#define IIDP1_FALIGNDATA 0x48 -#define IIDP1_FPMERGE 0x4b -#define IIDP1_BSHUFFLE 0x4c /* US-III */ -#define IIDP1_FEXPAND 0x4d -#define IIDP1_FPADD16 0x50 -#define IIDP1_FPADD16S 0x51 -#define IIDP1_FPADD32 0x52 -#define IIDP1_FPADD32S 0x53 -#define IIDP1_SUB16 0x54 -#define IIDP1_SUB16S 0x55 -#define IIDP1_SUB32 0x56 -#define IIDP1_SUB32S 0x57 -#define IIDP1_FZERO 0x60 -#define IIDP1_FZEROS 0x61 -#define IIDP1_FNOR 0x62 -#define IIDP1_FNORS 0x63 -#define IIDP1_FANDNOT2 0x64 -#define IIDP1_FANDNOT2S 0x65 -#define IIDP1_NOT2 0x66 -#define IIDP1_NOT2S 0x67 -#define IIDP1_FANDNOT1 0x68 -#define IIDP1_FANDNOT1S 0x69 -#define IIDP1_FNOT1 0x6a -#define IIDP1_FNOT1S 0x6b -#define IIDP1_FXOR 0x6c -#define IIDP1_FXORS 0x6d -#define IIDP1_FNAND 0x6e -#define IIDP1_FNANDS 0x6f -#define IIDP1_FAND 0x70 -#define IIDP1_FANDS 0x71 -#define IIDP1_FXNOR 0x72 -#define IIDP1_FXNORS 0x73 -#define IIDP1_FSRC1 0x74 -#define IIDP1_FSRC1S 0x75 -#define IIDP1_FORNOT2 0x76 -#define IIDP1_FORNOT2S 0x77 -#define IIDP1_FSRC2 0x78 -#define IIDP1_FSRC2S 0x79 -#define IIDP1_FORNOT1 0x7a -#define IIDP1_FORNOT1S 0x7b -#define IIDP1_FOR 0x7c -#define IIDP1_FORS 0x7d -#define IIDP1_FONE 0x7e -#define IIDP1_FONES 0x7f -#define IIDP1_SHUTDOWN 0x80 -#define IIDP1_SIAM 0x81 /* US-III */ - -/* - * Instruction modifiers - */ -/* cond values for integer ccr's */ -#define IICOND_N 0x00 -#define IICOND_E 0x01 -#define IICOND_LE 0x02 -#define IICOND_L 0x03 -#define IICOND_LEU 0x04 -#define IICOND_CS 0x05 -#define IICOND_NEG 0x06 -#define IICOND_VS 0x07 -#define IICOND_A 0x08 -#define IICOND_NE 0x09 -#define IICOND_G 0x0a -#define IICOND_GE 0x0b -#define IICOND_GU 0x0c -#define IICOND_CC 0x0d -#define IICOND_POS 0x0e -#define IICOND_VC 0x0f - -/* cond values for fp ccr's */ -#define IFCOND_N 0x00 -#define IFCOND_NE 0x01 -#define IFCOND_LG 0x02 -#define IFCOND_UL 0x03 -#define IFCOND_L 0x04 -#define IFCOND_UG 0x05 -#define IFCOND_G 0x06 -#define IFCOND_U 0x07 -#define IFCOND_A 0x08 -#define IFCOND_E 0x09 -#define IFCOND_UE 0x0a -#define IFCOND_GE 0x0b -#define IFCOND_UGE 0x0c -#define IFCOND_LE 0x0d -#define IFCOND_ULE 0x0e -#define IFCOND_O 0x0f - -/* rcond values for BPr, MOVr, FMOVr */ -#define IRCOND_Z 0x01 -#define IRCOND_LEZ 0x02 -#define IRCOND_LZ 0x03 -#define IRCOND_NZ 0x05 -#define IRCOND_GZ 0x06 -#define IRCOND_GEZ 0x07 - -/* cc values for MOVcc and FMOVcc */ -#define IFCC_ICC 0x04 -#define IFCC_XCC 0x06 -/* if true, the lower 2 bits are the fcc number */ -#define IFCC_FCC(c) ((c) & 3) -#define IFCC_GET_FCC(c) ((c) & 3) -#define IFCC_ISFCC(c) (((c) & 4) == 0) - -/* cc values for BPc and Tcc */ -#define IBCC_ICC 0x00 -#define IBCC_XCC 0x02 - -/* - * Integer registers - */ -#define IREG_G0 0x00 -#define IREG_O0 0x08 -#define IREG_L0 0x10 -#define IREQ_I0 0x18 - -#endif /* !_MACHINE_INSTR_H_ */ diff --git a/sys/sparc64/include/intr_machdep.h b/sys/sparc64/include/intr_machdep.h deleted file mode 100644 index b612893f1c352e..00000000000000 --- a/sys/sparc64/include/intr_machdep.h +++ /dev/null @@ -1,115 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2001 Jake Burkholder. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_INTR_MACHDEP_H_ -#define _MACHINE_INTR_MACHDEP_H_ - -#define IRSR_BUSY (1 << 5) - -#define PIL_MAX (1 << 4) -#define IV_MAX (1 << 11) - -#define IR_FREE (PIL_MAX * 2) - -#define IH_SHIFT PTR_SHIFT -#define IQE_SHIFT 5 -#define IV_SHIFT 6 - -#define PIL_LOW 1 /* stray interrupts */ -#define PIL_PREEMPT 2 /* preempt idle thread CPU IPI */ -#define PIL_ITHREAD 3 /* interrupts that use ithreads */ -#define PIL_RENDEZVOUS 4 /* SMP rendezvous IPI */ -#define PIL_AST 5 /* asynchronous trap IPI */ -#define PIL_HARDCLOCK 6 /* hardclock broadcast */ -#define PIL_FILTER 11 /* filter interrupts */ -#define PIL_BRIDGE 12 /* bridge interrupts */ -#define PIL_STOP 13 /* stop CPU IPI */ -#define PIL_TICK 14 /* tick interrupts */ - -#ifndef LOCORE - -#define INTR_BRIDGE INTR_MD1 - -struct trapframe; - -typedef void ih_func_t(struct trapframe *); -typedef void iv_func_t(void *); - -struct intr_request { - struct intr_request *ir_next; - iv_func_t *ir_func; - void *ir_arg; - u_int ir_vec; - u_int ir_pri; -}; - -struct intr_controller { - void (*ic_enable)(void *); - void (*ic_disable)(void *); - void (*ic_assign)(void *); - void (*ic_clear)(void *); -}; - -struct intr_vector { - iv_func_t *iv_func; - void *iv_arg; - const struct intr_controller *iv_ic; - void *iv_icarg; - struct intr_event *iv_event; - u_int iv_pri; - u_int iv_vec; - u_int iv_mid; - u_int iv_refcnt; - u_int iv_pad[2]; -}; - -extern ih_func_t *intr_handlers[]; -extern struct intr_vector intr_vectors[]; - -#ifdef SMP -void intr_add_cpu(u_int cpu); -#endif -int intr_bind(int vec, u_char cpu); -int intr_describe(int vec, void *ih, const char *descr); -void intr_setup(int level, ih_func_t *ihf, int pri, iv_func_t *ivf, - void *iva); -void intr_init1(void); -void intr_init2(void); -int intr_controller_register(int vec, const struct intr_controller *ic, - void *icarg); -int inthand_add(const char *name, int vec, int (*filt)(void *), - void (*handler)(void *), void *arg, int flags, void **cookiep); -int inthand_remove(int vec, void *cookie); - -ih_func_t intr_fast; - -#endif /* !LOCORE */ - -#endif /* !_MACHINE_INTR_MACHDEP_H_ */ diff --git a/sys/sparc64/include/iommureg.h b/sys/sparc64/include/iommureg.h deleted file mode 100644 index de794cd1e4498c..00000000000000 --- a/sys/sparc64/include/iommureg.h +++ /dev/null @@ -1,214 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: @(#)sbusreg.h 8.1 (Berkeley) 6/11/93 - * from: NetBSD: iommureg.h,v 1.6 2001/07/20 00:07:13 eeh Exp - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_IOMMUREG_H_ -#define _MACHINE_IOMMUREG_H_ - -/* - * UltraSPARC IOMMU registers, common to both the PCI and SBus - * controllers. - */ - -/* IOMMU registers */ -#define IMR_CTL 0x0000 /* IOMMU control register */ -#define IMR_TSB 0x0008 /* IOMMU TSB base register */ -#define IMR_FLUSH 0x0010 /* IOMMU flush register */ -/* The TTE Cache is Fire and Oberon only. */ -#define IMR_CACHE_FLUSH 0x0100 /* IOMMU TTE cache flush address register */ -#define IMR_CACHE_INVAL 0x0108 /* IOMMU TTE cache invalidate register */ - -/* streaming buffer registers */ -#define ISR_CTL 0x0000 /* streaming buffer control reg */ -#define ISR_PGFLUSH 0x0008 /* streaming buffer page flush */ -#define ISR_FLUSHSYNC 0x0010 /* streaming buffer flush sync */ - -/* streaming buffer diagnostics registers */ -#define ISD_DATA_DIAG 0x0000 /* streaming buffer data RAM diag 0..127 */ -#define ISD_ERROR_DIAG 0x0400 /* streaming buffer error status diag 0..127 */ -#define ISD_PG_TAG_DIAG 0x0800 /* streaming buffer page tag diag 0..15 */ -#define ISD_LN_TAG_DIAG 0x0900 /* streaming buffer line tag diag 0..15 */ - -/* streaming buffer control register */ -#define STRBUF_EN 0x0000000000000001UL -#define STRBUF_D 0x0000000000000002UL -#define STRBUF_RR_DIS 0x0000000000000004UL - -#define IOMMU_MAXADDR(bits) ((1UL << (bits)) - 1) - -/* - * control register bits - */ -/* Nummber of entries in the IOTSB - pre-Fire only */ -#define IOMMUCR_TSBSZ_MASK 0x0000000000070000UL -#define IOMMUCR_TSBSZ_SHIFT 16 -/* TSB cache snoop enable */ -#define IOMMUCR_SE 0x0000000000000400UL -/* Cache modes - Fire and Oberon */ -#define IOMMUCR_CM_NC_TLB_TBW 0x0000000000000000UL -#define IOMMUCR_CM_LC_NTLB_NTBW 0x0000000000000100UL -#define IOMMUCR_CM_LC_TLB_TBW 0x0000000000000200UL -#define IOMMUCR_CM_C_TLB_TBW 0x0000000000000300UL -/* IOMMU page size - pre-Fire only */ -#define IOMMUCR_8KPG 0x0000000000000000UL -#define IOMMUCR_64KPG 0x0000000000000004UL -/* Bypass enable - Fire and Oberon */ -#define IOMMUCR_BE 0x0000000000000002UL -/* Diagnostic mode enable - pre-Fire only */ -#define IOMMUCR_DE 0x0000000000000002UL -/* IOMMU/translation enable */ -#define IOMMUCR_EN 0x0000000000000001UL - -/* - * TSB base register bits - */ - /* TSB base address */ -#define IOMMUTB_TB_MASK 0x000007ffffffe000UL -#define IOMMUTB_TB_SHIFT 13 -/* IOMMU page size - Fire and Oberon */ -#define IOMMUTB_8KPG 0x0000000000000000UL -#define IOMMUTB_64KPG 0x0000000000000100UL -/* Nummber of entries in the IOTSB - Fire and Oberon */ -#define IOMMUTB_TSBSZ_MASK 0x0000000000000004UL -#define IOMMUTB_TSBSZ_SHIFT 0 - -/* - * TSB size definitions for both control and TSB base register */ -#define IOMMU_TSB1K 0 -#define IOMMU_TSB2K 1 -#define IOMMU_TSB4K 2 -#define IOMMU_TSB8K 3 -#define IOMMU_TSB16K 4 -#define IOMMU_TSB32K 5 -#define IOMMU_TSB64K 6 -#define IOMMU_TSB128K 7 -/* Fire and Oberon */ -#define IOMMU_TSB256K 8 -/* Fire and Oberon */ -#define IOMMU_TSB512K 9 -#define IOMMU_TSBENTRIES(tsbsz) \ - ((1 << (tsbsz)) << (IO_PAGE_SHIFT - IOTTE_SHIFT)) - -/* - * Diagnostic register definitions - */ -#define IOMMU_DTAG_VPNBITS 19 -#define IOMMU_DTAG_VPNMASK ((1 << IOMMU_DTAG_VPNBITS) - 1) -#define IOMMU_DTAG_VPNSHIFT 13 -#define IOMMU_DTAG_ERRBITS 3 -#define IOMMU_DTAG_ERRSHIFT 22 -#define IOMMU_DTAG_ERRMASK \ - (((1 << IOMMU_DTAG_ERRBITS) - 1) << IOMMU_DTAG_ERRSHIFT) - -#define IOMMU_DDATA_PGBITS 21 -#define IOMMU_DDATA_PGMASK ((1 << IOMMU_DDATA_PGBITS) - 1) -#define IOMMU_DDATA_PGSHIFT 13 -#define IOMMU_DDATA_C (1 << 28) -#define IOMMU_DDATA_V (1 << 30) - -/* - * IOMMU stuff - */ -/* Entry valid */ -#define IOTTE_V 0x8000000000000000UL -/* Page size - pre-Fire only */ -#define IOTTE_64K 0x2000000000000000UL -#define IOTTE_8K 0x0000000000000000UL -/* Streamable page - streaming buffer equipped variants only */ -#define IOTTE_STREAM 0x1000000000000000UL -/* Accesses to the same bus segment - SBus only */ -#define IOTTE_LOCAL 0x0800000000000000UL -/* Physical address mask (based on Oberon) */ -#define IOTTE_PAMASK 0x00007fffffffe000UL -/* Accesses to cacheable space - pre-Fire only */ -#define IOTTE_C 0x0000000000000010UL -/* Writeable */ -#define IOTTE_W 0x0000000000000002UL - -/* log2 of the IOMMU TTE size */ -#define IOTTE_SHIFT 3 - -/* Streaming buffer line size */ -#define STRBUF_LINESZ 64 - -/* - * Number of bytes written by a stream buffer flushsync operation to indicate - * completion. - */ -#define STRBUF_FLUSHSYNC_NBYTES STRBUF_LINESZ - -/* - * On sun4u each bus controller has a separate IOMMU. The IOMMU has - * a TSB which must be page aligned and physically contiguous. Mappings - * can be of 8K IOMMU pages or 64K IOMMU pages. We use 8K for compatibility - * with the CPU's MMU. - * - * On sysio, psycho, and psycho+, IOMMU TSBs using 8K pages can map the - * following size segments: - * - * VA size VA base TSB size tsbsize - * -------- -------- --------- ------- - * 8MB ff800000 8K 0 - * 16MB ff000000 16K 1 - * 32MB fe000000 32K 2 - * 64MB fc000000 64K 3 - * 128MB f8000000 128K 4 - * 256MB f0000000 256K 5 - * 512MB e0000000 512K 6 - * 1GB c0000000 1MB 7 - * - * Unfortunately, sabres on UltraSPARC IIi and IIe processors does not use - * this scheme to determine the IOVA base address. Instead, bits 31-29 are - * used to check against the Target Address Space register in the IIi and - * the IOMMU is used if they hit. God knows what goes on in the IIe. - * - */ - -#define IOTSB_BASESZ (1024 << IOTTE_SHIFT) -#define IOTSB_VEND (~IO_PAGE_MASK) -#define IOTSB_VSTART(sz) (u_int)(IOTSB_VEND << ((sz) + 10)) - -#define MAKEIOTTE(pa, w, c, s) \ - (((pa) & IOTTE_PAMASK) | ((w) ? IOTTE_W : 0) | \ - ((c) ? IOTTE_C : 0) | ((s) ? IOTTE_STREAM : 0) | \ - (IOTTE_V | IOTTE_8K)) -#define IOTSBSLOT(va) \ - ((u_int)(((vm_offset_t)(va)) - (is->is_dvmabase)) >> IO_PAGE_SHIFT) - -#endif /* !_MACHINE_IOMMUREG_H_ */ diff --git a/sys/sparc64/include/iommuvar.h b/sys/sparc64/include/iommuvar.h deleted file mode 100644 index f2fdd6c6dc75e8..00000000000000 --- a/sys/sparc64/include/iommuvar.h +++ /dev/null @@ -1,115 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 1999 Matthew R. Green - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: NetBSD: iommuvar.h,v 1.6 2008/05/29 14:51:26 mrg Exp - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_IOMMUVAR_H_ -#define _MACHINE_IOMMUVAR_H_ - -#define IO_PAGE_SIZE PAGE_SIZE_8K -#define IO_PAGE_MASK PAGE_MASK_8K -#define IO_PAGE_SHIFT PAGE_SHIFT_8K -#define round_io_page(x) round_page(x) -#define trunc_io_page(x) trunc_page(x) - -/* - * LRU queue handling for lazy resource allocation - */ -TAILQ_HEAD(iommu_maplruq_head, bus_dmamap); - -/* - * Per-IOMMU state; the parenthesized comments indicate the locking strategy: - * i - protected by is_mtx. - * r - read-only after initialization. - * * - comment refers to pointer target / target hardware registers - * (for bus_addr_t). - * is_maplruq is also locked by is_mtx. Elements of is_tsb may only be - * accessed from functions operating on the map owning the corresponding - * resource, so the locking the user is required to do to protect the - * map is sufficient. - * dm_reslist of all maps are locked by is_mtx as well. - * is_dvma_rman has its own internal lock. - */ -struct iommu_state { - struct mtx is_mtx; - struct rman is_dvma_rman; /* DVMA space rman */ - struct iommu_maplruq_head is_maplruq; /* (i) LRU queue */ - vm_paddr_t is_ptsb; /* (r) TSB physical address */ - uint64_t *is_tsb; /* (*i) TSB virtual address */ - int is_tsbsize; /* (r) 0 = 8K, ... */ - uint64_t is_pmaxaddr; /* (r) max. physical address */ - uint64_t is_dvmabase; /* (r) */ - uint64_t is_cr; /* (r) Control reg value */ - - vm_paddr_t is_flushpa[2]; /* (r) */ - volatile uint64_t *is_flushva[2]; /* (r, *i) */ - /* - * (i) - * When a flush is completed, 64 bytes will be stored at the given - * location, the first double word being 1, to indicate completion. - * The lower 6 address bits are ignored, so the addresses need to be - * suitably aligned; over-allocate a large enough margin to be able - * to adjust it. - * Two such buffers are needed. - */ - volatile char is_flush[STRBUF_FLUSHSYNC_NBYTES * 3 - 1]; - - /* copies of our parent's state, to allow us to be self contained */ - bus_space_tag_t is_bustag; /* (r) Our bus tag */ - bus_space_handle_t is_bushandle; /* (r) */ - bus_addr_t is_iommu; /* (r, *i) IOMMU registers */ - bus_addr_t is_sb[2]; /* (r, *i) Streaming buffer */ - /* Tag diagnostics access */ - bus_addr_t is_dtag; /* (r, *r) */ - /* Data RAM diagnostic access */ - bus_addr_t is_ddram; /* (r, *r) */ - /* LRU queue diag. access */ - bus_addr_t is_dqueue; /* (r, *r) */ - /* Virtual address diagnostics register */ - bus_addr_t is_dva; /* (r, *r) */ - /* Tag compare diagnostics access */ - bus_addr_t is_dtcmp; /* (r, *r) */ - /* behavior flags */ - u_int is_flags; /* (r) */ -#define IOMMU_RERUN_DISABLE (1 << 0) -#define IOMMU_FIRE (1 << 1) -#define IOMMU_FLUSH_CACHE (1 << 2) -#define IOMMU_PRESERVE_PROM (1 << 3) -}; - -/* interfaces for PCI/SBus code */ -void iommu_init(const char *name, struct iommu_state *is, u_int tsbsize, - uint32_t iovabase, u_int resvpg); -void iommu_reset(struct iommu_state *is); -void iommu_decode_fault(struct iommu_state *is, vm_offset_t phys); - -extern struct bus_dma_methods iommu_dma_methods; - -#endif /* !_MACHINE_IOMMUVAR_H_ */ diff --git a/sys/sparc64/include/jbus.h b/sys/sparc64/include/jbus.h deleted file mode 100644 index d644594f172fc8..00000000000000 --- a/sys/sparc64/include/jbus.h +++ /dev/null @@ -1,41 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2010 Marius Strobl - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_JBUS_H_ -#define _MACHINE_JBUS_H_ - -#define JBUS_CR_JID_SHIFT (17) -#define JBUS_CR_JID_SIZE (3) -#define JBUS_CR_JID_MASK \ - (((1 << JBUS_CR_JID_SIZE) - 1) << JBUS_CR_JID_SHIFT) - -#define JBUS_CR_GET_JID(cr) ((cr & JBUS_CR_JID_MASK) >> JBUS_CR_JID_SHIFT) - -#endif /* _MACHINE_JBUS_H_ */ diff --git a/sys/sparc64/include/kdb.h b/sys/sparc64/include/kdb.h deleted file mode 100644 index 8f3876e4a0e55e..00000000000000 --- a/sys/sparc64/include/kdb.h +++ /dev/null @@ -1,59 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2004 Marcel Moolenaar - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_KDB_H_ -#define _MACHINE_KDB_H_ - -#include - -#define KDB_STOPPEDPCB(pc) &stoppcbs[pc->pc_cpuid] - -static __inline void -kdb_cpu_clear_singlestep(void) -{ -} - -static __inline void -kdb_cpu_set_singlestep(void) -{ -} - -static __inline void -kdb_cpu_sync_icache(unsigned char *addr, size_t size) -{ -} - -static __inline void -kdb_cpu_trap(int vector, int _) -{ - flushw(); -} - -#endif /* _MACHINE_KDB_H_ */ diff --git a/sys/sparc64/include/kerneldump.h b/sys/sparc64/include/kerneldump.h deleted file mode 100644 index 975b566d0ce327..00000000000000 --- a/sys/sparc64/include/kerneldump.h +++ /dev/null @@ -1,54 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2002 by Thomas Moestl . - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE - * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_KERNELDUMP_H_ -#define _MACHINE_KERNELDUMP_H_ - -struct sparc64_dump_reg { - uint64_t dr_pa; - uint64_t dr_size; - uint64_t dr_offs; -}; - -/* - * Kernel dump format for sparc64. This does not use ELF because it is of no - * avail (only libkvm knows how to translate addresses properly anyway) and - * would require some ugly hacks. - */ -struct sparc64_dump_hdr { - uint64_t dh_hdr_size; - uint64_t dh_tsb_pa; - uint64_t dh_tsb_size; - uint64_t dh_tsb_mask; - int32_t dh_nregions; - int32_t dh_pad; - struct sparc64_dump_reg dh_regions[]; -}; - -#endif /* _MACHINE_KERNELDUMP_H_ */ diff --git a/sys/sparc64/include/ktr.h b/sys/sparc64/include/ktr.h deleted file mode 100644 index 01bb6a2d384c80..00000000000000 --- a/sys/sparc64/include/ktr.h +++ /dev/null @@ -1,101 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1996 Berkeley Software Design, Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Berkeley Software Design Inc's name may not be used to endorse or - * promote products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY BERKELEY SOFTWARE DESIGN INC ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL BERKELEY SOFTWARE DESIGN INC BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from BSDI $Id: ktr.h,v 1.10.2.7 2000/03/16 21:44:42 cp Exp $ - * $FreeBSD$ - */ - -#ifndef _MACHINE_KTR_H_ -#define _MACHINE_KTR_H_ - -#include - -#ifdef LOCORE - -/* - * XXX could really use another register ... - */ -#define ATR(desc, r1, r2, r3, l1, l2) \ - .sect .rodata ; \ -l1: .asciz desc ; \ - .previous ; \ - SET(ktr_idx, r2, r1) ; \ - lduw [r1], r2 ; \ -l2: add r2, 1, r3 ; \ - set KTR_ENTRIES - 1, r1 ; \ - and r3, r1, r3 ; \ - set ktr_idx, r1 ; \ - casa [r1] ASI_N, r2, r3 ; \ - cmp r2, r3 ; \ - bne %icc, l2 ## b ; \ - mov r3, r2 ; \ - SET(ktr_buf, r3, r1) ; \ - ldx [r1], r1 ; \ - mulx r2, KTR_SIZEOF, r2 ; \ - add r1, r2, r1 ; \ - rd %tick, r2 ; \ - stx r2, [r1 + KTR_TIMESTAMP] ; \ - lduw [PCPU(CPUID)], r2 ; \ - stw r2, [r1 + KTR_CPU] ; \ - stw %g0, [r1 + KTR_LINE] ; \ - stx %g0, [r1 + KTR_FILE] ; \ - SET(l1 ## b, r3, r2) ; \ - stx r2, [r1 + KTR_DESC] - -#define CATR(mask, desc, r1, r2, r3, l1, l2, l3) \ - setx mask, r3, r1 ; \ - setx ktr_mask, r3, r2 ; \ - ldx [r2], r2 ; \ - and r2, r1, r1 ; \ - brz r1, l3 ## f ; \ - nop ; \ - lduw [PCPU(CPUID)], r2 ; \ - mov _NCPUBITS, r3 ; \ - udivx r2, r3, r2 ; \ - srl r2, 0, r2 ; \ - sllx r2, PTR_SHIFT, r2 ; \ - SET(ktr_cpumask, r3, r1) ; \ - ldx [r1 + r2], r1 ; \ - lduw [PCPU(CPUID)], r2 ; \ - mov _NCPUBITS, r3 ; \ - udivx r2, r3, r2 ; \ - srl r2, 0, r2 ; \ - smul r2, r3, r3 ; \ - lduw [PCPU(CPUID)], r2 ; \ - sub r2, r3, r3 ; \ - mov 1, r2 ; \ - sllx r2, r3, r2 ; \ - andn r1, r2, r1 ; \ - brz r1, l3 ## f ; \ - nop ; \ - ATR(desc, r1, r2, r3, l1, l2) - -#endif /* LOCORE */ - -#endif /* !_MACHINE_KTR_H_ */ diff --git a/sys/sparc64/include/limits.h b/sys/sparc64/include/limits.h deleted file mode 100644 index 689e8a91072b19..00000000000000 --- a/sys/sparc64/include/limits.h +++ /dev/null @@ -1,43 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 1988, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)limits.h 8.3 (Berkeley) 1/4/94 - * $FreeBSD$ - */ - -#ifndef _MACHINE_LIMITS_H_ -#define _MACHINE_LIMITS_H_ - -#include - -#if __CC_SUPPORTS_WARNING -#warning "machine/limits.h is deprecated. Include sys/limits.h instead." -#endif - -#include - -#endif /* !_MACHINE_LIMITS_H_ */ diff --git a/sys/sparc64/include/lsu.h b/sys/sparc64/include/lsu.h deleted file mode 100644 index 1f62df9c8eee0c..00000000000000 --- a/sys/sparc64/include/lsu.h +++ /dev/null @@ -1,88 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright 2001 by Thomas Moestl . All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE - * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_LSU_H_ -#define _MACHINE_LSU_H_ - -/* - * Definitions for the Load-Store-Unit Control Register. This is called - * Data Cache Unit Control Register (DCUCR) for UltraSPARC-III and greater. - */ -#define LSU_IC (1UL << 0) -#define LSU_DC (1UL << 1) -#define LSU_IM (1UL << 2) -#define LSU_DM (1UL << 3) - -/* Parity control mask, UltraSPARC-I and II series only. */ -#define LSU_FM_SHIFT 4 -#define LSU_FM_BITS 16 -#define LSU_FM_MASK (((1UL << LSU_FM_BITS) - 1) << LSU_FM_SHIFT) - -#define LSU_VM_SHIFT 25 -#define LSU_VM_BITS 8 -#define LSU_VM_MASK (((1UL << LSU_VM_BITS) - 1) << LSU_VM_SHIFT) - -#define LSU_PM_SHIFT 33 -#define LSU_PM_BITS 8 -#define LSU_PM_MASK (((1UL << LSU_PM_BITS) - 1) << LSU_PM_SHIFT) - -#define LSU_VW (1UL << 21) -#define LSU_VR (1UL << 22) -#define LSU_PW (1UL << 23) -#define LSU_PR (1UL << 24) - -/* The following bits are valid for the UltraSPARC-III series only. */ -#define LSU_WE (1UL << 41) -#define LSU_SL (1UL << 42) -#define LSU_SPE (1UL << 43) -#define LSU_HPE (1UL << 44) -#define LSU_PE (1UL << 45) -#define LSU_RE (1UL << 46) -#define LSU_ME (1UL << 47) -#define LSU_CV (1UL << 48) -#define LSU_CP (1UL << 49) - -/* The following bit is valid for the UltraSPARC-IV only. */ -#define LSU_WIH (1UL << 4) - -/* The following bits are valid for the UltraSPARC-IV+ only. */ -#define LSU_PPS_SHIFT 50 -#define LSU_PPS_BITS 2 -#define LSU_PPS_MASK (((1UL << LSU_PPS_BITS) - 1) << LSU_PPS_SHIFT) - -#define LSU_IPS_SHIFT 52 -#define LSU_IPS_BITS 2 -#define LSU_IPS_MASK (((1UL << LSU_IPS_BITS) - 1) << LSU_IPS_SHIFT) - -#define LSU_PCM (1UL << 54) -#define LSU_WCE (1UL << 55) - -/* The following bit is valid for the SPARC64 V, VI, VII and VIIIfx only. */ -#define LSU_WEAK_SPCA (1UL << 41) - -#endif /* _MACHINE_LSU_H_ */ diff --git a/sys/sparc64/include/mcntl.h b/sys/sparc64/include/mcntl.h deleted file mode 100644 index 8dcc62868cbddc..00000000000000 --- a/sys/sparc64/include/mcntl.h +++ /dev/null @@ -1,64 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2010 Marius Strobl - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_MCNTL_H -#define _MACHINE_MCNTL_H - -/* - * Definitions for the SPARC64 V, VI, VII and VIIIfx Memory Control Register - */ -#define MCNTL_JPS1_TSBP (1UL << 8) - -#define MCNTL_RMD_SHIFT 12 -#define MCNTL_RMD_BITS 2 -#define MCNTL_RMD_MASK \ - (((1UL << MCNTL_RMD_BITS) - 1) << MCNTL_RMD_SHIFT) -#define MCNTL_RMD_FULL (0UL << MCNTL_RMD_SHIFT) -#define MCNTL_RMD_1024 (2UL << MCNTL_RMD_SHIFT) -#define MCNTL_RMD_512 (3UL << MCNTL_RMD_SHIFT) - -#define MCNTL_FW_FDTLB (1UL << 14) -#define MCNTL_FW_FITLB (1UL << 15) -#define MCNTL_NC_CACHE (1UL << 16) - -/* The following bits are valid for the SPARC64 VI, VII and VIIIfx only. */ -#define MCNTL_MPG_SDTLB (1UL << 6) -#define MCNTL_MPG_SITLB (1UL << 7) - -/* The following bits are valid for the SPARC64 VIIIfx only. */ -#define MCNTL_HPF_SHIFT 18 -#define MCNTL_HPF_BITS 2 -#define MCNTL_HPF_MASK \ - (((1UL << MCNTL_HPF_BITS) - 1) << MCNTL_HPF_SHIFT) -#define MCNTL_HPF_STRONG (0UL << MCNTL_HPF_SHIFT) -#define MCNTL_HPF_NOT (1UL << MCNTL_HPF_SHIFT) -#define MCNTL_HPF_WEAK (2UL << MCNTL_HPF_SHIFT) - -#endif /* _MACHINE_MCNTL_H */ diff --git a/sys/sparc64/include/md_var.h b/sys/sparc64/include/md_var.h deleted file mode 100644 index 3a30b235593559..00000000000000 --- a/sys/sparc64/include/md_var.h +++ /dev/null @@ -1,80 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1995 Bruce D. Evans. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the author nor the names of contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: FreeBSD: src/sys/i386/include/md_var.h,v 1.40 2001/07/12 - * $FreeBSD$ - */ - -#ifndef _MACHINE_MD_VAR_H_ -#define _MACHINE_MD_VAR_H_ - -typedef void cpu_block_copy_t(const void *src, void *dst, size_t len); -typedef void cpu_block_zero_t(void *dst, size_t len); - -extern char tl0_base[]; -extern char _end[]; - -extern long Maxmem; - -extern vm_offset_t kstack0; -extern vm_paddr_t kstack0_phys; - -struct pcpu; -struct md_utrap; - -uint32_t cpu_get_mid(u_int cpu_impl); -void cpu_identify(u_long vers, u_int clock, u_int id); -const char *cpu_portid_prop(u_int cpu_impl); -void cpu_setregs(struct pcpu *pc); -int is_physical_memory(vm_paddr_t addr); -struct md_utrap *utrap_alloc(void); -void utrap_free(struct md_utrap *ut); -struct md_utrap *utrap_hold(struct md_utrap *ut); - -cpu_block_copy_t spitfire_block_copy; -cpu_block_zero_t spitfire_block_zero; -cpu_block_copy_t zeus_block_copy; -cpu_block_zero_t zeus_block_zero; - -extern cpu_block_copy_t *cpu_block_copy; -extern cpu_block_zero_t *cpu_block_zero; - -/* - * Given that the VTOC8 disk label only uses 16-bit fields for cylinders, - * heads and sectors we might need to adjust the geometry of large disks. - */ -struct ccb_calc_geometry; -int scsi_da_bios_params(struct ccb_calc_geometry *ccg); -struct disk; -void sparc64_ata_disk_firmware_geom_adjust(struct disk *disk); -#define ata_disk_firmware_geom_adjust(disk) \ - sparc64_ata_disk_firmware_geom_adjust(disk) - -#endif /* !_MACHINE_MD_VAR_H_ */ diff --git a/sys/sparc64/include/memdev.h b/sys/sparc64/include/memdev.h deleted file mode 100644 index 486dbb5a5bfa03..00000000000000 --- a/sys/sparc64/include/memdev.h +++ /dev/null @@ -1,42 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2004 Mark R V Murray - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer - * in this position and unchanged. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_MEMDEV_H_ -#define _MACHINE_MEMDEV_H_ - -#define CDEV_MINOR_MEM 0 -#define CDEV_MINOR_KMEM 1 - -d_open_t memopen; -d_read_t memrw; -#define memioctl (d_ioctl_t *)NULL -#define memmmap (d_mmap_t *)NULL - -#endif /* _MACHINE_MEMDEV_H_ */ diff --git a/sys/sparc64/include/metadata.h b/sys/sparc64/include/metadata.h deleted file mode 100644 index 8eaa485469e7fd..00000000000000 --- a/sys/sparc64/include/metadata.h +++ /dev/null @@ -1,47 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2001 Jake Burkholder. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_METADATA_H_ -#define _MACHINE_METADATA_H_ - -#define MODINFOMD_ENVP 0x1001 -#define MODINFOMD_HOWTO 0x1002 -#define MODINFOMD_KERNEND 0x1003 -#define MODINFOMD_DTLB_SLOTS 0x1004 -#define MODINFOMD_ITLB_SLOTS 0x1005 -#define MODINFOMD_DTLB 0x1006 -#define MODINFOMD_ITLB 0x1007 - -struct tlb_entry { - vm_offset_t te_pa; - vm_offset_t te_va; -}; - -#endif /* !_MACHINE_METADATA_H_ */ diff --git a/sys/sparc64/include/nexusvar.h b/sys/sparc64/include/nexusvar.h deleted file mode 100644 index 2e5f461834178b..00000000000000 --- a/sys/sparc64/include/nexusvar.h +++ /dev/null @@ -1,36 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2010 Marius Strobl - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_NEXUSVAR_H_ -#define _MACHINE_NEXUSVAR_H_ - -DECLARE_CLASS(nexus_driver); - -#endif /* _MACHINE_NEXUSVAR_H_ */ diff --git a/sys/sparc64/include/ofw_machdep.h b/sys/sparc64/include/ofw_machdep.h deleted file mode 100644 index b3c33f449d0335..00000000000000 --- a/sys/sparc64/include/ofw_machdep.h +++ /dev/null @@ -1,50 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2001 by Thomas Moestl . - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE - * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_OFW_MACHDEP_H_ -#define _MACHINE_OFW_MACHDEP_H_ - -#include -#include -#include - -typedef uint64_t cell_t; - -/* sparc64 doesn't use the interrupt parent #address-cells in interrupt maps */ -#define OFW_IMAP_NO_IPARENT_ADDR_CELLS - -int OF_decode_addr(phandle_t, int, int *, bus_addr_t *); -void OF_getetheraddr(device_t, u_char *); -u_int OF_getscsinitid(device_t); -void OF_panic(const char *fmt, ...) __dead2 __printflike(1, 2); -void cpu_shutdown(void *) __dead2; -int ofw_entry(void *); -void ofw_exit(void *) __dead2; - -#endif /* _MACHINE_OFW_MACHDEP_H_ */ diff --git a/sys/sparc64/include/ofw_mem.h b/sys/sparc64/include/ofw_mem.h deleted file mode 100644 index 44d7c18f36d55b..00000000000000 --- a/sys/sparc64/include/ofw_mem.h +++ /dev/null @@ -1,48 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2001 Jake Burkholder. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_OFW_MEM_H_ -#define _MACHINE_OFW_MEM_H_ - -struct ofw_mem_region { - vm_paddr_t mr_start; - vm_size_t mr_size; -}; - -struct ofw_map { - vm_offset_t om_start; - vm_size_t om_size; - u_long om_tte; -}; - -extern struct ofw_mem_region sparc64_memreg[]; -extern int sparc64_nmemreg; - -#endif diff --git a/sys/sparc64/include/ofw_nexus.h b/sys/sparc64/include/ofw_nexus.h deleted file mode 100644 index 247a311b19898b..00000000000000 --- a/sys/sparc64/include/ofw_nexus.h +++ /dev/null @@ -1,81 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 1999 Matthew R. Green - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*- - * Copyright (c) 1998, 1999 Eduardo E. Horvath - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: NetBSD: psychoreg.h,v 1.14 2008/05/30 02:29:37 mrg Exp - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_OFW_NEXUS_H_ -#define _MACHINE_OFW_NEXUS_H_ - -/* - * These are the regs used for devices on the nexus. They apply to all of - * Fireplane/Safari, JBus and UPA. - */ - -struct nexus_regs { - uint32_t phys_hi; - uint32_t phys_lo; - uint32_t size_hi; - uint32_t size_lo; -}; - -#define NEXUS_REG_PHYS(r) \ - (((uint64_t)(r)->phys_hi << 32) | (uint64_t)(r)->phys_lo) -#define NEXUS_REG_SIZE(r) \ - (((uint64_t)(r)->size_hi << 32) | (uint64_t)(r)->size_lo) - -#endif /* !_MACHINE_OFW_NEXUS_H_ */ diff --git a/sys/sparc64/include/param.h b/sys/sparc64/include/param.h deleted file mode 100644 index 32083f65a1113e..00000000000000 --- a/sys/sparc64/include/param.h +++ /dev/null @@ -1,155 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * William Jolitz. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: @(#)param.h 5.8 (Berkeley) 6/28/91 - * $FreeBSD$ - */ - -#ifndef _SPARC64_INCLUDE_PARAM_H_ -#define _SPARC64_INCLUDE_PARAM_H_ - -/* - * Machine dependent constants for sparc64. - */ - -#include - -#define __PCI_BAR_ZERO_VALID - -#ifndef MACHINE -#define MACHINE "sparc64" -#endif -#ifndef MACHINE_ARCH -#define MACHINE_ARCH "sparc64" -#endif -#define MID_MACHINE MID_SPARC64 - -#if defined(SMP) || defined(KLD_MODULE) -#ifndef MAXCPU -#define MAXCPU 64 -#endif -#else -#define MAXCPU 1 -#endif /* SMP || KLD_MODULE */ - -#ifndef MAXMEMDOM -#define MAXMEMDOM 1 -#endif - -#define INT_SHIFT 2 -#define PTR_SHIFT 3 - -#define ALIGNBYTES _ALIGNBYTES -#define ALIGN(p) _ALIGN(p) -/* - * ALIGNED_POINTER is a boolean macro that checks whether an address - * is valid to fetch data elements of type t from on this architecture. - * This does not reflect the optimal alignment, just the possibility - * (within reasonable limits). - */ -#define ALIGNED_POINTER(p, t) ((((u_long)(p)) & (sizeof (t) - 1)) == 0) - -/* - * CACHE_LINE_SIZE is the compile-time maximum cache line size for an - * architecture. It should be used with appropriate caution. - */ -#define CACHE_LINE_SHIFT 7 -#define CACHE_LINE_SIZE (1 << CACHE_LINE_SHIFT) - -#define PAGE_SHIFT_8K 13 -#define PAGE_SIZE_8K (1L<> PAGE_SHIFT) -#define ptoa(x) ((unsigned long)(x) << PAGE_SHIFT) - -#define sparc64_btop(x) ((unsigned long)(x) >> PAGE_SHIFT) -#define sparc64_ptob(x) ((unsigned long)(x) << PAGE_SHIFT) - -#define pgtok(x) ((unsigned long)(x) * (PAGE_SIZE / 1024)) - -#ifdef _KERNEL -#define NO_FUEWORD 1 -#endif - -#endif /* !_SPARC64_INCLUDE_PARAM_H_ */ diff --git a/sys/sparc64/include/pcb.h b/sys/sparc64/include/pcb.h deleted file mode 100644 index e5a8c1bd9b9419..00000000000000 --- a/sys/sparc64/include/pcb.h +++ /dev/null @@ -1,65 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2001 Jake Burkholder. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_PCB_H_ -#define _MACHINE_PCB_H_ - -#ifndef LOCORE -#include -#endif - -#define MAXWIN 8 - -#define PCB_FEF (1 << 0) - -#ifndef LOCORE - -/* NOTE: pcb_ufp must be aligned on a 64 byte boundary. */ -struct pcb { - struct rwindow pcb_rw[MAXWIN]; - uint32_t pcb_kfp[64]; - uint32_t pcb_ufp[64]; - uint64_t pcb_rwsp[MAXWIN]; - uint64_t pcb_flags; - uint64_t pcb_nsaved; - uint64_t pcb_pc; - uint64_t pcb_sp; - uint64_t pcb_tpc; - uint64_t pcb_pad[3]; -} __aligned(64); - -#ifdef _KERNEL -void makectx(struct trapframe *tf, struct pcb *pcb); -int savectx(struct pcb *pcb) __returns_twice; -#endif - -#endif /* !LOCORE */ - -#endif /* !_MACHINE_PCB_H_ */ diff --git a/sys/sparc64/include/pcpu.h b/sys/sparc64/include/pcpu.h deleted file mode 100644 index 1716d95a08910f..00000000000000 --- a/sys/sparc64/include/pcpu.h +++ /dev/null @@ -1,103 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 1999 Luoqi Chen - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: FreeBSD: src/sys/i386/include/globaldata.h,v 1.27 2001/04/27 - * $FreeBSD$ - */ - -#ifndef _MACHINE_PCPU_H_ -#define _MACHINE_PCPU_H_ - -#include -#include -#include -#include - -#define ALT_STACK_SIZE 128 - -struct pmap; - -/* - * Inside the kernel, the globally reserved register g7 is used to - * point at the globaldata structure. - */ -#define PCPU_MD_FIELDS \ - struct cacheinfo pc_cache; \ - struct intr_request pc_irpool[IR_FREE]; \ - struct intr_request *pc_irhead; \ - struct intr_request **pc_irtail; \ - struct intr_request *pc_irfree; \ - struct pmap *pc_pmap; \ - vm_offset_t pc_addr; \ - vm_offset_t pc_qmap_addr; \ - u_long pc_tickref; \ - u_long pc_tickadj; \ - u_long pc_tickincrement; \ - u_int pc_clock; \ - u_int pc_impl; \ - u_int pc_mid; \ - u_int pc_node; \ - u_int pc_tlb_ctx; \ - u_int pc_tlb_ctx_max; \ - u_int pc_tlb_ctx_min; \ - char __pad[653] - -#ifdef _KERNEL - -extern void *dpcpu0; - -struct pcb; -struct pcpu; - -register struct pcb *curpcb __asm__(__XSTRING(PCB_REG)); -register struct pcpu *pcpup __asm__(__XSTRING(PCPU_REG)); - -#define get_pcpu() (pcpup) -#define PCPU_GET(member) (pcpup->pc_ ## member) - -static __inline __pure2 struct thread * -__curthread(void) -{ - struct thread *td; - - __asm("ldx [%" __XSTRING(PCPU_REG) "], %0" : "=r" (td)); - return (td); -} -#define curthread (__curthread()) - -/* - * XXX The implementation of this operation should be made atomic - * with respect to preemption. - */ -#define PCPU_ADD(member, value) (pcpup->pc_ ## member += (value)) -#define PCPU_INC(member) PCPU_ADD(member, 1) -#define PCPU_PTR(member) (&pcpup->pc_ ## member) -#define PCPU_SET(member,value) (pcpup->pc_ ## member = (value)) - -#endif /* _KERNEL */ - -#endif /* !_MACHINE_PCPU_H_ */ diff --git a/sys/sparc64/include/pcpu_aux.h b/sys/sparc64/include/pcpu_aux.h deleted file mode 100644 index db79491b538fd4..00000000000000 --- a/sys/sparc64/include/pcpu_aux.h +++ /dev/null @@ -1,50 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2019 The FreeBSD Foundation - * - * This software was developed by Konstantin Belousov - * under sponsorship from the FreeBSD Foundation. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_PCPU_AUX_H_ -#define _MACHINE_PCPU_AUX_H_ - -#ifndef _KERNEL -#error "Not for userspace" -#endif - -#ifndef _SYS_PCPU_H_ -#error "Do not include machine/pcpu_aux.h directly" -#endif - -/* - * To minimize memory waste in per-cpu UMA zones, the page size should - * be a multiple of the size of struct pcpu. - */ -_Static_assert(PAGE_SIZE % sizeof(struct pcpu) == 0, "fix pcpu size"); - -#endif /* _MACHINE_PCPU_AUX_H_ */ diff --git a/sys/sparc64/include/pmap.h b/sys/sparc64/include/pmap.h deleted file mode 100644 index 8ad192782f8c2c..00000000000000 --- a/sys/sparc64/include/pmap.h +++ /dev/null @@ -1,138 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1991 Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * the Systems Programming Group of the University of Utah Computer - * Science Department and William Jolitz of UUNET Technologies Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: hp300: @(#)pmap.h 7.2 (Berkeley) 12/16/90 - * from: @(#)pmap.h 7.4 (Berkeley) 5/12/91 - * from: FreeBSD: src/sys/i386/include/pmap.h,v 1.70 2000/11/30 - * $FreeBSD$ - */ - -#ifndef _MACHINE_PMAP_H_ -#define _MACHINE_PMAP_H_ - -#include -#include -#include -#include -#include -#include -#include - -#define PMAP_CONTEXT_MAX 8192 -#define PMAP_ENTER_QUICK_LOCKED 0x10000000 - -typedef struct pmap *pmap_t; - -struct md_page { - TAILQ_HEAD(, tte) tte_list; - struct pmap *pmap; - uint32_t colors[DCACHE_COLORS]; - int32_t color; -}; - -struct pmap { - struct mtx pm_mtx; - struct tte *pm_tsb; - vm_object_t pm_tsb_obj; - cpuset_t pm_active; - u_int pm_context[MAXCPU]; - struct pmap_statistics pm_stats; -}; - -#define PMAP_LOCK(pmap) mtx_lock(&(pmap)->pm_mtx) -#define PMAP_LOCK_ASSERT(pmap, type) \ - mtx_assert(&(pmap)->pm_mtx, (type)) -#define PMAP_LOCK_DESTROY(pmap) mtx_destroy(&(pmap)->pm_mtx) -#define PMAP_LOCK_INIT(pmap) mtx_init(&(pmap)->pm_mtx, "pmap", \ - NULL, MTX_DEF | MTX_DUPOK) -#define PMAP_LOCKED(pmap) mtx_owned(&(pmap)->pm_mtx) -#define PMAP_MTX(pmap) (&(pmap)->pm_mtx) -#define PMAP_TRYLOCK(pmap) mtx_trylock(&(pmap)->pm_mtx) -#define PMAP_UNLOCK(pmap) mtx_unlock(&(pmap)->pm_mtx) - -#define pmap_page_get_memattr(m) VM_MEMATTR_DEFAULT -#define pmap_page_is_write_mapped(m) (((m)->a.flags & PGA_WRITEABLE) != 0) -#define pmap_page_set_memattr(m, ma) (void)0 - -void pmap_bootstrap(u_int cpu_impl); -vm_paddr_t pmap_kextract(vm_offset_t va); -void pmap_kenter(vm_offset_t va, vm_page_t m); -void pmap_kremove(vm_offset_t); -void pmap_kenter_flags(vm_offset_t va, vm_paddr_t pa, u_long flags); -void pmap_kremove_flags(vm_offset_t va); -boolean_t pmap_page_is_mapped(vm_page_t m); - -int pmap_cache_enter(vm_page_t m, vm_offset_t va); - -int pmap_remove_tte(struct pmap *pm1, struct pmap *pm2, struct tte *tp, - vm_offset_t va); - -void pmap_map_tsb(void); -void pmap_set_kctx(void); - -#define vtophys(va) pmap_kextract((vm_offset_t)(va)) - -extern struct pmap kernel_pmap_store; -#define kernel_pmap (&kernel_pmap_store) -extern struct rwlock_padalign tte_list_global_lock; -extern vm_offset_t virtual_avail; -extern vm_offset_t virtual_end; - -#ifdef PMAP_STATS - -SYSCTL_DECL(_debug_pmap_stats); - -#define PMAP_STATS_VAR(name) \ - static long name; \ - SYSCTL_LONG(_debug_pmap_stats, OID_AUTO, name, CTLFLAG_RW, \ - &name, 0, "") - -#define PMAP_STATS_INC(var) \ - atomic_add_long(&var, 1) - -#else - -#define PMAP_STATS_VAR(name) -#define PMAP_STATS_INC(var) - -#endif - -static inline int -pmap_vmspace_copy(pmap_t dst_pmap __unused, pmap_t src_pmap __unused) -{ - - return (0); -} - -#endif /* !_MACHINE_PMAP_H_ */ diff --git a/sys/sparc64/include/pmc_mdep.h b/sys/sparc64/include/pmc_mdep.h deleted file mode 100644 index 7ced0b9559e97a..00000000000000 --- a/sys/sparc64/include/pmc_mdep.h +++ /dev/null @@ -1,28 +0,0 @@ -/*- - * This file is in the public domain. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_PMC_MDEP_H_ -#define _MACHINE_PMC_MDEP_H_ - -union pmc_md_op_pmcallocate { - uint64_t __pad[4]; -}; - -/* Logging */ -#define PMCLOG_READADDR PMCLOG_READ64 -#define PMCLOG_EMITADDR PMCLOG_EMIT64 - -#if _KERNEL -union pmc_md_pmc { -}; - -#define PMC_TRAPFRAME_TO_PC(TF) (0) /* Stubs */ -#define PMC_TRAPFRAME_TO_FP(TF) (0) -#define PMC_TRAPFRAME_TO_SP(TF) (0) - -#endif - -#endif /* !_MACHINE_PMC_MDEP_H_ */ diff --git a/sys/sparc64/include/proc.h b/sys/sparc64/include/proc.h deleted file mode 100644 index a581f511bdb13d..00000000000000 --- a/sys/sparc64/include/proc.h +++ /dev/null @@ -1,80 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1991 Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: @(#)proc.h 7.1 (Berkeley) 5/15/91 - * from: FreeBSD: src/sys/i386/include/proc.h,v 1.11 2001/06/29 - * $FreeBSD$ - */ - -#ifndef _MACHINE_PROC_H_ -#define _MACHINE_PROC_H_ - -#include - -struct md_utrap { - utrap_entry_t *ut_precise[UT_MAX]; /* must be first */ - int ut_refcnt; -}; - -struct mdthread { - int md_spinlock_count; /* (k) */ - register_t md_saved_pil; /* (k) */ -}; - -struct mdproc { - struct md_utrap *md_utrap; - void *md_sigtramp; -}; - -#define KINFO_PROC_SIZE 1088 - -struct syscall_args { - u_int code; - struct sysent *callp; - register_t args[8]; - int narg; -}; - -#ifdef _KERNEL - -#include - -/* Get the current kernel thread stack usage. */ -#define GET_STACK_USAGE(total, used) do { \ - struct thread *td = curthread; \ - (total) = td->td_kstack_pages * PAGE_SIZE - sizeof(struct pcb); \ - (used) = (char *)td->td_kstack + \ - td->td_kstack_pages * PAGE_SIZE - \ - (char *)&td; \ -} while (0) - -#endif - -#endif /* !_MACHINE_PROC_H_ */ diff --git a/sys/sparc64/include/procctl.h b/sys/sparc64/include/procctl.h deleted file mode 100644 index 5221cfcd7be193..00000000000000 --- a/sys/sparc64/include/procctl.h +++ /dev/null @@ -1,4 +0,0 @@ -/*- - * This file is in the public domain. - */ -/* $FreeBSD$ */ diff --git a/sys/sparc64/include/profile.h b/sys/sparc64/include/profile.h deleted file mode 100644 index 59cdec6b67c547..00000000000000 --- a/sys/sparc64/include/profile.h +++ /dev/null @@ -1,104 +0,0 @@ -/*- - * SPDX-License-Identifier: MIT-CMU - * - * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University. - * All rights reserved. - * - * Author: Chris G. Demetriou - * - * Permission to use, copy, modify and distribute this software and - * its documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND - * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie the - * rights to redistribute these changes. - * - * from: NetBSD: profile.h,v 1.9 1997/04/06 08:47:37 cgd Exp - * from: FreeBSD: src/sys/alpha/include/profile.h,v 1.4 1999/12/29 - * $FreeBSD$ - */ - -#ifndef _MACHINE_PROFILE_H_ -#define _MACHINE_PROFILE_H_ - -#if !defined(_KERNEL) && !defined(_SYS_CDEFS_H_) -#error this file needs sys/cdefs.h as a prerequisite -#endif - -#define FUNCTION_ALIGNMENT 32 - -typedef u_long fptrdiff_t; - -#ifdef _KERNEL - -#include -#include - -#define _MCOUNT_DECL void mcount -#define MCOUNT - -#define MCOUNT_DECL(s) register_t s; -#define MCOUNT_ENTER(s) s = rdpr(pil); wrpr(pil, 0, PIL_TICK) -#define MCOUNT_EXIT(s) wrpr(pil, 0, s) - -void bintr(void); -void btrap(void); -void eintr(void); -void user(void); - -#define MCOUNT_FROMPC_USER(pc) \ - ((pc < (uintfptr_t)VM_MAXUSER_ADDRESS) ? (uintfptr_t)user : pc) - -#define MCOUNT_FROMPC_INTR(pc) \ - ((pc >= (uintfptr_t)btrap && pc < (uintfptr_t)eintr) ? \ - ((pc >= (uintfptr_t)bintr) ? (uintfptr_t)bintr : \ - (uintfptr_t)btrap) : ~0UL) - -void mcount(uintfptr_t frompc, uintfptr_t selfpc); - -#else /* !_KERNEL */ - -typedef u_long uintfptr_t; - -#define _MCOUNT_DECL static __inline void __mcount - -#ifdef __GNUCLIKE_ASM -#define MCOUNT \ -void \ -_mcount() \ -{ \ - uintfptr_t frompc, selfpc; \ - \ - /* \ - * Find the return address for mcount, \ - * and the return address for mcount's caller. \ - * \ - * selfpc = pc pushed by call to mcount \ - */ \ - __asm("add %%o7, 8, %0" : "=r" (selfpc)); \ - /* \ - * frompc = pc pushed by call to mcount's caller. \ - */ \ - __asm("add %%i7, 8, %0" : "=r" (frompc)); \ - __mcount(frompc, selfpc); \ -} -#else /* !__GNUCLIKE_ASM */ -#define MCOUNT -#endif /* __GNUCLIKE_ASM */ - -#endif /* _KERNEL */ - -#endif /* !_MACHINE_PROFILE_H_ */ diff --git a/sys/sparc64/include/pstate.h b/sys/sparc64/include/pstate.h deleted file mode 100644 index df3a25bd751b91..00000000000000 --- a/sys/sparc64/include/pstate.h +++ /dev/null @@ -1,65 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2001 Jake Burkholder. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_PSTATE_H_ -#define _MACHINE_PSTATE_H_ - -#define PSTATE_AG (1<<0) -#define PSTATE_IE (1<<1) -#define PSTATE_PRIV (1<<2) -#define PSTATE_AM (1<<3) -#define PSTATE_PEF (1<<4) -#define PSTATE_RED (1<<5) - -#define PSTATE_MM_SHIFT (6) -#define PSTATE_MM_SIZE (2) -#define PSTATE_MM_MASK (((1<. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the author nor the names of any co-contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ diff --git a/sys/sparc64/include/resource.h b/sys/sparc64/include/resource.h deleted file mode 100644 index 229d14f253b0fb..00000000000000 --- a/sys/sparc64/include/resource.h +++ /dev/null @@ -1,45 +0,0 @@ -/*- - * Copyright 1998 Massachusetts Institute of Technology - * - * Permission to use, copy, modify, and distribute this software and - * its documentation for any purpose and without fee is hereby - * granted, provided that both the above copyright notice and this - * permission notice appear in all copies, that both the above - * copyright notice and this permission notice appear in all - * supporting documentation, and that the name of M.I.T. not be used - * in advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. M.I.T. makes - * no representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied - * warranty. - * - * THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS - * ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT - * SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_RESOURCE_H_ -#define _MACHINE_RESOURCE_H_ 1 - -/* - * Definitions of resource types for Intel Architecture machines - * with support for legacy ISA devices and drivers. - */ - -#define SYS_RES_IRQ 1 /* interrupt lines */ -#define SYS_RES_DRQ 2 /* isa dma lines */ -#define SYS_RES_MEMORY 3 /* i/o memory */ -#define SYS_RES_IOPORT 4 /* i/o ports */ - -#endif /* !_MACHINE_RESOURCE_H_ */ diff --git a/sys/sparc64/include/runq.h b/sys/sparc64/include/runq.h deleted file mode 100644 index 1fb8d1bdcfe689..00000000000000 --- a/sys/sparc64/include/runq.h +++ /dev/null @@ -1,60 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2001 Jake Burkholder - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_RUNQ_H_ -#define _MACHINE_RUNQ_H_ - -#define RQB_LEN (1UL) /* Number of priority status words. */ -#define RQB_L2BPW (6UL) /* Log2(sizeof(rqb_word_t) * NBBY)). */ -#define RQB_BPW (1UL<> RQB_L2BPW) - -#define RQB_FFS(word) (ffs64(word) - 1) - -/* - * Type of run queue status word. - */ -typedef u_int64_t rqb_word_t; - -static __inline u_long -ffs64(u_long mask) -{ - u_long bit; - - if (mask == 0) - return (0); - for (bit = 1; (mask & 1UL) == 0; bit++) - mask >>= 1UL; - return (bit); -} - -#endif diff --git a/sys/sparc64/include/sc_machdep.h b/sys/sparc64/include/sc_machdep.h deleted file mode 100644 index d50ef4867f7b24..00000000000000 --- a/sys/sparc64/include/sc_machdep.h +++ /dev/null @@ -1,78 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2003 Jake Burkholder. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_SC_MACHDEP_H_ -#define _MACHINE_SC_MACHDEP_H_ - -/* Color attributes for foreground text */ - -#define FG_BLACK 0x0 -#define FG_BLUE 0x1 -#define FG_GREEN 0x2 -#define FG_CYAN 0x3 -#define FG_RED 0x4 -#define FG_MAGENTA 0x5 -#define FG_BROWN 0x6 -#define FG_LIGHTGREY 0x7 -#define FG_DARKGREY 0x8 -#define FG_LIGHTBLUE 0x9 -#define FG_LIGHTGREEN 0xa -#define FG_LIGHTCYAN 0xb -#define FG_LIGHTRED 0xc -#define FG_LIGHTMAGENTA 0xd -#define FG_YELLOW 0xe -#define FG_WHITE 0xf -#define FG_BLINK 0x80 - -/* Color attributes for text background */ - -#define BG_BLACK 0x00 -#define BG_BLUE 0x10 -#define BG_GREEN 0x20 -#define BG_CYAN 0x30 -#define BG_RED 0x40 -#define BG_MAGENTA 0x50 -#define BG_BROWN 0x60 -#define BG_LIGHTGREY 0x70 -#define BG_DARKGREY 0x80 -#define BG_LIGHTBLUE 0x90 -#define BG_LIGHTGREEN 0xa0 -#define BG_LIGHTCYAN 0xb0 -#define BG_LIGHTRED 0xc0 -#define BG_LIGHTMAGENTA 0xd0 -#define BG_YELLOW 0xe0 -#define BG_WHITE 0xf0 - -#define SC_NORM_ATTR (FG_BLACK | BG_WHITE) -#define SC_NORM_REV_ATTR (FG_WHITE | BG_BLACK) -#define SC_KERNEL_CONS_ATTR (FG_BLACK | BG_WHITE) -#define SC_KERNEL_CONS_REV_ATTR (FG_WHITE | BG_BLACK) - -#endif /* !_MACHINE_SC_MACHDEP_H_ */ diff --git a/sys/sparc64/include/setjmp.h b/sys/sparc64/include/setjmp.h deleted file mode 100644 index 12035418cbbe6f..00000000000000 --- a/sys/sparc64/include/setjmp.h +++ /dev/null @@ -1,59 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1998 John Birrell . - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the author nor the names of any co-contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * From: FreeBSD: src/sys/i386/include/setjmp.h,v 1.5 2000/10/06 - * $FreeBSD$ - */ - -#ifndef _MACHINE_SETJMP_H_ -#define _MACHINE_SETJMP_H_ - -#include - -#define _JBLEN 5 - -#define _JB_FP 0 -#define _JB_PC 1 -#define _JB_SP 2 -#define _JB_SIGMASK 3 -#define _JB_SIGFLAG 5 - -/* - * jmp_buf and sigjmp_buf are encapsulated in different structs to force - * compile-time diagnostics for mismatches. The structs are the same - * internally to avoid some run-time errors for mismatches. - */ -#if __BSD_VISIBLE || __POSIX_VISIBLE || __XSI_VISIBLE -typedef struct _sigjmp_buf { long _sjb[_JBLEN + 1]; } sigjmp_buf[1]; -#endif - -typedef struct _jmp_buf { long _jb[_JBLEN + 1]; } jmp_buf[1]; - -#endif /* !_MACHINE_SETJMP_H_ */ diff --git a/sys/sparc64/include/sf_buf.h b/sys/sparc64/include/sf_buf.h deleted file mode 100644 index 10bbd888b59280..00000000000000 --- a/sys/sparc64/include/sf_buf.h +++ /dev/null @@ -1,37 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2014 Gleb Smirnoff - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_SF_BUF_H_ -#define _MACHINE_SF_BUF_H_ - -void sf_buf_map(struct sf_buf *, int); -int sf_buf_unmap(struct sf_buf *); - -#endif /* !_MACHINE_SF_BUF_H_ */ diff --git a/sys/sparc64/include/sigframe.h b/sys/sparc64/include/sigframe.h deleted file mode 100644 index b52238785d46bf..00000000000000 --- a/sys/sparc64/include/sigframe.h +++ /dev/null @@ -1,42 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1999 Marcel Moolenaar - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer - * in this position and unchanged. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * from: FreeBSD: src/sys/alpha/include/sigframe.h,v 1.1 1999/09/29 - * $FreeBSD$ - */ - -#ifndef _MACHINE_SIGFRAME_H_ -#define _MACHINE_SIGFRAME_H_ 1 - -struct sigframe { - ucontext_t sf_uc; - siginfo_t sf_si; -}; - -#endif /* _MACHINE_SIGFRAME_H_ */ diff --git a/sys/sparc64/include/signal.h b/sys/sparc64/include/signal.h deleted file mode 100644 index f0df6f5128101f..00000000000000 --- a/sys/sparc64/include/signal.h +++ /dev/null @@ -1,49 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1986, 1989, 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)signal.h 8.1 (Berkeley) 6/11/93 - * from: FreeBSD: src/sys/i386/include/signal.h,v 1.13 2000/11/09 - * $FreeBSD$ - */ - -#ifndef _MACHINE_SIGNAL_H_ -#define _MACHINE_SIGNAL_H_ - -#include - -typedef long sig_atomic_t; - -#if __BSD_VISIBLE -struct sigcontext { - int _dummy; -}; -#endif /* __BSD_VISIBLE */ - -#endif /* !_MACHINE_SIGNAL_H_ */ diff --git a/sys/sparc64/include/smp.h b/sys/sparc64/include/smp.h deleted file mode 100644 index 18b8d97268f8aa..00000000000000 --- a/sys/sparc64/include/smp.h +++ /dev/null @@ -1,404 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2001 Jake Burkholder. - * Copyright (c) 2007 - 2011 Marius Strobl - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_SMP_H_ -#define _MACHINE_SMP_H_ - -#ifdef SMP - -#define CPU_TICKSYNC 1 -#define CPU_STICKSYNC 2 -#define CPU_INIT 3 -#define CPU_BOOTSTRAP 4 - -#ifndef LOCORE - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#define IDR_BUSY 0x0000000000000001ULL -#define IDR_NACK 0x0000000000000002ULL -#define IDR_CHEETAH_ALL_BUSY 0x5555555555555555ULL -#define IDR_CHEETAH_ALL_NACK (~IDR_CHEETAH_ALL_BUSY) -#define IDR_CHEETAH_MAX_BN_PAIRS 32 -#define IDR_JALAPENO_MAX_BN_PAIRS 4 - -#define IDC_ITID_SHIFT 14 -#define IDC_BN_SHIFT 24 - -#define IPI_AST PIL_AST -#define IPI_RENDEZVOUS PIL_RENDEZVOUS -#define IPI_PREEMPT PIL_PREEMPT -#define IPI_HARDCLOCK PIL_HARDCLOCK -#define IPI_STOP PIL_STOP -#define IPI_STOP_HARD PIL_STOP - -#define IPI_RETRIES 5000 - -struct cpu_start_args { - u_int csa_count; - u_int csa_mid; - u_int csa_state; - vm_offset_t csa_pcpu; - u_long csa_tick; - u_long csa_stick; - u_long csa_ver; - struct tte csa_ttes[PCPU_PAGES]; -}; - -struct ipi_cache_args { - cpuset_t ica_mask; - vm_paddr_t ica_pa; -}; - -struct ipi_rd_args { - cpuset_t ira_mask; - register_t *ira_val; -}; - -struct ipi_tlb_args { - cpuset_t ita_mask; - struct pmap *ita_pmap; - u_long ita_start; - u_long ita_end; -}; -#define ita_va ita_start - -struct pcb; -struct pcpu; - -extern struct pcb stoppcbs[]; - -void cpu_mp_bootstrap(struct pcpu *pc); -void cpu_mp_shutdown(void); - -typedef void cpu_ipi_selected_t(cpuset_t, u_long, u_long, u_long); -extern cpu_ipi_selected_t *cpu_ipi_selected; -typedef void cpu_ipi_single_t(u_int, u_long, u_long, u_long); -extern cpu_ipi_single_t *cpu_ipi_single; - -void mp_init(void); - -extern struct mtx ipi_mtx; -extern struct ipi_cache_args ipi_cache_args; -extern struct ipi_rd_args ipi_rd_args; -extern struct ipi_tlb_args ipi_tlb_args; - -extern char *mp_tramp_code; -extern u_long mp_tramp_code_len; -extern u_long mp_tramp_tlb_slots; -extern u_long mp_tramp_func; - -extern void mp_startup(void); - -extern char tl_ipi_cheetah_dcache_page_inval[]; -extern char tl_ipi_spitfire_dcache_page_inval[]; -extern char tl_ipi_spitfire_icache_page_inval[]; - -extern char tl_ipi_level[]; - -extern char tl_ipi_stick_rd[]; -extern char tl_ipi_tick_rd[]; - -extern char tl_ipi_tlb_context_demap[]; -extern char tl_ipi_tlb_page_demap[]; -extern char tl_ipi_tlb_range_demap[]; - -static __inline void -ipi_all_but_self(u_int ipi) -{ - cpuset_t cpus; - - if (__predict_false(atomic_load_acq_int(&smp_started) == 0)) - return; - cpus = all_cpus; - sched_pin(); - CPU_CLR(PCPU_GET(cpuid), &cpus); - mtx_lock_spin(&ipi_mtx); - cpu_ipi_selected(cpus, 0, (u_long)tl_ipi_level, ipi); - mtx_unlock_spin(&ipi_mtx); - sched_unpin(); -} - -static __inline void -ipi_selected(cpuset_t cpus, u_int ipi) -{ - - if (__predict_false(atomic_load_acq_int(&smp_started) == 0 || - CPU_EMPTY(&cpus))) - return; - mtx_lock_spin(&ipi_mtx); - cpu_ipi_selected(cpus, 0, (u_long)tl_ipi_level, ipi); - mtx_unlock_spin(&ipi_mtx); -} - -static __inline void -ipi_cpu(int cpu, u_int ipi) -{ - - if (__predict_false(atomic_load_acq_int(&smp_started) == 0)) - return; - mtx_lock_spin(&ipi_mtx); - cpu_ipi_single(cpu, 0, (u_long)tl_ipi_level, ipi); - mtx_unlock_spin(&ipi_mtx); -} - -#if defined(_MACHINE_PMAP_H_) && defined(_SYS_MUTEX_H_) - -static __inline void * -ipi_dcache_page_inval(void *func, vm_paddr_t pa) -{ - struct ipi_cache_args *ica; - - if (__predict_false(atomic_load_acq_int(&smp_started) == 0)) - return (NULL); - sched_pin(); - ica = &ipi_cache_args; - mtx_lock_spin(&ipi_mtx); - ica->ica_mask = all_cpus; - CPU_CLR(PCPU_GET(cpuid), &ica->ica_mask); - ica->ica_pa = pa; - cpu_ipi_selected(ica->ica_mask, 0, (u_long)func, (u_long)ica); - return (&ica->ica_mask); -} - -static __inline void * -ipi_icache_page_inval(void *func, vm_paddr_t pa) -{ - struct ipi_cache_args *ica; - - if (__predict_false(atomic_load_acq_int(&smp_started) == 0)) - return (NULL); - sched_pin(); - ica = &ipi_cache_args; - mtx_lock_spin(&ipi_mtx); - ica->ica_mask = all_cpus; - CPU_CLR(PCPU_GET(cpuid), &ica->ica_mask); - ica->ica_pa = pa; - cpu_ipi_selected(ica->ica_mask, 0, (u_long)func, (u_long)ica); - return (&ica->ica_mask); -} - -static __inline void * -ipi_rd(u_int cpu, void *func, u_long *val) -{ - struct ipi_rd_args *ira; - - if (__predict_false(atomic_load_acq_int(&smp_started) == 0)) - return (NULL); - sched_pin(); - ira = &ipi_rd_args; - mtx_lock_spin(&ipi_mtx); - CPU_SETOF(cpu, &ira->ira_mask); - ira->ira_val = val; - cpu_ipi_single(cpu, 0, (u_long)func, (u_long)ira); - return (&ira->ira_mask); -} - -static __inline void * -ipi_tlb_context_demap(struct pmap *pm) -{ - struct ipi_tlb_args *ita; - cpuset_t cpus; - - if (__predict_false(atomic_load_acq_int(&smp_started) == 0)) - return (NULL); - sched_pin(); - cpus = pm->pm_active; - CPU_AND(&cpus, &all_cpus); - CPU_CLR(PCPU_GET(cpuid), &cpus); - if (CPU_EMPTY(&cpus)) { - sched_unpin(); - return (NULL); - } - ita = &ipi_tlb_args; - mtx_lock_spin(&ipi_mtx); - ita->ita_mask = cpus; - ita->ita_pmap = pm; - cpu_ipi_selected(cpus, 0, (u_long)tl_ipi_tlb_context_demap, - (u_long)ita); - return (&ita->ita_mask); -} - -static __inline void * -ipi_tlb_page_demap(struct pmap *pm, vm_offset_t va) -{ - struct ipi_tlb_args *ita; - cpuset_t cpus; - - if (__predict_false(atomic_load_acq_int(&smp_started) == 0)) - return (NULL); - sched_pin(); - cpus = pm->pm_active; - CPU_AND(&cpus, &all_cpus); - CPU_CLR(PCPU_GET(cpuid), &cpus); - if (CPU_EMPTY(&cpus)) { - sched_unpin(); - return (NULL); - } - ita = &ipi_tlb_args; - mtx_lock_spin(&ipi_mtx); - ita->ita_mask = cpus; - ita->ita_pmap = pm; - ita->ita_va = va; - cpu_ipi_selected(cpus, 0, (u_long)tl_ipi_tlb_page_demap, (u_long)ita); - return (&ita->ita_mask); -} - -static __inline void * -ipi_tlb_range_demap(struct pmap *pm, vm_offset_t start, vm_offset_t end) -{ - struct ipi_tlb_args *ita; - cpuset_t cpus; - - if (__predict_false(atomic_load_acq_int(&smp_started) == 0)) - return (NULL); - sched_pin(); - cpus = pm->pm_active; - CPU_AND(&cpus, &all_cpus); - CPU_CLR(PCPU_GET(cpuid), &cpus); - if (CPU_EMPTY(&cpus)) { - sched_unpin(); - return (NULL); - } - ita = &ipi_tlb_args; - mtx_lock_spin(&ipi_mtx); - ita->ita_mask = cpus; - ita->ita_pmap = pm; - ita->ita_start = start; - ita->ita_end = end; - cpu_ipi_selected(cpus, 0, (u_long)tl_ipi_tlb_range_demap, - (u_long)ita); - return (&ita->ita_mask); -} - -static __inline void -ipi_wait(void *cookie) -{ - volatile cpuset_t *mask; - - if (__predict_false((mask = cookie) != NULL)) { - while (!CPU_EMPTY(mask)) - ; - mtx_unlock_spin(&ipi_mtx); - sched_unpin(); - } -} - -#endif /* _MACHINE_PMAP_H_ && _SYS_MUTEX_H_ */ - -#endif /* !LOCORE */ - -#else - -#ifndef LOCORE - -static __inline void * -ipi_dcache_page_inval(void *func __unused, vm_paddr_t pa __unused) -{ - - return (NULL); -} - -static __inline void * -ipi_icache_page_inval(void *func __unused, vm_paddr_t pa __unused) -{ - - return (NULL); -} - -static __inline void * -ipi_rd(u_int cpu __unused, void *func __unused, u_long *val __unused) -{ - - return (NULL); -} - -static __inline void * -ipi_tlb_context_demap(struct pmap *pm __unused) -{ - - return (NULL); -} - -static __inline void * -ipi_tlb_page_demap(struct pmap *pm __unused, vm_offset_t va __unused) -{ - - return (NULL); -} - -static __inline void * -ipi_tlb_range_demap(struct pmap *pm __unused, vm_offset_t start __unused, - __unused vm_offset_t end) -{ - - return (NULL); -} - -static __inline void -ipi_wait(void *cookie __unused) -{ - -} - -static __inline void -tl_ipi_cheetah_dcache_page_inval(void) -{ - -} - -static __inline void -tl_ipi_spitfire_dcache_page_inval(void) -{ - -} - -static __inline void -tl_ipi_spitfire_icache_page_inval(void) -{ - -} - -#endif /* !LOCORE */ - -#endif /* SMP */ - -#endif /* !_MACHINE_SMP_H_ */ diff --git a/sys/sparc64/include/stack.h b/sys/sparc64/include/stack.h deleted file mode 100644 index a553a7a1431434..00000000000000 --- a/sys/sparc64/include/stack.h +++ /dev/null @@ -1,42 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2001 Jake Burkholder. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_STACK_H_ -#define _MACHINE_STACK_H_ - -extern char tl_trap_begin[]; -extern char tl_trap_end[]; -extern char tl_text_begin[]; -extern char tl_text_end[]; - -#define INKERNEL(va) \ - ((va) >= VM_MIN_KERNEL_ADDRESS && (va) <= VM_MAX_KERNEL_ADDRESS) - -#endif /* !_MACHINE_STACK_H_ */ diff --git a/sys/sparc64/include/stdarg.h b/sys/sparc64/include/stdarg.h deleted file mode 100644 index acb526429ac2ea..00000000000000 --- a/sys/sparc64/include/stdarg.h +++ /dev/null @@ -1,39 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * - * Copyright (c) 2017 Poul-Henning Kamp. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_STDARG_H_ -#define _MACHINE_STDARG_H_ - -#include - -#ifndef va_start - #error this file needs to be ported to your compiler -#endif - -#endif /* !_MACHINE_STDARG_H_ */ diff --git a/sys/sparc64/include/sysarch.h b/sys/sparc64/include/sysarch.h deleted file mode 100644 index fefaeb326868b3..00000000000000 --- a/sys/sparc64/include/sysarch.h +++ /dev/null @@ -1,76 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1993 The Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: FreeBSD: src/sys/i386/include/sysarch.h,v 1.14 2000/09/21 - * $FreeBSD$ - */ - -/* - * Architecture specific syscalls (sparc64) - */ -#ifndef _MACHINE_SYSARCH_H_ -#define _MACHINE_SYSARCH_H_ - -#include - -#define SPARC_UTRAP_INSTALL 1 -#define SPARC_SIGTRAMP_INSTALL 2 - -struct sparc_utrap_install_args { - int num; - const struct sparc_utrap_args *handlers; -}; - -struct sparc_sigtramp_install_args { - void *sia_new; - void **sia_old; -}; - -struct sparc_utrap_args { - utrap_entry_t type; - utrap_handler_t new_precise; - utrap_handler_t new_deferred; - utrap_handler_t *old_precise; - utrap_handler_t *old_deferred; -}; - -#ifndef _KERNEL -#include - -__BEGIN_DECLS -int __sparc_utrap_install(utrap_entry_t _type, - utrap_handler_t _new_precise, utrap_handler_t _new_deferred, - utrap_handler_t *_old_precise, utrap_handler_t *_old_deferred); -int sysarch(int _number, void *_args); -__END_DECLS - -#endif - -#endif /* !_MACHINE_SYSARCH_H_ */ diff --git a/sys/sparc64/include/tick.h b/sys/sparc64/include/tick.h deleted file mode 100644 index 44ed91dd972f85..00000000000000 --- a/sys/sparc64/include/tick.h +++ /dev/null @@ -1,39 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2001 Jake Burkholder. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_TICK_H_ -#define _MACHINE_TICK_H_ - -extern u_int tick_et_use_stick; - -void tick_clear(u_int cpu_impl); -void tick_stop(u_int cpu_impl); - -#endif diff --git a/sys/sparc64/include/tlb.h b/sys/sparc64/include/tlb.h deleted file mode 100644 index 7ee4101ea8ab03..00000000000000 --- a/sys/sparc64/include/tlb.h +++ /dev/null @@ -1,177 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2001 Jake Burkholder. - * Copyright (c) 2008, 2010 Marius Strobl - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_TLB_H_ -#define _MACHINE_TLB_H_ - -#define TLB_DIRECT_ADDRESS_BITS (43) -#define TLB_DIRECT_PAGE_BITS (PAGE_SHIFT_4M) - -#define TLB_DIRECT_ADDRESS_MASK ((1UL << TLB_DIRECT_ADDRESS_BITS) - 1) -#define TLB_DIRECT_PAGE_MASK ((1UL << TLB_DIRECT_PAGE_BITS) - 1) - -#define TLB_PHYS_TO_DIRECT(pa) \ - ((pa) | VM_MIN_DIRECT_ADDRESS) -#define TLB_DIRECT_TO_PHYS(va) \ - ((va) & TLB_DIRECT_ADDRESS_MASK) -#define TLB_DIRECT_TO_TTE_MASK \ - (TD_V | TD_4M | (TLB_DIRECT_ADDRESS_MASK - TLB_DIRECT_PAGE_MASK)) - -#define TLB_DAR_SLOT_SHIFT (3) -#define TLB_DAR_TLB_SHIFT (16) -#define TLB_DAR_SLOT(tlb, slot) \ - ((tlb) << TLB_DAR_TLB_SHIFT | (slot) << TLB_DAR_SLOT_SHIFT) -#define TLB_DAR_T16 (0) /* US-III{,i,+}, IV{,+} */ -#define TLB_DAR_T32 (0) /* US-I, II{,e,i} */ -#define TLB_DAR_DT512_0 (2) /* US-III{,i,+}, IV{,+} */ -#define TLB_DAR_DT512_1 (3) /* US-III{,i,+}, IV{,+} */ -#define TLB_DAR_IT128 (2) /* US-III{,i,+}, IV */ -#define TLB_DAR_IT512 (2) /* US-IV+ */ -#define TLB_DAR_FTLB (0) /* SPARC64 V, VI, VII, VIIIfx */ -#define TLB_DAR_STLB (2) /* SPARC64 V, VI, VII, VIIIfx */ - -#define TAR_VPN_SHIFT (13) -#define TAR_CTX_MASK ((1 << TAR_VPN_SHIFT) - 1) - -#define TLB_TAR_VA(va) ((va) & ~TAR_CTX_MASK) -#define TLB_TAR_CTX(ctx) ((ctx) & TAR_CTX_MASK) - -#define TLB_CXR_CTX_BITS (13) -#define TLB_CXR_CTX_MASK \ - (((1UL << TLB_CXR_CTX_BITS) - 1) << TLB_CXR_CTX_SHIFT) -#define TLB_CXR_CTX_SHIFT (0) -#define TLB_CXR_PGSZ_BITS (3) -#define TLB_CXR_PGSZ_MASK (~TLB_CXR_CTX_MASK) -#define TLB_PCXR_N_IPGSZ0_SHIFT (53) /* SPARC64 VI, VII, VIIIfx */ -#define TLB_PCXR_N_IPGSZ1_SHIFT (50) /* SPARC64 VI, VII, VIIIfx */ -#define TLB_PCXR_N_PGSZ0_SHIFT (61) -#define TLB_PCXR_N_PGSZ1_SHIFT (58) -#define TLB_PCXR_N_PGSZ_I_SHIFT (55) /* US-IV+ */ -#define TLB_PCXR_P_IPGSZ0_SHIFT (24) /* SPARC64 VI, VII, VIIIfx */ -#define TLB_PCXR_P_IPGSZ1_SHIFT (27) /* SPARC64 VI, VII, VIIIfx */ -#define TLB_PCXR_P_PGSZ0_SHIFT (16) -#define TLB_PCXR_P_PGSZ1_SHIFT (19) -/* - * Note that the US-IV+ documentation appears to have TLB_PCXR_P_PGSZ_I_SHIFT - * and TLB_PCXR_P_PGSZ0_SHIFT erroneously inverted. - */ -#define TLB_PCXR_P_PGSZ_I_SHIFT (22) /* US-IV+ */ -#define TLB_SCXR_S_PGSZ1_SHIFT (19) -#define TLB_SCXR_S_PGSZ0_SHIFT (16) - -#define TLB_TAE_PGSZ_BITS (3) -#define TLB_TAE_PGSZ0_MASK \ - (((1UL << TLB_TAE_PGSZ_BITS) - 1) << TLB_TAE_PGSZ0_SHIFT) -#define TLB_TAE_PGSZ1_MASK \ - (((1UL << TLB_TAE_PGSZ_BITS) - 1) << TLB_TAE_PGSZ1_SHIFT) -#define TLB_TAE_PGSZ0_SHIFT (16) -#define TLB_TAE_PGSZ1_SHIFT (19) - -#define TLB_DEMAP_ID_SHIFT (4) -#define TLB_DEMAP_ID_PRIMARY (0) -#define TLB_DEMAP_ID_SECONDARY (1) -#define TLB_DEMAP_ID_NUCLEUS (2) - -#define TLB_DEMAP_TYPE_SHIFT (6) -#define TLB_DEMAP_TYPE_PAGE (0) -#define TLB_DEMAP_TYPE_CONTEXT (1) -#define TLB_DEMAP_TYPE_ALL (2) /* US-III and beyond only */ - -#define TLB_DEMAP_VA(va) ((va) & ~PAGE_MASK) -#define TLB_DEMAP_ID(id) ((id) << TLB_DEMAP_ID_SHIFT) -#define TLB_DEMAP_TYPE(type) ((type) << TLB_DEMAP_TYPE_SHIFT) - -#define TLB_DEMAP_PAGE (TLB_DEMAP_TYPE(TLB_DEMAP_TYPE_PAGE)) -#define TLB_DEMAP_CONTEXT (TLB_DEMAP_TYPE(TLB_DEMAP_TYPE_CONTEXT)) -#define TLB_DEMAP_ALL (TLB_DEMAP_TYPE(TLB_DEMAP_TYPE_ALL)) - -#define TLB_DEMAP_PRIMARY (TLB_DEMAP_ID(TLB_DEMAP_ID_PRIMARY)) -#define TLB_DEMAP_SECONDARY (TLB_DEMAP_ID(TLB_DEMAP_ID_SECONDARY)) -#define TLB_DEMAP_NUCLEUS (TLB_DEMAP_ID(TLB_DEMAP_ID_NUCLEUS)) - -#define TLB_CTX_KERNEL (0) -#define TLB_CTX_USER_MIN (1) -#define TLB_CTX_USER_MAX (8192) - -#define MMU_SFSR_ASI_SHIFT (16) -#define MMU_SFSR_FT_SHIFT (7) -#define MMU_SFSR_E_SHIFT (6) -#define MMU_SFSR_CT_SHIFT (4) -#define MMU_SFSR_PR_SHIFT (3) -#define MMU_SFSR_W_SHIFT (2) -#define MMU_SFSR_OW_SHIFT (1) -#define MMU_SFSR_FV_SHIFT (0) - -#define MMU_SFSR_ASI_SIZE (8) -#define MMU_SFSR_FT_SIZE (6) -#define MMU_SFSR_CT_SIZE (2) - -#define MMU_SFSR_GET_ASI(sfsr) \ - (((sfsr) >> MMU_SFSR_ASI_SHIFT) & ((1UL << MMU_SFSR_ASI_SIZE) - 1)) -#define MMU_SFSR_GET_FT(sfsr) \ - (((sfsr) >> MMU_SFSR_FT_SHIFT) & ((1UL << MMU_SFSR_FT_SIZE) - 1)) -#define MMU_SFSR_GET_CT(sfsr) \ - (((sfsr) >> MMU_SFSR_CT_SHIFT) & ((1UL << MMU_SFSR_CT_SIZE) - 1)) - -#define MMU_SFSR_E (1UL << MMU_SFSR_E_SHIFT) -#define MMU_SFSR_PR (1UL << MMU_SFSR_PR_SHIFT) -#define MMU_SFSR_W (1UL << MMU_SFSR_W_SHIFT) -#define MMU_SFSR_OW (1UL << MMU_SFSR_OW_SHIFT) -#define MMU_SFSR_FV (1UL << MMU_SFSR_FV_SHIFT) - -typedef void tlb_flush_nonlocked_t(void); -typedef void tlb_flush_user_t(void); - -struct pmap; -struct tlb_entry; - -extern int dtlb_slots; -extern int itlb_slots; -extern int kernel_tlb_slots; -extern struct tlb_entry *kernel_tlbs; - -void tlb_context_demap(struct pmap *pm); -void tlb_page_demap(struct pmap *pm, vm_offset_t va); -void tlb_range_demap(struct pmap *pm, vm_offset_t start, vm_offset_t end); - -tlb_flush_nonlocked_t cheetah_tlb_flush_nonlocked; -tlb_flush_user_t cheetah_tlb_flush_user; - -tlb_flush_nonlocked_t spitfire_tlb_flush_nonlocked; -tlb_flush_user_t spitfire_tlb_flush_user; - -tlb_flush_nonlocked_t zeus_tlb_flush_nonlocked; -tlb_flush_user_t zeus_tlb_flush_user; - -extern tlb_flush_nonlocked_t *tlb_flush_nonlocked; -extern tlb_flush_user_t *tlb_flush_user; - -#endif /* !_MACHINE_TLB_H_ */ diff --git a/sys/sparc64/include/trap.h b/sys/sparc64/include/trap.h deleted file mode 100644 index 84d01f0750dff7..00000000000000 --- a/sys/sparc64/include/trap.h +++ /dev/null @@ -1,101 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2001 Jake Burkholder. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_TRAP_H_ -#define _MACHINE_TRAP_H_ - -#ifdef _KERNEL - -#define T_RESERVED 0 -#define T_INSTRUCTION_EXCEPTION 1 -#define T_INSTRUCTION_ERROR 2 -#define T_INSTRUCTION_PROTECTION 3 -#define T_ILLTRAP_INSTRUCTION 4 -#define T_ILLEGAL_INSTRUCTION 5 -#define T_PRIVILEGED_OPCODE 6 -#define T_FP_DISABLED 7 -#define T_FP_EXCEPTION_IEEE_754 8 -#define T_FP_EXCEPTION_OTHER 9 -#define T_TAG_OVERFLOW 10 -#define T_DIVISION_BY_ZERO 11 -#define T_DATA_EXCEPTION 12 -#define T_DATA_ERROR 13 -#define T_DATA_PROTECTION 14 -#define T_MEM_ADDRESS_NOT_ALIGNED 15 -#define T_PRIVILEGED_ACTION 16 -#define T_ASYNC_DATA_ERROR 17 -#define T_TRAP_INSTRUCTION_16 18 -#define T_TRAP_INSTRUCTION_17 19 -#define T_TRAP_INSTRUCTION_18 20 -#define T_TRAP_INSTRUCTION_19 21 -#define T_TRAP_INSTRUCTION_20 22 -#define T_TRAP_INSTRUCTION_21 23 -#define T_TRAP_INSTRUCTION_22 24 -#define T_TRAP_INSTRUCTION_23 25 -#define T_TRAP_INSTRUCTION_24 26 -#define T_TRAP_INSTRUCTION_25 27 -#define T_TRAP_INSTRUCTION_26 28 -#define T_TRAP_INSTRUCTION_27 29 -#define T_TRAP_INSTRUCTION_28 30 -#define T_TRAP_INSTRUCTION_29 31 -#define T_TRAP_INSTRUCTION_30 32 -#define T_TRAP_INSTRUCTION_31 33 -#define T_INSTRUCTION_MISS 34 -#define T_DATA_MISS 35 - -#define T_INTERRUPT 36 -#define T_PA_WATCHPOINT 37 -#define T_VA_WATCHPOINT 38 -#define T_CORRECTED_ECC_ERROR 39 -#define T_SPILL 40 -#define T_FILL 41 -#define T_FILL_RET 42 -#define T_BREAKPOINT 43 -#define T_CLEAN_WINDOW 44 -#define T_RANGE_CHECK 45 -#define T_FIX_ALIGNMENT 46 -#define T_INTEGER_OVERFLOW 47 -#define T_SYSCALL 48 -#define T_RSTRWP_PHYS 49 -#define T_RSTRWP_VIRT 50 -#define T_KSTACK_FAULT 51 - -#define T_MAX (T_KSTACK_FAULT + 1) - -#define T_KERNEL 64 - -#ifndef LOCORE -void sun4u_set_traptable(void *tba_addr); -extern const char *const trap_msg[]; -#endif - -#endif - -#endif /* !_MACHINE_TRAP_H_ */ diff --git a/sys/sparc64/include/tsb.h b/sys/sparc64/include/tsb.h deleted file mode 100644 index a13b331a1db40c..00000000000000 --- a/sys/sparc64/include/tsb.h +++ /dev/null @@ -1,97 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1997 Berkeley Software Design, Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Berkeley Software Design Inc's name may not be used to endorse or - * promote products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY BERKELEY SOFTWARE DESIGN INC ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL BERKELEY SOFTWARE DESIGN INC BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: BSDI: pmap.v9.h,v 1.10.2.6 1999/08/23 22:18:44 cp Exp - * $FreeBSD$ - */ - -#ifndef _MACHINE_TSB_H_ -#define _MACHINE_TSB_H_ - -#define TSB_PAGES_SHIFT (4) -#define TSB_PAGES (1 << TSB_PAGES_SHIFT) -#define TSB_BSHIFT (TSB_PAGES_SHIFT + PAGE_SHIFT) -#define TSB_BSIZE (1 << TSB_BSHIFT) -#define TSB_BUCKET_SHIFT (2) -#define TSB_BUCKET_SIZE (1 << TSB_BUCKET_SHIFT) -#define TSB_BUCKET_ADDRESS_BITS \ - (TSB_BSHIFT - TSB_BUCKET_SHIFT - TTE_SHIFT) -#define TSB_BUCKET_MASK ((1 << TSB_BUCKET_ADDRESS_BITS) - 1) - -#ifndef LOCORE - -#define TSB_SIZE (TSB_BSIZE / sizeof(struct tte)) - -extern struct tte *tsb_kernel; -extern vm_size_t tsb_kernel_mask; -extern vm_size_t tsb_kernel_size; -extern vm_paddr_t tsb_kernel_phys; - -static __inline struct tte * -tsb_vpntobucket(pmap_t pm, vm_offset_t vpn) -{ - - return (&pm->pm_tsb[(vpn & TSB_BUCKET_MASK) << TSB_BUCKET_SHIFT]); -} - -static __inline struct tte * -tsb_vtobucket(pmap_t pm, u_long sz, vm_offset_t va) -{ - - return (tsb_vpntobucket(pm, va >> TTE_PAGE_SHIFT(sz))); -} - -static __inline struct tte * -tsb_kvpntotte(vm_offset_t vpn) -{ - - return (&tsb_kernel[vpn & tsb_kernel_mask]); -} - -static __inline struct tte * -tsb_kvtotte(vm_offset_t va) -{ - - return (tsb_kvpntotte(va >> PAGE_SHIFT)); -} - -typedef int (tsb_callback_t)(struct pmap *, struct pmap *, struct tte *, - vm_offset_t); - -struct tte *tsb_tte_lookup(pmap_t pm, vm_offset_t va); -void tsb_tte_remove(struct tte *stp); -struct tte *tsb_tte_enter(pmap_t pm, vm_page_t m, vm_offset_t va, u_long sz, - u_long data); -void tsb_tte_local_remove(struct tte *tp); -void tsb_foreach(pmap_t pm1, pmap_t pm2, vm_offset_t start, vm_offset_t end, - tsb_callback_t *callback); - -#endif /* !LOCORE */ - -#endif /* !_MACHINE_TSB_H_ */ diff --git a/sys/sparc64/include/tstate.h b/sys/sparc64/include/tstate.h deleted file mode 100644 index 5e8cf0e9294b3a..00000000000000 --- a/sys/sparc64/include/tstate.h +++ /dev/null @@ -1,84 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright 2001 by Thomas Moestl . All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE - * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_TSTATE_H_ -#define _MACHINE_TSTATE_H_ - -#include -#include - -#define TSTATE_CWP_SHIFT 0 -#define TSTATE_CWP_BITS 5 -#define TSTATE_CWP_MASK \ - (((1 << TSTATE_CWP_BITS) - 1) << TSTATE_CWP_SHIFT) -#define TSTATE_CWP(x) ((x & TSTATE_CWP_MASK) >> TSTATE_CWP_SHIFT) - -#define TSTATE_PSTATE_SHIFT 8 -#define TSTATE_PSTATE_BITS 12 -#define TSTATE_PSTATE_MASK \ - (((1 << TSTATE_PSTATE_BITS) - 1) << TSTATE_PSTATE_SHIFT) -#define TSTATE_PSTATE(x) ((x) << TSTATE_PSTATE_SHIFT) -#define TSTATE_AG TSTATE_PSTATE(PSTATE_AG) -#define TSTATE_IE TSTATE_PSTATE(PSTATE_IE) -#define TSTATE_PRIV TSTATE_PSTATE(PSTATE_PRIV) -#define TSTATE_AM TSTATE_PSTATE(PSTATE_AM) -#define TSTATE_PEF TSTATE_PSTATE(PSTATE_PEF) -#define TSTATE_RED TSTATE_PSTATE(PSTATE_RED) -#define TSTATE_MM_TSO TSTATE_PSTATE(PSTATE_MM_TSO) -#define TSTATE_MM_PSO TSTATE_PSTATE(PSTATE_MM_PSO) -#define TSTATE_MM_RMO TSTATE_PSTATE(PSTATE_MM_RMO) -#define TSTATE_TLE TSTATE_PSTATE(PSTATE_TLE) -#define TSTATE_CLE TSTATE_PSTATE(PSTATE_CLE) -#define TSTATE_MG TSTATE_PSTATE(PSTATE_MG) -#define TSTATE_IG TSTATE_PSTATE(PSTATE_IG) - -#define TSTATE_ASI_SHIFT 24 -#define TSTATE_ASI_BITS 8 -#define TSTATE_ASI_MASK \ - (((1 << TSTATE_ASI_BITS) - 1) << TSTATE_ASI_SHIFT) -#define TSTATE_ASI(x) ((x & TSTATE_ASI_MASK) >> TSTATE_ASI_SHIFT) - -#define TSTATE_CCR_SHIFT 32 -#define TSTATE_ICC_SHIFT (TSTATE_CCR_SHIFT + ICC_SHIFT) -#define TSTATE_ICC_MASK (ICC_MASK << TSTATE_CCR_SHIFT) -#define TSTATE_XCC_SHIFT (TSTATE_CCR_SHIFT + XCC_SHIFT) -#define TSTATE_XCC_MASK (XCC_MASK << TSTATE_CCR_SHIFT) -#define TSTATE_CCR(x) ((x) << TSTATE_CCR_SHIFT) -#define TSTATE_ICC_C TSTATE_CCR(ICC_C) -#define TSTATE_ICC_V TSTATE_CCR(ICC_V) -#define TSTATE_ICC_Z TSTATE_CCR(ICC_Z) -#define TSTATE_ICC_N TSTATE_CCR(ICC_N) -#define TSTATE_XCC_C TSTATE_CCR(XCC_C) -#define TSTATE_XCC_V TSTATE_CCR(XCC_V) -#define TSTATE_XCC_Z TSTATE_CCR(XCC_Z) -#define TSTATE_XCC_N TSTATE_CCR(XCC_N) - -#define TSTATE_SECURE(tstate) \ - PSTATE_SECURE(((tstate) >> TSTATE_PSTATE_SHIFT) & ((1 << TSTATE_PSTATE_BITS) - 1)) - -#endif /* !_MACHINE_TSTATE_H_ */ diff --git a/sys/sparc64/include/tte.h b/sys/sparc64/include/tte.h deleted file mode 100644 index 527f1bad882c77..00000000000000 --- a/sys/sparc64/include/tte.h +++ /dev/null @@ -1,168 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1997 Berkeley Software Design, Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Berkeley Software Design Inc's name may not be used to endorse or - * promote products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY BERKELEY SOFTWARE DESIGN INC ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL BERKELEY SOFTWARE DESIGN INC BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: BSDI: pmap.v9.h,v 1.10.2.6 1999/08/23 22:18:44 cp Exp - * $FreeBSD$ - */ - -#ifndef _MACHINE_TTE_H_ -#define _MACHINE_TTE_H_ - -#define TTE_SHIFT (5) - -#define TD_SIZE_SHIFT (61) -#define TD_SOFT2_SHIFT (50) -#define TD_RSVD2_SHIFT (49) -#define TD_SIZE2_SHIFT (48) -#define TD_DIAG_SF_SHIFT (41) -#define TD_RSVD_CH_SHIFT (43) -#define TD_RSVD_OC_SHIFT (47) -#define TD_RSVD_PT_SHIFT TD_RSVD_CH_SHIFT -#define TD_RSVD_VE_SHIFT (41) -#define TD_PA_SHIFT (13) -#define TD_SOFT_SHIFT (7) - -#define TD_SIZE_BITS (2) -#define TD_SOFT2_BITS (9) -#define TD_RSVD2_BITS (1) /* US-IV+, SPARC64 VI, VII, VIIIfx */ -#define TD_SIZE2_BITS (1) /* US-IV+, SPARC64 VI, VII, VIIIfx */ -#define TD_DIAG_SF_BITS (9) /* US-I, II{,e,i} */ -#define TD_RSVD_CH_BITS (7) /* US-III{,i,+}, US-IV, SPARC64 V */ -#define TD_RSVD_OC_BITS (1) /* SPARC64 VI, VII */ -#define TD_RSVD_PT_BITS (5) /* US-IV+, SPARC64 VI, VII */ -#define TD_RSVD_VE_BITS (7) /* SPARC64 VIIIfx */ -#define TD_PA_CH_BITS (30) /* US-III{,i,+}, US-IV{,+}, SPARC64 V */ -#define TD_PA_OC_BITS (34) /* SPARC64 VI, VII */ -#define TD_PA_SF_BITS (28) /* US-I, II{,e,i}, SPARC64 VIIIfx */ -#define TD_PA_BITS TD_PA_CH_BITS -#define TD_SOFT_BITS (6) - -#define TD_SIZE_MASK ((1UL << TD_SIZE_BITS) - 1) -#define TD_SOFT2_MASK ((1UL << TD_SOFT2_BITS) - 1) -#define TD_RSVD2_MASK ((1UL << TD_RSVD2_BITS) - 1) -#define TD_SIZE2_MASK ((1UL << TD_SIZE2_BITS) - 1) -#define TD_DIAG_SF_MASK ((1UL << TD_DIAG_SF_BITS) - 1) -#define TD_RSVD_CH_MASK ((1UL << TD_RSVD_CH_BITS) - 1) -#define TD_RSVD_OC_MASK ((1UL << TD_RSVD_OC_BITS) - 1) -#define TD_RSVD_PT_MASK ((1UL << TD_RSVD_PT_BITS) - 1) -#define TD_RSVD_VE_MASK ((1UL << TD_RSVD_VE_BITS) - 1) -#define TD_PA_CH_MASK ((1UL << TD_PA_CH_BITS) - 1) -#define TD_PA_OC_MASK ((1UL << TD_PA_OC_BITS) - 1) -#define TD_PA_SF_MASK ((1UL << TD_PA_SF_BITS) - 1) -#define TD_PA_MASK ((1UL << TD_PA_BITS) - 1) -#define TD_SOFT_MASK ((1UL << TD_SOFT_BITS) - 1) - -#define TS_8K (0UL) -#define TS_64K (1UL) -#define TS_512K (2UL) -#define TS_4M (3UL) -#define TS_32M (4UL) /* US-IV+, SPARC64 VI, VII only */ -#define TS_256M (5UL) /* US-IV+, SPARC64 VI, VII only */ -#define TS_2G (6UL) /* SPARC64 VIIIfx only */ - -#define TS_MIN TS_8K -#define TS_MAX TS_4M - -#define TD_V (1UL << 63) -#define TD_8K (TS_8K << TD_SIZE_SHIFT) -#define TD_64K (TS_64K << TD_SIZE_SHIFT) -#define TD_512K (TS_512K << TD_SIZE_SHIFT) -#define TD_4M (TS_4M << TD_SIZE_SHIFT) -#define TD_32M \ - (((TS_32M & TD_SIZE_MASK) << TD_SIZE_SHIFT) | \ - (TD_SIZE2_MASK << TD_SIZE2_SHIFT)) -#define TD_256M \ - (((TS_256M & TD_SIZE_MASK) << TD_SIZE_SHIFT) | \ - (TD_SIZE2_MASK << TD_SIZE2_SHIFT)) -#define TD_2G \ - (((TS_2G & TD_SIZE_MASK) << TD_SIZE_SHIFT) | \ - (TD_SIZE2_MASK << TD_SIZE2_SHIFT)) -#define TD_NFO (1UL << 60) -#define TD_IE (1UL << 59) -#define TD_PA(pa) ((pa) & (TD_PA_MASK << TD_PA_SHIFT)) -/* NOTE: bit 6 of TD_SOFT will be sign-extended if used as an immediate. */ -#define TD_FAKE ((1UL << 5) << TD_SOFT_SHIFT) -#define TD_EXEC ((1UL << 4) << TD_SOFT_SHIFT) -#define TD_REF ((1UL << 3) << TD_SOFT_SHIFT) -#define TD_PV ((1UL << 2) << TD_SOFT_SHIFT) -#define TD_SW ((1UL << 1) << TD_SOFT_SHIFT) -#define TD_WIRED ((1UL << 0) << TD_SOFT_SHIFT) -#define TD_L (1UL << 6) -#define TD_CP (1UL << 5) -#define TD_CV (1UL << 4) -#define TD_E (1UL << 3) -#define TD_P (1UL << 2) -#define TD_W (1UL << 1) -#define TD_G (1UL << 0) - -#define TV_SIZE_BITS (TD_SIZE_BITS) -#define TV_VPN(va, sz) ((((va) >> TTE_PAGE_SHIFT(sz)) << TV_SIZE_BITS) | sz) - -#define TTE_SIZE_SPREAD (3) -#define TTE_PAGE_SHIFT(sz) \ - (PAGE_SHIFT + ((sz) * TTE_SIZE_SPREAD)) - -#define TTE_GET_SIZE(tp) \ - (((tp)->tte_data >> TD_SIZE_SHIFT) & TD_SIZE_MASK) -#define TTE_GET_PAGE_SHIFT(tp) \ - TTE_PAGE_SHIFT(TTE_GET_SIZE(tp)) -#define TTE_GET_PAGE_SIZE(tp) \ - (1 << TTE_GET_PAGE_SHIFT(tp)) -#define TTE_GET_PAGE_MASK(tp) \ - (TTE_GET_PAGE_SIZE(tp) - 1) - -#define TTE_GET_PA(tp) \ - ((tp)->tte_data & (TD_PA_MASK << TD_PA_SHIFT)) -#define TTE_GET_VPN(tp) \ - ((tp)->tte_vpn >> TV_SIZE_BITS) -#define TTE_GET_VA(tp) \ - (TTE_GET_VPN(tp) << TTE_GET_PAGE_SHIFT(tp)) -#define TTE_GET_PMAP(tp) \ - (((tp)->tte_data & TD_P) != 0 ? (kernel_pmap) : \ - (PHYS_TO_VM_PAGE(pmap_kextract((vm_offset_t)(tp)))->md.pmap)) -#define TTE_ZERO(tp) \ - memset(tp, 0, sizeof(*tp)) - -struct pmap; - -struct tte { - u_long tte_vpn; - u_long tte_data; - TAILQ_ENTRY(tte) tte_link; -}; - -static __inline int -tte_match(struct tte *tp, vm_offset_t va) -{ - - return (((tp->tte_data & TD_V) != 0) && - (tp->tte_vpn == TV_VPN(va, TTE_GET_SIZE(tp)))); -} - -#endif /* !_MACHINE_TTE_H_ */ diff --git a/sys/sparc64/include/ucontext.h b/sys/sparc64/include/ucontext.h deleted file mode 100644 index 6303b3f85636a3..00000000000000 --- a/sys/sparc64/include/ucontext.h +++ /dev/null @@ -1,66 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1999 Marcel Moolenaar - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer - * in this position and unchanged. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * from: FreeBSD: src/sys/alpha/include/ucontext.h,v 1.3 1999/10/08 - * $FreeBSD$ - */ - -#ifndef _MACHINE_UCONTEXT_H_ -#define _MACHINE_UCONTEXT_H_ - -struct __mcontext { - __uint64_t mc_global[8]; - __uint64_t mc_out[8]; - __uint64_t mc_local[8]; - __uint64_t mc_in[8]; - __uint32_t mc_fp[64]; -} __aligned(64); - -typedef struct __mcontext mcontext_t; - -#define _mc_flags mc_global[0] -#define _mc_sp mc_out[6] -#define _mc_fprs mc_local[0] -#define _mc_fsr mc_local[1] -#define _mc_gsr mc_local[2] -#define _mc_tnpc mc_in[0] -#define _mc_tpc mc_in[1] -#define _mc_tstate mc_in[2] -#define _mc_y mc_in[4] -#define _mc_wstate mc_in[5] - -#define _MC_VERSION_SHIFT 0 -#define _MC_VERSION_BITS 32 -#define _MC_VERSION 1L - -#define _MC_FLAGS_SHIFT 32 -#define _MC_FLAGS_BITS 32 -#define _MC_VOLUNTARY ((1L << 0) << _MC_FLAGS_SHIFT) - -#endif /* !_MACHINE_UCONTEXT_H_ */ diff --git a/sys/sparc64/include/upa.h b/sys/sparc64/include/upa.h deleted file mode 100644 index 90aec7d647bea2..00000000000000 --- a/sys/sparc64/include/upa.h +++ /dev/null @@ -1,43 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2001 by Thomas Moestl . - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE - * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_UPA_H_ -#define _MACHINE_UPA_H_ - -#define UPA_MEMSTART 0x1c000000000UL -#define UPA_MEMEND 0x1ffffffffffUL - -#define UPA_CR_MID_SHIFT (17) -#define UPA_CR_MID_SIZE (5) -#define UPA_CR_MID_MASK \ - (((1 << UPA_CR_MID_SIZE) - 1) << UPA_CR_MID_SHIFT) - -#define UPA_CR_GET_MID(cr) ((cr & UPA_CR_MID_MASK) >> UPA_CR_MID_SHIFT) - -#endif /* _MACHINE_UPA_H_ */ diff --git a/sys/sparc64/include/utrap.h b/sys/sparc64/include/utrap.h deleted file mode 100644 index ef2d02f0829486..00000000000000 --- a/sys/sparc64/include/utrap.h +++ /dev/null @@ -1,112 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2001 Jake Burkholder. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_UTRAP_H_ -#define _MACHINE_UTRAP_H_ - -#define UT_INSTRUCTION_EXCEPTION 1 -#define UT_INSTRUCTION_ERROR 2 -#define UT_INSTRUCTION_PROTECTION 3 -#define UT_ILLTRAP_INSTRUCTION 4 -#define UT_ILLEGAL_INSTRUCTION 5 -#define UT_PRIVILEGED_OPCODE 6 -#define UT_FP_DISABLED 7 -#define UT_FP_EXCEPTION_IEEE_754 8 -#define UT_FP_EXCEPTION_OTHER 9 -#define UT_TAG_OVERFLOW 10 -#define UT_DIVISION_BY_ZERO 11 -#define UT_DATA_EXCEPTION 12 -#define UT_DATA_ERROR 13 -#define UT_DATA_PROTECTION 14 -#define UT_MEM_ADDRESS_NOT_ALIGNED 15 -#define UT_PRIVILEGED_ACTION 16 -#define UT_ASYNC_DATA_ERROR 17 -#define UT_TRAP_INSTRUCTION_16 18 -#define UT_TRAP_INSTRUCTION_17 19 -#define UT_TRAP_INSTRUCTION_18 20 -#define UT_TRAP_INSTRUCTION_19 21 -#define UT_TRAP_INSTRUCTION_20 22 -#define UT_TRAP_INSTRUCTION_21 23 -#define UT_TRAP_INSTRUCTION_22 24 -#define UT_TRAP_INSTRUCTION_23 25 -#define UT_TRAP_INSTRUCTION_24 26 -#define UT_TRAP_INSTRUCTION_25 27 -#define UT_TRAP_INSTRUCTION_26 28 -#define UT_TRAP_INSTRUCTION_27 29 -#define UT_TRAP_INSTRUCTION_28 30 -#define UT_TRAP_INSTRUCTION_29 31 -#define UT_TRAP_INSTRUCTION_30 32 -#define UT_TRAP_INSTRUCTION_31 33 -#define UT_INSTRUCTION_MISS 34 -#define UT_DATA_MISS 35 -#define UT_MAX 36 - -#define ST_SUNOS_SYSCALL 0 -#define ST_BREAKPOINT 1 -#define ST_DIVISION_BY_ZERO 2 -#define ST_FLUSH_WINDOWS 3 /* XXX implement! */ -#define ST_CLEAN_WINDOW 4 -#define ST_RANGE_CHECK 5 -#define ST_FIX_ALIGNMENT 6 -#define ST_INTEGER_OVERFLOW 7 -/* 8 is 32-bit ABI syscall (old solaris syscall?) */ -#define ST_BSD_SYSCALL 9 -#define ST_FP_RESTORE 10 -/* 11-15 are available */ -/* 16 is linux 32 bit syscall (but supposed to be reserved, grr) */ -/* 17 is old linux 64 bit syscall (but supposed to be reserved, grr) */ -/* 16-31 are reserved for user applications (utraps) */ -#define ST_GETCC 32 /* XXX implement! */ -#define ST_SETCC 33 /* XXX implement! */ -#define ST_GETPSR 34 /* XXX implement! */ -#define ST_SETPSR 35 /* XXX implement! */ -/* 36-63 are available */ -#define ST_SOLARIS_SYSCALL 64 -#define ST_SYSCALL 65 -#define ST_SYSCALL32 66 -/* 67 is reserved to OS source licensee */ -/* 68 is return from deferred trap (not supported) */ -/* 69-95 are reserved to SPARC international */ -/* 96-108 are available */ -/* 109 is linux 64 bit syscall */ -/* 110 is linux 64 bit getcontext (?) */ -/* 111 is linux 64 bit setcontext (?) */ -/* 112-255 are available */ - -#define UTH_NOCHANGE (-1) - -#ifndef __ASM__ - -typedef int utrap_entry_t; -typedef void *utrap_handler_t; - -#endif - -#endif diff --git a/sys/sparc64/include/vdso.h b/sys/sparc64/include/vdso.h deleted file mode 100644 index 903fe1f4c6dac6..00000000000000 --- a/sys/sparc64/include/vdso.h +++ /dev/null @@ -1,36 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright 2012 Konstantin Belousov . - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _SPARC64_VDSO_H -#define _SPARC64_VDSO_H - -#define VDSO_TIMEHANDS_MD \ - uint32_t th_res[8]; - -#endif diff --git a/sys/sparc64/include/ver.h b/sys/sparc64/include/ver.h deleted file mode 100644 index 2bab327c7150f5..00000000000000 --- a/sys/sparc64/include/ver.h +++ /dev/null @@ -1,94 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2001 Jake Burkholder. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_VER_H_ -#define _MACHINE_VER_H_ - -#define VER_MANUF_SHIFT (48) -#define VER_IMPL_SHIFT (32) -#define VER_MASK_SHIFT (24) -#define VER_MAXTL_SHIFT (8) -#define VER_MAXWIN_SHIFT (0) - -#define VER_MANUF_SIZE (16) -#define VER_IMPL_SIZE (16) -#define VER_MASK_SIZE (8) -#define VER_MAXTL_SIZE (8) -#define VER_MAXWIN_SIZE (5) - -#ifndef LOCORE - -#define VER_MANUF_MASK \ - (((1UL << VER_MANUF_SIZE) - 1) << VER_MANUF_SHIFT) -#define VER_IMPL_MASK \ - (((1UL << VER_IMPL_SIZE) - 1) << VER_IMPL_SHIFT) -#define VER_MASK_MASK \ - (((1UL << VER_MASK_SIZE) - 1) << VER_MASK_SHIFT) -#define VER_MAXTL_MASK \ - (((1UL << VER_MAXTL_SIZE) - 1) << VER_MAXTL_SHIFT) -#define VER_MAXWIN_MASK \ - (((1UL << VER_MAXWIN_SIZE) - 1) << VER_MAXWIN_SHIFT) - -#define VER_MANUF(ver) \ - (((ver) & VER_MANUF_MASK) >> VER_MANUF_SHIFT) -#define VER_IMPL(ver) \ - (((ver) & VER_IMPL_MASK) >> VER_IMPL_SHIFT) -#define VER_MASK(ver) \ - (((ver) & VER_MASK_MASK) >> VER_MASK_SHIFT) -#define VER_MAXTL(ver) \ - (((ver) & VER_MAXTL_MASK) >> VER_MAXTL_SHIFT) -#define VER_MAXWIN(ver) \ - (((ver) & VER_MAXWIN_MASK) >> VER_MAXWIN_SHIFT) - -extern char sparc64_model[]; - -#endif /* !LOCORE */ - -/* Known implementations */ -#define CPU_IMPL_SPARC64 0x01 -#define CPU_IMPL_SPARC64II 0x02 -#define CPU_IMPL_SPARC64III 0x03 -#define CPU_IMPL_SPARC64IV 0x04 -#define CPU_IMPL_SPARC64V 0x05 -#define CPU_IMPL_SPARC64VI 0x06 -#define CPU_IMPL_SPARC64VII 0x07 -#define CPU_IMPL_SPARC64VIIIfx 0x08 -#define CPU_IMPL_ULTRASPARCI 0x10 -#define CPU_IMPL_ULTRASPARCII 0x11 -#define CPU_IMPL_ULTRASPARCIIi 0x12 -#define CPU_IMPL_ULTRASPARCIIe 0x13 -#define CPU_IMPL_ULTRASPARCIII 0x14 -#define CPU_IMPL_ULTRASPARCIIIp 0x15 -#define CPU_IMPL_ULTRASPARCIIIi 0x16 -#define CPU_IMPL_ULTRASPARCIV 0x18 -#define CPU_IMPL_ULTRASPARCIVp 0x19 -#define CPU_IMPL_ULTRASPARCIIIip 0x22 - -#endif /* !_MACHINE_VER_H_ */ diff --git a/sys/sparc64/include/vm.h b/sys/sparc64/include/vm.h deleted file mode 100644 index 348cdf012c9b73..00000000000000 --- a/sys/sparc64/include/vm.h +++ /dev/null @@ -1,38 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2009 Alan L. Cox - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_VM_H_ -#define _MACHINE_VM_H_ - -/* Memory attribute configuration is not (yet) implemented. */ -#define VM_MEMATTR_DEFAULT 0 -#define VM_MEMATTR_UNCACHEABLE 0 - -#endif /* !_MACHINE_VM_H_ */ diff --git a/sys/sparc64/include/vmparam.h b/sys/sparc64/include/vmparam.h deleted file mode 100644 index f23ebb06d65aae..00000000000000 --- a/sys/sparc64/include/vmparam.h +++ /dev/null @@ -1,248 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. - * Copyright (c) 1994 John S. Dyson - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * William Jolitz. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: @(#)vmparam.h 5.9 (Berkeley) 5/12/91 - * from: FreeBSD: src/sys/i386/include/vmparam.h,v 1.33 2000/03/30 - * $FreeBSD$ - */ - -#ifndef _MACHINE_VMPARAM_H_ -#define _MACHINE_VMPARAM_H_ - -/* - * Virtual memory related constants, all in bytes - */ -#ifndef MAXTSIZ -#define MAXTSIZ (1*1024*1024*1024) /* max text size */ -#endif -#ifndef DFLDSIZ -#define DFLDSIZ (128*1024*1024) /* initial data size limit */ -#endif -#ifndef MAXDSIZ -#define MAXDSIZ (1*1024*1024*1024) /* max data size */ -#endif -#ifndef DFLSSIZ -#define DFLSSIZ (128*1024*1024) /* initial stack size limit */ -#endif -#ifndef MAXSSIZ -#define MAXSSIZ (1*1024*1024*1024) /* max stack size */ -#endif -#ifndef SGROWSIZ -#define SGROWSIZ (128*1024) /* amount to grow stack */ -#endif - -/* - * The physical address space is sparsely populated. - */ -#define VM_PHYSSEG_SPARSE - -/* - * The number of PHYSSEG entries must be one greater than the number - * of phys_avail entries because the phys_avail entry that spans the - * largest physical address that is accessible by ISA DMA is split - * into two PHYSSEG entries. - */ -#define VM_PHYSSEG_MAX 64 - -/* - * Create two free page pools: VM_FREEPOOL_DEFAULT is the default pool - * from which physical pages are allocated and VM_FREEPOOL_DIRECT is - * the pool from which physical pages for small UMA objects are - * allocated. - */ -#define VM_NFREEPOOL 2 -#define VM_FREEPOOL_DEFAULT 0 -#define VM_FREEPOOL_DIRECT 1 - -/* - * Create one free page list: VM_FREELIST_DEFAULT is for all physical - * pages. - */ -#define VM_NFREELIST 1 -#define VM_FREELIST_DEFAULT 0 - -/* - * An allocation size of 16MB is supported in order to optimize the - * use of the direct map by UMA. Specifically, a cache line contains - * at most four TTEs, collectively mapping 16MB of physical memory. - * By reducing the number of distinct 16MB "pages" that are used by UMA, - * the physical memory allocator reduces the likelihood of both 4MB - * page TLB misses and cache misses caused by 4MB page TLB misses. - */ -#define VM_NFREEORDER 12 - -/* - * Enable superpage reservations: 1 level. - */ -#ifndef VM_NRESERVLEVEL -#define VM_NRESERVLEVEL 1 -#endif - -/* - * Level 0 reservations consist of 512 pages. - */ -#ifndef VM_LEVEL_0_ORDER -#define VM_LEVEL_0_ORDER 9 -#endif - -/** - * Address space layout. - * - * UltraSPARC I and II implement a 44 bit virtual address space. The address - * space is split into 2 regions at each end of the 64 bit address space, with - * an out of range "hole" in the middle. UltraSPARC III implements the full - * 64 bit virtual address space, but we don't really have any use for it and - * 43 bits of user address space is considered to be "enough", so we ignore it. - * - * Upper region: 0xffffffffffffffff - * 0xfffff80000000000 - * - * Hole: 0xfffff7ffffffffff - * 0x0000080000000000 - * - * Lower region: 0x000007ffffffffff - * 0x0000000000000000 - * - * In general we ignore the upper region, and use the lower region as mappable - * space. - * - * We define some interesting address constants: - * - * VM_MIN_ADDRESS and VM_MAX_ADDRESS define the start and end of the entire - * 64 bit address space, mostly just for convenience. - * - * VM_MIN_DIRECT_ADDRESS and VM_MAX_DIRECT_ADDRESS define the start and end - * of the direct mapped region. This maps virtual addresses to physical - * addresses directly using 4mb tlb entries, with the physical address encoded - * in the lower 43 bits of virtual address. These mappings are convenient - * because they do not require page tables, and because they never change they - * do not require tlb flushes. However, since these mappings are cacheable, - * we must ensure that all pages accessed this way are either not double - * mapped, or that all other mappings have virtual color equal to physical - * color, in order to avoid creating illegal aliases in the data cache. - * - * VM_MIN_KERNEL_ADDRESS and VM_MAX_KERNEL_ADDRESS define the start and end of - * mappable kernel virtual address space. VM_MIN_KERNEL_ADDRESS is basically - * arbitrary, a convenient address is chosen which allows both the kernel text - * and data and the prom's address space to be mapped with 1 4mb tsb page. - * VM_MAX_KERNEL_ADDRESS is variable, computed at startup time based on the - * amount of physical memory available. Each 4mb tsb page provides 1g of - * virtual address space, with the only practical limit being available - * phsyical memory. - * - * VM_MIN_PROM_ADDRESS and VM_MAX_PROM_ADDRESS define the start and end of the - * prom address space. On startup the prom's mappings are duplicated in the - * kernel tsb, to allow prom memory to be accessed normally by the kernel. - * - * VM_MIN_USER_ADDRESS and VM_MAX_USER_ADDRESS define the start and end of the - * user address space. There are some hardware errata about using addresses - * at the boundary of the va hole, so we allow just under 43 bits of user - * address space. Note that the kernel and user address spaces overlap, but - * this doesn't matter because they use different tlb contexts, and because - * the kernel address space is not mapped into each process' address space. - */ -#define VM_MIN_ADDRESS (0x0000000000000000UL) -#define VM_MAX_ADDRESS (0xffffffffffffffffUL) - -#define VM_MIN_DIRECT_ADDRESS (0xfffff80000000000UL) -#define VM_MAX_DIRECT_ADDRESS (VM_MAX_ADDRESS) - -#define VM_MIN_KERNEL_ADDRESS (0x00000000c0000000UL) -#define VM_MAX_KERNEL_ADDRESS (vm_max_kernel_address) - -#define VM_MIN_PROM_ADDRESS (0x00000000f0000000UL) -#define VM_MAX_PROM_ADDRESS (0x00000000ffffffffUL) - -#define VM_MIN_USER_ADDRESS (0x0000000000000000UL) -#define VM_MAX_USER_ADDRESS (0x000007fe00000000UL) - -#define VM_MINUSER_ADDRESS (VM_MIN_USER_ADDRESS) -#define VM_MAXUSER_ADDRESS (VM_MAX_USER_ADDRESS) - -#define KERNBASE (VM_MIN_KERNEL_ADDRESS) -#define PROMBASE (VM_MIN_PROM_ADDRESS) -#define USRSTACK (VM_MAX_USER_ADDRESS) - -/* - * How many physical pages per kmem arena virtual page. - */ -#ifndef VM_KMEM_SIZE_SCALE -#define VM_KMEM_SIZE_SCALE (tsb_kernel_ldd_phys == 0 ? 3 : 2) -#endif - -/* - * Optional floor (in bytes) on the size of the kmem arena. - */ -#ifndef VM_KMEM_SIZE_MIN -#define VM_KMEM_SIZE_MIN (16 * 1024 * 1024) -#endif - -/* - * Optional ceiling (in bytes) on the size of the kmem arena: 60% of the - * kernel map. - */ -#ifndef VM_KMEM_SIZE_MAX -#define VM_KMEM_SIZE_MAX ((VM_MAX_KERNEL_ADDRESS - \ - VM_MIN_KERNEL_ADDRESS + 1) * 3 / 5) -#endif - -/* - * Initial pagein size of beginning of executable file. - */ -#ifndef VM_INITIAL_PAGEIN -#define VM_INITIAL_PAGEIN 16 -#endif - -#define UMA_MD_SMALL_ALLOC - -extern u_int tsb_kernel_ldd_phys; -extern vm_offset_t vm_max_kernel_address; - -/* - * Older sparc64 machines have a virtually indexed L1 data cache of 16KB. - * Consequently, mapping the same physical page multiple times may have - * caching disabled. - */ -#define ZERO_REGION_SIZE PAGE_SIZE - -#include - -#define SFBUF -#define SFBUF_MAP - -#define PMAP_HAS_DMAP dcache_color_ignore -#define PHYS_TO_DMAP(x) (TLB_PHYS_TO_DIRECT(x)) - -#endif /* !_MACHINE_VMPARAM_H_ */ diff --git a/sys/sparc64/include/watch.h b/sys/sparc64/include/watch.h deleted file mode 100644 index 1adb2e1c667041..00000000000000 --- a/sys/sparc64/include/watch.h +++ /dev/null @@ -1,43 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright 2001 by Thomas Moestl . All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE - * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_WATCH_H_ -#define _MACHINE_WATCH_H_ - -int watch_phys_set_mask(vm_paddr_t pa, u_long mask); -int watch_phys_set(vm_paddr_t pa, int sz); -vm_paddr_t watch_phys_get(int *bm); -void watch_phys_clear(void); -int watch_phys_active(void); -int watch_virt_set_mask(vm_offset_t va, u_long mask); -int watch_virt_set(vm_offset_t va, int sz); -vm_offset_t watch_virt_get(int *bm); -void watch_virt_clear(void); -int watch_virt_active(void); - -#endif /* _MACHINE_WATCH_H_ */ diff --git a/sys/sparc64/include/wstate.h b/sys/sparc64/include/wstate.h deleted file mode 100644 index e55916b7dcf90a..00000000000000 --- a/sys/sparc64/include/wstate.h +++ /dev/null @@ -1,68 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1997 Berkeley Software Design, Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Berkeley Software Design Inc's name may not be used to endorse or - * promote products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY BERKELEY SOFTWARE DESIGN INC ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL BERKELEY SOFTWARE DESIGN INC BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: BSDI: wstate.h,v 1.4 1997/09/18 13:05:51 torek Exp - * $FreeBSD$ - */ - -#ifndef _MACHINE_WSTATE_H_ -#define _MACHINE_WSTATE_H_ - -/* - * Window state register bits - * - * There really are no bits per se, just the two fields WSTATE.NORMAL - * and WSTATE.OTHER. The rest is up to software. - * - * We use WSTATE_NORMAL to represent user mode or kernel mode saves - * (whichever is currently in effect) and WSTATE_OTHER to represent - * user mode saves (only). - * - * Note that locore.s assumes this same bit layout (since the translation - * from "bits" to "{spill,fill}_N_{normal,other}" is done in hardware). - */ - -#define WSTATE_NORMAL_MASK 1 /* wstate normal minus transition */ -#define WSTATE_OTHER_SHIFT 3 /* for wstate other / user */ -#define WSTATE_OTHER_MASK /* wstate other minus nested */ \ - (WSTATE_NORMAL_MASK << WSTATE_OTHER_SHIFT) - -#define WSTATE_KERNEL 0 /* normal kernel wstate */ -#define WSTATE_USER_64 0 /* normal 64bit user wstate */ -#define WSTATE_USER_32 1 /* normal 32bit user wstate */ - -#define WSTATE_TRANSITION 2 /* if set, force user window */ -#define WSTATE_NESTED /* if set, spill must not fault */ \ - (WSTATE_TRANSITION << WSTATE_OTHER_SHIFT) - -/* Values used by the PROM and (Open)Solaris */ -#define WSTATE_PROM_KMIX 7 -#define WSTATE_PROM_MASK 7 - -#endif /* !_MACHINE_WSTATE_H_ */ diff --git a/sys/sparc64/isa/isa.c b/sys/sparc64/isa/isa.c deleted file mode 100644 index f035ddc8c8d6e9..00000000000000 --- a/sys/sparc64/isa/isa.c +++ /dev/null @@ -1,363 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 1998 Doug Rabson - * Copyright (c) 2001 Thomas Moestl - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: FreeBSD: src/sys/alpha/isa/isa.c,v 1.26 2001/07/11 - */ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include - -#include - -#include - -#include -#include -#include - -#include -#include - -#include - -#include -#include - -#include -#include - -/* There can be only one ISA bus, so it is safe to use globals. */ -static u_int64_t isa_io_base; -static u_int64_t isa_io_limit; -static u_int64_t isa_mem_base; -static u_int64_t isa_mem_limit; - -device_t isa_bus_device; - -static phandle_t isab_node; -static struct isa_ranges *isab_ranges; -static int isab_nrange; -static struct ofw_bus_iinfo isa_iinfo; - -/* - * XXX: This is really partly PCI-specific, but unfortunately is - * differently enough to have to duplicate it here... - */ -#define ISAB_RANGE_PHYS(r) \ - (((u_int64_t)(r)->phys_mid << 32) | (u_int64_t)(r)->phys_lo) -#define ISAB_RANGE_SPACE(r) (((r)->phys_hi >> 24) & 0x03) - -#define ISAR_SPACE_IO 0x01 -#define ISAR_SPACE_MEM 0x02 - -#define INRANGE(x, start, end) ((x) >= (start) && (x) <= (end)) - -static void isa_setup_children(device_t, phandle_t); - -void -isa_init(device_t dev) -{ - device_t bridge; - int i; - - /* The parent of the bus must be a PCI-ISA bridge. */ - bridge = device_get_parent(dev); - isab_node = ofw_bus_get_node(bridge); - isab_nrange = OF_getprop_alloc_multi(isab_node, "ranges", - sizeof(*isab_ranges), (void **)&isab_ranges); - if (isab_nrange <= 0) - panic("isa_init: cannot get bridge range property"); - - ofw_bus_setup_iinfo(isab_node, &isa_iinfo, sizeof(ofw_isa_intr_t)); - - isa_setup_children(dev, isab_node); - - for (i = isab_nrange - 1; i >= 0; i--) { - switch(ISAB_RANGE_SPACE(&isab_ranges[i])) { - case ISAR_SPACE_IO: - /* This is probably always 0. */ - isa_io_base = ISAB_RANGE_PHYS(&isab_ranges[i]); - isa_io_limit = isab_ranges[i].size; - break; - case ISAR_SPACE_MEM: - /* This is probably always 0. */ - isa_mem_base = ISAB_RANGE_PHYS(&isab_ranges[i]); - isa_mem_limit = isab_ranges[i].size; - break; - } - } -} - -static const struct { - const char *const name; - uint32_t id; -} ofw_isa_pnp_map[] = { - { "SUNW,lomh", 0x0000ae4e }, /* SUN0000 */ - { "dma", 0x0002d041 }, /* PNP0200 */ - { "floppy", 0x0007d041 }, /* PNP0700 */ - { "rtc", 0x000bd041 }, /* PNP0B00 */ - { "flashprom", 0x0100ae4e }, /* SUN0001 */ - { "parallel", 0x0104d041 }, /* PNP0401 */ - { "serial", 0x0105d041 }, /* PNP0501 */ - { "su", 0x0105d041 }, /* PNP0501 */ - { "i2c", 0x0200ae4e }, /* SUN0002 */ - { "rmc-comm", 0x0300ae4e }, /* SUN0003 */ - { "kb_ps2", 0x0303d041 }, /* PNP0303 */ - { "kdmouse", 0x030fd041 }, /* PNP0F03 */ - { "bscbus", 0x0400ae4e }, /* SUN0004 */ - { "power", 0x0c0cd041 }, /* PNP0C0C */ - { NULL, 0x0 } -}; - -static void -isa_setup_children(device_t dev, phandle_t parent) -{ - struct isa_regs *regs; - struct resource_list *rl; - device_t cdev; - u_int64_t end, start; - ofw_isa_intr_t *intrs, rintr; - phandle_t node; - uint32_t *drqs, *regidx; - int i, ndrq, nintr, nreg, nregidx, rid, rtype; - char *name; - - /* - * Loop through children and fake up PnP devices for them. - * Their resources are added as fully mapped and specified because - * adjusting the resources and the resource list entries respectively - * in isa_alloc_resource() causes trouble with drivers which use - * rman_get_start(), pass-through or allocate and release resources - * multiple times, etc. Adjusting the resources might be better off - * in a bus_activate_resource method but the common ISA code doesn't - * allow for an isa_activate_resource(). - */ - for (node = OF_child(parent); node != 0; node = OF_peer(node)) { - if ((OF_getprop_alloc(node, "name", (void **)&name)) == -1) - continue; - - /* - * Keyboard and mouse controllers hang off of the `8042' - * node but we have no real use for the `8042' itself. - */ - if (strcmp(name, "8042") == 0) { - isa_setup_children(dev, node); - OF_prop_free(name); - continue; - } - - for (i = 0; ofw_isa_pnp_map[i].name != NULL; i++) - if (strcmp(ofw_isa_pnp_map[i].name, name) == 0) - break; - if (ofw_isa_pnp_map[i].name == NULL) { - device_printf(dev, "no PnP map entry for node " - "0x%lx: %s\n", (unsigned long)node, name); - OF_prop_free(name); - continue; - } - - if ((cdev = BUS_ADD_CHILD(dev, ISA_ORDER_PNPBIOS, NULL, -1)) == - NULL) - panic("isa_setup_children: BUS_ADD_CHILD failed"); - isa_set_logicalid(cdev, ofw_isa_pnp_map[i].id); - isa_set_vendorid(cdev, ofw_isa_pnp_map[i].id); - - rl = BUS_GET_RESOURCE_LIST(dev, cdev); - nreg = OF_getprop_alloc_multi(node, "reg", sizeof(*regs), - (void **)®s); - for (i = 0; i < nreg; i++) { - start = ISA_REG_PHYS(®s[i]); - end = start + regs[i].size - 1; - rtype = ofw_isa_range_map(isab_ranges, isab_nrange, - &start, &end, NULL); - rid = 0; - while (resource_list_find(rl, rtype, rid) != NULL) - rid++; - bus_set_resource(cdev, rtype, rid, start, - end - start + 1); - } - if (nreg == -1 && parent != isab_node) { - /* - * The "reg" property still might be an index into - * the set of registers of the parent device like - * with the nodes hanging off of the `8042' node. - */ - nregidx = OF_getprop_alloc_multi(node, "reg", sizeof(*regidx), - (void **)®idx); - if (nregidx > 2) - panic("isa_setup_children: impossible number " - "of register indices"); - if (nregidx != -1 && (nreg = OF_getprop_alloc_multi(parent, - "reg", sizeof(*regs), (void **)®s)) >= nregidx) { - for (i = 0; i < nregidx; i++) { - start = ISA_REG_PHYS(®s[regidx[i]]); - end = start + regs[regidx[i]].size - 1; - rtype = ofw_isa_range_map(isab_ranges, - isab_nrange, &start, &end, NULL); - rid = 0; - while (resource_list_find(rl, rtype, - rid) != NULL) - rid++; - bus_set_resource(cdev, rtype, rid, - start, end - start + 1); - } - } - if (regidx != NULL) - OF_prop_free(regidx); - } - if (regs != NULL) - OF_prop_free(regs); - - nintr = OF_getprop_alloc_multi(node, "interrupts", sizeof(*intrs), - (void **)&intrs); - for (i = 0; i < nintr; i++) { - if (intrs[i] > 7) - panic("isa_setup_children: intr too large"); - rintr = ofw_isa_route_intr(device_get_parent(dev), node, - &isa_iinfo, intrs[i]); - if (rintr == PCI_INVALID_IRQ) { - device_printf(dev, "could not map ISA " - "interrupt %d for node 0x%lx: %s\n", - intrs[i], (unsigned long)node, name); - continue; - } - bus_set_resource(cdev, SYS_RES_IRQ, i, rintr, 1); - } - if (intrs != NULL) - OF_prop_free(intrs); - - ndrq = OF_getprop_alloc_multi(node, "dma-channel", sizeof(*drqs), - (void **)&drqs); - for (i = 0; i < ndrq; i++) - bus_set_resource(cdev, SYS_RES_DRQ, i, drqs[i], 1); - if (drqs != NULL) - OF_prop_free(drqs); - - /* - * Devices using DMA hang off of the `dma' node instead of - * directly from the ISA bridge node. - */ - if (strcmp(name, "dma") == 0) - isa_setup_children(dev, node); - - OF_prop_free(name); - } -} - -struct resource * -isa_alloc_resource(device_t bus, device_t child, int type, int *rid, - rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) -{ - /* - * Consider adding a resource definition. - */ - int passthrough = (device_get_parent(child) != bus); - int isdefault = RMAN_IS_DEFAULT_RANGE(start, end); - struct resource_list *rl; - struct resource_list_entry *rle; - u_long base, limit; - - rl = BUS_GET_RESOURCE_LIST(bus, child); - if (!passthrough && !isdefault) { - rle = resource_list_find(rl, type, *rid); - if (!rle) { - if (*rid < 0) - return (NULL); - switch (type) { - case SYS_RES_IRQ: - if (*rid >= ISA_NIRQ) - return (NULL); - break; - case SYS_RES_DRQ: - if (*rid >= ISA_NDRQ) - return (NULL); - break; - case SYS_RES_MEMORY: - if (*rid >= ISA_NMEM) - return (NULL); - break; - case SYS_RES_IOPORT: - if (*rid >= ISA_NPORT) - return (NULL); - break; - default: - return (NULL); - } - resource_list_add(rl, type, *rid, start, end, count); - } - } - - /* - * Sanity check if the resource in the respective entry is fully - * mapped and specified and its type allocable. A driver could - * have added an out of range resource on its own. - */ - if (!passthrough) { - if ((rle = resource_list_find(rl, type, *rid)) == NULL) - return (NULL); - base = limit = 0; - switch (type) { - case SYS_RES_MEMORY: - base = isa_mem_base; - limit = base + isa_mem_limit; - break; - case SYS_RES_IOPORT: - base = isa_io_base; - limit = base + isa_io_limit; - break; - case SYS_RES_IRQ: - if (rle->start != rle->end || rle->start <= 7) - return (NULL); - break; - case SYS_RES_DRQ: - break; - default: - return (NULL); - } - if (type == SYS_RES_MEMORY || type == SYS_RES_IOPORT) { - if (!INRANGE(rle->start, base, limit) || - !INRANGE(rle->end, base, limit)) - return (NULL); - } - } - - return (resource_list_alloc(rl, bus, child, type, rid, start, end, - count, flags)); -} - -int -isa_release_resource(device_t bus, device_t child, int type, int rid, - struct resource *res) -{ - - return (bus_generic_rl_release_resource(bus, child, type, rid, res)); -} diff --git a/sys/sparc64/isa/isa_dma.c b/sys/sparc64/isa/isa_dma.c deleted file mode 100644 index 1a1b009db10e10..00000000000000 --- a/sys/sparc64/isa/isa_dma.c +++ /dev/null @@ -1,98 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2004 Pyun YongHyeon. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include - -#include -#include - -/* - * Glue code to load sound(4). Though fdc(4), ppc(4) don't work on - * sparc64 yet, they may need this glue code too. - */ - -int -isa_dma_init(int chan, u_int bouncebufsize, int flag) -{ - - return (0); -} - -int -isa_dma_acquire(int chan) -{ - return (0); -} - -void -isa_dma_release(int chan) -{ - -} - -void -isa_dmacascade(int chan) -{ - -} - -void -isa_dmastart(int flags, caddr_t addr, u_int nbytes, int chan) -{ - -} - -void -isa_dmadone(int flags, caddr_t addr, int nbytes, int chan) -{ - -} - -int -isa_dmastatus(int chan) -{ - return (0); -} - -int -isa_dmatc(int chan) -{ - return (0); -} - -int -isa_dmastop(int chan) -{ - return (0); -} diff --git a/sys/sparc64/isa/ofw_isa.c b/sys/sparc64/isa/ofw_isa.c deleted file mode 100644 index a66a738726acce..00000000000000 --- a/sys/sparc64/isa/ofw_isa.c +++ /dev/null @@ -1,148 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1999, 2000 Matthew R. Green - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: NetBSD: ebus.c,v 1.52 2008/05/29 14:51:26 mrg Exp - */ -/*- - * Copyright (c) 2001, 2003 Thomas Moestl - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -__FBSDID("$FreeBSD$"); - -/* - * Helper functions which can be used in both ISA and EBus code. - */ - -#include -#include -#include - -#include -#include - -#include -#include - -#include -#include - -#include "pcib_if.h" - -int -ofw_isa_range_restype(struct isa_ranges *range) -{ - int ps = ISA_RANGE_PS(range); - - switch (ps) { - case OFW_PCI_CS_IO: - return (SYS_RES_IOPORT); - case OFW_PCI_CS_MEM32: - return (SYS_RES_MEMORY); - default: - panic("ofw_isa_range_restype: illegal space %x", ps); - } - -} - -/* XXX: this only supports PCI as parent bus right now. */ -int -ofw_isa_range_map(struct isa_ranges *range, int nrange, u_long *start, - u_long *end, int *which) -{ - struct isa_ranges *r; - uint64_t offs, cstart, cend; - int i; - - for (i = 0; i < nrange; i++) { - r = &range[i]; - cstart = ISA_RANGE_CHILD(r); - cend = cstart + r->size - 1; - if (*start < cstart || *start > cend) - continue; - if (*end < cstart || *end > cend) { - panic("ofw_isa_map_iorange: iorange crosses PCI " - "ranges (%#lx not in %#lx - %#lx)", *end, cstart, - cend); - } - offs = ISA_RANGE_PHYS(r); - *start = *start + offs - cstart; - *end = *end + offs - cstart; - if (which != NULL) - *which = i; - return (ofw_isa_range_restype(r)); - } - panic("ofw_isa_map_iorange: could not map range %#lx - %#lx", - *start, *end); -} - -ofw_pci_intr_t -ofw_isa_route_intr(device_t bridge, phandle_t node, struct ofw_bus_iinfo *ii, - ofw_isa_intr_t intr) -{ - struct isa_regs reg; - device_t pbridge; - ofw_isa_intr_t mintr; - - pbridge = device_get_parent(device_get_parent(bridge)); - /* - * If we get a match from using the map, the resulting INO is - * fully specified, so we may not continue to map. - */ - if (!ofw_bus_lookup_imap(node, ii, ®, sizeof(reg), - &intr, sizeof(intr), &mintr, sizeof(mintr), NULL)) { - /* Try routing at the parent bridge. */ - mintr = PCIB_ROUTE_INTERRUPT(pbridge, bridge, intr); - } - return (mintr); -} diff --git a/sys/sparc64/isa/ofw_isa.h b/sys/sparc64/isa/ofw_isa.h deleted file mode 100644 index c1974f1f88b4f9..00000000000000 --- a/sys/sparc64/isa/ofw_isa.h +++ /dev/null @@ -1,102 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1999, 2000 Matthew R. Green - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: NetBSD: ebus.c,v 1.52 2008/05/29 14:51:26 mrg Exp - */ -/*- - * Copyright (c) 2001 Thomas Moestl - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _SPARC64_ISA_OFW_ISA_H_ -#define _SPARC64_ISA_OFW_ISA_H_ - -/* - * ISA PROM structures - */ -struct isa_regs { - u_int32_t phys_hi; /* high bits of physaddr */ - u_int32_t phys_lo; - u_int32_t size; -}; - -#define ISA_REG_PHYS(r) \ - ((((u_int64_t)((r)->phys_hi)) << 32) | ((u_int64_t)(r)->phys_lo)) - -/* XXX: this is a guess. Verify... */ -struct isa_ranges { - u_int32_t child_hi; - u_int32_t child_lo; - u_int32_t phys_hi; - u_int32_t phys_mid; - u_int32_t phys_lo; - u_int32_t size; -}; - -#define ISA_RANGE_CHILD(r) \ - ((((u_int64_t)((r)->child_hi)) << 32) | ((u_int64_t)(r)->child_lo)) -#define ISA_RANGE_PS(r) (((r)->phys_hi >> 24) & 0x03) -#define ISA_RANGE_PHYS(r) \ - ((((u_int64_t)(r)->phys_mid) << 32) | ((u_int64_t)(r)->phys_lo)) - -typedef u_int32_t ofw_isa_intr_t; - -int ofw_isa_range_restype(struct isa_ranges *); -/* Map an IO range. Returns the resource type of the range. */ -int ofw_isa_range_map(struct isa_ranges *, int, u_long *, u_long *, int *); - -ofw_pci_intr_t ofw_isa_route_intr(device_t, phandle_t, struct ofw_bus_iinfo *, - ofw_isa_intr_t); - -#endif /* !_SPARC64_ISA_OFW_ISA_H_ */ diff --git a/sys/sparc64/pci/apb.c b/sys/sparc64/pci/apb.c deleted file mode 100644 index 757a1e8608dcfb..00000000000000 --- a/sys/sparc64/pci/apb.c +++ /dev/null @@ -1,309 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1994,1995 Stefan Esser, Wolfgang StanglMeier - * Copyright (c) 2000 Michael Smith - * Copyright (c) 2000 BSDi - * Copyright (c) 2001, 2003 Thomas Moestl - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: FreeBSD: src/sys/dev/pci/pci_pci.c,v 1.3 2000/12/13 - */ - -#include -__FBSDID("$FreeBSD$"); - -/* - * Support for the Sun APB (Advanced PCI Bridge) PCI-PCI bridge. - * This bridge does not fully comply to the PCI bridge specification, and is - * therefore not supported by the generic driver. - * We can use some of the pcib methods anyway. - */ - -#include "opt_ofw_pci.h" - -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include - -#include -#include -#include - -#include "pcib_if.h" - -#include -#include - -/* - * Bridge-specific data. - */ -struct apb_softc { - struct ofw_pcib_gen_softc sc_bsc; - uint8_t sc_iomap; - uint8_t sc_memmap; -}; - -static device_probe_t apb_probe; -static device_attach_t apb_attach; -static bus_alloc_resource_t apb_alloc_resource; -static bus_adjust_resource_t apb_adjust_resource; - -static device_method_t apb_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, apb_probe), - DEVMETHOD(device_attach, apb_attach), - - /* Bus interface */ - DEVMETHOD(bus_alloc_resource, apb_alloc_resource), - DEVMETHOD(bus_adjust_resource, apb_adjust_resource), - DEVMETHOD(bus_release_resource, bus_generic_release_resource), - - /* pcib interface */ - DEVMETHOD(pcib_route_interrupt, ofw_pcib_gen_route_interrupt), - DEVMETHOD(pcib_request_feature, pcib_request_feature_allow), - - /* ofw_bus interface */ - DEVMETHOD(ofw_bus_get_node, ofw_pcib_gen_get_node), - - DEVMETHOD_END -}; - -static devclass_t pcib_devclass; - -DEFINE_CLASS_1(pcib, apb_driver, apb_methods, sizeof(struct apb_softc), - pcib_driver); -EARLY_DRIVER_MODULE(apb, pci, apb_driver, pcib_devclass, 0, 0, BUS_PASS_BUS); -MODULE_DEPEND(apb, pci, 1, 1, 1); - -/* APB specific registers */ -#define APBR_IOMAP 0xde -#define APBR_MEMMAP 0xdf - -/* Definitions for the mapping registers */ -#define APB_IO_SCALE 0x200000 -#define APB_MEM_SCALE 0x20000000 - -/* - * Generic device interface - */ -static int -apb_probe(device_t dev) -{ - - if (pci_get_vendor(dev) == 0x108e && /* Sun */ - pci_get_device(dev) == 0x5000) { /* APB */ - device_set_desc(dev, "APB PCI-PCI bridge"); - return (0); - } - return (ENXIO); -} - -static void -apb_map_print(uint8_t map, rman_res_t scale) -{ - int i, first; - - for (first = 1, i = 0; i < 8; i++) { - if ((map & (1 << i)) != 0) { - printf("%s0x%jx-0x%jx", first ? "" : ", ", - i * scale, (i + 1) * scale - 1); - first = 0; - } - } -} - -static int -apb_checkrange(uint8_t map, rman_res_t scale, rman_res_t start, rman_res_t end) -{ - int i, ei; - - i = start / scale; - ei = end / scale; - if (i > 7 || ei > 7) - return (0); - for (; i <= ei; i++) - if ((map & (1 << i)) == 0) - return (0); - return (1); -} - -static int -apb_attach(device_t dev) -{ - struct apb_softc *sc; - struct sysctl_ctx_list *sctx; - struct sysctl_oid *soid; - - sc = device_get_softc(dev); - - /* - * Get current bridge configuration. - */ - sc->sc_bsc.ops_pcib_sc.domain = pci_get_domain(dev); - sc->sc_bsc.ops_pcib_sc.pribus = pci_get_bus(dev); - pci_write_config(dev, PCIR_PRIBUS_1, sc->sc_bsc.ops_pcib_sc.pribus, 1); - sc->sc_bsc.ops_pcib_sc.bus.sec = - pci_read_config(dev, PCIR_SECBUS_1, 1); - sc->sc_bsc.ops_pcib_sc.bus.sub = - pci_read_config(dev, PCIR_SUBBUS_1, 1); - sc->sc_bsc.ops_pcib_sc.bridgectl = - pci_read_config(dev, PCIR_BRIDGECTL_1, 2); - sc->sc_iomap = pci_read_config(dev, APBR_IOMAP, 1); - sc->sc_memmap = pci_read_config(dev, APBR_MEMMAP, 1); - - /* - * Setup SYSCTL reporting nodes. - */ - sctx = device_get_sysctl_ctx(dev); - soid = device_get_sysctl_tree(dev); - SYSCTL_ADD_UINT(sctx, SYSCTL_CHILDREN(soid), OID_AUTO, "domain", - CTLFLAG_RD, &sc->sc_bsc.ops_pcib_sc.domain, 0, - "Domain number"); - SYSCTL_ADD_UINT(sctx, SYSCTL_CHILDREN(soid), OID_AUTO, "pribus", - CTLFLAG_RD, &sc->sc_bsc.ops_pcib_sc.pribus, 0, - "Primary bus number"); - SYSCTL_ADD_UINT(sctx, SYSCTL_CHILDREN(soid), OID_AUTO, "secbus", - CTLFLAG_RD, &sc->sc_bsc.ops_pcib_sc.bus.sec, 0, - "Secondary bus number"); - SYSCTL_ADD_UINT(sctx, SYSCTL_CHILDREN(soid), OID_AUTO, "subbus", - CTLFLAG_RD, &sc->sc_bsc.ops_pcib_sc.bus.sub, 0, - "Subordinate bus number"); - - ofw_pcib_gen_setup(dev); - - if (bootverbose) { - device_printf(dev, " domain %d\n", - sc->sc_bsc.ops_pcib_sc.domain); - device_printf(dev, " secondary bus %d\n", - sc->sc_bsc.ops_pcib_sc.bus.sec); - device_printf(dev, " subordinate bus %d\n", - sc->sc_bsc.ops_pcib_sc.bus.sub); - device_printf(dev, " I/O decode "); - apb_map_print(sc->sc_iomap, APB_IO_SCALE); - printf("\n"); - device_printf(dev, " memory decode "); - apb_map_print(sc->sc_memmap, APB_MEM_SCALE); - printf("\n"); - } - - device_add_child(dev, "pci", -1); - return (bus_generic_attach(dev)); -} - -/* - * We have to trap resource allocation requests and ensure that the bridge - * is set up to, or capable of handling them. - */ -static struct resource * -apb_alloc_resource(device_t dev, device_t child, int type, int *rid, - rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) -{ - struct apb_softc *sc; - - sc = device_get_softc(dev); - - /* - * If this is a "default" allocation against this rid, we can't work - * out where it's coming from (we should actually never see these) so - * we just have to punt. - */ - if (RMAN_IS_DEFAULT_RANGE(start, end)) { - device_printf(dev, "can't decode default resource id %d for " - "%s, bypassing\n", *rid, device_get_nameunit(child)); - goto passup; - } - - /* - * Fail the allocation for this range if it's not supported. - * XXX we should probably just fix up the bridge decode and - * soldier on. - */ - switch (type) { - case SYS_RES_IOPORT: - if (!apb_checkrange(sc->sc_iomap, APB_IO_SCALE, start, end)) { - device_printf(dev, "device %s requested unsupported " - "I/O range 0x%jx-0x%jx\n", - device_get_nameunit(child), start, end); - return (NULL); - } - if (bootverbose) - device_printf(sc->sc_bsc.ops_pcib_sc.dev, "device " - "%s requested decoded I/O range 0x%jx-0x%jx\n", - device_get_nameunit(child), start, end); - break; - case SYS_RES_MEMORY: - if (!apb_checkrange(sc->sc_memmap, APB_MEM_SCALE, start, - end)) { - device_printf(dev, "device %s requested unsupported " - "memory range 0x%jx-0x%jx\n", - device_get_nameunit(child), start, end); - return (NULL); - } - if (bootverbose) - device_printf(sc->sc_bsc.ops_pcib_sc.dev, "device " - "%s requested decoded memory range 0x%jx-0x%jx\n", - device_get_nameunit(child), start, end); - break; - } - - passup: - /* - * Bridge is OK decoding this resource, so pass it up. - */ - return (bus_generic_alloc_resource(dev, child, type, rid, start, end, - count, flags)); -} - -static int -apb_adjust_resource(device_t dev, device_t child, int type, - struct resource *r, rman_res_t start, rman_res_t end) -{ - struct apb_softc *sc; - - sc = device_get_softc(dev); - switch (type) { - case SYS_RES_IOPORT: - if (!apb_checkrange(sc->sc_iomap, APB_IO_SCALE, start, end)) - return (ENXIO); - break; - case SYS_RES_MEMORY: - if (!apb_checkrange(sc->sc_memmap, APB_MEM_SCALE, start, end)) - return (ENXIO); - break; - } - return (bus_generic_adjust_resource(dev, child, type, r, start, end)); -} diff --git a/sys/sparc64/pci/fire.c b/sys/sparc64/pci/fire.c deleted file mode 100644 index b978d7bead0baf..00000000000000 --- a/sys/sparc64/pci/fire.c +++ /dev/null @@ -1,1877 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1999, 2000 Matthew R. Green - * Copyright (c) 2001 - 2003 by Thomas Moestl - * Copyright (c) 2009 by Marius Strobl - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: NetBSD: psycho.c,v 1.39 2001/10/07 20:30:41 eeh Exp - * from: FreeBSD: psycho.c 183152 2008-09-18 19:45:22Z marius - */ - -#include -__FBSDID("$FreeBSD$"); - -/* - * Driver for `Fire' JBus to PCI Express and `Oberon' Uranus to PCI Express - * bridges - */ - -#include "opt_fire.h" -#include "opt_ofw_pci.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include - -#include "pcib_if.h" - -struct fire_msiqarg; - -static const struct fire_desc *fire_get_desc(device_t dev); -static void fire_dmamap_sync(bus_dma_tag_t dt __unused, bus_dmamap_t map, - bus_dmasync_op_t op); -static int fire_get_intrmap(struct fire_softc *sc, u_int ino, - bus_addr_t *intrmapptr, bus_addr_t *intrclrptr); -static void fire_intr_assign(void *arg); -static void fire_intr_clear(void *arg); -static void fire_intr_disable(void *arg); -static void fire_intr_enable(void *arg); -static int fire_intr_register(struct fire_softc *sc, u_int ino); -static inline void fire_msiq_common(struct intr_vector *iv, - struct fire_msiqarg *fmqa); -static void fire_msiq_filter(void *cookie); -static void fire_msiq_handler(void *cookie); -static void fire_set_intr(struct fire_softc *sc, u_int index, u_int ino, - driver_filter_t handler, void *arg); -static timecounter_get_t fire_get_timecount; - -/* Interrupt handlers */ -static driver_filter_t fire_dmc_pec; -static driver_filter_t fire_pcie; -static driver_filter_t fire_xcb; - -/* - * Methods - */ -static pcib_alloc_msi_t fire_alloc_msi; -static pcib_alloc_msix_t fire_alloc_msix; -static bus_alloc_resource_t fire_alloc_resource; -static device_attach_t fire_attach; -static pcib_map_msi_t fire_map_msi; -static pcib_maxslots_t fire_maxslots; -static device_probe_t fire_probe; -static pcib_read_config_t fire_read_config; -static pcib_release_msi_t fire_release_msi; -static pcib_release_msix_t fire_release_msix; -static pcib_route_interrupt_t fire_route_interrupt; -static bus_setup_intr_t fire_setup_intr; -static bus_teardown_intr_t fire_teardown_intr; -static pcib_write_config_t fire_write_config; - -static device_method_t fire_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, fire_probe), - DEVMETHOD(device_attach, fire_attach), - DEVMETHOD(device_shutdown, bus_generic_shutdown), - DEVMETHOD(device_suspend, bus_generic_suspend), - DEVMETHOD(device_resume, bus_generic_resume), - - /* Bus interface */ - DEVMETHOD(bus_read_ivar, ofw_pci_read_ivar), - DEVMETHOD(bus_setup_intr, fire_setup_intr), - DEVMETHOD(bus_teardown_intr, fire_teardown_intr), - DEVMETHOD(bus_alloc_resource, fire_alloc_resource), - DEVMETHOD(bus_activate_resource, ofw_pci_activate_resource), - DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), - DEVMETHOD(bus_adjust_resource, ofw_pci_adjust_resource), - DEVMETHOD(bus_release_resource, bus_generic_release_resource), - DEVMETHOD(bus_get_dma_tag, ofw_pci_get_dma_tag), - - /* pcib interface */ - DEVMETHOD(pcib_maxslots, fire_maxslots), - DEVMETHOD(pcib_read_config, fire_read_config), - DEVMETHOD(pcib_write_config, fire_write_config), - DEVMETHOD(pcib_route_interrupt, fire_route_interrupt), - DEVMETHOD(pcib_alloc_msi, fire_alloc_msi), - DEVMETHOD(pcib_release_msi, fire_release_msi), - DEVMETHOD(pcib_alloc_msix, fire_alloc_msix), - DEVMETHOD(pcib_release_msix, fire_release_msix), - DEVMETHOD(pcib_map_msi, fire_map_msi), - DEVMETHOD(pcib_request_feature, pcib_request_feature_allow), - - /* ofw_bus interface */ - DEVMETHOD(ofw_bus_get_node, ofw_pci_get_node), - - DEVMETHOD_END -}; - -static devclass_t fire_devclass; - -DEFINE_CLASS_0(pcib, fire_driver, fire_methods, sizeof(struct fire_softc)); -EARLY_DRIVER_MODULE(fire, nexus, fire_driver, fire_devclass, 0, 0, - BUS_PASS_BUS); -MODULE_DEPEND(fire, nexus, 1, 1, 1); - -static const struct intr_controller fire_ic = { - fire_intr_enable, - fire_intr_disable, - fire_intr_assign, - fire_intr_clear -}; - -struct fire_icarg { - struct fire_softc *fica_sc; - bus_addr_t fica_map; - bus_addr_t fica_clr; -}; - -static const struct intr_controller fire_msiqc_filter = { - fire_intr_enable, - fire_intr_disable, - fire_intr_assign, - NULL -}; - -struct fire_msiqarg { - struct fire_icarg fmqa_fica; - struct mtx fmqa_mtx; - struct fo_msiq_record *fmqa_base; - uint64_t fmqa_head; - uint64_t fmqa_tail; - uint32_t fmqa_msiq; - uint32_t fmqa_msi; -}; - -#define FIRE_PERF_CNT_QLTY 100 - -#define FIRE_SPC_BARRIER(spc, sc, offs, len, flags) \ - bus_barrier((sc)->sc_mem_res[(spc)], (offs), (len), (flags)) -#define FIRE_SPC_READ_8(spc, sc, offs) \ - bus_read_8((sc)->sc_mem_res[(spc)], (offs)) -#define FIRE_SPC_WRITE_8(spc, sc, offs, v) \ - bus_write_8((sc)->sc_mem_res[(spc)], (offs), (v)) - -#ifndef FIRE_DEBUG -#define FIRE_SPC_SET(spc, sc, offs, reg, v) \ - FIRE_SPC_WRITE_8((spc), (sc), (offs), (v)) -#else -#define FIRE_SPC_SET(spc, sc, offs, reg, v) do { \ - device_printf((sc)->sc_dev, reg " 0x%016llx -> 0x%016llx\n", \ - (unsigned long long)FIRE_SPC_READ_8((spc), (sc), (offs)), \ - (unsigned long long)(v)); \ - FIRE_SPC_WRITE_8((spc), (sc), (offs), (v)); \ - } while (0) -#endif - -#define FIRE_PCI_BARRIER(sc, offs, len, flags) \ - FIRE_SPC_BARRIER(FIRE_PCI, (sc), (offs), len, flags) -#define FIRE_PCI_READ_8(sc, offs) \ - FIRE_SPC_READ_8(FIRE_PCI, (sc), (offs)) -#define FIRE_PCI_WRITE_8(sc, offs, v) \ - FIRE_SPC_WRITE_8(FIRE_PCI, (sc), (offs), (v)) -#define FIRE_CTRL_BARRIER(sc, offs, len, flags) \ - FIRE_SPC_BARRIER(FIRE_CTRL, (sc), (offs), len, flags) -#define FIRE_CTRL_READ_8(sc, offs) \ - FIRE_SPC_READ_8(FIRE_CTRL, (sc), (offs)) -#define FIRE_CTRL_WRITE_8(sc, offs, v) \ - FIRE_SPC_WRITE_8(FIRE_CTRL, (sc), (offs), (v)) - -#define FIRE_PCI_SET(sc, offs, v) \ - FIRE_SPC_SET(FIRE_PCI, (sc), (offs), # offs, (v)) -#define FIRE_CTRL_SET(sc, offs, v) \ - FIRE_SPC_SET(FIRE_CTRL, (sc), (offs), # offs, (v)) - -struct fire_desc { - const char *fd_string; - int fd_mode; - const char *fd_name; -}; - -static const struct fire_desc fire_compats[] = { - { "pciex108e,80f0", FIRE_MODE_FIRE, "Fire" }, -#if 0 - { "pciex108e,80f8", FIRE_MODE_OBERON, "Oberon" }, -#endif - { NULL, 0, NULL } -}; - -static const struct fire_desc * -fire_get_desc(device_t dev) -{ - const struct fire_desc *desc; - const char *compat; - - compat = ofw_bus_get_compat(dev); - if (compat == NULL) - return (NULL); - for (desc = fire_compats; desc->fd_string != NULL; desc++) - if (strcmp(desc->fd_string, compat) == 0) - return (desc); - return (NULL); -} - -static int -fire_probe(device_t dev) -{ - const char *dtype; - - dtype = ofw_bus_get_type(dev); - if (dtype != NULL && strcmp(dtype, OFW_TYPE_PCIE) == 0 && - fire_get_desc(dev) != NULL) { - device_set_desc(dev, "Sun Host-PCIe bridge"); - return (BUS_PROBE_GENERIC); - } - return (ENXIO); -} - -static int -fire_attach(device_t dev) -{ - struct fire_softc *sc; - const struct fire_desc *desc; - struct ofw_pci_msi_ranges msi_ranges; - struct ofw_pci_msi_addr_ranges msi_addr_ranges; - struct ofw_pci_msi_eq_to_devino msi_eq_to_devino; - struct fire_msiqarg *fmqa; - struct timecounter *tc; - bus_dma_tag_t dmat; - uint64_t ino_bitmap, val; - phandle_t node; - uint32_t prop, prop_array[2]; - int i, j, mode; - u_int lw; - uint16_t mps; - - sc = device_get_softc(dev); - node = ofw_bus_get_node(dev); - desc = fire_get_desc(dev); - mode = desc->fd_mode; - - sc->sc_dev = dev; - sc->sc_mode = mode; - sc->sc_flags = 0; - - mtx_init(&sc->sc_msi_mtx, "msi_mtx", NULL, MTX_DEF); - mtx_init(&sc->sc_pcib_mtx, "pcib_mtx", NULL, MTX_SPIN); - - /* - * Fire and Oberon have two register banks: - * (0) per-PBM PCI Express configuration and status registers - * (1) (shared) Fire/Oberon controller configuration and status - * registers - */ - for (i = 0; i < FIRE_NREG; i++) { - j = i; - sc->sc_mem_res[i] = bus_alloc_resource_any(dev, - SYS_RES_MEMORY, &j, RF_ACTIVE); - if (sc->sc_mem_res[i] == NULL) - panic("%s: could not allocate register bank %d", - __func__, i); - } - - if (OF_getprop(node, "portid", &sc->sc_ign, sizeof(sc->sc_ign)) == -1) - panic("%s: could not determine IGN", __func__); - if (OF_getprop(node, "module-revision#", &prop, sizeof(prop)) == -1) - panic("%s: could not determine module-revision", __func__); - - device_printf(dev, "%s, module-revision %d, IGN %#x\n", - desc->fd_name, prop, sc->sc_ign); - - /* - * Hunt through all the interrupt mapping regs and register - * the interrupt controller for our interrupt vectors. We do - * this early in order to be able to catch stray interrupts. - */ - i = OF_getprop(node, "ino-bitmap", (void *)prop_array, - sizeof(prop_array)); - if (i == -1) - panic("%s: could not get ino-bitmap", __func__); - ino_bitmap = ((uint64_t)prop_array[1] << 32) | prop_array[0]; - for (i = 0; i <= FO_MAX_INO; i++) { - if ((ino_bitmap & (1ULL << i)) == 0) - continue; - j = fire_intr_register(sc, i); - if (j != 0) - device_printf(dev, "could not register interrupt " - "controller for INO %d (%d)\n", i, j); - } - - /* JBC/UBC module initialization */ - FIRE_CTRL_SET(sc, FO_XBC_ERR_LOG_EN, ~0ULL); - FIRE_CTRL_SET(sc, FO_XBC_ERR_STAT_CLR, ~0ULL); - /* not enabled by OpenSolaris */ - FIRE_CTRL_SET(sc, FO_XBC_INT_EN, ~0ULL); - if (sc->sc_mode == FIRE_MODE_FIRE) { - FIRE_CTRL_SET(sc, FIRE_JBUS_PAR_CTRL, - FIRE_JBUS_PAR_CTRL_P_EN); - FIRE_CTRL_SET(sc, FIRE_JBC_FATAL_RST_EN, - ((1ULL << FIRE_JBC_FATAL_RST_EN_SPARE_P_INT_SHFT) & - FIRE_JBC_FATAL_RST_EN_SPARE_P_INT_MASK) | - FIRE_JBC_FATAL_RST_EN_MB_PEA_P_INT | - FIRE_JBC_FATAL_RST_EN_CPE_P_INT | - FIRE_JBC_FATAL_RST_EN_APE_P_INT | - FIRE_JBC_FATAL_RST_EN_PIO_CPE_INT | - FIRE_JBC_FATAL_RST_EN_JTCEEW_P_INT | - FIRE_JBC_FATAL_RST_EN_JTCEEI_P_INT | - FIRE_JBC_FATAL_RST_EN_JTCEER_P_INT); - FIRE_CTRL_SET(sc, FIRE_JBC_CORE_BLOCK_INT_EN, ~0ULL); - } - - /* TLU initialization */ - FIRE_PCI_SET(sc, FO_PCI_TLU_OEVENT_STAT_CLR, - FO_PCI_TLU_OEVENT_S_MASK | FO_PCI_TLU_OEVENT_P_MASK); - /* not enabled by OpenSolaris */ - FIRE_PCI_SET(sc, FO_PCI_TLU_OEVENT_INT_EN, - FO_PCI_TLU_OEVENT_S_MASK | FO_PCI_TLU_OEVENT_P_MASK); - FIRE_PCI_SET(sc, FO_PCI_TLU_UERR_STAT_CLR, - FO_PCI_TLU_UERR_INT_S_MASK | FO_PCI_TLU_UERR_INT_P_MASK); - /* not enabled by OpenSolaris */ - FIRE_PCI_SET(sc, FO_PCI_TLU_UERR_INT_EN, - FO_PCI_TLU_UERR_INT_S_MASK | FO_PCI_TLU_UERR_INT_P_MASK); - FIRE_PCI_SET(sc, FO_PCI_TLU_CERR_STAT_CLR, - FO_PCI_TLU_CERR_INT_S_MASK | FO_PCI_TLU_CERR_INT_P_MASK); - /* not enabled by OpenSolaris */ - FIRE_PCI_SET(sc, FO_PCI_TLU_CERR_INT_EN, - FO_PCI_TLU_CERR_INT_S_MASK | FO_PCI_TLU_CERR_INT_P_MASK); - val = FIRE_PCI_READ_8(sc, FO_PCI_TLU_CTRL) | - ((FO_PCI_TLU_CTRL_L0S_TIM_DFLT << FO_PCI_TLU_CTRL_L0S_TIM_SHFT) & - FO_PCI_TLU_CTRL_L0S_TIM_MASK) | - ((FO_PCI_TLU_CTRL_CFG_DFLT << FO_PCI_TLU_CTRL_CFG_SHFT) & - FO_PCI_TLU_CTRL_CFG_MASK); - if (sc->sc_mode == FIRE_MODE_OBERON) - val &= ~FO_PCI_TLU_CTRL_NWPR_EN; - val |= FO_PCI_TLU_CTRL_CFG_REMAIN_DETECT_QUIET; - FIRE_PCI_SET(sc, FO_PCI_TLU_CTRL, val); - FIRE_PCI_SET(sc, FO_PCI_TLU_DEV_CTRL, 0); - FIRE_PCI_SET(sc, FO_PCI_TLU_LNK_CTRL, FO_PCI_TLU_LNK_CTRL_CLK); - - /* DLU/LPU initialization */ - if (sc->sc_mode == FIRE_MODE_OBERON) - FIRE_PCI_SET(sc, FO_PCI_LPU_INT_MASK, 0); - else - FIRE_PCI_SET(sc, FO_PCI_LPU_RST, 0); - FIRE_PCI_SET(sc, FO_PCI_LPU_LNK_LYR_CFG, - FO_PCI_LPU_LNK_LYR_CFG_VC0_EN); - FIRE_PCI_SET(sc, FO_PCI_LPU_FLW_CTRL_UPDT_CTRL, - FO_PCI_LPU_FLW_CTRL_UPDT_CTRL_FC0_NP_EN | - FO_PCI_LPU_FLW_CTRL_UPDT_CTRL_FC0_P_EN); - if (sc->sc_mode == FIRE_MODE_OBERON) - FIRE_PCI_SET(sc, FO_PCI_LPU_TXLNK_RPLY_TMR_THRS, - (OBERON_PCI_LPU_TXLNK_RPLY_TMR_THRS_DFLT << - FO_PCI_LPU_TXLNK_RPLY_TMR_THRS_SHFT) & - FO_PCI_LPU_TXLNK_RPLY_TMR_THRS_MASK); - else { - switch ((FIRE_PCI_READ_8(sc, FO_PCI_TLU_LNK_STAT) & - FO_PCI_TLU_LNK_STAT_WDTH_MASK) >> - FO_PCI_TLU_LNK_STAT_WDTH_SHFT) { - case 1: - lw = 0; - break; - case 4: - lw = 1; - break; - case 8: - lw = 2; - break; - case 16: - lw = 3; - break; - default: - lw = 0; - } - mps = (FIRE_PCI_READ_8(sc, FO_PCI_TLU_CTRL) & - FO_PCI_TLU_CTRL_CFG_MPS_MASK) >> - FO_PCI_TLU_CTRL_CFG_MPS_SHFT; - i = sizeof(fire_freq_nak_tmr_thrs) / - sizeof(*fire_freq_nak_tmr_thrs); - if (mps >= i) - mps = i - 1; - FIRE_PCI_SET(sc, FO_PCI_LPU_TXLNK_FREQ_LAT_TMR_THRS, - (fire_freq_nak_tmr_thrs[mps][lw] << - FO_PCI_LPU_TXLNK_FREQ_LAT_TMR_THRS_SHFT) & - FO_PCI_LPU_TXLNK_FREQ_LAT_TMR_THRS_MASK); - FIRE_PCI_SET(sc, FO_PCI_LPU_TXLNK_RPLY_TMR_THRS, - (fire_rply_tmr_thrs[mps][lw] << - FO_PCI_LPU_TXLNK_RPLY_TMR_THRS_SHFT) & - FO_PCI_LPU_TXLNK_RPLY_TMR_THRS_MASK); - FIRE_PCI_SET(sc, FO_PCI_LPU_TXLNK_RTR_FIFO_PTR, - ((FO_PCI_LPU_TXLNK_RTR_FIFO_PTR_TL_DFLT << - FO_PCI_LPU_TXLNK_RTR_FIFO_PTR_TL_SHFT) & - FO_PCI_LPU_TXLNK_RTR_FIFO_PTR_TL_MASK) | - ((FO_PCI_LPU_TXLNK_RTR_FIFO_PTR_HD_DFLT << - FO_PCI_LPU_TXLNK_RTR_FIFO_PTR_HD_SHFT) & - FO_PCI_LPU_TXLNK_RTR_FIFO_PTR_HD_MASK)); - FIRE_PCI_SET(sc, FO_PCI_LPU_LTSSM_CFG2, - (FO_PCI_LPU_LTSSM_CFG2_12_TO_DFLT << - FO_PCI_LPU_LTSSM_CFG2_12_TO_SHFT) & - FO_PCI_LPU_LTSSM_CFG2_12_TO_MASK); - FIRE_PCI_SET(sc, FO_PCI_LPU_LTSSM_CFG3, - (FO_PCI_LPU_LTSSM_CFG3_2_TO_DFLT << - FO_PCI_LPU_LTSSM_CFG3_2_TO_SHFT) & - FO_PCI_LPU_LTSSM_CFG3_2_TO_MASK); - FIRE_PCI_SET(sc, FO_PCI_LPU_LTSSM_CFG4, - ((FO_PCI_LPU_LTSSM_CFG4_DATA_RATE_DFLT << - FO_PCI_LPU_LTSSM_CFG4_DATA_RATE_SHFT) & - FO_PCI_LPU_LTSSM_CFG4_DATA_RATE_MASK) | - ((FO_PCI_LPU_LTSSM_CFG4_N_FTS_DFLT << - FO_PCI_LPU_LTSSM_CFG4_N_FTS_SHFT) & - FO_PCI_LPU_LTSSM_CFG4_N_FTS_MASK)); - FIRE_PCI_SET(sc, FO_PCI_LPU_LTSSM_CFG5, 0); - } - - /* ILU initialization */ - FIRE_PCI_SET(sc, FO_PCI_ILU_ERR_STAT_CLR, ~0ULL); - /* not enabled by OpenSolaris */ - FIRE_PCI_SET(sc, FO_PCI_ILU_INT_EN, ~0ULL); - - /* IMU initialization */ - FIRE_PCI_SET(sc, FO_PCI_IMU_ERR_STAT_CLR, ~0ULL); - FIRE_PCI_SET(sc, FO_PCI_IMU_INT_EN, - FIRE_PCI_READ_8(sc, FO_PCI_IMU_INT_EN) & - ~(FO_PCI_IMU_ERR_INT_FATAL_MES_NOT_EN_S | - FO_PCI_IMU_ERR_INT_NFATAL_MES_NOT_EN_S | - FO_PCI_IMU_ERR_INT_COR_MES_NOT_EN_S | - FO_PCI_IMU_ERR_INT_FATAL_MES_NOT_EN_P | - FO_PCI_IMU_ERR_INT_NFATAL_MES_NOT_EN_P | - FO_PCI_IMU_ERR_INT_COR_MES_NOT_EN_P)); - - /* MMU initialization */ - FIRE_PCI_SET(sc, FO_PCI_MMU_ERR_STAT_CLR, - FO_PCI_MMU_ERR_INT_S_MASK | FO_PCI_MMU_ERR_INT_P_MASK); - /* not enabled by OpenSolaris */ - FIRE_PCI_SET(sc, FO_PCI_MMU_INT_EN, - FO_PCI_MMU_ERR_INT_S_MASK | FO_PCI_MMU_ERR_INT_P_MASK); - - /* DMC initialization */ - FIRE_PCI_SET(sc, FO_PCI_DMC_CORE_BLOCK_INT_EN, ~0ULL); - FIRE_PCI_SET(sc, FO_PCI_DMC_DBG_SEL_PORTA, 0); - FIRE_PCI_SET(sc, FO_PCI_DMC_DBG_SEL_PORTB, 0); - - /* PEC initialization */ - FIRE_PCI_SET(sc, FO_PCI_PEC_CORE_BLOCK_INT_EN, ~0ULL); - - /* Establish handlers for interesting interrupts. */ - if ((ino_bitmap & (1ULL << FO_DMC_PEC_INO)) != 0) - fire_set_intr(sc, 1, FO_DMC_PEC_INO, fire_dmc_pec, sc); - if ((ino_bitmap & (1ULL << FO_XCB_INO)) != 0) - fire_set_intr(sc, 0, FO_XCB_INO, fire_xcb, sc); - - /* MSI/MSI-X support */ - if (OF_getprop(node, "#msi", &sc->sc_msi_count, - sizeof(sc->sc_msi_count)) == -1) - panic("%s: could not determine MSI count", __func__); - if (OF_getprop(node, "msi-ranges", &msi_ranges, - sizeof(msi_ranges)) == -1) - sc->sc_msi_first = 0; - else - sc->sc_msi_first = msi_ranges.first; - if (OF_getprop(node, "msi-data-mask", &sc->sc_msi_data_mask, - sizeof(sc->sc_msi_data_mask)) == -1) - panic("%s: could not determine MSI data mask", __func__); - if (OF_getprop(node, "msix-data-width", &sc->sc_msix_data_width, - sizeof(sc->sc_msix_data_width)) > 0) - sc->sc_flags |= FIRE_MSIX; - if (OF_getprop(node, "msi-address-ranges", &msi_addr_ranges, - sizeof(msi_addr_ranges)) == -1) - panic("%s: could not determine MSI address ranges", __func__); - sc->sc_msi_addr32 = OFW_PCI_MSI_ADDR_RANGE_32(&msi_addr_ranges); - sc->sc_msi_addr64 = OFW_PCI_MSI_ADDR_RANGE_64(&msi_addr_ranges); - if (OF_getprop(node, "#msi-eqs", &sc->sc_msiq_count, - sizeof(sc->sc_msiq_count)) == -1) - panic("%s: could not determine MSI event queue count", - __func__); - if (OF_getprop(node, "msi-eq-size", &sc->sc_msiq_size, - sizeof(sc->sc_msiq_size)) == -1) - panic("%s: could not determine MSI event queue size", - __func__); - if (OF_getprop(node, "msi-eq-to-devino", &msi_eq_to_devino, - sizeof(msi_eq_to_devino)) == -1 && - OF_getprop(node, "msi-eq-devino", &msi_eq_to_devino, - sizeof(msi_eq_to_devino)) == -1) { - sc->sc_msiq_first = 0; - sc->sc_msiq_ino_first = FO_EQ_FIRST_INO; - } else { - sc->sc_msiq_first = msi_eq_to_devino.eq_first; - sc->sc_msiq_ino_first = msi_eq_to_devino.devino_first; - } - if (sc->sc_msiq_ino_first < FO_EQ_FIRST_INO || - sc->sc_msiq_ino_first + sc->sc_msiq_count - 1 > FO_EQ_LAST_INO) - panic("%s: event queues exceed INO range", __func__); - sc->sc_msi_bitmap = malloc(roundup2(sc->sc_msi_count, NBBY) / NBBY, - M_DEVBUF, M_NOWAIT | M_ZERO); - if (sc->sc_msi_bitmap == NULL) - panic("%s: could not malloc MSI bitmap", __func__); - sc->sc_msi_msiq_table = malloc(sc->sc_msi_count * - sizeof(*sc->sc_msi_msiq_table), M_DEVBUF, M_NOWAIT | M_ZERO); - if (sc->sc_msi_msiq_table == NULL) - panic("%s: could not malloc MSI-MSI event queue table", - __func__); - sc->sc_msiq_bitmap = malloc(roundup2(sc->sc_msiq_count, NBBY) / NBBY, - M_DEVBUF, M_NOWAIT | M_ZERO); - if (sc->sc_msiq_bitmap == NULL) - panic("%s: could not malloc MSI event queue bitmap", __func__); - j = FO_EQ_RECORD_SIZE * FO_EQ_NRECORDS * sc->sc_msiq_count; - sc->sc_msiq = contigmalloc(j, M_DEVBUF, M_NOWAIT, 0, ~0UL, - FO_EQ_ALIGNMENT, 0); - if (sc->sc_msiq == NULL) - panic("%s: could not contigmalloc MSI event queue", __func__); - memset(sc->sc_msiq, 0, j); - FIRE_PCI_SET(sc, FO_PCI_EQ_BASE_ADDR, FO_PCI_EQ_BASE_ADDR_BYPASS | - (pmap_kextract((vm_offset_t)sc->sc_msiq) & - FO_PCI_EQ_BASE_ADDR_MASK)); - for (i = 0; i < sc->sc_msi_count; i++) { - j = (i + sc->sc_msi_first) << 3; - FIRE_PCI_WRITE_8(sc, FO_PCI_MSI_MAP_BASE + j, - FIRE_PCI_READ_8(sc, FO_PCI_MSI_MAP_BASE + j) & - ~FO_PCI_MSI_MAP_V); - } - for (i = 0; i < sc->sc_msiq_count; i++) { - j = i + sc->sc_msiq_ino_first; - if ((ino_bitmap & (1ULL << j)) == 0) { - mtx_lock(&sc->sc_msi_mtx); - setbit(sc->sc_msiq_bitmap, i); - mtx_unlock(&sc->sc_msi_mtx); - } - fmqa = intr_vectors[INTMAP_VEC(sc->sc_ign, j)].iv_icarg; - mtx_init(&fmqa->fmqa_mtx, "msiq_mtx", NULL, MTX_SPIN); - fmqa->fmqa_base = - (struct fo_msiq_record *)((caddr_t)sc->sc_msiq + - (FO_EQ_RECORD_SIZE * FO_EQ_NRECORDS * i)); - j = i + sc->sc_msiq_first; - fmqa->fmqa_msiq = j; - j <<= 3; - fmqa->fmqa_head = FO_PCI_EQ_HD_BASE + j; - fmqa->fmqa_tail = FO_PCI_EQ_TL_BASE + j; - FIRE_PCI_WRITE_8(sc, FO_PCI_EQ_CTRL_CLR_BASE + j, - FO_PCI_EQ_CTRL_CLR_COVERR | FO_PCI_EQ_CTRL_CLR_E2I | - FO_PCI_EQ_CTRL_CLR_DIS); - FIRE_PCI_WRITE_8(sc, fmqa->fmqa_tail, - (0 << FO_PCI_EQ_TL_SHFT) & FO_PCI_EQ_TL_MASK); - FIRE_PCI_WRITE_8(sc, fmqa->fmqa_head, - (0 << FO_PCI_EQ_HD_SHFT) & FO_PCI_EQ_HD_MASK); - } - FIRE_PCI_SET(sc, FO_PCI_MSI_32_BIT_ADDR, sc->sc_msi_addr32 & - FO_PCI_MSI_32_BIT_ADDR_MASK); - FIRE_PCI_SET(sc, FO_PCI_MSI_64_BIT_ADDR, sc->sc_msi_addr64 & - FO_PCI_MSI_64_BIT_ADDR_MASK); - - /* - * Establish a handler for interesting PCIe messages and disable - * unintersting ones. - */ - mtx_lock(&sc->sc_msi_mtx); - for (i = 0; i < sc->sc_msiq_count; i++) { - if (isclr(sc->sc_msiq_bitmap, i) != 0) { - j = i; - break; - } - } - if (i == sc->sc_msiq_count) { - mtx_unlock(&sc->sc_msi_mtx); - panic("%s: no spare event queue for PCIe messages", __func__); - } - setbit(sc->sc_msiq_bitmap, j); - mtx_unlock(&sc->sc_msi_mtx); - i = INTMAP_VEC(sc->sc_ign, j + sc->sc_msiq_ino_first); - if (bus_set_resource(dev, SYS_RES_IRQ, 2, i, 1) != 0) - panic("%s: failed to add interrupt for PCIe messages", - __func__); - fire_set_intr(sc, 2, INTINO(i), fire_pcie, intr_vectors[i].iv_icarg); - j += sc->sc_msiq_first; - /* - * "Please note that setting the EQNUM field to a value larger than - * 35 will yield unpredictable results." - */ - if (j > 35) - panic("%s: invalid queue for PCIe messages (%d)", - __func__, j); - FIRE_PCI_SET(sc, FO_PCI_ERR_COR, FO_PCI_ERR_PME_V | - ((j << FO_PCI_ERR_PME_EQNUM_SHFT) & FO_PCI_ERR_PME_EQNUM_MASK)); - FIRE_PCI_SET(sc, FO_PCI_ERR_NONFATAL, FO_PCI_ERR_PME_V | - ((j << FO_PCI_ERR_PME_EQNUM_SHFT) & FO_PCI_ERR_PME_EQNUM_MASK)); - FIRE_PCI_SET(sc, FO_PCI_ERR_FATAL, FO_PCI_ERR_PME_V | - ((j << FO_PCI_ERR_PME_EQNUM_SHFT) & FO_PCI_ERR_PME_EQNUM_MASK)); - FIRE_PCI_SET(sc, FO_PCI_PM_PME, 0); - FIRE_PCI_SET(sc, FO_PCI_PME_TO_ACK, 0); - FIRE_PCI_WRITE_8(sc, FO_PCI_EQ_CTRL_SET_BASE + (j << 3), - FO_PCI_EQ_CTRL_SET_EN); - -#define TC_COUNTER_MAX_MASK 0xffffffff - - /* - * Setup JBC/UBC performance counter 0 in bus cycle counting - * mode as timecounter. - */ - if (device_get_unit(dev) == 0) { - FIRE_CTRL_SET(sc, FO_XBC_PRF_CNT0, 0); - FIRE_CTRL_SET(sc, FO_XBC_PRF_CNT1, 0); - FIRE_CTRL_SET(sc, FO_XBC_PRF_CNT_SEL, - (FO_XBC_PRF_CNT_NONE << FO_XBC_PRF_CNT_CNT1_SHFT) | - (FO_XBC_PRF_CNT_XB_CLK << FO_XBC_PRF_CNT_CNT0_SHFT)); - tc = malloc(sizeof(*tc), M_DEVBUF, M_NOWAIT | M_ZERO); - if (tc == NULL) - panic("%s: could not malloc timecounter", __func__); - tc->tc_get_timecount = fire_get_timecount; - tc->tc_counter_mask = TC_COUNTER_MAX_MASK; - if (OF_getprop(OF_peer(0), "clock-frequency", &prop, - sizeof(prop)) == -1) - panic("%s: could not determine clock frequency", - __func__); - tc->tc_frequency = prop; - tc->tc_name = strdup(device_get_nameunit(dev), M_DEVBUF); - tc->tc_priv = sc; - /* - * Due to initial problems with the JBus-driven performance - * counters not advancing which might be firmware dependent - * ensure that it actually works. - */ - if (fire_get_timecount(tc) - fire_get_timecount(tc) != 0) - tc->tc_quality = FIRE_PERF_CNT_QLTY; - else - tc->tc_quality = -FIRE_PERF_CNT_QLTY; - tc_init(tc); - } - - /* - * Set up the IOMMU. Both Fire and Oberon have one per PBM, but - * neither has a streaming buffer. - */ - memcpy(&sc->sc_dma_methods, &iommu_dma_methods, - sizeof(sc->sc_dma_methods)); - sc->sc_is.is_flags = IOMMU_FIRE | IOMMU_PRESERVE_PROM; - if (sc->sc_mode == FIRE_MODE_OBERON) { - sc->sc_is.is_flags |= IOMMU_FLUSH_CACHE; - sc->sc_is.is_pmaxaddr = IOMMU_MAXADDR(OBERON_IOMMU_BITS); - } else { - sc->sc_dma_methods.dm_dmamap_sync = fire_dmamap_sync; - sc->sc_is.is_pmaxaddr = IOMMU_MAXADDR(FIRE_IOMMU_BITS); - } - sc->sc_is.is_sb[0] = sc->sc_is.is_sb[1] = 0; - /* Punch in our copies. */ - sc->sc_is.is_bustag = rman_get_bustag(sc->sc_mem_res[FIRE_PCI]); - sc->sc_is.is_bushandle = rman_get_bushandle(sc->sc_mem_res[FIRE_PCI]); - sc->sc_is.is_iommu = FO_PCI_MMU; - val = FIRE_PCI_READ_8(sc, FO_PCI_MMU + IMR_CTL); - iommu_init(device_get_nameunit(dev), &sc->sc_is, 7, -1, 0); -#ifdef FIRE_DEBUG - device_printf(dev, "FO_PCI_MMU + IMR_CTL 0x%016llx -> 0x%016llx\n", - (long long unsigned)val, (long long unsigned)sc->sc_is.is_cr); -#endif - /* Create our DMA tag. */ - if (bus_dma_tag_create(bus_get_dma_tag(dev), 8, 0x100000000, - sc->sc_is.is_pmaxaddr, ~0, NULL, NULL, sc->sc_is.is_pmaxaddr, - 0xff, 0xffffffff, 0, NULL, NULL, &dmat) != 0) - panic("%s: could not create PCI DMA tag", __func__); - dmat->dt_cookie = &sc->sc_is; - dmat->dt_mt = &sc->sc_dma_methods; - - if (ofw_pci_attach_common(dev, dmat, FO_IO_SIZE, FO_MEM_SIZE) != 0) - panic("%s: ofw_pci_attach_common() failed", __func__); - -#define FIRE_SYSCTL_ADD_UINT(name, arg, desc) \ - SYSCTL_ADD_UINT(device_get_sysctl_ctx(dev), \ - SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, \ - (name), CTLFLAG_RD, (arg), 0, (desc)) - - FIRE_SYSCTL_ADD_UINT("ilu_err", &sc->sc_stats_ilu_err, - "ILU unknown errors"); - FIRE_SYSCTL_ADD_UINT("jbc_ce_async", &sc->sc_stats_jbc_ce_async, - "JBC correctable errors"); - FIRE_SYSCTL_ADD_UINT("jbc_unsol_int", &sc->sc_stats_jbc_unsol_int, - "JBC unsolicited interrupt ACK/NACK errors"); - FIRE_SYSCTL_ADD_UINT("jbc_unsol_rd", &sc->sc_stats_jbc_unsol_rd, - "JBC unsolicited read response errors"); - FIRE_SYSCTL_ADD_UINT("mmu_err", &sc->sc_stats_mmu_err, "MMU errors"); - FIRE_SYSCTL_ADD_UINT("tlu_ce", &sc->sc_stats_tlu_ce, - "DLU/TLU correctable errors"); - FIRE_SYSCTL_ADD_UINT("tlu_oe_non_fatal", - &sc->sc_stats_tlu_oe_non_fatal, - "DLU/TLU other event non-fatal errors summary"); - FIRE_SYSCTL_ADD_UINT("tlu_oe_rx_err", &sc->sc_stats_tlu_oe_rx_err, - "DLU/TLU receive other event errors"); - FIRE_SYSCTL_ADD_UINT("tlu_oe_tx_err", &sc->sc_stats_tlu_oe_tx_err, - "DLU/TLU transmit other event errors"); - FIRE_SYSCTL_ADD_UINT("ubc_dmardue", &sc->sc_stats_ubc_dmardue, - "UBC DMARDUE erros"); - -#undef FIRE_SYSCTL_ADD_UINT - - device_add_child(dev, "pci", -1); - return (bus_generic_attach(dev)); -} - -static void -fire_set_intr(struct fire_softc *sc, u_int index, u_int ino, - driver_filter_t handler, void *arg) -{ - u_long vec; - int rid; - - rid = index; - sc->sc_irq_res[index] = bus_alloc_resource_any(sc->sc_dev, - SYS_RES_IRQ, &rid, RF_ACTIVE); - if (sc->sc_irq_res[index] == NULL || - INTINO(vec = rman_get_start(sc->sc_irq_res[index])) != ino || - INTIGN(vec) != sc->sc_ign || - intr_vectors[vec].iv_ic != &fire_ic || - bus_setup_intr(sc->sc_dev, sc->sc_irq_res[index], - INTR_TYPE_MISC | INTR_BRIDGE, handler, NULL, arg, - &sc->sc_ihand[index]) != 0) - panic("%s: failed to set up interrupt %d", __func__, index); -} - -static int -fire_intr_register(struct fire_softc *sc, u_int ino) -{ - struct fire_icarg *fica; - bus_addr_t intrclr, intrmap; - int error; - - if (fire_get_intrmap(sc, ino, &intrmap, &intrclr) == 0) - return (ENXIO); - fica = malloc((ino >= FO_EQ_FIRST_INO && ino <= FO_EQ_LAST_INO) ? - sizeof(struct fire_msiqarg) : sizeof(struct fire_icarg), M_DEVBUF, - M_NOWAIT | M_ZERO); - if (fica == NULL) - return (ENOMEM); - fica->fica_sc = sc; - fica->fica_map = intrmap; - fica->fica_clr = intrclr; - error = (intr_controller_register(INTMAP_VEC(sc->sc_ign, ino), - &fire_ic, fica)); - if (error != 0) - free(fica, M_DEVBUF); - return (error); -} - -static int -fire_get_intrmap(struct fire_softc *sc, u_int ino, bus_addr_t *intrmapptr, - bus_addr_t *intrclrptr) -{ - - if (ino > FO_MAX_INO) { - device_printf(sc->sc_dev, "out of range INO %d requested\n", - ino); - return (0); - } - - ino <<= 3; - if (intrmapptr != NULL) - *intrmapptr = FO_PCI_INT_MAP_BASE + ino; - if (intrclrptr != NULL) - *intrclrptr = FO_PCI_INT_CLR_BASE + ino; - return (1); -} - -/* - * Interrupt handlers - */ -static int -fire_dmc_pec(void *arg) -{ - struct fire_softc *sc; - device_t dev; - uint64_t cestat, dmcstat, ilustat, imustat, mcstat, mmustat, mmutfar; - uint64_t mmutfsr, oestat, pecstat, uestat, val; - u_int fatal, oenfatal; - - fatal = 0; - sc = arg; - dev = sc->sc_dev; - mtx_lock_spin(&sc->sc_pcib_mtx); - mcstat = FIRE_PCI_READ_8(sc, FO_PCI_MULTI_CORE_ERR_STAT); - if ((mcstat & FO_PCI_MULTI_CORE_ERR_STAT_DMC) != 0) { - dmcstat = FIRE_PCI_READ_8(sc, FO_PCI_DMC_CORE_BLOCK_ERR_STAT); - if ((dmcstat & FO_PCI_DMC_CORE_BLOCK_INT_EN_IMU) != 0) { - imustat = FIRE_PCI_READ_8(sc, FO_PCI_IMU_INT_STAT); - device_printf(dev, "IMU error %#llx\n", - (unsigned long long)imustat); - if ((imustat & - FO_PCI_IMU_ERR_INT_EQ_NOT_EN_P) != 0) { - fatal = 1; - val = FIRE_PCI_READ_8(sc, - FO_PCI_IMU_SCS_ERR_LOG); - device_printf(dev, "SCS error log %#llx\n", - (unsigned long long)val); - } - if ((imustat & FO_PCI_IMU_ERR_INT_EQ_OVER_P) != 0) { - fatal = 1; - val = FIRE_PCI_READ_8(sc, - FO_PCI_IMU_EQS_ERR_LOG); - device_printf(dev, "EQS error log %#llx\n", - (unsigned long long)val); - } - if ((imustat & (FO_PCI_IMU_ERR_INT_MSI_MAL_ERR_P | - FO_PCI_IMU_ERR_INT_MSI_PAR_ERR_P | - FO_PCI_IMU_ERR_INT_PMEACK_MES_NOT_EN_P | - FO_PCI_IMU_ERR_INT_PMPME_MES_NOT_EN_P | - FO_PCI_IMU_ERR_INT_FATAL_MES_NOT_EN_P | - FO_PCI_IMU_ERR_INT_NFATAL_MES_NOT_EN_P | - FO_PCI_IMU_ERR_INT_COR_MES_NOT_EN_P | - FO_PCI_IMU_ERR_INT_MSI_NOT_EN_P)) != 0) { - fatal = 1; - val = FIRE_PCI_READ_8(sc, - FO_PCI_IMU_RDS_ERR_LOG); - device_printf(dev, "RDS error log %#llx\n", - (unsigned long long)val); - } - } - if ((dmcstat & FO_PCI_DMC_CORE_BLOCK_INT_EN_MMU) != 0) { - fatal = 1; - mmustat = FIRE_PCI_READ_8(sc, FO_PCI_MMU_INT_STAT); - mmutfar = FIRE_PCI_READ_8(sc, - FO_PCI_MMU_TRANS_FAULT_ADDR); - mmutfsr = FIRE_PCI_READ_8(sc, - FO_PCI_MMU_TRANS_FAULT_STAT); - if ((mmustat & (FO_PCI_MMU_ERR_INT_TBW_DPE_P | - FO_PCI_MMU_ERR_INT_TBW_ERR_P | - FO_PCI_MMU_ERR_INT_TBW_UDE_P | - FO_PCI_MMU_ERR_INT_TBW_DME_P | - FO_PCI_MMU_ERR_INT_TTC_CAE_P | - FIRE_PCI_MMU_ERR_INT_TTC_DPE_P | - OBERON_PCI_MMU_ERR_INT_TTC_DUE_P | - FO_PCI_MMU_ERR_INT_TRN_ERR_P)) != 0) - fatal = 1; - else { - sc->sc_stats_mmu_err++; - FIRE_PCI_WRITE_8(sc, FO_PCI_MMU_ERR_STAT_CLR, - mmustat); - } - device_printf(dev, - "MMU error %#llx: TFAR %#llx TFSR %#llx\n", - (unsigned long long)mmustat, - (unsigned long long)mmutfar, - (unsigned long long)mmutfsr); - } - } - if ((mcstat & FO_PCI_MULTI_CORE_ERR_STAT_PEC) != 0) { - pecstat = FIRE_PCI_READ_8(sc, FO_PCI_PEC_CORE_BLOCK_INT_STAT); - if ((pecstat & FO_PCI_PEC_CORE_BLOCK_INT_STAT_UERR) != 0) { - fatal = 1; - uestat = FIRE_PCI_READ_8(sc, - FO_PCI_TLU_UERR_INT_STAT); - device_printf(dev, - "DLU/TLU uncorrectable error %#llx\n", - (unsigned long long)uestat); - if ((uestat & (FO_PCI_TLU_UERR_INT_UR_P | - OBERON_PCI_TLU_UERR_INT_POIS_P | - FO_PCI_TLU_UERR_INT_MFP_P | - FO_PCI_TLU_UERR_INT_ROF_P | - FO_PCI_TLU_UERR_INT_UC_P | - FIRE_PCI_TLU_UERR_INT_PP_P | - OBERON_PCI_TLU_UERR_INT_POIS_P)) != 0) { - val = FIRE_PCI_READ_8(sc, - FO_PCI_TLU_RX_UERR_HDR1_LOG); - device_printf(dev, - "receive header log %#llx\n", - (unsigned long long)val); - val = FIRE_PCI_READ_8(sc, - FO_PCI_TLU_RX_UERR_HDR2_LOG); - device_printf(dev, - "receive header log 2 %#llx\n", - (unsigned long long)val); - } - if ((uestat & FO_PCI_TLU_UERR_INT_CTO_P) != 0) { - val = FIRE_PCI_READ_8(sc, - FO_PCI_TLU_TX_UERR_HDR1_LOG); - device_printf(dev, - "transmit header log %#llx\n", - (unsigned long long)val); - val = FIRE_PCI_READ_8(sc, - FO_PCI_TLU_TX_UERR_HDR2_LOG); - device_printf(dev, - "transmit header log 2 %#llx\n", - (unsigned long long)val); - } - if ((uestat & FO_PCI_TLU_UERR_INT_DLP_P) != 0) { - val = FIRE_PCI_READ_8(sc, - FO_PCI_LPU_LNK_LYR_INT_STAT); - device_printf(dev, - "link layer interrupt and status %#llx\n", - (unsigned long long)val); - } - if ((uestat & FO_PCI_TLU_UERR_INT_TE_P) != 0) { - val = FIRE_PCI_READ_8(sc, - FO_PCI_LPU_PHY_LYR_INT_STAT); - device_printf(dev, - "phy layer interrupt and status %#llx\n", - (unsigned long long)val); - } - } - if ((pecstat & FO_PCI_PEC_CORE_BLOCK_INT_STAT_CERR) != 0) { - sc->sc_stats_tlu_ce++; - cestat = FIRE_PCI_READ_8(sc, - FO_PCI_TLU_CERR_INT_STAT); - device_printf(dev, - "DLU/TLU correctable error %#llx\n", - (unsigned long long)cestat); - val = FIRE_PCI_READ_8(sc, - FO_PCI_LPU_LNK_LYR_INT_STAT); - device_printf(dev, - "link layer interrupt and status %#llx\n", - (unsigned long long)val); - if ((cestat & FO_PCI_TLU_CERR_INT_RE_P) != 0) { - FIRE_PCI_WRITE_8(sc, - FO_PCI_LPU_LNK_LYR_INT_STAT, val); - val = FIRE_PCI_READ_8(sc, - FO_PCI_LPU_PHY_LYR_INT_STAT); - device_printf(dev, - "phy layer interrupt and status %#llx\n", - (unsigned long long)val); - } - FIRE_PCI_WRITE_8(sc, FO_PCI_TLU_CERR_STAT_CLR, - cestat); - } - if ((pecstat & FO_PCI_PEC_CORE_BLOCK_INT_STAT_OEVENT) != 0) { - oenfatal = 0; - oestat = FIRE_PCI_READ_8(sc, - FO_PCI_TLU_OEVENT_INT_STAT); - device_printf(dev, "DLU/TLU other event %#llx\n", - (unsigned long long)oestat); - if ((oestat & (FO_PCI_TLU_OEVENT_MFC_P | - FO_PCI_TLU_OEVENT_MRC_P | - FO_PCI_TLU_OEVENT_WUC_P | - FO_PCI_TLU_OEVENT_RUC_P | - FO_PCI_TLU_OEVENT_CRS_P)) != 0) { - val = FIRE_PCI_READ_8(sc, - FO_PCI_TLU_RX_OEVENT_HDR1_LOG); - device_printf(dev, - "receive header log %#llx\n", - (unsigned long long)val); - val = FIRE_PCI_READ_8(sc, - FO_PCI_TLU_RX_OEVENT_HDR2_LOG); - device_printf(dev, - "receive header log 2 %#llx\n", - (unsigned long long)val); - if ((oestat & (FO_PCI_TLU_OEVENT_MFC_P | - FO_PCI_TLU_OEVENT_MRC_P | - FO_PCI_TLU_OEVENT_WUC_P | - FO_PCI_TLU_OEVENT_RUC_P)) != 0) - fatal = 1; - else { - sc->sc_stats_tlu_oe_rx_err++; - oenfatal = 1; - } - } - if ((oestat & (FO_PCI_TLU_OEVENT_MFC_P | - FO_PCI_TLU_OEVENT_CTO_P | - FO_PCI_TLU_OEVENT_WUC_P | - FO_PCI_TLU_OEVENT_RUC_P)) != 0) { - val = FIRE_PCI_READ_8(sc, - FO_PCI_TLU_TX_OEVENT_HDR1_LOG); - device_printf(dev, - "transmit header log %#llx\n", - (unsigned long long)val); - val = FIRE_PCI_READ_8(sc, - FO_PCI_TLU_TX_OEVENT_HDR2_LOG); - device_printf(dev, - "transmit header log 2 %#llx\n", - (unsigned long long)val); - if ((oestat & (FO_PCI_TLU_OEVENT_MFC_P | - FO_PCI_TLU_OEVENT_CTO_P | - FO_PCI_TLU_OEVENT_WUC_P | - FO_PCI_TLU_OEVENT_RUC_P)) != 0) - fatal = 1; - else { - sc->sc_stats_tlu_oe_tx_err++; - oenfatal = 1; - } - } - if ((oestat & (FO_PCI_TLU_OEVENT_ERO_P | - FO_PCI_TLU_OEVENT_EMP_P | - FO_PCI_TLU_OEVENT_EPE_P | - FIRE_PCI_TLU_OEVENT_ERP_P | - OBERON_PCI_TLU_OEVENT_ERBU_P | - FIRE_PCI_TLU_OEVENT_EIP_P | - OBERON_PCI_TLU_OEVENT_EIUE_P)) != 0) { - fatal = 1; - val = FIRE_PCI_READ_8(sc, - FO_PCI_LPU_LNK_LYR_INT_STAT); - device_printf(dev, - "link layer interrupt and status %#llx\n", - (unsigned long long)val); - } - if ((oestat & (FO_PCI_TLU_OEVENT_IIP_P | - FO_PCI_TLU_OEVENT_EDP_P | - FIRE_PCI_TLU_OEVENT_EHP_P | - OBERON_PCI_TLU_OEVENT_TLUEITMO_S | - FO_PCI_TLU_OEVENT_ERU_P)) != 0) - fatal = 1; - if ((oestat & (FO_PCI_TLU_OEVENT_NFP_P | - FO_PCI_TLU_OEVENT_LWC_P | - FO_PCI_TLU_OEVENT_LIN_P | - FO_PCI_TLU_OEVENT_LRS_P | - FO_PCI_TLU_OEVENT_LDN_P | - FO_PCI_TLU_OEVENT_LUP_P)) != 0) - oenfatal = 1; - if (oenfatal != 0) { - sc->sc_stats_tlu_oe_non_fatal++; - FIRE_PCI_WRITE_8(sc, - FO_PCI_TLU_OEVENT_STAT_CLR, oestat); - if ((oestat & FO_PCI_TLU_OEVENT_LIN_P) != 0) - FIRE_PCI_WRITE_8(sc, - FO_PCI_LPU_LNK_LYR_INT_STAT, - FIRE_PCI_READ_8(sc, - FO_PCI_LPU_LNK_LYR_INT_STAT)); - } - } - if ((pecstat & FO_PCI_PEC_CORE_BLOCK_INT_STAT_ILU) != 0) { - ilustat = FIRE_PCI_READ_8(sc, FO_PCI_ILU_INT_STAT); - device_printf(dev, "ILU error %#llx\n", - (unsigned long long)ilustat); - if ((ilustat & (FIRE_PCI_ILU_ERR_INT_IHB_PE_P | - FIRE_PCI_ILU_ERR_INT_IHB_PE_P)) != 0) - fatal = 1; - else { - sc->sc_stats_ilu_err++; - FIRE_PCI_WRITE_8(sc, FO_PCI_ILU_INT_STAT, - ilustat); - } - } - } - mtx_unlock_spin(&sc->sc_pcib_mtx); - if (fatal != 0) - panic("%s: fatal DMC/PEC error", - device_get_nameunit(sc->sc_dev)); - return (FILTER_HANDLED); -} - -static int -fire_xcb(void *arg) -{ - struct fire_softc *sc; - device_t dev; - uint64_t errstat, intstat, val; - u_int fatal; - - fatal = 0; - sc = arg; - dev = sc->sc_dev; - mtx_lock_spin(&sc->sc_pcib_mtx); - if (sc->sc_mode == FIRE_MODE_OBERON) { - intstat = FIRE_CTRL_READ_8(sc, FO_XBC_INT_STAT); - device_printf(dev, "UBC error: interrupt status %#llx\n", - (unsigned long long)intstat); - if ((intstat & ~(OBERON_UBC_ERR_INT_DMARDUEB_P | - OBERON_UBC_ERR_INT_DMARDUEA_P)) != 0) - fatal = 1; - else - sc->sc_stats_ubc_dmardue++; - if (fatal != 0) { - mtx_unlock_spin(&sc->sc_pcib_mtx); - panic("%s: fatal UBC core block error", - device_get_nameunit(sc->sc_dev)); - } else { - FIRE_CTRL_SET(sc, FO_XBC_ERR_STAT_CLR, ~0ULL); - mtx_unlock_spin(&sc->sc_pcib_mtx); - } - } else { - errstat = FIRE_CTRL_READ_8(sc, FIRE_JBC_CORE_BLOCK_ERR_STAT); - if ((errstat & (FIRE_JBC_CORE_BLOCK_ERR_STAT_MERGE | - FIRE_JBC_CORE_BLOCK_ERR_STAT_JBCINT | - FIRE_JBC_CORE_BLOCK_ERR_STAT_DMCINT)) != 0) { - intstat = FIRE_CTRL_READ_8(sc, FO_XBC_INT_STAT); - device_printf(dev, "JBC interrupt status %#llx\n", - (unsigned long long)intstat); - if ((intstat & FIRE_JBC_ERR_INT_EBUS_TO_P) != 0) { - val = FIRE_CTRL_READ_8(sc, - FIRE_JBC_CSR_ERR_LOG); - device_printf(dev, "CSR error log %#llx\n", - (unsigned long long)val); - } - if ((intstat & (FIRE_JBC_ERR_INT_UNSOL_RD_P | - FIRE_JBC_ERR_INT_UNSOL_INT_P)) != 0) { - if ((intstat & - FIRE_JBC_ERR_INT_UNSOL_RD_P) != 0) - sc->sc_stats_jbc_unsol_rd++; - if ((intstat & - FIRE_JBC_ERR_INT_UNSOL_INT_P) != 0) - sc->sc_stats_jbc_unsol_int++; - val = FIRE_CTRL_READ_8(sc, - FIRE_DMCINT_IDC_ERR_LOG); - device_printf(dev, - "DMCINT IDC error log %#llx\n", - (unsigned long long)val); - } - if ((intstat & (FIRE_JBC_ERR_INT_MB_PER_P | - FIRE_JBC_ERR_INT_MB_PEW_P)) != 0) { - fatal = 1; - val = FIRE_CTRL_READ_8(sc, - FIRE_MERGE_TRANS_ERR_LOG); - device_printf(dev, - "merge transaction error log %#llx\n", - (unsigned long long)val); - } - if ((intstat & FIRE_JBC_ERR_INT_IJP_P) != 0) { - fatal = 1; - val = FIRE_CTRL_READ_8(sc, - FIRE_JBCINT_OTRANS_ERR_LOG); - device_printf(dev, - "JBCINT out transaction error log " - "%#llx\n", (unsigned long long)val); - val = FIRE_CTRL_READ_8(sc, - FIRE_JBCINT_OTRANS_ERR_LOG2); - device_printf(dev, - "JBCINT out transaction error log 2 " - "%#llx\n", (unsigned long long)val); - } - if ((intstat & (FIRE_JBC_ERR_INT_UE_ASYN_P | - FIRE_JBC_ERR_INT_CE_ASYN_P | - FIRE_JBC_ERR_INT_JTE_P | FIRE_JBC_ERR_INT_JBE_P | - FIRE_JBC_ERR_INT_JUE_P | - FIRE_JBC_ERR_INT_ICISE_P | - FIRE_JBC_ERR_INT_WR_DPE_P | - FIRE_JBC_ERR_INT_RD_DPE_P | - FIRE_JBC_ERR_INT_ILL_BMW_P | - FIRE_JBC_ERR_INT_ILL_BMR_P | - FIRE_JBC_ERR_INT_BJC_P)) != 0) { - if ((intstat & (FIRE_JBC_ERR_INT_UE_ASYN_P | - FIRE_JBC_ERR_INT_JTE_P | - FIRE_JBC_ERR_INT_JBE_P | - FIRE_JBC_ERR_INT_JUE_P | - FIRE_JBC_ERR_INT_ICISE_P | - FIRE_JBC_ERR_INT_WR_DPE_P | - FIRE_JBC_ERR_INT_RD_DPE_P | - FIRE_JBC_ERR_INT_ILL_BMW_P | - FIRE_JBC_ERR_INT_ILL_BMR_P | - FIRE_JBC_ERR_INT_BJC_P)) != 0) - fatal = 1; - else - sc->sc_stats_jbc_ce_async++; - val = FIRE_CTRL_READ_8(sc, - FIRE_JBCINT_ITRANS_ERR_LOG); - device_printf(dev, - "JBCINT in transaction error log %#llx\n", - (unsigned long long)val); - val = FIRE_CTRL_READ_8(sc, - FIRE_JBCINT_ITRANS_ERR_LOG2); - device_printf(dev, - "JBCINT in transaction error log 2 " - "%#llx\n", (unsigned long long)val); - } - if ((intstat & (FIRE_JBC_ERR_INT_PIO_UNMAP_RD_P | - FIRE_JBC_ERR_INT_ILL_ACC_RD_P | - FIRE_JBC_ERR_INT_PIO_UNMAP_P | - FIRE_JBC_ERR_INT_PIO_DPE_P | - FIRE_JBC_ERR_INT_PIO_CPE_P | - FIRE_JBC_ERR_INT_ILL_ACC_P)) != 0) { - fatal = 1; - val = FIRE_CTRL_READ_8(sc, - FIRE_JBC_CSR_ERR_LOG); - device_printf(dev, - "DMCINT ODCD error log %#llx\n", - (unsigned long long)val); - } - if ((intstat & (FIRE_JBC_ERR_INT_MB_PEA_P | - FIRE_JBC_ERR_INT_CPE_P | FIRE_JBC_ERR_INT_APE_P | - FIRE_JBC_ERR_INT_PIO_CPE_P | - FIRE_JBC_ERR_INT_JTCEEW_P | - FIRE_JBC_ERR_INT_JTCEEI_P | - FIRE_JBC_ERR_INT_JTCEER_P)) != 0) { - fatal = 1; - val = FIRE_CTRL_READ_8(sc, - FIRE_FATAL_ERR_LOG); - device_printf(dev, "fatal error log %#llx\n", - (unsigned long long)val); - val = FIRE_CTRL_READ_8(sc, - FIRE_FATAL_ERR_LOG2); - device_printf(dev, "fatal error log 2 " - "%#llx\n", (unsigned long long)val); - } - if (fatal != 0) { - mtx_unlock_spin(&sc->sc_pcib_mtx); - panic("%s: fatal JBC core block error", - device_get_nameunit(sc->sc_dev)); - } else { - FIRE_CTRL_SET(sc, FO_XBC_ERR_STAT_CLR, ~0ULL); - mtx_unlock_spin(&sc->sc_pcib_mtx); - } - } else { - mtx_unlock_spin(&sc->sc_pcib_mtx); - panic("%s: unknown JCB core block error status %#llx", - device_get_nameunit(sc->sc_dev), - (unsigned long long)errstat); - } - } - return (FILTER_HANDLED); -} - -static int -fire_pcie(void *arg) -{ - struct fire_msiqarg *fmqa; - struct fire_softc *sc; - struct fo_msiq_record *qrec; - device_t dev; - uint64_t word0; - u_int head, msg, msiq; - - fmqa = arg; - sc = fmqa->fmqa_fica.fica_sc; - dev = sc->sc_dev; - msiq = fmqa->fmqa_msiq; - mtx_lock_spin(&fmqa->fmqa_mtx); - head = (FIRE_PCI_READ_8(sc, fmqa->fmqa_head) & FO_PCI_EQ_HD_MASK) >> - FO_PCI_EQ_HD_SHFT; - qrec = &fmqa->fmqa_base[head]; - word0 = qrec->fomqr_word0; - for (;;) { - KASSERT((word0 & FO_MQR_WORD0_FMT_TYPE_MSG) != 0, - ("%s: received non-PCIe message in event queue %d " - "(word0 %#llx)", device_get_nameunit(dev), msiq, - (unsigned long long)word0)); - msg = (word0 & FO_MQR_WORD0_DATA0_MASK) >> - FO_MQR_WORD0_DATA0_SHFT; - -#define PCIE_MSG_CODE_ERR_COR 0x30 -#define PCIE_MSG_CODE_ERR_NONFATAL 0x31 -#define PCIE_MSG_CODE_ERR_FATAL 0x33 - - if (msg == PCIE_MSG_CODE_ERR_COR) - device_printf(dev, "correctable PCIe error\n"); - else if (msg == PCIE_MSG_CODE_ERR_NONFATAL || - msg == PCIE_MSG_CODE_ERR_FATAL) - panic("%s: %sfatal PCIe error", - device_get_nameunit(dev), - msg == PCIE_MSG_CODE_ERR_NONFATAL ? "non-" : ""); - else - panic("%s: received unknown PCIe message %#x", - device_get_nameunit(dev), msg); - qrec->fomqr_word0 &= ~FO_MQR_WORD0_FMT_TYPE_MASK; - head = (head + 1) % sc->sc_msiq_size; - qrec = &fmqa->fmqa_base[head]; - word0 = qrec->fomqr_word0; - if (__predict_true((word0 & FO_MQR_WORD0_FMT_TYPE_MASK) == 0)) - break; - } - FIRE_PCI_WRITE_8(sc, fmqa->fmqa_head, (head & FO_PCI_EQ_HD_MASK) << - FO_PCI_EQ_HD_SHFT); - if ((FIRE_PCI_READ_8(sc, fmqa->fmqa_tail) & - FO_PCI_EQ_TL_OVERR) != 0) { - device_printf(dev, "event queue %d overflow\n", msiq); - msiq <<= 3; - FIRE_PCI_WRITE_8(sc, FO_PCI_EQ_CTRL_CLR_BASE + msiq, - FIRE_PCI_READ_8(sc, FO_PCI_EQ_CTRL_CLR_BASE + msiq) | - FO_PCI_EQ_CTRL_CLR_COVERR); - } - mtx_unlock_spin(&fmqa->fmqa_mtx); - return (FILTER_HANDLED); -} - -static int -fire_maxslots(device_t dev) -{ - - return (1); -} - -static uint32_t -fire_read_config(device_t dev, u_int bus, u_int slot, u_int func, u_int reg, - int width) -{ - - return (ofw_pci_read_config_common(dev, PCIE_REGMAX, FO_CONF_OFF(bus, - slot, func, reg), bus, slot, func, reg, width)); -} - -static void -fire_write_config(device_t dev, u_int bus, u_int slot, u_int func, u_int reg, - uint32_t val, int width) -{ - - ofw_pci_write_config_common(dev, PCIE_REGMAX, FO_CONF_OFF(bus, slot, - func, reg), bus, slot, func, reg, val, width); -} - -static int -fire_route_interrupt(device_t bridge, device_t dev, int pin) -{ - ofw_pci_intr_t mintr; - - mintr = ofw_pci_route_interrupt_common(bridge, dev, pin); - if (!PCI_INTERRUPT_VALID(mintr)) - device_printf(bridge, - "could not route pin %d for device %d.%d\n", - pin, pci_get_slot(dev), pci_get_function(dev)); - return (mintr); -} - -static void -fire_dmamap_sync(bus_dma_tag_t dt __unused, bus_dmamap_t map, - bus_dmasync_op_t op) -{ - - if ((map->dm_flags & DMF_LOADED) == 0) - return; - - if ((op & BUS_DMASYNC_POSTREAD) != 0) - ofw_pci_dmamap_sync_stst_order_common(); - else if ((op & BUS_DMASYNC_PREWRITE) != 0) - membar(Sync); -} - -static void -fire_intr_enable(void *arg) -{ - struct intr_vector *iv; - struct fire_icarg *fica; - struct fire_softc *sc; - struct pcpu *pc; - uint64_t mr; - u_int ctrl, i; - - iv = arg; - fica = iv->iv_icarg; - sc = fica->fica_sc; - mr = FO_PCI_IMAP_V; - if (sc->sc_mode == FIRE_MODE_OBERON) - mr |= (iv->iv_mid << OBERON_PCI_IMAP_T_DESTID_SHFT) & - OBERON_PCI_IMAP_T_DESTID_MASK; - else - mr |= (iv->iv_mid << FIRE_PCI_IMAP_T_JPID_SHFT) & - FIRE_PCI_IMAP_T_JPID_MASK; - /* - * Given that all mondos for the same target are required to use the - * same interrupt controller we just use the CPU ID for indexing the - * latter. - */ - ctrl = 0; - for (i = 0; i < mp_ncpus; ++i) { - pc = pcpu_find(i); - if (pc == NULL || iv->iv_mid != pc->pc_mid) - continue; - ctrl = pc->pc_cpuid % 4; - break; - } - mr |= (1ULL << ctrl) << FO_PCI_IMAP_INT_CTRL_NUM_SHFT & - FO_PCI_IMAP_INT_CTRL_NUM_MASK; - FIRE_PCI_WRITE_8(sc, fica->fica_map, mr); -} - -static void -fire_intr_disable(void *arg) -{ - struct intr_vector *iv; - struct fire_icarg *fica; - struct fire_softc *sc; - - iv = arg; - fica = iv->iv_icarg; - sc = fica->fica_sc; - FIRE_PCI_WRITE_8(sc, fica->fica_map, - FIRE_PCI_READ_8(sc, fica->fica_map) & ~FO_PCI_IMAP_V); -} - -static void -fire_intr_assign(void *arg) -{ - struct intr_vector *iv; - struct fire_icarg *fica; - struct fire_softc *sc; - uint64_t mr; - - iv = arg; - fica = iv->iv_icarg; - sc = fica->fica_sc; - mr = FIRE_PCI_READ_8(sc, fica->fica_map); - if ((mr & FO_PCI_IMAP_V) != 0) { - FIRE_PCI_WRITE_8(sc, fica->fica_map, mr & ~FO_PCI_IMAP_V); - FIRE_PCI_BARRIER(sc, fica->fica_map, 8, - BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); - } - while (FIRE_PCI_READ_8(sc, fica->fica_clr) != INTCLR_IDLE) - ; - if ((mr & FO_PCI_IMAP_V) != 0) - fire_intr_enable(arg); -} - -static void -fire_intr_clear(void *arg) -{ - struct intr_vector *iv; - struct fire_icarg *fica; - - iv = arg; - fica = iv->iv_icarg; - FIRE_PCI_WRITE_8(fica->fica_sc, fica->fica_clr, INTCLR_IDLE); -} - -/* - * Given that the event queue implementation matches our current MD and MI - * interrupt frameworks like square pegs fit into round holes we are generous - * and use one event queue per MSI for now, which limits us to 35 MSIs/MSI-Xs - * per Host-PCIe-bridge (we use one event queue for the PCIe error messages). - * This seems tolerable as long as most devices just use one MSI/MSI-X anyway. - * Adding knowledge about MSIs/MSI-Xs to the MD interrupt code should allow us - * to decouple the 1:1 mapping at the cost of no longer being able to bind - * MSIs/MSI-Xs to specific CPUs as we currently have no reliable way to - * quiesce a device while we move its MSIs/MSI-Xs to another event queue. - */ - -static int -fire_alloc_msi(device_t dev, device_t child, int count, int maxcount __unused, - int *irqs) -{ - struct fire_softc *sc; - u_int i, j, msiqrun; - - if (powerof2(count) == 0 || count > 32) - return (EINVAL); - - sc = device_get_softc(dev); - mtx_lock(&sc->sc_msi_mtx); - msiqrun = 0; - for (i = 0; i < sc->sc_msiq_count; i++) { - for (j = i; j < i + count; j++) { - if (isclr(sc->sc_msiq_bitmap, j) == 0) - break; - } - if (j == i + count) { - msiqrun = i; - break; - } - } - if (i == sc->sc_msiq_count) { - mtx_unlock(&sc->sc_msi_mtx); - return (ENXIO); - } - for (i = 0; i + count < sc->sc_msi_count; i += count) { - for (j = i; j < i + count; j++) - if (isclr(sc->sc_msi_bitmap, j) == 0) - break; - if (j == i + count) { - for (j = 0; j < count; j++) { - setbit(sc->sc_msiq_bitmap, msiqrun + j); - setbit(sc->sc_msi_bitmap, i + j); - sc->sc_msi_msiq_table[i + j] = msiqrun + j; - irqs[j] = sc->sc_msi_first + i + j; - } - mtx_unlock(&sc->sc_msi_mtx); - return (0); - } - } - mtx_unlock(&sc->sc_msi_mtx); - return (ENXIO); -} - -static int -fire_release_msi(device_t dev, device_t child, int count, int *irqs) -{ - struct fire_softc *sc; - u_int i; - - sc = device_get_softc(dev); - mtx_lock(&sc->sc_msi_mtx); - for (i = 0; i < count; i++) { - clrbit(sc->sc_msiq_bitmap, - sc->sc_msi_msiq_table[irqs[i] - sc->sc_msi_first]); - clrbit(sc->sc_msi_bitmap, irqs[i] - sc->sc_msi_first); - } - mtx_unlock(&sc->sc_msi_mtx); - return (0); -} - -static int -fire_alloc_msix(device_t dev, device_t child, int *irq) -{ - struct fire_softc *sc; - int i, msiq; - - sc = device_get_softc(dev); - if ((sc->sc_flags & FIRE_MSIX) == 0) - return (ENXIO); - mtx_lock(&sc->sc_msi_mtx); - msiq = 0; - for (i = 0; i < sc->sc_msiq_count; i++) { - if (isclr(sc->sc_msiq_bitmap, i) != 0) { - msiq = i; - break; - } - } - if (i == sc->sc_msiq_count) { - mtx_unlock(&sc->sc_msi_mtx); - return (ENXIO); - } - for (i = sc->sc_msi_count - 1; i >= 0; i--) { - if (isclr(sc->sc_msi_bitmap, i) != 0) { - setbit(sc->sc_msiq_bitmap, msiq); - setbit(sc->sc_msi_bitmap, i); - sc->sc_msi_msiq_table[i] = msiq; - *irq = sc->sc_msi_first + i; - mtx_unlock(&sc->sc_msi_mtx); - return (0); - } - } - mtx_unlock(&sc->sc_msi_mtx); - return (ENXIO); -} - -static int -fire_release_msix(device_t dev, device_t child, int irq) -{ - struct fire_softc *sc; - - sc = device_get_softc(dev); - if ((sc->sc_flags & FIRE_MSIX) == 0) - return (ENXIO); - mtx_lock(&sc->sc_msi_mtx); - clrbit(sc->sc_msiq_bitmap, - sc->sc_msi_msiq_table[irq - sc->sc_msi_first]); - clrbit(sc->sc_msi_bitmap, irq - sc->sc_msi_first); - mtx_unlock(&sc->sc_msi_mtx); - return (0); -} - -static int -fire_map_msi(device_t dev, device_t child, int irq, uint64_t *addr, - uint32_t *data) -{ - struct fire_softc *sc; - struct pci_devinfo *dinfo; - - sc = device_get_softc(dev); - dinfo = device_get_ivars(child); - if (dinfo->cfg.msi.msi_alloc > 0) { - if ((irq & ~sc->sc_msi_data_mask) != 0) { - device_printf(dev, "invalid MSI 0x%x\n", irq); - return (EINVAL); - } - } else { - if ((sc->sc_flags & FIRE_MSIX) == 0) - return (ENXIO); - if (fls(irq) > sc->sc_msix_data_width) { - device_printf(dev, "invalid MSI-X 0x%x\n", irq); - return (EINVAL); - } - } - if (dinfo->cfg.msi.msi_alloc > 0 && - (dinfo->cfg.msi.msi_ctrl & PCIM_MSICTRL_64BIT) == 0) - *addr = sc->sc_msi_addr32; - else - *addr = sc->sc_msi_addr64; - *data = irq; - return (0); -} - -static void -fire_msiq_handler(void *cookie) -{ - struct intr_vector *iv; - struct fire_msiqarg *fmqa; - - iv = cookie; - fmqa = iv->iv_icarg; - /* - * Note that since fire_intr_clear() will clear the event queue - * interrupt after the handler associated with the MSI [sic] has - * been executed we have to protect the access to the event queue as - * otherwise nested event queue interrupts cause corruption of the - * event queue on MP machines. Obviously especially when abandoning - * the 1:1 mapping it would be better to not clear the event queue - * interrupt after each handler invocation but only once when the - * outstanding MSIs have been processed but unfortunately that - * doesn't work well and leads to interrupt storms with controllers/ - * drivers which don't mask interrupts while the handler is executed. - * Maybe delaying clearing the MSI until after the handler has been - * executed could be used to work around this but that's not the - * intended usage and might in turn cause lost MSIs. - */ - mtx_lock_spin(&fmqa->fmqa_mtx); - fire_msiq_common(iv, fmqa); - mtx_unlock_spin(&fmqa->fmqa_mtx); -} - -static void -fire_msiq_filter(void *cookie) -{ - struct intr_vector *iv; - struct fire_msiqarg *fmqa; - - iv = cookie; - fmqa = iv->iv_icarg; - /* - * For filters we don't use fire_intr_clear() since it would clear - * the event queue interrupt while we're still processing the event - * queue as filters and associated post-filter handler are executed - * directly, which in turn would lead to lost MSIs. So we clear the - * event queue interrupt only once after processing the event queue. - * Given that this still guarantees the filters to not be executed - * concurrently and no other CPU can clear the event queue interrupt - * while the event queue is still processed, we don't even need to - * interlock the access to the event queue in this case. - */ - critical_enter(); - fire_msiq_common(iv, fmqa); - FIRE_PCI_WRITE_8(fmqa->fmqa_fica.fica_sc, fmqa->fmqa_fica.fica_clr, - INTCLR_IDLE); - critical_exit(); -} - -static inline void -fire_msiq_common(struct intr_vector *iv, struct fire_msiqarg *fmqa) -{ - struct fire_softc *sc; - struct fo_msiq_record *qrec; - device_t dev; - uint64_t word0; - u_int head, msi, msiq; - - sc = fmqa->fmqa_fica.fica_sc; - dev = sc->sc_dev; - msiq = fmqa->fmqa_msiq; - head = (FIRE_PCI_READ_8(sc, fmqa->fmqa_head) & FO_PCI_EQ_HD_MASK) >> - FO_PCI_EQ_HD_SHFT; - qrec = &fmqa->fmqa_base[head]; - word0 = qrec->fomqr_word0; - for (;;) { - if (__predict_false((word0 & FO_MQR_WORD0_FMT_TYPE_MASK) == 0)) - break; - KASSERT((word0 & FO_MQR_WORD0_FMT_TYPE_MSI64) != 0 || - (word0 & FO_MQR_WORD0_FMT_TYPE_MSI32) != 0, - ("%s: received non-MSI/MSI-X message in event queue %d " - "(word0 %#llx)", device_get_nameunit(dev), msiq, - (unsigned long long)word0)); - msi = (word0 & FO_MQR_WORD0_DATA0_MASK) >> - FO_MQR_WORD0_DATA0_SHFT; - /* - * Sanity check the MSI/MSI-X as long as we use a 1:1 mapping. - */ - KASSERT(msi == fmqa->fmqa_msi, - ("%s: received non-matching MSI/MSI-X in event queue %d " - "(%d versus %d)", device_get_nameunit(dev), msiq, msi, - fmqa->fmqa_msi)); - FIRE_PCI_WRITE_8(sc, FO_PCI_MSI_CLR_BASE + (msi << 3), - FO_PCI_MSI_CLR_EQWR_N); - if (__predict_false(intr_event_handle(iv->iv_event, - NULL) != 0)) - printf("stray MSI/MSI-X in event queue %d\n", msiq); - qrec->fomqr_word0 &= ~FO_MQR_WORD0_FMT_TYPE_MASK; - head = (head + 1) % sc->sc_msiq_size; - qrec = &fmqa->fmqa_base[head]; - word0 = qrec->fomqr_word0; - } - FIRE_PCI_WRITE_8(sc, fmqa->fmqa_head, (head & FO_PCI_EQ_HD_MASK) << - FO_PCI_EQ_HD_SHFT); - if (__predict_false((FIRE_PCI_READ_8(sc, fmqa->fmqa_tail) & - FO_PCI_EQ_TL_OVERR) != 0)) { - device_printf(dev, "event queue %d overflow\n", msiq); - msiq <<= 3; - FIRE_PCI_WRITE_8(sc, FO_PCI_EQ_CTRL_CLR_BASE + msiq, - FIRE_PCI_READ_8(sc, FO_PCI_EQ_CTRL_CLR_BASE + msiq) | - FO_PCI_EQ_CTRL_CLR_COVERR); - } -} - -static int -fire_setup_intr(device_t dev, device_t child, struct resource *ires, - int flags, driver_filter_t *filt, driver_intr_t *intr, void *arg, - void **cookiep) -{ - struct fire_softc *sc; - struct fire_msiqarg *fmqa; - u_long vec; - int error; - u_int msi, msiq; - - sc = device_get_softc(dev); - /* - * XXX this assumes that a device only has one INTx, while in fact - * Cassini+ and Saturn can use all four the firmware has assigned - * to them, but so does pci(4). - */ - if (rman_get_rid(ires) != 0) { - msi = rman_get_start(ires); - msiq = sc->sc_msi_msiq_table[msi - sc->sc_msi_first]; - vec = INTMAP_VEC(sc->sc_ign, sc->sc_msiq_ino_first + msiq); - msiq += sc->sc_msiq_first; - if (intr_vectors[vec].iv_ic != &fire_ic) { - device_printf(dev, - "invalid interrupt controller for vector 0x%lx\n", - vec); - return (EINVAL); - } - /* - * The MD interrupt code needs the vector rather than the MSI. - */ - rman_set_start(ires, vec); - rman_set_end(ires, vec); - error = bus_generic_setup_intr(dev, child, ires, flags, filt, - intr, arg, cookiep); - rman_set_start(ires, msi); - rman_set_end(ires, msi); - if (error != 0) - return (error); - fmqa = intr_vectors[vec].iv_icarg; - /* - * XXX inject our event queue handler. - */ - if (filt != NULL) { - intr_vectors[vec].iv_func = fire_msiq_filter; - intr_vectors[vec].iv_ic = &fire_msiqc_filter; - /* - * Ensure the event queue interrupt is cleared, it - * might have triggered before. Given we supply NULL - * as ic_clear, inthand_add() won't do this for us. - */ - FIRE_PCI_WRITE_8(sc, fmqa->fmqa_fica.fica_clr, - INTCLR_IDLE); - } else - intr_vectors[vec].iv_func = fire_msiq_handler; - /* Record the MSI/MSI-X as long as we we use a 1:1 mapping. */ - fmqa->fmqa_msi = msi; - FIRE_PCI_WRITE_8(sc, FO_PCI_EQ_CTRL_SET_BASE + (msiq << 3), - FO_PCI_EQ_CTRL_SET_EN); - msi <<= 3; - FIRE_PCI_WRITE_8(sc, FO_PCI_MSI_MAP_BASE + msi, - (FIRE_PCI_READ_8(sc, FO_PCI_MSI_MAP_BASE + msi) & - ~FO_PCI_MSI_MAP_EQNUM_MASK) | - ((msiq << FO_PCI_MSI_MAP_EQNUM_SHFT) & - FO_PCI_MSI_MAP_EQNUM_MASK)); - FIRE_PCI_WRITE_8(sc, FO_PCI_MSI_CLR_BASE + msi, - FO_PCI_MSI_CLR_EQWR_N); - FIRE_PCI_WRITE_8(sc, FO_PCI_MSI_MAP_BASE + msi, - FIRE_PCI_READ_8(sc, FO_PCI_MSI_MAP_BASE + msi) | - FO_PCI_MSI_MAP_V); - return (error); - } - - /* - * Make sure the vector is fully specified and we registered - * our interrupt controller for it. - */ - vec = rman_get_start(ires); - if (INTIGN(vec) != sc->sc_ign) { - device_printf(dev, "invalid interrupt vector 0x%lx\n", vec); - return (EINVAL); - } - if (intr_vectors[vec].iv_ic != &fire_ic) { - device_printf(dev, - "invalid interrupt controller for vector 0x%lx\n", vec); - return (EINVAL); - } - return (bus_generic_setup_intr(dev, child, ires, flags, filt, intr, - arg, cookiep)); -} - -static int -fire_teardown_intr(device_t dev, device_t child, struct resource *ires, - void *cookie) -{ - struct fire_softc *sc; - u_long vec; - int error; - u_int msi, msiq; - - sc = device_get_softc(dev); - if (rman_get_rid(ires) != 0) { - msi = rman_get_start(ires); - msiq = sc->sc_msi_msiq_table[msi - sc->sc_msi_first]; - vec = INTMAP_VEC(sc->sc_ign, msiq + sc->sc_msiq_ino_first); - msiq += sc->sc_msiq_first; - msi <<= 3; - FIRE_PCI_WRITE_8(sc, FO_PCI_MSI_MAP_BASE + msi, - FIRE_PCI_READ_8(sc, FO_PCI_MSI_MAP_BASE + msi) & - ~FO_PCI_MSI_MAP_V); - msiq <<= 3; - FIRE_PCI_WRITE_8(sc, FO_PCI_EQ_CTRL_CLR_BASE + msiq, - FO_PCI_EQ_CTRL_CLR_COVERR | FO_PCI_EQ_CTRL_CLR_E2I | - FO_PCI_EQ_CTRL_CLR_DIS); - FIRE_PCI_WRITE_8(sc, FO_PCI_EQ_TL_BASE + msiq, - (0 << FO_PCI_EQ_TL_SHFT) & FO_PCI_EQ_TL_MASK); - FIRE_PCI_WRITE_8(sc, FO_PCI_EQ_HD_BASE + msiq, - (0 << FO_PCI_EQ_HD_SHFT) & FO_PCI_EQ_HD_MASK); - intr_vectors[vec].iv_ic = &fire_ic; - /* - * The MD interrupt code needs the vector rather than the MSI. - */ - rman_set_start(ires, vec); - rman_set_end(ires, vec); - error = bus_generic_teardown_intr(dev, child, ires, cookie); - msi >>= 3; - rman_set_start(ires, msi); - rman_set_end(ires, msi); - return (error); - } - return (bus_generic_teardown_intr(dev, child, ires, cookie)); -} - -static struct resource * -fire_alloc_resource(device_t bus, device_t child, int type, int *rid, - rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) -{ - struct fire_softc *sc; - - if (type == SYS_RES_IRQ && *rid == 0) { - sc = device_get_softc(bus); - start = end = INTMAP_VEC(sc->sc_ign, end); - } - return (ofw_pci_alloc_resource(bus, child, type, rid, start, end, - count, flags)); -} - -static u_int -fire_get_timecount(struct timecounter *tc) -{ - struct fire_softc *sc; - - sc = tc->tc_priv; - return (FIRE_CTRL_READ_8(sc, FO_XBC_PRF_CNT0) & TC_COUNTER_MAX_MASK); -} diff --git a/sys/sparc64/pci/firereg.h b/sys/sparc64/pci/firereg.h deleted file mode 100644 index c3ebc151110436..00000000000000 --- a/sys/sparc64/pci/firereg.h +++ /dev/null @@ -1,1012 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2009 Marius Strobl - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _SPARC64_PCI_FIREREG_H_ -#define _SPARC64_PCI_FIREREG_H_ - -#define FIRE_NINTR 3 /* 2 OFW + 1 MSIq */ -#define FIRE_NREG 2 - -#define FIRE_PCI 0 -#define FIRE_CTRL 1 - -/* PCI configuration and status registers */ -#define FO_PCI_INT_MAP_BASE 0x01000 -#define FO_PCI_INT_CLR_BASE 0x01400 -#define FO_PCI_EQ_BASE_ADDR 0x10000 -#define FO_PCI_EQ_CTRL_SET_BASE 0x11000 -#define FO_PCI_EQ_CTRL_CLR_BASE 0x11200 -#define FO_PCI_EQ_TL_BASE 0x11600 -#define FO_PCI_EQ_HD_BASE 0x11800 -#define FO_PCI_MSI_MAP_BASE 0x20000 -#define FO_PCI_MSI_CLR_BASE 0x28000 -#define FO_PCI_ERR_COR 0x30000 -#define FO_PCI_ERR_NONFATAL 0x30008 -#define FO_PCI_ERR_FATAL 0x30010 -#define FO_PCI_PM_PME 0x30018 -#define FO_PCI_PME_TO_ACK 0x30020 -#define FO_PCI_IMU_INT_EN 0x31008 -#define FO_PCI_IMU_INT_STAT 0x31010 -#define FO_PCI_IMU_ERR_STAT_CLR 0x31018 -#define FO_PCI_IMU_RDS_ERR_LOG 0x31028 -#define FO_PCI_IMU_SCS_ERR_LOG 0x31030 -#define FO_PCI_IMU_EQS_ERR_LOG 0x31038 -#define FO_PCI_DMC_CORE_BLOCK_INT_EN 0x31800 -#define FO_PCI_DMC_CORE_BLOCK_ERR_STAT 0x31808 -#define FO_PCI_MULTI_CORE_ERR_STAT 0x31810 -#define FO_PCI_MSI_32_BIT_ADDR 0x34000 -#define FO_PCI_MSI_64_BIT_ADDR 0x34008 -#define FO_PCI_MMU 0x40000 -#define FO_PCI_MMU_INT_EN 0x41008 -#define FO_PCI_MMU_INT_STAT 0x41010 -#define FO_PCI_MMU_ERR_STAT_CLR 0x41018 -#define FO_PCI_MMU_TRANS_FAULT_ADDR 0x41028 -#define FO_PCI_MMU_TRANS_FAULT_STAT 0x41030 -#define FO_PCI_ILU_INT_EN 0x51008 -#define FO_PCI_ILU_INT_STAT 0x51010 -#define FO_PCI_ILU_ERR_STAT_CLR 0x51018 -#define FO_PCI_DMC_DBG_SEL_PORTA 0x53000 -#define FO_PCI_DMC_DBG_SEL_PORTB 0x53008 -#define FO_PCI_PEC_CORE_BLOCK_INT_EN 0x51800 -#define FO_PCI_PEC_CORE_BLOCK_INT_STAT 0x51808 -#define FO_PCI_TLU_CTRL 0x80000 -#define FO_PCI_TLU_OEVENT_INT_EN 0x81008 -#define FO_PCI_TLU_OEVENT_INT_STAT 0x81010 -#define FO_PCI_TLU_OEVENT_STAT_CLR 0x81018 -#define FO_PCI_TLU_RX_OEVENT_HDR1_LOG 0x81028 -#define FO_PCI_TLU_RX_OEVENT_HDR2_LOG 0x81030 -#define FO_PCI_TLU_TX_OEVENT_HDR1_LOG 0x81038 -#define FO_PCI_TLU_TX_OEVENT_HDR2_LOG 0x81040 -#define FO_PCI_TLU_DEV_CTRL 0x90008 -#define FO_PCI_TLU_LNK_CTRL 0x90020 -#define FO_PCI_TLU_LNK_STAT 0x90028 -#define FO_PCI_TLU_UERR_INT_EN 0x91008 -#define FO_PCI_TLU_UERR_INT_STAT 0x91010 -#define FO_PCI_TLU_UERR_STAT_CLR 0x91018 -#define FO_PCI_TLU_RX_UERR_HDR1_LOG 0x91028 -#define FO_PCI_TLU_RX_UERR_HDR2_LOG 0x91030 -#define FO_PCI_TLU_TX_UERR_HDR1_LOG 0x91038 -#define FO_PCI_TLU_TX_UERR_HDR2_LOG 0x91040 -#define FO_PCI_TLU_CERR_INT_EN 0xa1008 -#define FO_PCI_TLU_CERR_INT_STAT 0xa1010 -#define FO_PCI_TLU_CERR_STAT_CLR 0xa1018 -#define FO_PCI_LPU_RST 0xe2008 -#define FO_PCI_LPU_INT_STAT 0xe2040 -#define FO_PCI_LPU_INT_MASK 0xe0248 -#define FO_PCI_LPU_LNK_LYR_CFG 0xe2200 -#define FO_PCI_LPU_LNK_LYR_INT_STAT 0xe2210 -#define FO_PCI_LPU_FLW_CTRL_UPDT_CTRL 0xe2240 -#define FO_PCI_LPU_TXLNK_FREQ_LAT_TMR_THRS 0xe2400 -#define FO_PCI_LPU_TXLNK_RPLY_TMR_THRS 0xe2410 -#define FO_PCI_LPU_TXLNK_RTR_FIFO_PTR 0xe2430 -#define FO_PCI_LPU_PHY_LYR_INT_STAT 0xe2610 -#define FO_PCI_LPU_LTSSM_CFG2 0xe2788 -#define FO_PCI_LPU_LTSSM_CFG3 0xe2790 -#define FO_PCI_LPU_LTSSM_CFG4 0xe2798 -#define FO_PCI_LPU_LTSSM_CFG5 0xe27a0 - -/* PCI interrupt mapping registers */ -#define FO_PCI_IMAP_MDO_MODE 0x8000000000000000ULL -#define FO_PCI_IMAP_V 0x0000000080000000ULL -#define FIRE_PCI_IMAP_T_JPID_MASK 0x000000007c000000ULL -#define FIRE_PCI_IMAP_T_JPID_SHFT 26 -#define OBERON_PCI_IMAP_T_DESTID_MASK 0x000000007fe00000ULL -#define OBERON_PCI_IMAP_T_DESTID_SHFT 21 -#define FO_PCI_IMAP_INT_CTRL_NUM_MASK 0x00000000000003c0ULL -#define FO_PCI_IMAP_INT_CTRL_NUM_SHFT 6 - -/* PCI interrupt clear registers - use INTCLR_* from */ - -/* PCI event queue base address register */ -#define FO_PCI_EQ_BASE_ADDR_BYPASS 0xfffc000000000000ULL -#define FO_PCI_EQ_BASE_ADDR_MASK 0xfffffffffff80000ULL -#define FO_PCI_EQ_BASE_ADDR_SHFT 19 - -/* PCI event queue control set registers */ -#define FO_PCI_EQ_CTRL_SET_ENOVERR 0x0200000000000000ULL -#define FO_PCI_EQ_CTRL_SET_EN 0x0000100000000000ULL - -/* PCI event queue control clear registers */ -#define FO_PCI_EQ_CTRL_CLR_COVERR 0x0200000000000000ULL -#define FO_PCI_EQ_CTRL_CLR_E2I 0x0000800000000000ULL -#define FO_PCI_EQ_CTRL_CLR_DIS 0x0000100000000000ULL - -/* PCI event queue tail registers */ -#define FO_PCI_EQ_TL_OVERR 0x0200000000000000ULL -#define FO_PCI_EQ_TL_MASK 0x000000000000007fULL -#define FO_PCI_EQ_TL_SHFT 0 - -/* PCI event queue head registers */ -#define FO_PCI_EQ_HD_MASK 0x000000000000007fULL -#define FO_PCI_EQ_HD_SHFT 0 - -/* PCI MSI mapping registers */ -#define FO_PCI_MSI_MAP_V 0x8000000000000000ULL -#define FO_PCI_MSI_MAP_EQWR_N 0x4000000000000000ULL -#define FO_PCI_MSI_MAP_EQNUM_MASK 0x000000000000003fULL -#define FO_PCI_MSI_MAP_EQNUM_SHFT 0 - -/* PCI MSI clear registers */ -#define FO_PCI_MSI_CLR_EQWR_N 0x4000000000000000ULL - -/* - * PCI IMU interrupt enable, interrupt status and error status clear - * registers - */ -#define FO_PCI_IMU_ERR_INT_SPARE_S_MASK 0x00007c0000000000ULL -#define FO_PCI_IMU_ERR_INT_SPARE_S_SHFT 42 -#define FO_PCI_IMU_ERR_INT_EQ_OVER_S 0x0000020000000000ULL -#define FO_PCI_IMU_ERR_INT_EQ_NOT_EN_S 0x0000010000000000ULL -#define FO_PCI_IMU_ERR_INT_MSI_MAL_ERR_S 0x0000008000000000ULL -#define FO_PCI_IMU_ERR_INT_MSI_PAR_ERR_S 0x0000004000000000ULL -#define FO_PCI_IMU_ERR_INT_PMEACK_MES_NOT_EN_S 0x0000002000000000ULL -#define FO_PCI_IMU_ERR_INT_PMPME_MES_NOT_EN_S 0x0000001000000000ULL -#define FO_PCI_IMU_ERR_INT_FATAL_MES_NOT_EN_S 0x0000000800000000ULL -#define FO_PCI_IMU_ERR_INT_NFATAL_MES_NOT_EN_S 0x0000000400000000ULL -#define FO_PCI_IMU_ERR_INT_COR_MES_NOT_EN_S 0x0000000200000000ULL -#define FO_PCI_IMU_ERR_INT_MSI_NOT_EN_S 0x0000000100000000ULL -#define FO_PCI_IMU_ERR_INT_SPARE_P_MASK 0x0000000000007c00ULL -#define FO_PCI_IMU_ERR_INT_SPARE_P_SHFT 10 -#define FO_PCI_IMU_ERR_INT_EQ_OVER_P 0x0000000000000200ULL -#define FO_PCI_IMU_ERR_INT_EQ_NOT_EN_P 0x0000000000000100ULL -#define FO_PCI_IMU_ERR_INT_MSI_MAL_ERR_P 0x0000000000000080ULL -#define FO_PCI_IMU_ERR_INT_MSI_PAR_ERR_P 0x0000000000000040ULL -#define FO_PCI_IMU_ERR_INT_PMEACK_MES_NOT_EN_P 0x0000000000000020ULL -#define FO_PCI_IMU_ERR_INT_PMPME_MES_NOT_EN_P 0x0000000000000010ULL -#define FO_PCI_IMU_ERR_INT_FATAL_MES_NOT_EN_P 0x0000000000000008ULL -#define FO_PCI_IMU_ERR_INT_NFATAL_MES_NOT_EN_P 0x0000000000000004ULL -#define FO_PCI_IMU_ERR_INT_COR_MES_NOT_EN_P 0x0000000000000002ULL -#define FO_PCI_IMU_ERR_INT_MSI_NOT_EN_P 0x0000000000000001ULL - -/* PCI IMU RDS error log register */ -#define FO_PCI_IMU_RDS_ERR_LOG_TYPE_MASK 0xfc00000000000000ULL -#define FO_PCI_IMU_RDS_ERR_LOG_TYPE_SHFT 58 -#define FO_PCI_IMU_RDS_ERR_LOG_LENGTH_MASK 0x03ff000000000000ULL -#define FO_PCI_IMU_RDS_ERR_LOG_LENGTH_SHFT 48 -#define FO_PCI_IMU_RDS_ERR_LOG_REQ_ID_MASK 0x0000ffff00000000ULL -#define FO_PCI_IMU_RDS_ERR_LOG_REQ_ID_SHFT 32 -#define FO_PCI_IMU_RDS_ERR_LOG_TLP_TAG_MASK 0x00000000ff000000ULL -#define FO_PCI_IMU_RDS_ERR_LOG_TLP_TAG_SHFT 24 -#define FO_PCI_IMU_RDS_ERR_LOG_BE_MCODE_MASK 0x0000000000ff0000ULL -#define FO_PCI_IMU_RDS_ERR_LOG_BE_MCODE_SHFT 16 -#define FO_PCI_IMU_RDS_ERR_LOG_MSI_DATA_MASK 0x000000000000ffffULL -#define FO_PCI_IMU_RDS_ERR_LOG_MSI_DATA_SHFT 0 - -/* PCI IMU SCS error log register */ -#define FO_PCI_IMU_SCS_ERR_LOG_TYPE_MASK 0xfc00000000000000ULL -#define FO_PCI_IMU_SCS_ERR_LOG_TYPE_SHFT 58 -#define FO_PCI_IMU_SCS_ERR_LOG_LENGTH_MASK 0x03ff000000000000ULL -#define FO_PCI_IMU_SCS_ERR_LOG_LENGTH_SHFT 48 -#define FO_PCI_IMU_SCS_ERR_LOG_REQ_ID_MASK 0x0000ffff00000000ULL -#define FO_PCI_IMU_SCS_ERR_LOG_REQ_ID_SHFT 32 -#define FO_PCI_IMU_SCS_ERR_LOG_TLP_TAG_MASK 0x00000000ff000000ULL -#define FO_PCI_IMU_SCS_ERR_LOG_TLP_TAG_SHFT 24 -#define FO_PCI_IMU_SCS_ERR_LOG_BE_MODE_MASK 0x0000000000ff0000ULL -#define FO_PCI_IMU_SCS_ERR_LOG_BE_MCODE_SHFT 16 -#define FO_PCI_IMU_SCS_ERR_LOG_EQ_NUM_MASK 0x000000000000003fULL -#define FO_PCI_IMU_SCS_ERR_LOG_EQ_NUM_SHFT 0 - -/* PCI IMU EQS error log register */ -#define FO_PCI_IMU_EQS_ERR_LOG_EQ_NUM_MASK 0x000000000000003fULL -#define FO_PCI_IMU_EQS_ERROR_LOG_EQ_NUM_SHFT 0 - -/* - * PCI ERR COR, ERR NONFATAL, ERR FATAL, PM PME and PME To ACK mapping - * registers - */ -#define FO_PCI_ERR_PME_V 0x8000000000000000ULL -#define FO_PCI_ERR_PME_EQNUM_MASK 0x000000000000003fULL -#define FO_PCI_ERR_PME_EQNUM_SHFT 0 - -/* PCI DMC core and block interrupt enable register */ -#define FO_PCI_DMC_CORE_BLOCK_INT_EN_DMC 0x8000000000000000ULL -#define FO_PCI_DMC_CORE_BLOCK_INT_EN_MMU 0x0000000000000002ULL -#define FO_PCI_DMC_CORE_BLOCK_INT_EN_IMU 0x0000000000000001ULL - -/* PCI DMC core and block error status register */ -#define FO_PCI_DMC_CORE_BLOCK_ERR_STAT_MMU 0x0000000000000002ULL -#define FO_PCI_DMC_CORE_BLOCK_ERR_STAT_IMU 0x0000000000000001ULL - -/* PCI multi core error status register */ -#define FO_PCI_MULTI_CORE_ERR_STAT_PEC 0x0000000000000002ULL -#define FO_PCI_MULTI_CORE_ERR_STAT_DMC 0x0000000000000001ULL - -/* PCI MSI 32-bit address register */ -#define FO_PCI_MSI_32_BIT_ADDR_MASK 0x00000000ffff0000ULL -#define FO_PCI_MSI_32_BIT_ADDR_SHFT 16 - -/* PCI MSI 64-bit address register */ -#define FO_PCI_MSI_64_BIT_ADDR_MASK 0x0000ffffffff0000ULL -#define FO_PCI_MSI_64_BIT_ADDR_SHFT 16 - -/* - * PCI MMU interrupt enable, interrupt status and error status clear - * registers - */ -#define FO_PCI_MMU_ERR_INT_S_MASK 0x0000ffff00000000ULL -#define FO_PCI_MMU_ERR_INT_S_SHFT 32 -#define FO_PCI_MMU_ERR_INT_TBW_DPE_S 0x0000800000000000ULL -#define FO_PCI_MMU_ERR_INT_TBW_ERR_S 0x0000400000000000ULL -#define FO_PCI_MMU_ERR_INT_TBW_UDE_S 0x0000200000000000ULL -#define FO_PCI_MMU_ERR_INT_TBW_DME_S 0x0000100000000000ULL -#define FO_PCI_MMU_ERR_INT_SPARE3_S 0x0000080000000000ULL -#define FO_PCI_MMU_ERR_INT_SPARE2_S 0x0000040000000000ULL -#define FO_PCI_MMU_ERR_INT_TTC_CAE_S 0x0000020000000000ULL -#define FIRE_PCI_MMU_ERR_INT_TTC_DPE_S 0x0000010000000000ULL -#define OBERON_PCI_MMU_ERR_INT_TTC_DUE_S 0x0000010000000000ULL -#define FO_PCI_MMU_ERR_INT_TTE_PRT_S 0x0000008000000000ULL -#define FO_PCI_MMU_ERR_INT_TTE_INV_S 0x0000004000000000ULL -#define FO_PCI_MMU_ERR_INT_TRN_OOR_S 0x0000002000000000ULL -#define FO_PCI_MMU_ERR_INT_TRN_ERR_S 0x0000001000000000ULL -#define FO_PCI_MMU_ERR_INT_SPARE1_S 0x0000000800000000ULL -#define FO_PCI_MMU_ERR_INT_SPARE0_S 0x0000000400000000ULL -#define FO_PCI_MMU_ERR_INT_BYP_OOR_S 0x0000000200000000ULL -#define FO_PCI_MMU_ERR_INT_BYP_ERR_S 0x0000000100000000ULL -#define FO_PCI_MMU_ERR_INT_P_MASK 0x000000000000ffffULL -#define FO_PCI_MMU_ERR_INT_P_SHFT 0 -#define FO_PCI_MMU_ERR_INT_TBW_DPE_P 0x0000000000008000ULL -#define FO_PCI_MMU_ERR_INT_TBW_ERR_P 0x0000000000004000ULL -#define FO_PCI_MMU_ERR_INT_TBW_UDE_P 0x0000000000002000ULL -#define FO_PCI_MMU_ERR_INT_TBW_DME_P 0x0000000000001000ULL -#define FO_PCI_MMU_ERR_INT_SPARE3_P 0x0000000000000800ULL -#define FO_PCI_MMU_ERR_INT_SPARE2_P 0x0000000000000400ULL -#define FO_PCI_MMU_ERR_INT_TTC_CAE_P 0x0000000000000200ULL -#define FIRE_PCI_MMU_ERR_INT_TTC_DPE_P 0x0000000000000100ULL -#define OBERON_PCI_MMU_ERR_INT_TTC_DUE_P 0x0000000000000100ULL -#define FO_PCI_MMU_ERR_INT_TTE_PRT_P 0x0000000000000080ULL -#define FO_PCI_MMU_ERR_INT_TTE_INV_P 0x0000000000000040ULL -#define FO_PCI_MMU_ERR_INT_TRN_OOR_P 0x0000000000000020ULL -#define FO_PCI_MMU_ERR_INT_TRN_ERR_P 0x0000000000000010ULL -#define FO_PCI_MMU_ERR_INT_SPARE1_P 0x0000000000000008ULL -#define FO_PCI_MMU_ERR_INT_SPARE0_P 0x0000000000000004ULL -#define FO_PCI_MMU_ERR_INT_BYP_OOR_P 0x0000000000000002ULL -#define FO_PCI_MMU_ERR_INT_BYP_ERR_P 0x0000000000000001ULL - -/* PCI MMU translation fault address register */ -#define FO_PCI_MMU_TRANS_FAULT_ADDR_VA_MASK 0xfffffffffffffffcULL -#define FO_PCI_MMU_TRANS_FAULT_ADDR_VA_SHFT 2 - -/* PCI MMU translation fault status register */ -#define FO_PCI_MMU_TRANS_FAULT_STAT_ENTRY_MASK 0x000001ff00000000ULL -#define FO_PCI_MMU_TRANS_FAULT_STAT_ENTRY_SHFT 32 -#define FO_PCI_MMU_TRANS_FAULT_STAT_TYPE_MASK 0x00000000007f0000ULL -#define FO_PCI_MMU_TRANS_FAULT_STAT_TYPE_SHFT 16 -#define FO_PCI_MMU_TRANS_FAULT_STAT_ID_MASK 0x000000000000ffffULL -#define FO_PCI_MMU_TRANS_FAULT_STAT_ID_SHFT 0 - -/* - * PCI ILU interrupt enable, interrupt status and error status clear - * registers - */ -#define FO_PCI_ILU_ERR_INT_SPARE3_S 0x0000008000000000ULL -#define FO_PCI_ILU_ERR_INT_SPARE2_S 0x0000004000000000ULL -#define FO_PCI_ILU_ERR_INT_SPARE1_S 0x0000002000000000ULL -#define FIRE_PCI_ILU_ERR_INT_IHB_PE_S 0x0000001000000000ULL -#define OBERON_PCI_ILU_ERR_INT_IHB_UE_S 0x0000001000000000ULL -#define FO_PCI_ILU_ERR_INT_SPARE3_P 0x0000000000000080ULL -#define FO_PCI_ILU_ERR_INT_SPARE2_P 0x0000000000000040ULL -#define FO_PCI_ILU_ERR_INT_SPARE1_P 0x0000000000000020ULL -#define FIRE_PCI_ILU_ERR_INT_IHB_PE_P 0x0000000000000010ULL -#define OBERON_PCI_ILU_ERR_INT_IHB_UE_P 0x0000000000000010ULL - -/* PCI DMC debug select registers for port a/b */ -#define FO_PCI_DMC_DBG_SEL_PORT_BLCK_MASK 0x00000000000003c0ULL -#define FO_PCI_DMC_DBG_SEL_PORT_BLCK_SHFT 6 -#define FO_PCI_DMC_DBG_SEL_PORT_SUB_MASK 0x0000000000000038ULL -#define FO_PCI_DMC_DBG_SEL_PORT_SUB_SHFT 3 -#define FO_PCI_DMC_DBG_SEL_PORT_SUB_SGNL_MASK 0x0000000000000007ULL -#define FO_PCI_DMC_DBG_SEL_PORT_SUB_SGNL_SHFT 0 - -/* PCI PEC core and block interrupt enable register */ -#define FO_PCI_PEC_CORE_BLOCK_INT_EN_PEC 0x8000000000000000ULL -#define FO_PCI_PEC_CORE_BLOCK_INT_EN_ILU 0x0000000000000008ULL -#define FO_PCI_PEC_CORE_BLOCK_INT_EN_UERR 0x0000000000000004ULL -#define FO_PCI_PEC_CORE_BLOCK_INT_EN_CERR 0x0000000000000002ULL -#define FO_PCI_PEC_CORE_BLOCK_INT_EN_OEVENT 0x0000000000000001ULL - -/* PCI PEC core and block interrupt status register */ -#define FO_PCI_PEC_CORE_BLOCK_INT_STAT_ILU 0x0000000000000008ULL -#define FO_PCI_PEC_CORE_BLOCK_INT_STAT_UERR 0x0000000000000004ULL -#define FO_PCI_PEC_CORE_BLOCK_INT_STAT_CERR 0x0000000000000002ULL -#define FO_PCI_PEC_CORE_BLOCK_INT_STAT_OEVENT 0x0000000000000001ULL - -/* PCI TLU control register */ -#define FO_PCI_TLU_CTRL_L0S_TIM_MASK 0x00000000ff000000ULL -#define FO_PCI_TLU_CTRL_L0S_TIM_SHFT 24 -#define FO_PCI_TLU_CTRL_NWPR_EN 0x0000000000100000ULL -#define FO_PCI_TLU_CTRL_CTO_SEL_MASK 0x0000000000070000ULL -#define FO_PCI_TLU_CTRL_CTO_SEL_SHFT 16 -#define FO_PCI_TLU_CTRL_CFG_MASK 0x000000000000ffffULL -#define FO_PCI_TLU_CTRL_CFG_SHFT 0 -#define FO_PCI_TLU_CTRL_CFG_REMAIN_DETECT_QUIET 0x0000000000000100ULL -#define FO_PCI_TLU_CTRL_CFG_PAD_LOOPBACK_EN 0x0000000000000080ULL -#define FO_PCI_TLU_CTRL_CFG_EWRAP_LOOPBACK_EN 0x0000000000000040ULL -#define FO_PCI_TLU_CTRL_CFG_DIGITAL_LOOPBACK_EN 0x0000000000000020ULL -#define FO_PCI_TLU_CTRL_CFG_MPS_MASK 0x000000000000001cULL -#define FO_PCI_TLU_CTRL_CFG_MPS_SHFT 2 -#define FO_PCI_TLU_CTRL_CFG_COMMON_CLK_CFG 0x0000000000000002ULL -#define FO_PCI_TLU_CTRL_CFG_PORT 0x0000000000000001ULL - -/* - * PCI TLU other event interrupt enable, interrupt status and status clear - * registers - */ -#define FO_PCI_TLU_OEVENT_S_MASK 0x00ffffff00000000ULL -#define FO_PCI_TLU_OEVENT_S_SHFT 32 -#define FO_PCI_TLU_OEVENT_SPARE_S 0x0080000000000000ULL -#define FO_PCI_TLU_OEVENT_MFC_S 0x0040000000000000ULL -#define FO_PCI_TLU_OEVENT_CTO_S 0x0020000000000000ULL -#define FO_PCI_TLU_OEVENT_NFP_S 0x0010000000000000ULL -#define FO_PCI_TLU_OEVENT_LWC_S 0x0008000000000000ULL -#define FO_PCI_TLU_OEVENT_MRC_S 0x0004000000000000ULL -#define FO_PCI_TLU_OEVENT_WUC_S 0x0002000000000000ULL -#define FO_PCI_TLU_OEVENT_RUC_S 0x0001000000000000ULL -#define FO_PCI_TLU_OEVENT_CRS_S 0x0000800000000000ULL -#define FO_PCI_TLU_OEVENT_IIP_S 0x0000400000000000ULL -#define FO_PCI_TLU_OEVENT_EDP_S 0x0000200000000000ULL -#define FIRE_PCI_TLU_OEVENT_EHP_S 0x0000100000000000ULL -#define OBERON_PCI_TLU_OEVENT_EHBUE_S 0x0000100000000000ULL -#define OBERON_PCI_TLU_OEVENT_EDBUE_S 0x0000100000000000ULL -#define FO_PCI_TLU_OEVENT_LIN_S 0x0000080000000000ULL -#define FO_PCI_TLU_OEVENT_LRS_S 0x0000040000000000ULL -#define FO_PCI_TLU_OEVENT_LDN_S 0x0000020000000000ULL -#define FO_PCI_TLU_OEVENT_LUP_S 0x0000010000000000ULL -#define FO_PCI_TLU_OEVENT_LPU_S_MASK 0x000000c000000000ULL -#define FO_PCI_TLU_OEVENT_LPU_S_SHFT 38 -#define OBERON_PCI_TLU_OEVENT_TLUEITMO_S 0x0000008000000000ULL -#define FO_PCI_TLU_OEVENT_ERU_S 0x0000002000000000ULL -#define FO_PCI_TLU_OEVENT_ERO_S 0x0000001000000000ULL -#define FO_PCI_TLU_OEVENT_EMP_S 0x0000000800000000ULL -#define FO_PCI_TLU_OEVENT_EPE_S 0x0000000400000000ULL -#define FIRE_PCI_TLU_OEVENT_ERP_S 0x0000000200000000ULL -#define OBERON_PCI_TLU_OEVENT_ERBU_S 0x0000000200000000ULL -#define FIRE_PCI_TLU_OEVENT_EIP_S 0x0000000100000000ULL -#define OBERON_PCI_TLU_OEVENT_EIUE_S 0x0000000100000000ULL -#define FO_PCI_TLU_OEVENT_P_MASK 0x0000000000ffffffULL -#define FO_PCI_TLU_OEVENT_P_SHFT 0 -#define FO_PCI_TLU_OEVENT_SPARE_P 0x0000000000800000ULL -#define FO_PCI_TLU_OEVENT_MFC_P 0x0000000000400000ULL -#define FO_PCI_TLU_OEVENT_CTO_P 0x0000000000200000ULL -#define FO_PCI_TLU_OEVENT_NFP_P 0x0000000000100000ULL -#define FO_PCI_TLU_OEVENT_LWC_P 0x0000000000080000ULL -#define FO_PCI_TLU_OEVENT_MRC_P 0x0000000000040000ULL -#define FO_PCI_TLU_OEVENT_WUC_P 0x0000000000020000ULL -#define FO_PCI_TLU_OEVENT_RUC_P 0x0000000000010000ULL -#define FO_PCI_TLU_OEVENT_CRS_P 0x0000000000008000ULL -#define FO_PCI_TLU_OEVENT_IIP_P 0x0000000000004000ULL -#define FO_PCI_TLU_OEVENT_EDP_P 0x0000000000002000ULL -#define FIRE_PCI_TLU_OEVENT_EHP_P 0x0000000000001000ULL -#define OBERON_PCI_TLU_OEVENT_EHBUE_P 0x0000000000001000ULL -#define OBERON_PCI_TLU_OEVENT_EDBUE_P 0x0000000000001000ULL -#define FO_PCI_TLU_OEVENT_LIN_P 0x0000000000000800ULL -#define FO_PCI_TLU_OEVENT_LRS_P 0x0000000000000400ULL -#define FO_PCI_TLU_OEVENT_LDN_P 0x0000000000000200ULL -#define FO_PCI_TLU_OEVENT_LUP_P 0x0000000000000100ULL -#define FO_PCI_TLU_OEVENT_LPU_P_MASK 0x00000000000000c0ULL -#define FO_PCI_TLU_OEVENT_LPU_P_SHFT 6 -#define OBERON_PCI_TLU_OEVENT_TLUEITMO_P 0x0000000000000080ULL -#define FO_PCI_TLU_OEVENT_ERU_P 0x0000000000000020ULL -#define FO_PCI_TLU_OEVENT_ERO_P 0x0000000000000010ULL -#define FO_PCI_TLU_OEVENT_EMP_P 0x0000000000000008ULL -#define FO_PCI_TLU_OEVENT_EPE_P 0x0000000000000004ULL -#define FIRE_PCI_TLU_OEVENT_ERP_P 0x0000000000000002ULL -#define OBERON_PCI_TLU_OEVENT_ERBU_P 0x0000000000000002ULL -#define FIRE_PCI_TLU_OEVENT_EIP_P 0x0000000000000001ULL -#define OBERON_PCI_TLU_OEVENT_EIUE_P 0x0000000000000001ULL - -/* PCI receive/transmit DLU/TLU other event header 1/2 log registers */ -#define FO_PCI_TLU_OEVENT_HDR_LOG_MASK 0xffffffffffffffffULL -#define FO_PCI_TLU_OEVENT_HDR_LOG_SHFT 0 - -/* PCI TLU device control register */ -#define FO_PCI_TLU_DEV_CTRL_MRRS_MASK 0x0000000000007000ULL -#define FO_PCI_TLU_DEV_CTRL_MRRS_SHFT 12 -#define FO_PCI_TLU_DEV_CTRL_MPS_MASK 0x00000000000000e0ULL -#define FO_PCI_TLU_DEV_CTRL_MPS_SHFT 5 - -/* - * PCI TLU uncorrectable error interrupt enable, interrupt status and - * status clear registers - */ -#define FO_PCI_TLU_UERR_INT_S_MASK 0x001fffff00000000ULL -#define FO_PCI_TLU_UERR_INT_S_SHFT 32 -#define FO_PCI_TLU_UERR_INT_UR_S 0x0010000000000000ULL -#define OBERON_PCI_TLU_UERR_INT_ECRC_S 0x0008000000000000ULL -#define FO_PCI_TLU_UERR_INT_MFP_S 0x0004000000000000ULL -#define FO_PCI_TLU_UERR_INT_ROF_S 0x0002000000000000ULL -#define FO_PCI_TLU_UERR_INT_UC_S 0x0001000000000000ULL -#define FO_PCI_TLU_UERR_INT_CA_S 0x0000800000000000ULL -#define FO_PCI_TLU_UERR_INT_CTO_S 0x0000400000000000ULL -#define FO_PCI_TLU_UERR_INT_FCP_S 0x0000200000000000ULL -#define FIRE_PCI_TLU_UERR_INT_PP_S 0x0000100000000000ULL -#define OBERON_PCI_TLU_UERR_INT_POIS_S 0x0000100000000000ULL -#define FO_PCI_TLU_UERR_INT_DLP_S 0x0000001000000000ULL -#define FO_PCI_TLU_UERR_INT_TE_S 0x0000000100000000ULL -#define FO_PCI_TLU_UERR_INT_P_MASK 0x00000000001fffffULL -#define FO_PCI_TLU_UERR_INT_P_SHFT 0 -#define FO_PCI_TLU_UERR_INT_UR_P 0x0000000000100000ULL -#define OBERON_PCI_TLU_UERR_INT_ECRC_P 0x0000000000080000ULL -#define FO_PCI_TLU_UERR_INT_MFP_P 0x0000000000040000ULL -#define FO_PCI_TLU_UERR_INT_ROF_P 0x0000000000020000ULL -#define FO_PCI_TLU_UERR_INT_UC_P 0x0000000000010000ULL -#define FO_PCI_TLU_UERR_INT_CA_P 0x0000000000008000ULL -#define FO_PCI_TLU_UERR_INT_CTO_P 0x0000000000004000ULL -#define FO_PCI_TLU_UERR_INT_FCP_P 0x0000000000002000ULL -#define FIRE_PCI_TLU_UERR_INT_PP_P 0x0000000000001000ULL -#define OBERON_PCI_TLU_UERR_INT_POIS_P 0x0000000000001000ULL -#define FO_PCI_TLU_UERR_INT_DLP_P 0x0000000000000010ULL -#define FO_PCI_TLU_UERR_INT_TE_P 0x0000000000000001ULL - -/* - * PCI TLU correctable error interrupt enable, interrupt status and - * status clear registers - */ -#define FO_PCI_TLU_CERR_INT_S_MASK 0x001fffff00000000ULL -#define FO_PCI_TLU_CERR_INT_S_SHFT 32 -#define FO_PCI_TLU_CERR_INT_RTO_S 0x0000100000000000ULL -#define FO_PCI_TLU_CERR_INT_RNR_S 0x0000010000000000ULL -#define FO_PCI_TLU_CERR_INT_BDP_S 0x0000008000000000ULL -#define FO_PCI_TLU_CERR_INT_BTP_S 0x0000004000000000ULL -#define FO_PCI_TLU_CERR_INT_RE_S 0x0000000100000000ULL -#define FO_PCI_TLU_CERR_INT_P_MASK 0x00000000001fffffULL -#define FO_PCI_TLU_CERR_INT_P_SHFT 0 -#define FO_PCI_TLU_CERR_INT_RTO_P 0x0000000000001000ULL -#define FO_PCI_TLU_CERR_INT_RNR_P 0x0000000000000100ULL -#define FO_PCI_TLU_CERR_INT_BDP_P 0x0000000000000080ULL -#define FO_PCI_TLU_CERR_INT_BTP_P 0x0000000000000040ULL -#define FO_PCI_TLU_CERR_INT_RE_P 0x0000000000000001ULL - -/* PCI TLU reset register */ -#define FO_PCI_LPU_RST_WE 0x0000000080000000ULL -#define FO_PCI_LPU_RST_UNUSED_MASK 0x0000000000000e00ULL -#define FO_PCI_LPU_RST_UNUSED_SHFT 9 -#define FO_PCI_LPU_RST_ERR 0x0000000000000100ULL -#define FO_PCI_LPU_RST_TXLINK 0x0000000000000080ULL -#define FO_PCI_LPU_RST_RXLINK 0x0000000000000040ULL -#define FO_PCI_LPU_RST_SMLINK 0x0000000000000020ULL -#define FO_PCI_LPU_RST_LTSSM 0x0000000000000010ULL -#define FO_PCI_LPU_RST_TXPHY 0x0000000000000008ULL -#define FO_PCI_LPU_RST_RXPHY 0x0000000000000004ULL -#define FO_PCI_LPU_RST_TXPCS 0x0000000000000002ULL -#define FO_PCI_LPU_RST_RXPCS 0x0000000000000001ULL - -/* PCI TLU link control register */ -#define FO_PCI_TLU_LNK_CTRL_EXTSYNC 0x0000000000000080ULL -#define FO_PCI_TLU_LNK_CTRL_CLK 0x0000000000000040ULL -#define FO_PCI_TLU_LNK_CTRL_RETRAIN 0x0000000000000020ULL -#define FO_PCI_TLU_LNK_CTRL_DIS 0x0000000000000010ULL -#define FO_PCI_TLU_LNK_CTRL_RCB 0x0000000000000008ULL -#define FO_PCI_TLU_LNK_CTRL_ASPM_L0S_L1S 0x0000000000000003ULL -#define FO_PCI_TLU_LNK_CTRL_ASPM_L1S 0x0000000000000002ULL -#define FO_PCI_TLU_LNK_CTRL_ASPM_L0S 0x0000000000000001ULL -#define FO_PCI_TLU_LNK_CTRL_ASPM_DIS 0x0000000000000000ULL - -/* PCI TLU link status register */ -#define FO_PCI_TLU_LNK_STAT_CLK 0x0000000000001000ULL -#define FO_PCI_TLU_LNK_STAT_TRAIN 0x0000000000000800ULL -#define FO_PCI_TLU_LNK_STAT_ERR 0x0000000000000400ULL -#define FO_PCI_TLU_LNK_STAT_WDTH_MASK 0x00000000000003f0ULL -#define FO_PCI_TLU_LNK_STAT_WDTH_SHFT 4 -#define FO_PCI_TLU_LNK_STAT_SPEED_MASK 0x000000000000000fULL -#define FO_PCI_TLU_LNK_STAT_SPEED_SHFT 0 - -/* - * PCI receive/transmit DLU/TLU uncorrectable error header 1/2 log - * registers - */ -#define FO_PCI_TLU_UERR_HDR_LOG_MASK 0xffffffffffffffffULL -#define FO_PCI_TLU_UERR_HDR_LOG_SHFT 0 - -/* PCI DLU/LPU interrupt status and mask registers */ -#define FO_PCI_LPU_INT_INT 0x0000000080000000ULL -#define FIRE_PCI_LPU_INT_PRF_CNT2_OFLW 0x0000000000000080ULL -#define FIRE_PCI_LPU_INT_PRF_CNT1_OFLW 0x0000000000000040ULL -#define FO_PCI_LPU_INT_LNK_LYR 0x0000000000000020ULL -#define FO_PCI_LPU_INT_PHY_ERR 0x0000000000000010ULL -#define FIRE_PCI_LPU_INT_LTSSM 0x0000000000000008ULL -#define FIRE_PCI_LPU_INT_PHY_TX 0x0000000000000004ULL -#define FIRE_PCI_LPU_INT_PHY_RX 0x0000000000000002ULL -#define FIRE_PCI_LPU_INT_PHY_GB 0x0000000000000001ULL - -/* PCI DLU/LPU link layer config register */ -#define FIRE_PCI_LPU_LNK_LYR_CFG_AUTO_UPDT_DIS 0x0000000000080000ULL -#define FIRE_PCI_LPU_LNK_LYR_CFG_FREQ_NAK_EN 0x0000000000040000ULL -#define FIRE_PCI_LPU_LNK_LYR_CFG_RPLY_AFTER_REQ 0x0000000000020000ULL -#define FIRE_PCI_LPU_LNK_LYR_CFG_LAT_THRS_WR_EN 0x0000000000010000ULL -#define FO_PCI_LPU_LNK_LYR_CFG_VC0_EN 0x0000000000000100ULL -#define FIRE_PCI_LPU_LNK_LYR_CFG_L0S_ADJ_FAC_EN 0x0000000000000010ULL -#define FIER_PCI_LPU_LNK_LYR_CFG_TLP_XMIT_FC_EN 0x0000000000000008ULL -#define FO_PCI_LPU_LNK_LYR_CFG_FREQ_ACK_EN 0x0000000000000004ULL -#define FO_PCI_LPU_LNK_LYR_CFG_RETRY_DIS 0x0000000000000002ULL - -/* PCI DLU/LPU link layer interrupt and status register */ -#define FO_PCI_LPU_LNK_LYR_INT_STAT_LNK_ERR_ACT 0x0000000080000000ULL -#define OBERON_PCI_LPU_LNK_LYR_INT_STAT_PBUS_PE 0x0000000000800000ULL -#define FO_PCI_LPU_LNK_LYR_INT_STAT_USPRTD_DLLP 0x0000000000400000ULL -#define FO_PCI_LPU_LNK_LYR_INT_STAT_DLLP_RX_ERR 0x0000000000200000ULL -#define FO_PCI_LPU_LNK_LYR_INT_STAT_BAD_DLLP 0x0000000000100000ULL -#define FO_PCI_LPU_LNK_LYR_INT_STAT_TLP_RX_ERR 0x0000000000040000ULL -#define FO_PCI_LPU_LNK_LYR_INT_STAT_SRC_ERR_TLP 0x0000000000020000ULL -#define FO_PCI_LPU_LNK_LYR_INT_STAT_BAD_TLP 0x0000000000010000ULL -#define FO_PCI_LPU_LNK_LYR_INT_STAT_RBF_UDF_ERR 0x0000000000000200ULL -#define FO_PCI_LPU_LNK_LYR_INT_STAT_RBF_OVF_ERR 0x0000000000000100ULL -#define FO_PCI_LPU_LNK_LYR_INT_STAT_EG_TLPM_ERR 0x0000000000000080ULL -#define FO_PCI_LPU_LNK_LYR_INT_STAT_EG_TFRM_ERR 0x0000000000000040ULL -#define FO_PCI_LPU_LNK_LYR_INT_STAT_RBF_PE 0x0000000000000020ULL -#define FO_PCI_LPU_LNK_LYR_INT_STAT_EGRESS_PE 0x0000000000000010ULL -#define FO_PCI_LPU_LNK_LYR_INT_STAT_RPLY_TMR_TO 0x0000000000000004ULL -#define FO_PCI_LPU_LNK_LYR_INT_STAT_RPLY_NUM_RO 0x0000000000000002ULL -#define FO_PCI_LPU_LNK_LYR_INT_STAT_DLNK_PES 0x0000000000000001ULL - -/* PCI DLU/LPU flow control update control register */ -#define FO_PCI_LPU_FLW_CTRL_UPDT_CTRL_FC0_C_EN 0x0000000000000004ULL -#define FO_PCI_LPU_FLW_CTRL_UPDT_CTRL_FC0_NP_EN 0x0000000000000002ULL -#define FO_PCI_LPU_FLW_CTRL_UPDT_CTRL_FC0_P_EN 0x0000000000000001ULL - -/* PCI DLU/LPU txlink ACKNAK latency timer threshold register */ -#define FO_PCI_LPU_TXLNK_FREQ_LAT_TMR_THRS_MASK 0x000000000000ffffULL -#define FO_PCI_LPU_TXLNK_FREQ_LAT_TMR_THRS_SHFT 0 - -/* PCI DLU/LPU txlink replay timer threshold register */ -#define FO_PCI_LPU_TXLNK_RPLY_TMR_THRS_MASK 0x00000000000fffffULL -#define FO_PCI_LPU_TXLNK_RPLY_TMR_THRS_SHFT 0 - -/* PCI DLU/LPU txlink FIFO pointer register */ -#define FO_PCI_LPU_TXLNK_RTR_FIFO_PTR_TL_MASK 0x00000000ffff0000ULL -#define FO_PCI_LPU_TXLNK_RTR_FIFO_PTR_TL_SHFT 16 -#define FO_PCI_LPU_TXLNK_RTR_FIFO_PTR_HD_MASK 0x000000000000ffffULL -#define FO_PCI_LPU_TXLNK_RTR_FIFO_PTR_HD_SHFT 0 - -/* PCI DLU/LPU phy layer interrupt and status register */ -#define FO_PCI_LPU_PHY_LYR_INT_STAT_PHY_LYR_ERR 0x0000000080000000ULL -#define FO_PCI_LPU_PHY_LYR_INT_STAT_KC_DLLP_ERR 0x0000000000000800ULL -#define FO_PCI_LPU_PHY_LYR_INT_STAT_END_POS_ERR 0x0000000000000400ULL -#define FO_PCI_LPU_PHY_LYR_INT_STAT_LNK_ERR 0x0000000000000200ULL -#define FO_PCI_LPU_PHY_LYR_INT_STAT_TRN_ERR 0x0000000000000100ULL -#define FO_PCI_LPU_PHY_LYR_INT_STAT_EDB_DET 0x0000000000000080ULL -#define FO_PCI_LPU_PHY_LYR_INT_STAT_SDP_END 0x0000000000000040ULL -#define FO_PCI_LPU_PHY_LYR_INT_STAT_STP_END_EDB 0x0000000000000020ULL -#define FO_PCI_LPU_PHY_LYR_INT_STAT_INVC_ERR 0x0000000000000010ULL -#define FO_PCI_LPU_PHY_LYR_INT_STAT_MULTI_SDP 0x0000000000000008ULL -#define FO_PCI_LPU_PHY_LYR_INT_STAT_MULTI_STP 0x0000000000000004ULL -#define FO_PCI_LPU_PHY_LYR_INT_STAT_ILL_SDP_POS 0x0000000000000002ULL -#define FO_PCI_LPU_PHY_LYR_INT_STAT_ILL_STP_POS 0x0000000000000001ULL - -/* PCI DLU/LPU LTSSM config2 register */ -#define FO_PCI_LPU_LTSSM_CFG2_12_TO_MASK 0x00000000ffffffffULL -#define FO_PCI_LPU_LTSSM_CFG2_12_TO_SHFT 0 - -/* PCI DLU/LPU LTSSM config3 register */ -#define FO_PCI_LPU_LTSSM_CFG3_2_TO_MASK 0x00000000ffffffffULL -#define FO_PCI_LPU_LTSSM_CFG3_2_TO_SHFT 0 - -/* PCI DLU/LPU LTSSM config4 register */ -#define FO_PCI_LPU_LTSSM_CFG4_TRN_CTRL_MASK 0x00000000ff000000ULL -#define FO_PCI_LPU_LTSSM_CFG4_TRN_CTRL_SHFT 24 -#define FO_PCI_LPU_LTSSM_CFG4_DATA_RATE_MASK 0x0000000000ff0000ULL -#define FO_PCI_LPU_LTSSM_CFG4_DATA_RATE_SHFT 16 -#define FO_PCI_LPU_LTSSM_CFG4_N_FTS_MASK 0x000000000000ff00ULL -#define FO_PCI_LPU_LTSSM_CFG4_N_FTS_SHFT 8 -#define FO_PCI_LPU_LTSSM_CFG4_LNK_NUM_MASK 0x00000000000000ffULL -#define FO_PCI_LPU_LTSSM_CFG4_LNK_NUM_SHFT 0 - -/* PCI DLU/LPU LTSSM config5 register */ -#define FO_PCI_LPU_LTSSM_CFG5_UNUSED0_MASK 0x00000000ffffe000ULL -#define FO_PCI_LPU_LTSSM_CFG5_UNUSED0_SHFT 13 -#define FO_PCI_LPU_LTSSM_CFG5_RCV_DET_TST_MODE 0x0000000000001000ULL -#define FO_PCI_LPU_LTSSM_CFG5_POLL_CMPLNC_DIS 0x0000000000000800ULL -#define FO_PCI_LPU_LTSSM_CFG5_TX_IDLE_TX_FTS 0x0000000000000400ULL -#define FO_PCI_LPU_LTSSM_CFG5_RX_FTS_RVR_LK 0x0000000000000200ULL -#define FO_PCI_LPU_LTSSM_CFG5_UNUSED1_MASK 0x0000000000000180ULL -#define FO_PCI_LPU_LTSSM_CFG5_UNUSED1_SHFT 7 -#define FO_PCI_LPU_LTSSM_CFG5_LPBK_NTRY_ACTIVE 0x0000000000000040ULL -#define FO_PCI_LPU_LTSSM_CFG5_LPBK_NTRY_EXIT 0x0000000000000020ULL -#define FO_PCI_LPU_LTSSM_CFG5_LPBK_ACTIVE_EXIT 0x0000000000000010ULL -#define FO_PCI_LPU_LTSSM_CFG5_L1_IDLE_RCVRY_LK 0x0000000000000008ULL -#define FO_PCI_LPU_LTSSM_CFG5_L0_TRN_CNTRL_RST 0x0000000000000004ULL -#define FO_PCI_LPU_LTSSM_CFG5_L0_LPBK 0x0000000000000002ULL -#define FO_PCI_LPU_LTSSM_CFG5_UNUSED2 0x0000000000000001ULL - -/* Controller configuration and status registers */ -#define FIRE_JBUS_PAR_CTRL 0x60010 -#define FO_XBC_ERR_LOG_EN 0x61000 -#define FO_XBC_INT_EN 0x61008 -#define FO_XBC_INT_STAT 0x61010 -#define FO_XBC_ERR_STAT_CLR 0x61018 -#define FIRE_JBC_FATAL_RST_EN 0x61028 -#define FIRE_JBCINT_ITRANS_ERR_LOG 0x61040 -#define FIRE_JBCINT_ITRANS_ERR_LOG2 0x61048 -#define FIRE_JBCINT_OTRANS_ERR_LOG 0x61040 -#define FIRE_JBCINT_OTRANS_ERR_LOG2 0x61048 -#define FIRE_FATAL_ERR_LOG 0x61050 -#define FIRE_FATAL_ERR_LOG2 0x61058 -#define FIRE_MERGE_TRANS_ERR_LOG 0x61060 -#define FIRE_DMCINT_ODCD_ERR_LOG 0x61068 -#define FIRE_DMCINT_IDC_ERR_LOG 0x61070 -#define FIRE_JBC_CSR_ERR_LOG 0x61078 -#define FIRE_JBC_CORE_BLOCK_INT_EN 0x61800 -#define FIRE_JBC_CORE_BLOCK_ERR_STAT 0x61808 -#define FO_XBC_PRF_CNT_SEL 0x62000 -#define FO_XBC_PRF_CNT0 0x62008 -#define FO_XBC_PRF_CNT1 0x62010 - -/* JBus parity control register */ -#define FIRE_JBUS_PAR_CTRL_P_EN 0x8000000000000000ULL -#define FIRE_JBUS_PAR_CTRL_INVRTD_PAR_MASK 0x000000000000003cULL -#define FIRE_JBUS_PAR_CTRL_INVRTD_PAR_SHFT 2 -#define FIRE_JBUS_PAR_CTRL_NEXT_DATA 0x0000000000000002ULL -#define FIRE_JBUS_PAR_CTRL_NEXT_ADDR 0x0000000000000001ULL - -/* JBC error log enable register - may also apply to UBC */ -#define FIRE_JBC_ERR_LOG_EN_SPARE_MASK 0x00000000e0000000ULL -#define FIRE_JBC_ERR_LOG_EN_SPARE_SHFT 29 -#define FIRE_JBC_ERR_LOG_EN_PIO_UNMAP_RD 0x0000000010000000ULL -#define FIRE_JBC_ERR_LOG_EN_ILL_ACC_RD 0x0000000008000000ULL -#define FIRE_JBC_ERR_LOG_EN_EBUS_TO 0x0000000004000000ULL -#define FIRE_JBC_ERR_LOG_EN_MB_PEA 0x0000000002000000ULL -#define FIRE_JBC_ERR_LOG_EN_MB_PER 0x0000000001000000ULL -#define FIRE_JBC_ERR_LOG_EN_MB_PEW 0x0000000000800000ULL -#define FIRE_JBC_ERR_LOG_EN_UE_ASYN 0x0000000000400000ULL -#define FIRE_JBC_ERR_LOG_EN_CE_ASYN 0x0000000000200000ULL -#define FIRE_JBC_ERR_LOG_EN_JTE 0x0000000000100000ULL -#define FIRE_JBC_ERR_LOG_EN_JBE 0x0000000000080000ULL -#define FIRE_JBC_ERR_LOG_EN_JUE 0x0000000000040000ULL -#define FIRE_JBC_ERR_LOG_EN_IJP 0x0000000000020000ULL -#define FIRE_JBC_ERR_LOG_EN_ICISE 0x0000000000010000ULL -#define FIRE_JBC_ERR_LOG_EN_CPE 0x0000000000008000ULL -#define FIRE_JBC_ERR_LOG_EN_APE 0x0000000000004000ULL -#define FIRE_JBC_ERR_LOG_EN_WR_DPE 0x0000000000002000ULL -#define FIRE_JBC_ERR_LOG_EN_RD_DPE 0x0000000000001000ULL -#define FIRE_JBC_ERR_LOG_EN_ILL_BMW 0x0000000000000800ULL -#define FIRE_JBC_ERR_LOG_EN_ILL_BMR 0x0000000000000400ULL -#define FIRE_JBC_ERR_LOG_EN_BJC 0x0000000000000200ULL -#define FIRE_JBC_ERR_LOG_EN_PIO_UNMAP 0x0000000000000100ULL -#define FIRE_JBC_ERR_LOG_EN_PIO_DPE 0x0000000000000080ULL -#define FIRE_JBC_ERR_LOG_EN_PIO_CPE 0x0000000000000040ULL -#define FIRE_JBC_ERR_LOG_EN_ILL_ACC 0x0000000000000020ULL -#define FIRE_JBC_ERR_LOG_EN_UNSOL_RD 0x0000000000000010ULL -#define FIRE_JBC_ERR_LOG_EN_UNSOL_INT 0x0000000000000008ULL -#define FIRE_JBC_ERR_LOG_EN_JTCEEW 0x0000000000000004ULL -#define FIRE_JBC_ERR_LOG_EN_JTCEEI 0x0000000000000002ULL -#define FIRE_JBC_ERR_LOG_EN_JTCEER 0x0000000000000001ULL - -/* JBC interrupt enable, interrupt status and error status clear registers */ -#define FIRE_JBC_ERR_INT_SPARE_S_MASK 0xe000000000000000ULL -#define FIRE_JBC_ERR_INT_SPARE_S_SHFT 61 -#define FIRE_JBC_ERR_INT_PIO_UNMAP_RD_S 0x1000000000000000ULL -#define FIRE_JBC_ERR_INT_ILL_ACC_RD_S 0x0800000000000000ULL -#define FIRE_JBC_ERR_INT_EBUS_TO_S 0x0400000000000000ULL -#define FIRE_JBC_ERR_INT_MB_PEA_S 0x0200000000000000ULL -#define FIRE_JBC_ERR_INT_MB_PER_S 0x0100000000000000ULL -#define FIRE_JBC_ERR_INT_MB_PEW_S 0x0080000000000000ULL -#define FIRE_JBC_ERR_INT_UE_ASYN_S 0x0040000000000000ULL -#define FIRE_JBC_ERR_INT_CE_ASYN_S 0x0020000000000000ULL -#define FIRE_JBC_ERR_INT_JTE_S 0x0010000000000000ULL -#define FIRE_JBC_ERR_INT_JBE_S 0x0008000000000000ULL -#define FIRE_JBC_ERR_INT_JUE_S 0x0004000000000000ULL -#define FIRE_JBC_ERR_INT_IJP_S 0x0002000000000000ULL -#define FIRE_JBC_ERR_INT_ICISE_S 0x0001000000000000ULL -#define FIRE_JBC_ERR_INT_CPE_S 0x0000800000000000ULL -#define FIRE_JBC_ERR_INT_APE_S 0x0000400000000000ULL -#define FIRE_JBC_ERR_INT_WR_DPE_S 0x0000200000000000ULL -#define FIRE_JBC_ERR_INT_RD_DPE_S 0x0000100000000000ULL -#define FIRE_JBC_ERR_INT_ILL_BMW_S 0x0000080000000000ULL -#define FIRE_JBC_ERR_INT_ILL_BMR_S 0x0000040000000000ULL -#define FIRE_JBC_ERR_INT_BJC_S 0x0000020000000000ULL -#define FIRE_JBC_ERR_INT_PIO_UNMAP_S 0x0000010000000000ULL -#define FIRE_JBC_ERR_INT_PIO_DPE_S 0x0000008000000000ULL -#define FIRE_JBC_ERR_INT_PIO_CPE_S 0x0000004000000000ULL -#define FIRE_JBC_ERR_INT_ILL_ACC_S 0x0000002000000000ULL -#define FIRE_JBC_ERR_INT_UNSOL_RD_S 0x0000001000000000ULL -#define FIRE_JBC_ERR_INT_UNSOL_INT_S 0x0000000800000000ULL -#define FIRE_JBC_ERR_INT_JTCEEW_S 0x0000000400000000ULL -#define FIRE_JBC_ERR_INT_JTCEEI_S 0x0000000200000000ULL -#define FIRE_JBC_ERR_INT_JTCEER_S 0x0000000100000000ULL -#define FIRE_JBC_ERR_INT_SPARE_P_MASK 0x00000000e0000000ULL -#define FIRE_JBC_ERR_INT_SPARE_P_SHFT 29 -#define FIRE_JBC_ERR_INT_PIO_UNMAP_RD_P 0x0000000010000000ULL -#define FIRE_JBC_ERR_INT_ILL_ACC_RD_P 0x0000000008000000ULL -#define FIRE_JBC_ERR_INT_EBUS_TO_P 0x0000000004000000ULL -#define FIRE_JBC_ERR_INT_MB_PEA_P 0x0000000002000000ULL -#define FIRE_JBC_ERR_INT_MB_PER_P 0x0000000001000000ULL -#define FIRE_JBC_ERR_INT_MB_PEW_P 0x0000000000800000ULL -#define FIRE_JBC_ERR_INT_UE_ASYN_P 0x0000000000400000ULL -#define FIRE_JBC_ERR_INT_CE_ASYN_P 0x0000000000200000ULL -#define FIRE_JBC_ERR_INT_JTE_P 0x0000000000100000ULL -#define FIRE_JBC_ERR_INT_JBE_P 0x0000000000080000ULL -#define FIRE_JBC_ERR_INT_JUE_P 0x0000000000040000ULL -#define FIRE_JBC_ERR_INT_IJP_P 0x0000000000020000ULL -#define FIRE_JBC_ERR_INT_ICISE_P 0x0000000000010000ULL -#define FIRE_JBC_ERR_INT_CPE_P 0x0000000000008000ULL -#define FIRE_JBC_ERR_INT_APE_P 0x0000000000004000ULL -#define FIRE_JBC_ERR_INT_WR_DPE_P 0x0000000000002000ULL -#define FIRE_JBC_ERR_INT_RD_DPE_P 0x0000000000001000ULL -#define FIRE_JBC_ERR_INT_ILL_BMW_P 0x0000000000000800ULL -#define FIRE_JBC_ERR_INT_ILL_BMR_P 0x0000000000000400ULL -#define FIRE_JBC_ERR_INT_BJC_P 0x0000000000000200ULL -#define FIRE_JBC_ERR_INT_PIO_UNMAP_P 0x0000000000000100ULL -#define FIRE_JBC_ERR_INT_PIO_DPE_P 0x0000000000000080ULL -#define FIRE_JBC_ERR_INT_PIO_CPE_P 0x0000000000000040ULL -#define FIRE_JBC_ERR_INT_ILL_ACC_P 0x0000000000000020ULL -#define FIRE_JBC_ERR_INT_UNSOL_RD_P 0x0000000000000010ULL -#define FIRE_JBC_ERR_INT_UNSOL_INT_P 0x0000000000000008ULL -#define FIRE_JBC_ERR_INT_JTCEEW_P 0x0000000000000004ULL -#define FIRE_JBC_ERR_INT_JTCEEI_P 0x0000000000000002ULL -#define FIRE_JBC_ERR_INT_JTCEER_P 0x0000000000000001ULL - -/* UBC interrupt enable, error status and error status clear registers */ -#define OBERON_UBC_ERR_INT_PIORBEUE_S 0x0004000000000000ULL -#define OBERON_UBC_ERR_INT_PIOWBEUE_S 0x0002000000000000ULL -#define OBERON_UBC_ERR_INT_PIOWTUE_S 0x0001000000000000ULL -#define OBERON_UBC_ERR_INT_MEMWTAXB_S 0x0000080000000000ULL -#define OBERON_UBC_ERR_INT_MEMRDAXB_S 0x0000040000000000ULL -#define OBERON_UBC_ERR_INT_DMAWTUEB_S 0x0000020000000000ULL -#define OBERON_UBC_ERR_INT_DMARDUEB_S 0x0000010000000000ULL -#define OBERON_UBC_ERR_INT_MEMWTAXA_S 0x0000000800000000ULL -#define OBERON_UBC_ERR_INT_MEMRDAXA_S 0x0000000400000000ULL -#define OBERON_UBC_ERR_INT_DMAWTUEA_S 0x0000000200000000ULL -#define OBERON_UBC_ERR_INT_DMARDUEA_S 0x0000000100000000ULL -#define OBERON_UBC_ERR_INT_PIORBEUE_P 0x0000000000040000ULL -#define OBERON_UBC_ERR_INT_PIOWBEUE_P 0x0000000000020000ULL -#define OBERON_UBC_ERR_INT_PIOWTUE_P 0x0000000000010000ULL -#define OBERON_UBC_ERR_INT_MEMWTAXB_P 0x0000000000000800ULL -#define OBERON_UBC_ERR_INT_MEMRDAXB_P 0x0000000000000400ULL -#define OBERON_UBC_ERR_INT_DMARDUEB_P 0x0000000000000200ULL -#define OBERON_UBC_ERR_INT_DMAWTUEB_P 0x0000000000000100ULL -#define OBERON_UBC_ERR_INT_MEMWTAXA_P 0x0000000000000008ULL -#define OBERON_UBC_ERR_INT_MEMRDAXA_P 0x0000000000000004ULL -#define OBERON_UBC_ERR_INT_DMAWTUEA_P 0x0000000000000002ULL -#define OBERON_UBC_ERR_INT_DMARDUEA_P 0x0000000000000001ULL - -/* JBC fatal reset enable register */ -#define FIRE_JBC_FATAL_RST_EN_SPARE_P_INT_MASK 0x000000000c000000ULL -#define FIRE_JBC_FATAL_RST_EN_SPARE_P_INT_SHFT 26 -#define FIRE_JBC_FATAL_RST_EN_MB_PEA_P_INT 0x0000000002000000ULL -#define FIRE_JBC_FATAL_RST_EN_CPE_P_INT 0x0000000000008000ULL -#define FIRE_JBC_FATAL_RST_EN_APE_P_INT 0x0000000000004000ULL -#define FIRE_JBC_FATAL_RST_EN_PIO_CPE_INT 0x0000000000000040ULL -#define FIRE_JBC_FATAL_RST_EN_JTCEEW_P_INT 0x0000000000000004ULL -#define FIRE_JBC_FATAL_RST_EN_JTCEEI_P_INT 0x0000000000000002ULL -#define FIRE_JBC_FATAL_RST_EN_JTCEER_P_INT 0x0000000000000001ULL - -/* JBC JBCINT in transaction error log register */ -#define FIRE_JBCINT_ITRANS_ERR_LOG_Q_WORD_MASK 0x00c0000000000000ULL -#define FIRE_JBCINT_ITRANS_ERR_LOG_Q_WORD_SHFT 54 -#define FIRE_JBCINT_ITRANS_ERR_LOG_TRANSID_MASK 0x0003000000000000ULL -#define FIRE_JBCINT_ITRANS_ERR_LOG_TRANSID_SHFT 48 -#define FIRE_JBCINT_ITRANS_ERR_LOG_ADDR_MASK 0x000007ffffffffffULL -#define FIRE_JBCINT_ITRANS_ERR_LOG_ADDR_SHFT 0 - -/* JBC JBCINT in transaction error log register 2 */ -#define FIRE_JBCINT_ITRANS_ERR_LOG2_ARB_WN_MASK 0x000ffffff0000000ULL -#define FIRE_JBCINT_ITRANS_ERR_LOG2_ARB_WN_SHFT 28 -#define FIRE_JBCINT_ITRANS_ERR_LOG2_J_REQ_MASK 0x000000000fe00000ULL -#define FIRE_JBCINT_ITRANS_ERR_LOG2_J_REQ_SHFT 21 -#define FIRE_JBCINT_ITRANS_ERR_LOG2_J_PACK_MASK 0x00000000001fffffULL -#define FIRE_JBCINT_ITRANS_ERR_LOG2_J_PACK_SHFT 0 - -/* JBC JBCINT out transaction error log register */ -#define FIRE_JBCINT_OTRANS_ERR_LOG_TRANSID_MASK 0x003f000000000000ULL -#define FIRE_JBCINT_OTRANS_ERR_LOG_TRANSID_SHFT 48 -#define FIRE_JBCINT_OTRANS_ERR_LOG_ADDR_MASK 0x000007ffffffffffULL -#define FIRE_JBCINT_OTRANS_ERR_LOG_ADDR_SHFT 0 - -/* JBC JBCINT out transaction error log register 2 */ -#define FIRE_JBCINT_OTRANS_ERR_LOG2_ARB_WN_MASK 0x000ffffff0000000ULL -#define FIRE_JBCINT_OTRANS_ERR_LOG2_ARB_WN_SHFT 28 -#define FIRE_JBCINT_OTRANS_ERR_LOG2_J_REQ_MASK 0x000000000fe00000ULL -#define FIRE_JBCINT_OTRANS_ERR_LOG2_J_REQ_SHFT 21 -#define FIRE_JBCINT_OTRANS_ERR_LOG2_J_PACK_MASK 0x00000000001fffffULL -#define FIRE_JBCINT_OTRANS_ERR_LOG2_J_PACK_SHFT 0 - -/* JBC merge transaction error log register */ -#define FIRE_FATAL_ERR_LOG_DATA_MASK 0xffffffffffffffffULL -#define FIRE_FATAL_ERR_LOG_DATA_SHFT 0 - -/* JBC merge transaction error log register 2 */ -#define FIRE_FATAL_ERR_LOG2_ARB_WN_MASK 0x000ffffff0000000ULL -#define FIRE_FATAL_ERR_LOG2_ARB_WN_SHFT 28 -#define FIRE_FATAL_ERR_LOG2_J_REQ_MASK 0x000000000fe00000ULL -#define FIRE_FATAL_ERR_LOG2_J_REQ_SHFT 21 -#define FIRE_FATAL_ERR_LOG2_J_PACK_MASK 0x00000000001fffffULL -#define FIRE_FATAL_ERR_LOG2_J_PACK_SHFT 0 - -/* JBC merge transaction error log register */ -#define FIRE_MERGE_TRANS_ERR_LOG_Q_WORD_MASK 0x00c0000000000000ULL -#define FIRE_MERGE_TRANS_ERR_LOG_Q_WORD_SHFT 54 -#define FIRE_MERGE_TRANS_ERR_LOG_TRANSID_MASK 0x0003000000000000ULL -#define FIRE_MERGE_TRANS_ERR_LOG_TRANSID_SHFT 48 -#define FIRE_MERGE_TRANS_ERR_LOG_JBC_TAG_MASK 0x0000f80000000000ULL -#define FIRE_MERGE_TRANS_ERR_LOG_JBC_TAG_SHFT 43 -#define FIRE_MERGE_TRANS_ERR_LOG_ADDR_MASK 0x000007ffffffffffULL -#define FIRE_MERGE_TRANS_ERR_LOG_ADDR_SHFT 0 - -/* JBC DMCINT ODCD error log register */ -#define FIRE_DMCINT_ODCD_ERR_LOG_TRANS_ID_MASK 0x0030000000000000ULL -#define FIRE_DMCINT_ODCD_ERR_LOG_TRANS_ID_SHFT 52 -#define FIRE_DMCINT_ODCD_ERR_LOG_AID_MASK 0x000f000000000000ULL -#define FIRE_DMCINT_ODCD_ERR_LOG_AID_SHFT 48 -#define FIRE_DMCINT_ODCD_ERR_LOG_TTYPE_MASK 0x0000f80000000000ULL -#define FIRE_DMCINT_ODCD_ERR_LOG_TTYPE_SHFT 43 -#define FIRE_DMCINT_ODCD_ERR_LOG_ADDR_MASK 0x000007ffffffffffULL -#define FIRE_DMCINT_ODCD_ERR_LOG_ADDR_SHFT 0 - -/* JBC DMCINT IDC error log register */ -#define FIRE_DMCINT_IDC_ERR_DMC_CTAG_MASK 0x000000000fff0000ULL -#define FIRE_DMCINT_IDC_ERR_DMC_CTAG_SHFT 16 -#define FIRE_DMCINT_IDC_ERR_TRANSID_MASK 0x000000000000c000ULL -#define FIRE_DMCINT_IDC_ERR_AGNTID_MASK 0x0000000000003c00ULL -#define FIRE_DMCINT_IDC_ERR_AGNTID_SHFT 10 -#define FIRE_DMCINT_IDC_ERR_SRCID_MASK 0x00000000000003e0ULL -#define FIRE_DMCINT_IDC_ERR_SRCID_SHFT 5 -#define FIRE_DMCINT_IDC_ERR_TARGID_MASK 0x000000000000001fULL -#define FIRE_DMCINT_IDC_ERRO_TARGID_SHFT 0 - -/* JBC CSR error log register */ -#define FIRE_JBC_CSR_ERR_LOG_WR 0x0000040000000000ULL -#define FIRE_JBC_CSR_ERR_LOG_BMASK_MASK 0x000003fffc000000ULL -#define FIRE_JBC_CSR_ERR_LOG_BMASK_SHFT 26 -#define FIRE_JBC_CSR_ERR_LOG_ADDR_MASK 0x0000000003ffffffULL -#define FIRE_JBC_CSR_ERR_LOG_ADDR_SHFT 0 - -/* JBC core and block interrupt enable register */ -#define FIRE_JBC_CORE_BLOCK_INT_EN_JBC 0x8000000000000000ULL -#define FIRE_JBC_CORE_BLOCK_INT_EN_CSR 0x0000000000000008ULL -#define FIRE_JBC_CORE_BLOCK_INT_EN_MERGE 0x0000000000000004ULL -#define FIRE_JBC_CORE_BLOCK_INT_EN_JBCINT 0x0000000000000002ULL -#define FIRE_JBC_CORE_BLOCK_INT_EN_DMCINT 0x0000000000000001ULL - -/* JBC core and block error status register */ -#define FIRE_JBC_CORE_BLOCK_ERR_STAT_CSR 0x0000000000000008ULL -#define FIRE_JBC_CORE_BLOCK_ERR_STAT_MERGE 0x0000000000000004ULL -#define FIRE_JBC_CORE_BLOCK_ERR_STAT_JBCINT 0x0000000000000002ULL -#define FIRE_JBC_CORE_BLOCK_ERR_STAT_DMCINT 0x0000000000000001ULL - -/* JBC performance counter select register - may also apply to UBC */ -#define FO_XBC_PRF_CNT_PIO_RD_PCIEB 0x0000000000000018ULL -#define FO_XBC_PRF_CNT_PIO_WR_PCIEB 0x0000000000000017ULL -#define FO_XBC_PRF_CNT_PIO_RD_PCIEA 0x0000000000000016ULL -#define FO_XBC_PRF_CNT_PIO_WR_PCIEA 0x0000000000000015ULL -#define FO_XBC_PRF_CNT_WB 0x0000000000000014ULL -#define FO_XBC_PRF_CNT_PIO_FRGN 0x0000000000000013ULL -#define FO_XBC_PRF_CNT_XB_NCHRNT 0x0000000000000012ULL -#define FO_XBC_PRF_CNT_FO_CHRNT 0x0000000000000011ULL -#define FO_XBC_PRF_CNT_XB_CHRNT 0x0000000000000010ULL -#define FO_XBC_PRF_CNT_AOKOFF_DOKOFF 0x000000000000000fULL -#define FO_XBC_PRF_CNT_DOKOFF 0x000000000000000eULL -#define FO_XBC_PRF_CNT_AOKOFF 0x000000000000000dULL -#define FO_XBC_PRF_CNT_RD_TOTAL 0x000000000000000cULL -#define FO_XBC_PRF_CNT_WR_TOTAL 0x000000000000000bULL -#define FO_XBC_PRF_CNT_WR_PARTIAL 0x000000000000000aULL -#define FO_XBC_PRF_CNT_PIOS_CSR_RINGB 0x0000000000000009ULL -#define FO_XBC_PRF_CNT_PIOS_CSR_RINGA 0x0000000000000008ULL -#define FO_XBC_PRF_CNT_PIOS_EBUS 0x0000000000000007ULL -#define FO_XBC_PRF_CNT_PIOS_I2C 0x0000000000000006ULL -#define FO_XBC_PRF_CNT_RD_LAT_SMPLS 0x0000000000000005ULL -#define FO_XBC_PRF_CNT_RD_LAT 0x0000000000000004ULL -#define FO_XBC_PRF_CNT_ON_XB 0x0000000000000003ULL -#define FO_XBC_PRF_CNT_XB_IDL 0x0000000000000002ULL -#define FO_XBC_PRF_CNT_XB_CLK 0x0000000000000001ULL -#define FO_XBC_PRF_CNT_NONE 0x0000000000000000ULL -#define FO_XBC_PRF_CNT_CNT1_SHFT 8 -#define FO_XBC_PRF_CNT_CNT0_SHFT 0 - -/* JBC performance counter 0/1 registers - may also apply to UBC */ -#define FO_XBC_PRF_CNT_MASK 0xffffffffffffffffULL -#define FO_XBC_PRF_CNT_SHFT 0 - -/* Lookup tables */ -const uint16_t fire_freq_nak_tmr_thrs[6][4] = { - { 0x00ed, 0x049, 0x043, 0x030 }, - { 0x01a0, 0x076, 0x06b, 0x048 }, - { 0x022f, 0x09a, 0x056, 0x056 }, - { 0x042f, 0x11a, 0x096, 0x096 }, - { 0x082f, 0x21a, 0x116, 0x116 }, - { 0x102f, 0x41a, 0x216, 0x216 } -}; - -const uint16_t fire_rply_tmr_thrs[6][4] = { - { 0x0379, 0x112, 0x0fc, 0x0b4 }, - { 0x0618, 0x1BA, 0x192, 0x10e }, - { 0x0831, 0x242, 0x143, 0x143 }, - { 0x0fb1, 0x422, 0x233, 0x233 }, - { 0x1eb0, 0x7e1, 0x412, 0x412 }, - { 0x3cb0, 0xf61, 0x7d2, 0x7d2 } -}; - -/* Register default values */ -#define FO_PCI_TLU_CTRL_L0S_TIM_DFLT 0xda -#define FO_PCI_TLU_CTRL_CFG_DFLT 0x1 -#define FO_PCI_LPU_LTSSM_CFG2_12_TO_DFLT 0x2dc6c0 -#define FO_PCI_LPU_LTSSM_CFG3_2_TO_DFLT 0x7a120 -#define FO_PCI_LPU_LTSSM_CFG4_DATA_RATE_DFLT 0x2 -#define FO_PCI_LPU_LTSSM_CFG4_N_FTS_DFLT 0x8c -#define OBERON_PCI_LPU_TXLNK_RPLY_TMR_THRS_DFLT 0xc9 -#define FO_PCI_LPU_TXLNK_RTR_FIFO_PTR_HD_DFLT 0x0 -#define FO_PCI_LPU_TXLNK_RTR_FIFO_PTR_TL_DFLT 0xffff - -/* INO macros */ -#define FO_EQ_FIRST_INO 0x18 -#define FO_EQ_LAST_INO 0x3b -#define FO_DMC_PEC_INO 0x3e -#define FO_XCB_INO 0x3f -#define FO_MAX_INO FO_XCB_INO - -/* Device space macros */ -#define FO_CONF_BUS_SHFT 20 -#define FO_CONF_DEV_SHFT 15 -#define FO_CONF_FUNC_SHFT 12 -#define FO_CONF_REG_SHFT 0 -#define FO_IO_SIZE 0x10000000 -#define FO_MEM_SIZE 0x1ffff0000 - -#define FO_CONF_OFF(bus, slot, func, reg) \ - (((bus) << FO_CONF_BUS_SHFT) | \ - ((slot) << FO_CONF_DEV_SHFT) | \ - ((func) << FO_CONF_FUNC_SHFT) | \ - ((reg) << FO_CONF_REG_SHFT)) - -/* Width of the physical addresses the IOMMU translates to */ -#define FIRE_IOMMU_BITS 43 -#define OBERON_IOMMU_BITS 47 - -/* Event queue macros */ -#define FO_EQ_ALIGNMENT (512 * 1024) -#define FO_EQ_NRECORDS 128 -#define FO_EQ_RECORD_SIZE 64 - -/* Event queue record format */ -struct fo_msiq_record { - uint64_t fomqr_word0; - uint64_t fomqr_word1; - uint64_t fomqr_reserved[6]; -}; - -#define FO_MQR_WORD0_FMT_TYPE_MASK 0x7f00000000000000ULL -#define FO_MQR_WORD0_FMT_TYPE_SHFT 56 -#define FO_MQR_WORD0_FMT_TYPE_MSI64 0x7800000000000000ULL -#define FO_MQR_WORD0_FMT_TYPE_MSI32 0x5800000000000000ULL -#define FO_MQR_WORD0_FMT_TYPE_MSG 0x3000000000000000ULL -#define FO_MQR_WORD0_FMT_TYPE_MSG_ROUTE_MASK 0x0700000000000000ULL -#define FO_MQR_WORD0_FMT_TYPE_MSG_ROUTE_SHFT 56 -#define FO_MQR_WORD0_LENGTH_MASK 0x00ffc00000000000ULL -#define FO_MQR_WORD0_LENGTH_SHFT 46 -#define FO_MQR_WORD0_ADDR0_MASK 0x00003fff00000000ULL -#define FO_MQR_WORD0_ADDR0_SHFT 32 -#define FO_MQR_WORD0_RID_MASK 0x00000000ffff0000ULL -#define FO_MQR_WORD0_RID_SHFT 16 -#define FO_MQR_WORD0_DATA0_MASK 0x000000000000ffffULL -#define FO_MQR_WORD0_DATA0_SHFT 0 -#define FO_MQR_WORD1_ADDR1_MASK 0xffffffffffff0000ULL -#define FO_MQR_WORD1_ADDR1_SHFT 16 -#define FO_MQR_WORD1_DATA1_MASK 0x000000000000ffffULL -#define FO_MQR_WORD1_DATA1_SHFT 0 - -#endif /* !_SPARC64_PCI_FIREREG_H_ */ diff --git a/sys/sparc64/pci/firevar.h b/sys/sparc64/pci/firevar.h deleted file mode 100644 index 6f5765b036e093..00000000000000 --- a/sys/sparc64/pci/firevar.h +++ /dev/null @@ -1,91 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2009 by Marius Strobl . - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification, immediately at the beginning of the file. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _SPARC64_PCI_FIREVAR_H_ -#define _SPARC64_PCI_FIREVAR_H_ - -struct fire_softc { - /* - * This is here so that we can hook up the common bus interface - * methods in ofw_pci.c directly. - */ - struct ofw_pci_softc sc_ops; - - struct iommu_state sc_is; - struct bus_dma_methods sc_dma_methods; - - struct mtx sc_msi_mtx; - struct mtx sc_pcib_mtx; - - struct resource *sc_mem_res[FIRE_NREG]; - struct resource *sc_irq_res[FIRE_NINTR]; - void *sc_ihand[FIRE_NINTR]; - - device_t sc_dev; - - uint64_t *sc_msiq; - u_char *sc_msi_bitmap; - uint32_t *sc_msi_msiq_table; - u_char *sc_msiq_bitmap; - uint64_t sc_msi_addr32; - uint64_t sc_msi_addr64; - uint32_t sc_msi_count; - uint32_t sc_msi_first; - uint32_t sc_msi_data_mask; - uint32_t sc_msix_data_width; - uint32_t sc_msiq_count; - uint32_t sc_msiq_size; - uint32_t sc_msiq_first; - uint32_t sc_msiq_ino_first; - - u_int sc_mode; -#define FIRE_MODE_FIRE 0 -#define FIRE_MODE_OBERON 1 - - u_int sc_flags; -#define FIRE_MSIX (1 << 0) - - uint32_t sc_ign; - - uint32_t sc_stats_ilu_err; - uint32_t sc_stats_jbc_ce_async; - uint32_t sc_stats_jbc_unsol_int; - uint32_t sc_stats_jbc_unsol_rd; - uint32_t sc_stats_mmu_err; - uint32_t sc_stats_tlu_ce; - uint32_t sc_stats_tlu_oe_non_fatal; - uint32_t sc_stats_tlu_oe_rx_err; - uint32_t sc_stats_tlu_oe_tx_err; - uint32_t sc_stats_ubc_dmardue; -}; - -#endif /* !_SPARC64_PCI_FIREVAR_H_ */ diff --git a/sys/sparc64/pci/ofw_pci.c b/sys/sparc64/pci/ofw_pci.c deleted file mode 100644 index 67b07b727cd6be..00000000000000 --- a/sys/sparc64/pci/ofw_pci.c +++ /dev/null @@ -1,406 +0,0 @@ -/*- - * Copyright (c) 1999, 2000 Matthew R. Green - * Copyright (c) 2001 - 2003 by Thomas Moestl - * Copyright (c) 2005 - 2015 by Marius Strobl - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: NetBSD: psycho.c,v 1.35 2001/09/10 16:17:06 eeh Exp - */ - -#include -__FBSDID("$FreeBSD$"); - -#include "opt_ofw_pci.h" - -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include - -#include - -int -ofw_pci_attach_common(device_t dev, bus_dma_tag_t dmat, u_long iosize, - u_long memsize) -{ - struct ofw_pci_softc *sc; - struct ofw_pci_ranges *range; - phandle_t node; - uint32_t prop_array[2]; - u_int i, j, nrange; - - sc = device_get_softc(dev); - node = ofw_bus_get_node(dev); - sc->sc_node = node; - sc->sc_pci_dmat = dmat; - - /* Initialize memory and I/O rmans. */ - sc->sc_pci_io_rman.rm_type = RMAN_ARRAY; - sc->sc_pci_io_rman.rm_descr = "PCI I/O Ports"; - if (rman_init(&sc->sc_pci_io_rman) != 0 || - rman_manage_region(&sc->sc_pci_io_rman, 0, iosize) != 0) { - device_printf(dev, "failed to set up I/O rman\n"); - return (ENXIO); - } - sc->sc_pci_mem_rman.rm_type = RMAN_ARRAY; - sc->sc_pci_mem_rman.rm_descr = "PCI Memory"; - if (rman_init(&sc->sc_pci_mem_rman) != 0 || - rman_manage_region(&sc->sc_pci_mem_rman, 0, memsize) != 0) { - device_printf(dev, "failed to set up memory rman\n"); - return (ENXIO); - } - - /* - * Find the addresses of the various bus spaces. The physical - * start addresses of the ranges are the configuration, I/O and - * memory handles. There should not be multiple ones of one kind. - */ - nrange = OF_getprop_alloc_multi(node, "ranges", sizeof(*range), - (void **)&range); - for (i = 0; i < nrange; i++) { - j = OFW_PCI_RANGE_CS(&range[i]); - if (sc->sc_pci_bh[j] != 0) { - device_printf(dev, "duplicate range for space %d\n", - j); - OF_prop_free(range); - return (EINVAL); - } - sc->sc_pci_bh[j] = OFW_PCI_RANGE_PHYS(&range[i]); - } - OF_prop_free(range); - - /* - * Make sure that the expected ranges are actually present. - * The OFW_PCI_CS_MEM64 one is not currently used. - */ - if (sc->sc_pci_bh[OFW_PCI_CS_CONFIG] == 0) { - device_printf(dev, "missing CONFIG range\n"); - return (ENXIO); - } - if (sc->sc_pci_bh[OFW_PCI_CS_IO] == 0) { - device_printf(dev, "missing IO range\n"); - return (ENXIO); - } - if (sc->sc_pci_bh[OFW_PCI_CS_MEM32] == 0) { - device_printf(dev, "missing MEM32 range\n"); - return (ENXIO); - } - - /* Allocate our tags. */ - sc->sc_pci_iot = sparc64_alloc_bus_tag(NULL, PCI_IO_BUS_SPACE); - if (sc->sc_pci_iot == NULL) { - device_printf(dev, "could not allocate PCI I/O tag\n"); - return (ENXIO); - } - sc->sc_pci_cfgt = sparc64_alloc_bus_tag(NULL, PCI_CONFIG_BUS_SPACE); - if (sc->sc_pci_cfgt == NULL) { - device_printf(dev, - "could not allocate PCI configuration space tag\n"); - return (ENXIO); - } - - /* - * Get the bus range from the firmware. - */ - i = OF_getprop(node, "bus-range", (void *)prop_array, - sizeof(prop_array)); - if (i == -1) { - device_printf(dev, "could not get bus-range\n"); - return (ENXIO); - } - if (i != sizeof(prop_array)) { - device_printf(dev, "broken bus-range (%d)", i); - return (EINVAL); - } - sc->sc_pci_secbus = prop_array[0]; - sc->sc_pci_subbus = prop_array[1]; - if (bootverbose != 0) - device_printf(dev, "bus range %u to %u; PCI bus %d\n", - sc->sc_pci_secbus, sc->sc_pci_subbus, sc->sc_pci_secbus); - - ofw_bus_setup_iinfo(node, &sc->sc_pci_iinfo, sizeof(ofw_pci_intr_t)); - - return (0); -} - -uint32_t -ofw_pci_read_config_common(device_t dev, u_int regmax, u_long offset, - u_int bus, u_int slot, u_int func, u_int reg, int width) -{ - struct ofw_pci_softc *sc; - bus_space_handle_t bh; - uint32_t r, wrd; - int i; - uint16_t shrt; - uint8_t byte; - - sc = device_get_softc(dev); - if (bus < sc->sc_pci_secbus || bus > sc->sc_pci_subbus || - slot > PCI_SLOTMAX || func > PCI_FUNCMAX || reg > regmax) - return (-1); - - bh = sc->sc_pci_bh[OFW_PCI_CS_CONFIG]; - switch (width) { - case 1: - i = bus_space_peek_1(sc->sc_pci_cfgt, bh, offset, &byte); - r = byte; - break; - case 2: - i = bus_space_peek_2(sc->sc_pci_cfgt, bh, offset, &shrt); - r = shrt; - break; - case 4: - i = bus_space_peek_4(sc->sc_pci_cfgt, bh, offset, &wrd); - r = wrd; - break; - default: - panic("%s: bad width %d", __func__, width); - /* NOTREACHED */ - } - - if (i) { -#ifdef OFW_PCI_DEBUG - printf("%s: read data error reading: %d.%d.%d: 0x%x\n", - __func__, bus, slot, func, reg); -#endif - r = -1; - } - return (r); -} - -void -ofw_pci_write_config_common(device_t dev, u_int regmax, u_long offset, - u_int bus, u_int slot, u_int func, u_int reg, uint32_t val, int width) -{ - struct ofw_pci_softc *sc; - bus_space_handle_t bh; - - sc = device_get_softc(dev); - if (bus < sc->sc_pci_secbus || bus > sc->sc_pci_subbus || - slot > PCI_SLOTMAX || func > PCI_FUNCMAX || reg > regmax) - return; - - bh = sc->sc_pci_bh[OFW_PCI_CS_CONFIG]; - switch (width) { - case 1: - bus_space_write_1(sc->sc_pci_cfgt, bh, offset, val); - break; - case 2: - bus_space_write_2(sc->sc_pci_cfgt, bh, offset, val); - break; - case 4: - bus_space_write_4(sc->sc_pci_cfgt, bh, offset, val); - break; - default: - panic("%s: bad width %d", __func__, width); - /* NOTREACHED */ - } -} - -ofw_pci_intr_t -ofw_pci_route_interrupt_common(device_t bridge, device_t dev, int pin) -{ - struct ofw_pci_softc *sc; - struct ofw_pci_register reg; - ofw_pci_intr_t pintr, mintr; - - sc = device_get_softc(bridge); - pintr = pin; - if (ofw_bus_lookup_imap(ofw_bus_get_node(dev), &sc->sc_pci_iinfo, - ®, sizeof(reg), &pintr, sizeof(pintr), &mintr, sizeof(mintr), - NULL) != 0) - return (mintr); - return (PCI_INVALID_IRQ); -} - -void -ofw_pci_dmamap_sync_stst_order_common(void) -{ - static u_char buf[VIS_BLOCKSIZE] __aligned(VIS_BLOCKSIZE); - register_t reg, s; - - s = intr_disable(); - reg = rd(fprs); - wr(fprs, reg | FPRS_FEF, 0); - __asm __volatile("stda %%f0, [%0] %1" - : : "r" (buf), "n" (ASI_BLK_COMMIT_S)); - membar(Sync); - wr(fprs, reg, 0); - intr_restore(s); -} - -int -ofw_pci_read_ivar(device_t dev, device_t child __unused, int which, - uintptr_t *result) -{ - struct ofw_pci_softc *sc; - - switch (which) { - case PCIB_IVAR_DOMAIN: - *result = device_get_unit(dev); - return (0); - case PCIB_IVAR_BUS: - sc = device_get_softc(dev); - *result = sc->sc_pci_secbus; - return (0); - } - return (ENOENT); -} - -struct resource * -ofw_pci_alloc_resource(device_t bus, device_t child, int type, int *rid, - rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) -{ - struct ofw_pci_softc *sc; - struct resource *rv; - struct rman *rm; - - sc = device_get_softc(bus); - switch (type) { - case SYS_RES_IRQ: - /* - * XXX: Don't accept blank ranges for now, only single - * interrupts. The other case should not happen with - * the MI PCI code ... - * XXX: This may return a resource that is out of the - * range that was specified. Is this correct ...? - */ - if (start != end) - panic("%s: XXX: interrupt range", __func__); - return (bus_generic_alloc_resource(bus, child, type, rid, - start, end, count, flags)); - case SYS_RES_MEMORY: - rm = &sc->sc_pci_mem_rman; - break; - case SYS_RES_IOPORT: - rm = &sc->sc_pci_io_rman; - break; - default: - return (NULL); - } - - rv = rman_reserve_resource(rm, start, end, count, flags & ~RF_ACTIVE, - child); - if (rv == NULL) - return (NULL); - rman_set_rid(rv, *rid); - - if ((flags & RF_ACTIVE) != 0 && bus_activate_resource(child, type, - *rid, rv) != 0) { - rman_release_resource(rv); - return (NULL); - } - return (rv); -} - -int -ofw_pci_activate_resource(device_t bus, device_t child, int type, int rid, - struct resource *r) -{ - struct ofw_pci_softc *sc; - struct bus_space_tag *tag; - - sc = device_get_softc(bus); - switch (type) { - case SYS_RES_IRQ: - return (bus_generic_activate_resource(bus, child, type, rid, - r)); - case SYS_RES_MEMORY: - tag = sparc64_alloc_bus_tag(r, PCI_MEMORY_BUS_SPACE); - if (tag == NULL) - return (ENOMEM); - rman_set_bustag(r, tag); - rman_set_bushandle(r, sc->sc_pci_bh[OFW_PCI_CS_MEM32] + - rman_get_start(r)); - break; - case SYS_RES_IOPORT: - rman_set_bustag(r, sc->sc_pci_iot); - rman_set_bushandle(r, sc->sc_pci_bh[OFW_PCI_CS_IO] + - rman_get_start(r)); - break; - } - return (rman_activate_resource(r)); -} - -int -ofw_pci_adjust_resource(device_t bus, device_t child, int type, - struct resource *r, rman_res_t start, rman_res_t end) -{ - struct ofw_pci_softc *sc; - struct rman *rm; - - sc = device_get_softc(bus); - switch (type) { - case SYS_RES_IRQ: - return (bus_generic_adjust_resource(bus, child, type, r, - start, end)); - case SYS_RES_MEMORY: - rm = &sc->sc_pci_mem_rman; - break; - case SYS_RES_IOPORT: - rm = &sc->sc_pci_io_rman; - break; - default: - return (EINVAL); - } - if (rman_is_region_manager(r, rm) == 0) - return (EINVAL); - return (rman_adjust_resource(r, start, end)); -} - -bus_dma_tag_t -ofw_pci_get_dma_tag(device_t bus, device_t child __unused) -{ - struct ofw_pci_softc *sc; - - sc = device_get_softc(bus); - return (sc->sc_pci_dmat); -} - -phandle_t -ofw_pci_get_node(device_t bus, device_t child __unused) -{ - struct ofw_pci_softc *sc; - - sc = device_get_softc(bus); - /* We only have one child, the PCI bus, which needs our own node. */ - return (sc->sc_node); -} diff --git a/sys/sparc64/pci/ofw_pci.h b/sys/sparc64/pci/ofw_pci.h deleted file mode 100644 index 908e35d8fcd8cc..00000000000000 --- a/sys/sparc64/pci/ofw_pci.h +++ /dev/null @@ -1,172 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1999, 2000 Matthew R. Green - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*- - * Copyright (c) 1998, 1999 Eduardo E. Horvath - * Copyright (c) 2001, 2003 by Thomas Moestl - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: NetBSD: psychoreg.h,v 1.14 2008/05/30 02:29:37 mrg Exp - * - * $FreeBSD$ - */ - -#ifndef _SPARC64_PCI_OFW_PCI_H_ -#define _SPARC64_PCI_OFW_PCI_H_ - -#include - -#include - -#include "ofw_pci_if.h" - -typedef uint32_t ofw_pci_intr_t; - -/* PCI range child spaces. XXX: are these MI? */ -#define OFW_PCI_CS_CONFIG 0x00 -#define OFW_PCI_CS_IO 0x01 -#define OFW_PCI_CS_MEM32 0x02 -#define OFW_PCI_CS_MEM64 0x03 -#define OFW_PCI_NUM_CS 4 - -/* OFW device types */ -#define OFW_TYPE_PCI "pci" -#define OFW_TYPE_PCIE "pciex" - -struct ofw_pci_msi_addr_ranges { - uint32_t addr32_hi; - uint32_t addr32_lo; - uint32_t addr32_sz; - uint32_t addr64_hi; - uint32_t addr64_lo; - uint32_t addr64_sz; -}; - -#define OFW_PCI_MSI_ADDR_RANGE_32(r) \ - (((uint64_t)(r)->addr32_hi << 32) | (uint64_t)(r)->addr32_lo) -#define OFW_PCI_MSI_ADDR_RANGE_64(r) \ - (((uint64_t)(r)->addr64_hi << 32) | (uint64_t)(r)->addr64_lo) - -struct ofw_pci_msi_eq_to_devino { - uint32_t eq_first; - uint32_t eq_count; - uint32_t devino_first; -}; - -struct ofw_pci_msi_ranges { - uint32_t first; - uint32_t count; -}; - -struct ofw_pci_ranges { - uint32_t cspace; - uint32_t child_hi; - uint32_t child_lo; - uint32_t phys_hi; - uint32_t phys_lo; - uint32_t size_hi; - uint32_t size_lo; -}; - -#define OFW_PCI_RANGE_CHILD(r) \ - (((uint64_t)(r)->child_hi << 32) | (uint64_t)(r)->child_lo) -#define OFW_PCI_RANGE_PHYS(r) \ - (((uint64_t)(r)->phys_hi << 32) | (uint64_t)(r)->phys_lo) -#define OFW_PCI_RANGE_SIZE(r) \ - (((uint64_t)(r)->size_hi << 32) | (uint64_t)(r)->size_lo) -#define OFW_PCI_RANGE_CS(r) (((r)->cspace >> 24) & 0x03) - -/* default values */ -#define OFW_PCI_LATENCY 64 - -/* - * Common and generic parts of host-PCI-bridge support - */ - -struct ofw_pci_softc { - struct rman sc_pci_mem_rman; - struct rman sc_pci_io_rman; - - bus_space_handle_t sc_pci_bh[OFW_PCI_NUM_CS]; - bus_space_tag_t sc_pci_cfgt; - bus_space_tag_t sc_pci_iot; - bus_dma_tag_t sc_pci_dmat; - - struct ofw_bus_iinfo sc_pci_iinfo; - - phandle_t sc_node; - - uint8_t sc_pci_secbus; - uint8_t sc_pci_subbus; -}; - -int ofw_pci_attach_common(device_t dev, bus_dma_tag_t dmat, u_long iosize, - u_long memsize); -uint32_t ofw_pci_read_config_common(device_t dev, u_int regmax, u_long offset, - u_int bus, u_int slot, u_int func, u_int reg, int width); -void ofw_pci_write_config_common(device_t dev, u_int regmax, u_long offset, - u_int bus, u_int slot, u_int func, u_int reg, uint32_t val, int width); -ofw_pci_intr_t ofw_pci_route_interrupt_common(device_t bridge, device_t dev, - int pin); - -void ofw_pci_dmamap_sync_stst_order_common(void); - -bus_activate_resource_t ofw_pci_activate_resource; -bus_adjust_resource_t ofw_pci_adjust_resource; -bus_alloc_resource_t ofw_pci_alloc_resource; -bus_get_dma_tag_t ofw_pci_get_dma_tag; -bus_read_ivar_t ofw_pci_read_ivar; - -ofw_bus_get_node_t ofw_pci_get_node; - -#endif /* ! _SPARC64_PCI_OFW_PCI_H_ */ diff --git a/sys/sparc64/pci/ofw_pci_if.m b/sys/sparc64/pci/ofw_pci_if.m deleted file mode 100644 index f9490bd782822f..00000000000000 --- a/sys/sparc64/pci/ofw_pci_if.m +++ /dev/null @@ -1,48 +0,0 @@ -#- -# Copyright (c) 2001, 2003 by Thomas Moestl -# Copyright (c) 2011 Marius Strobl -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -# IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, -# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE -# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# $FreeBSD$ - -#include - -INTERFACE ofw_pci; - -CODE { - static ofw_pci_setup_device_t ofw_pci_default_setup_device; - - static void - ofw_pci_default_setup_device(device_t dev, device_t child) - { - - if (device_get_parent(dev) != NULL) - OFW_PCI_SETUP_DEVICE(device_get_parent(dev), child); - } -}; - -# Setup a device further upward in the tree. -METHOD void setup_device { - device_t dev; - device_t child; -} DEFAULT ofw_pci_default_setup_device; diff --git a/sys/sparc64/pci/ofw_pcib.c b/sys/sparc64/pci/ofw_pcib.c deleted file mode 100644 index 3589b00f32fa73..00000000000000 --- a/sys/sparc64/pci/ofw_pcib.c +++ /dev/null @@ -1,176 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1994,1995 Stefan Esser, Wolfgang StanglMeier - * Copyright (c) 2000 Michael Smith - * Copyright (c) 2000 BSDi - * Copyright (c) 2001 - 2003 Thomas Moestl - * Copyright (c) 2009 by Marius Strobl - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: FreeBSD: src/sys/dev/pci/pci_pci.c,v 1.3 2000/12/13 - */ - -#include -__FBSDID("$FreeBSD$"); - -#include "opt_ofw_pci.h" - -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include - -#include "pcib_if.h" - -#include -#include - -#define PCI_DEVID_ALI_M5249 0x524910b9 -#define PCI_VENDOR_PLX 0x10b5 - -static device_probe_t ofw_pcib_probe; -static device_attach_t ofw_pcib_attach; -static ofw_pci_setup_device_t ofw_pcib_setup_device; - -static device_method_t ofw_pcib_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, ofw_pcib_probe), - DEVMETHOD(device_attach, ofw_pcib_attach), - - /* Bus interface */ - - /* pcib interface */ - DEVMETHOD(pcib_route_interrupt, ofw_pcib_gen_route_interrupt), - DEVMETHOD(pcib_request_feature, pcib_request_feature_allow), - - /* ofw_bus interface */ - DEVMETHOD(ofw_bus_get_node, ofw_pcib_gen_get_node), - DEVMETHOD(ofw_pci_setup_device, ofw_pcib_setup_device), - - DEVMETHOD_END -}; - -static devclass_t pcib_devclass; - -DEFINE_CLASS_1(pcib, ofw_pcib_driver, ofw_pcib_methods, - sizeof(struct ofw_pcib_gen_softc), pcib_driver); -EARLY_DRIVER_MODULE(ofw_pcib, pci, ofw_pcib_driver, pcib_devclass, NULL, NULL, - BUS_PASS_BUS); -MODULE_DEPEND(ofw_pcib, pci, 1, 1, 1); - -static int -ofw_pcib_probe(device_t dev) -{ - char desc[sizeof("OFW PCIe-PCIe bridge")]; - const char *dtype, *pbdtype; - -#define ISDTYPE(dtype, type) \ - (((dtype) != NULL) && strcmp((dtype), (type)) == 0) - - if ((pci_get_class(dev) == PCIC_BRIDGE) && - (pci_get_subclass(dev) == PCIS_BRIDGE_PCI) && - ofw_bus_get_node(dev) != 0) { - dtype = ofw_bus_get_type(dev); - pbdtype = ofw_bus_get_type(device_get_parent( - device_get_parent(dev))); - snprintf(desc, sizeof(desc), "OFW PCI%s-PCI%s bridge", - ISDTYPE(pbdtype, OFW_TYPE_PCIE) ? "e" : "", - ISDTYPE(dtype, OFW_TYPE_PCIE) ? "e" : ""); - device_set_desc_copy(dev, desc); - return (BUS_PROBE_DEFAULT); - } - -#undef ISDTYPE - - return (ENXIO); -} - -static int -ofw_pcib_attach(device_t dev) -{ - struct ofw_pcib_gen_softc *sc; - - sc = device_get_softc(dev); - - switch (pci_get_devid(dev)) { - /* - * The ALi M5249 found in Fire-based machines by definition must me - * subtractive as they have a ISA bridge on their secondary side but - * don't indicate this in the class code although the ISA I/O range - * isn't included in their bridge decode. - */ - case PCI_DEVID_ALI_M5249: - sc->ops_pcib_sc.flags |= PCIB_SUBTRACTIVE; - break; - } - - switch (pci_get_vendor(dev)) { - /* - * Concurrently write the primary and secondary bus numbers in order - * to work around a bug in PLX PEX 8114 causing the internal shadow - * copies of these not to be updated when setting them bytewise. - */ - case PCI_VENDOR_PLX: - pci_write_config(dev, PCIR_PRIBUS_1, - pci_read_config(dev, PCIR_SECBUS_1, 1) << 8 | - pci_read_config(dev, PCIR_PRIBUS_1, 1), 2); - break; - } - - ofw_pcib_gen_setup(dev); - pcib_attach_common(dev); - return (pcib_attach_child(dev)); -} - -static void -ofw_pcib_setup_device(device_t bus, device_t child) -{ - int i; - uint16_t reg; - - switch (pci_get_vendor(bus)) { - /* - * For PLX PEX 8532 issue 64 TLPs to the child from the downstream - * port to the child device in order to work around a hardware bug. - */ - case PCI_VENDOR_PLX: - for (i = 0, reg = 0; i < 64; i++) - reg |= pci_get_devid(child); - break; - } - - OFW_PCI_SETUP_DEVICE(device_get_parent(bus), child); -} diff --git a/sys/sparc64/pci/ofw_pcib_subr.c b/sys/sparc64/pci/ofw_pcib_subr.c deleted file mode 100644 index d6f3b264745aa2..00000000000000 --- a/sys/sparc64/pci/ofw_pcib_subr.c +++ /dev/null @@ -1,109 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2003 by Thomas Moestl - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE - * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include -__FBSDID("$FreeBSD$"); - -#include "opt_ofw_pci.h" - -#include -#include -#include -#include - -#include -#include -#include - -#include - -#include -#include -#include - -#include "pcib_if.h" - -#include -#include - -void -ofw_pcib_gen_setup(device_t bridge) -{ - struct ofw_pcib_gen_softc *sc; - - sc = device_get_softc(bridge); - sc->ops_pcib_sc.dev = bridge; - sc->ops_node = ofw_bus_get_node(bridge); - KASSERT(sc->ops_node != 0, - ("ofw_pcib_gen_setup: no ofw pci parent bus!")); - - ofw_bus_setup_iinfo(sc->ops_node, &sc->ops_iinfo, - sizeof(ofw_pci_intr_t)); -} - -int -ofw_pcib_gen_route_interrupt(device_t bridge, device_t dev, int intpin) -{ - struct ofw_pcib_gen_softc *sc; - struct ofw_bus_iinfo *ii; - struct ofw_pci_register reg; - ofw_pci_intr_t pintr, mintr; - - sc = device_get_softc(bridge); - ii = &sc->ops_iinfo; - if (ii->opi_imapsz > 0) { - pintr = intpin; - if (ofw_bus_lookup_imap(ofw_bus_get_node(dev), ii, ®, - sizeof(reg), &pintr, sizeof(pintr), &mintr, sizeof(mintr), - NULL)) { - /* - * If we've found a mapping, return it and don't map - * it again on higher levels - that causes problems - * in some cases, and never seems to be required. - */ - return (mintr); - } - } else if (intpin >= 1 && intpin <= 4) { - /* - * When an interrupt map is missing, we need to do the - * standard PCI swizzle and continue mapping at the parent. - */ - return (pcib_route_interrupt(bridge, dev, intpin)); - } - /* Try at the parent. */ - return (PCIB_ROUTE_INTERRUPT(device_get_parent(device_get_parent( - bridge)), bridge, intpin)); -} - -phandle_t -ofw_pcib_gen_get_node(device_t bridge, device_t dev) -{ - struct ofw_pcib_gen_softc *sc; - - sc = device_get_softc(bridge); - return (sc->ops_node); -} diff --git a/sys/sparc64/pci/ofw_pcib_subr.h b/sys/sparc64/pci/ofw_pcib_subr.h deleted file mode 100644 index cc551b673edfd0..00000000000000 --- a/sys/sparc64/pci/ofw_pcib_subr.h +++ /dev/null @@ -1,48 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2003 by Thomas Moestl - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE - * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _SPARC64_PCI_OFW_PCI_SUBR_H -#define _SPARC64_PCI_OFW_PCI_SUBR_H - -struct ofw_pcib_gen_softc { - /* - * This is here so that we can use pci bridge methods, too - the - * generic routines only need the dev, secbus and subbus members - * filled. - */ - struct pcib_softc ops_pcib_sc; - phandle_t ops_node; - struct ofw_bus_iinfo ops_iinfo; -}; - -void ofw_pcib_gen_setup(device_t); -pcib_route_interrupt_t ofw_pcib_gen_route_interrupt; -ofw_bus_get_node_t ofw_pcib_gen_get_node; - -#endif /* !_SPARC64_PCI_OFW_PCI_SUBR_H */ diff --git a/sys/sparc64/pci/ofw_pcibus.c b/sys/sparc64/pci/ofw_pcibus.c deleted file mode 100644 index f214ce27696fe7..00000000000000 --- a/sys/sparc64/pci/ofw_pcibus.c +++ /dev/null @@ -1,368 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 1997, Stefan Esser - * Copyright (c) 2000, Michael Smith - * Copyright (c) 2000, BSDi - * Copyright (c) 2003, Thomas Moestl - * Copyright (c) 2005 - 2009 Marius Strobl - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice unmodified, this list of conditions, and the following - * disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include -__FBSDID("$FreeBSD$"); - -#include "opt_ofw_pci.h" - -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#ifndef SUN4V -#include -#include -#endif -#include - -#include -#include -#include - -#include - -#include "pcib_if.h" -#include "pci_if.h" - -/* Helper functions */ -static void ofw_pcibus_setup_device(device_t bridge, uint32_t clock, - u_int busno, u_int slot, u_int func); - -/* Methods */ -static bus_child_deleted_t ofw_pcibus_child_deleted; -static bus_child_pnpinfo_str_t ofw_pcibus_pnpinfo_str; -static device_attach_t ofw_pcibus_attach; -static device_probe_t ofw_pcibus_probe; -static ofw_bus_get_devinfo_t ofw_pcibus_get_devinfo; -static pci_alloc_devinfo_t ofw_pcibus_alloc_devinfo; -static pci_assign_interrupt_t ofw_pcibus_assign_interrupt; - -static device_method_t ofw_pcibus_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, ofw_pcibus_probe), - DEVMETHOD(device_attach, ofw_pcibus_attach), - - /* Bus interface */ - DEVMETHOD(bus_child_deleted, ofw_pcibus_child_deleted), - DEVMETHOD(bus_child_pnpinfo_str, ofw_pcibus_pnpinfo_str), - DEVMETHOD(bus_rescan, bus_null_rescan), - - /* PCI interface */ - DEVMETHOD(pci_alloc_devinfo, ofw_pcibus_alloc_devinfo), - DEVMETHOD(pci_assign_interrupt, ofw_pcibus_assign_interrupt), - - /* ofw_bus interface */ - DEVMETHOD(ofw_bus_get_devinfo, ofw_pcibus_get_devinfo), - DEVMETHOD(ofw_bus_get_compat, ofw_bus_gen_get_compat), - DEVMETHOD(ofw_bus_get_model, ofw_bus_gen_get_model), - DEVMETHOD(ofw_bus_get_name, ofw_bus_gen_get_name), - DEVMETHOD(ofw_bus_get_node, ofw_bus_gen_get_node), - DEVMETHOD(ofw_bus_get_type, ofw_bus_gen_get_type), - - DEVMETHOD_END -}; - -struct ofw_pcibus_devinfo { - struct pci_devinfo opd_dinfo; - struct ofw_bus_devinfo opd_obdinfo; -}; - -static devclass_t pci_devclass; - -DEFINE_CLASS_1(pci, ofw_pcibus_driver, ofw_pcibus_methods, - sizeof(struct pci_softc), pci_driver); -EARLY_DRIVER_MODULE(ofw_pcibus, pcib, ofw_pcibus_driver, pci_devclass, 0, 0, - BUS_PASS_BUS); -MODULE_VERSION(ofw_pcibus, 1); -MODULE_DEPEND(ofw_pcibus, pci, 1, 1, 1); - -static int -ofw_pcibus_probe(device_t dev) -{ - - if (ofw_bus_get_node(dev) == -1) - return (ENXIO); - device_set_desc(dev, "OFW PCI bus"); - - return (0); -} - -/* - * Perform miscellaneous setups the firmware usually does not do for us. - */ -static void -ofw_pcibus_setup_device(device_t bridge, uint32_t clock, u_int busno, - u_int slot, u_int func) -{ -#define CS_READ(n, w) \ - PCIB_READ_CONFIG(bridge, busno, slot, func, (n), (w)) -#define CS_WRITE(n, v, w) \ - PCIB_WRITE_CONFIG(bridge, busno, slot, func, (n), (v), (w)) - -#ifndef SUN4V - uint32_t reg; - - /* - * Initialize the latency timer register for busmaster devices to - * work properly. This is another task which the firmware doesn't - * always perform. The Min_Gnt register can be used to compute its - * recommended value: it contains the desired latency in units of - * 1/4 us assuming a clock rate of 33MHz. To calculate the correct - * latency timer value, the clock frequency of the bus (defaulting - * to 33MHz) should be used and no wait states assumed. - * For bridges, we additionally set up the bridge control and the - * secondary latency registers. - */ - if ((CS_READ(PCIR_HDRTYPE, 1) & PCIM_HDRTYPE) == - PCIM_HDRTYPE_BRIDGE) { - reg = CS_READ(PCIR_BRIDGECTL_1, 1); - reg |= PCIB_BCR_MASTER_ABORT_MODE | PCIB_BCR_SERR_ENABLE | - PCIB_BCR_PERR_ENABLE; -#ifdef OFW_PCI_DEBUG - device_printf(bridge, - "bridge %d/%d/%d: control 0x%x -> 0x%x\n", - busno, slot, func, CS_READ(PCIR_BRIDGECTL_1, 1), reg); -#endif /* OFW_PCI_DEBUG */ - CS_WRITE(PCIR_BRIDGECTL_1, reg, 1); - - reg = OFW_PCI_LATENCY; -#ifdef OFW_PCI_DEBUG - device_printf(bridge, - "bridge %d/%d/%d: latency timer %d -> %d\n", - busno, slot, func, CS_READ(PCIR_SECLAT_1, 1), reg); -#endif /* OFW_PCI_DEBUG */ - CS_WRITE(PCIR_SECLAT_1, reg, 1); - } else { - reg = CS_READ(PCIR_MINGNT, 1); - if ((int)reg > 0) { - switch (clock) { - case 33000000: - reg *= 8; - break; - case 66000000: - reg *= 4; - break; - } - reg = min(reg, 255); - } else - reg = OFW_PCI_LATENCY; - } -#ifdef OFW_PCI_DEBUG - device_printf(bridge, "device %d/%d/%d: latency timer %d -> %d\n", - busno, slot, func, CS_READ(PCIR_LATTIMER, 1), reg); -#endif /* OFW_PCI_DEBUG */ - CS_WRITE(PCIR_LATTIMER, reg, 1); - - /* - * Compute a value to write into the cache line size register. - * The role of the streaming cache is unclear in write invalidate - * transfers, so it is made sure that it's line size is always - * reached. Generally, the cache line size is fixed at 64 bytes - * by Fireplane/Safari, JBus and UPA. - */ - CS_WRITE(PCIR_CACHELNSZ, STRBUF_LINESZ / sizeof(uint32_t), 1); -#endif - - /* - * Ensure that ALi M5229 report the actual content of PCIR_PROGIF - * and that IDE I/O is force enabled. The former is done in order - * to have unique behavior across revisions as some default to - * hiding bits 4-6 for compliance with PCI 2.3. The latter is done - * as at least revision 0xc8 requires the PCIM_CMD_PORTEN bypass - * to be always enabled as otherwise even enabling PCIM_CMD_PORTEN - * results in an instant data access trap on Fire-based machines. - * Thus these quirks have to be handled before pci(4) adds the maps. - * Note that for older revisions bit 0 of register 0x50 enables the - * internal IDE function instead of force enabling IDE I/O. - */ - if ((CS_READ(PCIR_VENDOR, 2) == 0x10b9 && - CS_READ(PCIR_DEVICE, 2) == 0x5229)) - CS_WRITE(0x50, CS_READ(0x50, 1) | 0x3, 1); - - /* - * The preset in the intline register is usually wrong. Reset - * it to 255, so that the PCI code will reroute the interrupt if - * needed. - */ - CS_WRITE(PCIR_INTLINE, PCI_INVALID_IRQ, 1); - -#undef CS_READ -#undef CS_WRITE -} - -static int -ofw_pcibus_attach(device_t dev) -{ - device_t pcib; - struct ofw_pci_register pcir; - struct ofw_pcibus_devinfo *dinfo; - phandle_t node, child; - uint32_t clock; - u_int busno, domain, func, slot; - int error; - - error = pci_attach_common(dev); - if (error) - return (error); - pcib = device_get_parent(dev); - domain = pcib_get_domain(dev); - busno = pcib_get_bus(dev); - node = ofw_bus_get_node(dev); - - /* - * Add the PCI side of the host-PCI bridge itself to the bus. - * Note that we exclude the host-PCIe bridges here as these - * have no configuration space implemented themselves. - */ - if (strcmp(device_get_name(device_get_parent(pcib)), "nexus") == 0 && - ofw_bus_get_type(pcib) != NULL && - strcmp(ofw_bus_get_type(pcib), OFW_TYPE_PCIE) != 0 && - (dinfo = (struct ofw_pcibus_devinfo *)pci_read_device(pcib, dev, - domain, busno, 0, 0)) != NULL) { - if (ofw_bus_gen_setup_devinfo(&dinfo->opd_obdinfo, node) != 0) - pci_freecfg((struct pci_devinfo *)dinfo); - else - pci_add_child(dev, (struct pci_devinfo *)dinfo); - } - - if (OF_getprop(ofw_bus_get_node(pcib), "clock-frequency", &clock, - sizeof(clock)) == -1) - clock = 33000000; - for (child = OF_child(node); child != 0; child = OF_peer(child)) { - if (OF_getprop(child, "reg", &pcir, sizeof(pcir)) == -1) - continue; - slot = OFW_PCI_PHYS_HI_DEVICE(pcir.phys_hi); - func = OFW_PCI_PHYS_HI_FUNCTION(pcir.phys_hi); - /* Some OFW device trees contain dupes. */ - if (pci_find_dbsf(domain, busno, slot, func) != NULL) - continue; - ofw_pcibus_setup_device(pcib, clock, busno, slot, func); - dinfo = (struct ofw_pcibus_devinfo *)pci_read_device(pcib, dev, - domain, busno, slot, func); - if (dinfo == NULL) - continue; - if (ofw_bus_gen_setup_devinfo(&dinfo->opd_obdinfo, child) != - 0) { - pci_freecfg((struct pci_devinfo *)dinfo); - continue; - } - pci_add_child(dev, (struct pci_devinfo *)dinfo); - OFW_PCI_SETUP_DEVICE(pcib, dinfo->opd_dinfo.cfg.dev); - } - - return (bus_generic_attach(dev)); -} - -struct pci_devinfo * -ofw_pcibus_alloc_devinfo(device_t dev) -{ - struct ofw_pcibus_devinfo *dinfo; - - dinfo = malloc(sizeof(*dinfo), M_DEVBUF, M_WAITOK | M_ZERO); - return (&dinfo->opd_dinfo); -} - -static int -ofw_pcibus_assign_interrupt(device_t dev, device_t child) -{ - ofw_pci_intr_t intr; - int isz; - - isz = OF_getprop(ofw_bus_get_node(child), "interrupts", &intr, - sizeof(intr)); - if (isz != sizeof(intr)) { - /* No property; our best guess is the intpin. */ - intr = pci_get_intpin(child); -#ifndef SUN4V - } else if (intr >= 255) { - /* - * A fully specified interrupt (including IGN), as present on - * SPARCengine Ultra AX and E450. Extract the INO and return - * it. - */ - return (INTINO(intr)); -#endif - } - /* - * If we got intr from a property, it may or may not be an intpin. - * For on-board devices, it frequently is not, and is completely out - * of the valid intpin range. For PCI slots, it hopefully is, - * otherwise we will have trouble interfacing with non-OFW buses - * such as cardbus. - * Since we cannot tell which it is without violating layering, we - * will always use the route_interrupt method, and treat exceptions - * on the level they become apparent. - */ - return (PCIB_ROUTE_INTERRUPT(device_get_parent(dev), child, intr)); -} - -static const struct ofw_bus_devinfo * -ofw_pcibus_get_devinfo(device_t bus, device_t dev) -{ - struct ofw_pcibus_devinfo *dinfo; - - dinfo = device_get_ivars(dev); - return (&dinfo->opd_obdinfo); -} - -static void -ofw_pcibus_child_deleted(device_t dev, device_t child) -{ - struct ofw_pcibus_devinfo *dinfo; - - dinfo = device_get_ivars(dev); - ofw_bus_gen_destroy_devinfo(&dinfo->opd_obdinfo); - pci_child_deleted(dev, child); -} - -static int -ofw_pcibus_pnpinfo_str(device_t dev, device_t child, char *buf, - size_t buflen) -{ - - pci_child_pnpinfo_str_method(dev, child, buf, buflen); - if (ofw_bus_get_node(child) != -1) { - strlcat(buf, " ", buflen); /* Separate info. */ - ofw_bus_gen_child_pnpinfo_str(dev, child, buf, buflen); - } - - return (0); -} diff --git a/sys/sparc64/pci/psycho.c b/sys/sparc64/pci/psycho.c deleted file mode 100644 index f7f4c40e389c1a..00000000000000 --- a/sys/sparc64/pci/psycho.c +++ /dev/null @@ -1,1074 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1999, 2000 Matthew R. Green - * Copyright (c) 2001 - 2003 by Thomas Moestl - * Copyright (c) 2005 - 2006 Marius Strobl - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: NetBSD: psycho.c,v 1.39 2001/10/07 20:30:41 eeh Exp - */ - -#include -__FBSDID("$FreeBSD$"); - -/* - * Support for `Hummingbird' (UltraSPARC IIe), `Psycho' and `Psycho+' - * (UltraSPARC II) and `Sabre' (UltraSPARC IIi) UPA to PCI bridges. - */ - -#include "opt_ofw_pci.h" -#include "opt_psycho.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include - -#include "pcib_if.h" - -static const struct psycho_desc *psycho_find_desc(const struct psycho_desc *, - const char *); -static const struct psycho_desc *psycho_get_desc(device_t); -static void psycho_set_intr(struct psycho_softc *, u_int, bus_addr_t, - driver_filter_t, driver_intr_t); -static int psycho_find_intrmap(struct psycho_softc *, u_int, bus_addr_t *, - bus_addr_t *, u_long *); -static void sabre_dmamap_sync(bus_dma_tag_t dt, bus_dmamap_t map, - bus_dmasync_op_t op); -static void psycho_intr_enable(void *); -static void psycho_intr_disable(void *); -static void psycho_intr_assign(void *); -static void psycho_intr_clear(void *); - -/* Interrupt handlers */ -static driver_filter_t psycho_ue; -static driver_filter_t psycho_ce; -static driver_filter_t psycho_pci_bus; -static driver_filter_t psycho_powerdebug; -static driver_intr_t psycho_powerdown; -static driver_intr_t psycho_overtemp; -#ifdef PSYCHO_MAP_WAKEUP -static driver_filter_t psycho_wakeup; -#endif - -/* IOMMU support */ -static void psycho_iommu_init(struct psycho_softc *, int, uint32_t); - -/* - * Methods - */ -static device_probe_t psycho_probe; -static device_attach_t psycho_attach; -static bus_setup_intr_t psycho_setup_intr; -static bus_alloc_resource_t psycho_alloc_resource; -static pcib_maxslots_t psycho_maxslots; -static pcib_read_config_t psycho_read_config; -static pcib_write_config_t psycho_write_config; -static pcib_route_interrupt_t psycho_route_interrupt; -static ofw_pci_setup_device_t psycho_setup_device; - -static device_method_t psycho_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, psycho_probe), - DEVMETHOD(device_attach, psycho_attach), - DEVMETHOD(device_shutdown, bus_generic_shutdown), - DEVMETHOD(device_suspend, bus_generic_suspend), - DEVMETHOD(device_resume, bus_generic_resume), - - /* Bus interface */ - DEVMETHOD(bus_read_ivar, ofw_pci_read_ivar), - DEVMETHOD(bus_setup_intr, psycho_setup_intr), - DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), - DEVMETHOD(bus_alloc_resource, psycho_alloc_resource), - DEVMETHOD(bus_activate_resource, ofw_pci_activate_resource), - DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), - DEVMETHOD(bus_adjust_resource, ofw_pci_adjust_resource), - DEVMETHOD(bus_release_resource, bus_generic_release_resource), - DEVMETHOD(bus_get_dma_tag, ofw_pci_get_dma_tag), - - /* pcib interface */ - DEVMETHOD(pcib_maxslots, psycho_maxslots), - DEVMETHOD(pcib_read_config, psycho_read_config), - DEVMETHOD(pcib_write_config, psycho_write_config), - DEVMETHOD(pcib_route_interrupt, psycho_route_interrupt), - DEVMETHOD(pcib_request_feature, pcib_request_feature_allow), - - /* ofw_bus interface */ - DEVMETHOD(ofw_bus_get_node, ofw_pci_get_node), - - /* ofw_pci interface */ - DEVMETHOD(ofw_pci_setup_device, psycho_setup_device), - - DEVMETHOD_END -}; - -static devclass_t psycho_devclass; - -DEFINE_CLASS_0(pcib, psycho_driver, psycho_methods, - sizeof(struct psycho_softc)); -EARLY_DRIVER_MODULE(psycho, nexus, psycho_driver, psycho_devclass, NULL, NULL, - BUS_PASS_BUS); - -static SYSCTL_NODE(_hw, OID_AUTO, psycho, CTLFLAG_RD, 0, "psycho parameters"); - -static u_int psycho_powerfail = 1; -SYSCTL_UINT(_hw_psycho, OID_AUTO, powerfail, CTLFLAG_RDTUN, &psycho_powerfail, - 0, "powerfail action (0: none, 1: shutdown (default), 2: debugger)"); - -static SLIST_HEAD(, psycho_softc) psycho_softcs = - SLIST_HEAD_INITIALIZER(psycho_softcs); - -static const struct intr_controller psycho_ic = { - psycho_intr_enable, - psycho_intr_disable, - psycho_intr_assign, - psycho_intr_clear -}; - -struct psycho_icarg { - struct psycho_softc *pica_sc; - bus_addr_t pica_map; - bus_addr_t pica_clr; -}; - -#define PSYCHO_READ8(sc, off) \ - bus_read_8((sc)->sc_mem_res, (off)) -#define PSYCHO_WRITE8(sc, off, v) \ - bus_write_8((sc)->sc_mem_res, (off), (v)) -#define PCICTL_READ8(sc, off) \ - PSYCHO_READ8((sc), (sc)->sc_pcictl + (off)) -#define PCICTL_WRITE8(sc, off, v) \ - PSYCHO_WRITE8((sc), (sc)->sc_pcictl + (off), (v)) - -/* - * "Sabre" is the UltraSPARC IIi onboard UPA to PCI bridge. It manages a - * single PCI bus and does not have a streaming buffer. It often has an APB - * (advanced PCI bridge) connected to it, which was designed specifically for - * the IIi. The APB lets the IIi handle two independent PCI buses, and - * appears as two "Simba"'s underneath the Sabre. - * - * "Hummingbird" is the UltraSPARC IIe onboard UPA to PCI bridge. It's - * basically the same as Sabre but without an APB underneath it. - * - * "Psycho" and "Psycho+" are dual UPA to PCI bridges. They sit on the UPA - * bus and manage two PCI buses. "Psycho" has two 64-bit 33MHz buses, while - * "Psycho+" controls both a 64-bit 33Mhz and a 64-bit 66Mhz PCI bus. You - * will usually find a "Psycho+" since I don't think the original "Psycho" - * ever shipped, and if it did it would be in the U30. - * - * Each "Psycho" PCI bus appears as a separate OFW node, but since they are - * both part of the same IC, they only have a single register space. As such, - * they need to be configured together, even though the autoconfiguration will - * attach them separately. - * - * On UltraIIi machines, "Sabre" itself usually takes pci0, with "Simba" often - * as pci1 and pci2, although they have been implemented with other PCI bus - * numbers on some machines. - * - * On UltraII machines, there can be any number of "Psycho+" ICs, each - * providing two PCI buses. - */ - -struct psycho_desc { - const char *pd_string; - int pd_mode; - const char *pd_name; -}; - -static const struct psycho_desc psycho_compats[] = { - { "pci108e,8000", PSYCHO_MODE_PSYCHO, "Psycho compatible" }, - { "pci108e,a000", PSYCHO_MODE_SABRE, "Sabre compatible" }, - { "pci108e,a001", PSYCHO_MODE_SABRE, "Hummingbird compatible" }, - { NULL, 0, NULL } -}; - -static const struct psycho_desc psycho_models[] = { - { "SUNW,psycho", PSYCHO_MODE_PSYCHO, "Psycho" }, - { "SUNW,sabre", PSYCHO_MODE_SABRE, "Sabre" }, - { NULL, 0, NULL } -}; - -static const struct psycho_desc * -psycho_find_desc(const struct psycho_desc *table, const char *string) -{ - const struct psycho_desc *desc; - - if (string == NULL) - return (NULL); - for (desc = table; desc->pd_string != NULL; desc++) - if (strcmp(desc->pd_string, string) == 0) - return (desc); - return (NULL); -} - -static const struct psycho_desc * -psycho_get_desc(device_t dev) -{ - const struct psycho_desc *rv; - - rv = psycho_find_desc(psycho_models, ofw_bus_get_model(dev)); - if (rv == NULL) - rv = psycho_find_desc(psycho_compats, - ofw_bus_get_compat(dev)); - return (rv); -} - -static int -psycho_probe(device_t dev) -{ - const char *dtype; - - dtype = ofw_bus_get_type(dev); - if (dtype != NULL && strcmp(dtype, OFW_TYPE_PCI) == 0 && - psycho_get_desc(dev) != NULL) { - device_set_desc(dev, "U2P UPA-PCI bridge"); - return (0); - } - return (ENXIO); -} - -static int -psycho_attach(device_t dev) -{ - struct psycho_icarg *pica; - struct psycho_softc *asc, *sc, *osc; - const struct psycho_desc *desc; - bus_addr_t intrclr, intrmap; - bus_dma_tag_t dmat; - uint64_t csr, dr; - phandle_t node; - uint32_t dvmabase, prop; - u_int rerun, ver; - int i, j; - - node = ofw_bus_get_node(dev); - sc = device_get_softc(dev); - desc = psycho_get_desc(dev); - - sc->sc_dev = dev; - sc->sc_mode = desc->pd_mode; - - /* - * The Psycho gets three register banks: - * (0) per-PBM configuration and status registers - * (1) per-PBM PCI configuration space, containing only the - * PBM 256-byte PCI header - * (2) the shared Psycho configuration registers - */ - if (sc->sc_mode == PSYCHO_MODE_PSYCHO) { - i = 2; - sc->sc_pcictl = - bus_get_resource_start(dev, SYS_RES_MEMORY, 0) - - bus_get_resource_start(dev, SYS_RES_MEMORY, 2); - switch (sc->sc_pcictl) { - case PSR_PCICTL0: - sc->sc_half = 0; - break; - case PSR_PCICTL1: - sc->sc_half = 1; - break; - default: - panic("%s: bogus PCI control register location", - __func__); - /* NOTREACHED */ - } - } else { - i = 0; - sc->sc_pcictl = PSR_PCICTL0; - sc->sc_half = 0; - } - sc->sc_mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &i, - (sc->sc_mode == PSYCHO_MODE_PSYCHO ? RF_SHAREABLE : 0) | - RF_ACTIVE); - if (sc->sc_mem_res == NULL) - panic("%s: could not allocate registers", __func__); - - /* - * Match other Psychos that are already configured against - * the base physical address. This will be the same for a - * pair of devices that share register space. - */ - osc = NULL; - SLIST_FOREACH(asc, &psycho_softcs, sc_link) { - if (rman_get_start(asc->sc_mem_res) == - rman_get_start(sc->sc_mem_res)) { - /* Found partner. */ - osc = asc; - break; - } - } - if (osc == NULL) { - sc->sc_mtx = malloc(sizeof(*sc->sc_mtx), M_DEVBUF, - M_NOWAIT | M_ZERO); - if (sc->sc_mtx == NULL) - panic("%s: could not malloc mutex", __func__); - mtx_init(sc->sc_mtx, "pcib_mtx", NULL, MTX_SPIN); - } else { - if (sc->sc_mode != PSYCHO_MODE_PSYCHO) - panic("%s: no partner expected", __func__); - if (mtx_initialized(osc->sc_mtx) == 0) - panic("%s: mutex not initialized", __func__); - sc->sc_mtx = osc->sc_mtx; - } - SLIST_INSERT_HEAD(&psycho_softcs, sc, sc_link); - - csr = PSYCHO_READ8(sc, PSR_CS); - ver = PSYCHO_GCSR_VERS(csr); - sc->sc_ign = 0x1f; /* Hummingbird/Sabre IGN is always 0x1f. */ - if (sc->sc_mode == PSYCHO_MODE_PSYCHO) - sc->sc_ign = PSYCHO_GCSR_IGN(csr); - if (OF_getprop(node, "clock-frequency", &prop, sizeof(prop)) == -1) - prop = 33000000; - - device_printf(dev, - "%s, impl %d, version %d, IGN %#x, bus %c, %dMHz\n", - desc->pd_name, (u_int)PSYCHO_GCSR_IMPL(csr), ver, sc->sc_ign, - 'A' + sc->sc_half, prop / 1000 / 1000); - - /* Set up the PCI control and PCI diagnostic registers. */ - - csr = PCICTL_READ8(sc, PCR_CS); - csr &= ~PCICTL_ARB_PARK; - if (OF_getproplen(node, "no-bus-parking") < 0) - csr |= PCICTL_ARB_PARK; - - /* Workarounds for version specific bugs. */ - dr = PCICTL_READ8(sc, PCR_DIAG); - switch (ver) { - case 0: - dr |= DIAG_RTRY_DIS; - dr &= ~DIAG_DWSYNC_DIS; - rerun = 0; - break; - case 1: - csr &= ~PCICTL_ARB_PARK; - dr |= DIAG_RTRY_DIS | DIAG_DWSYNC_DIS; - rerun = 0; - break; - default: - dr |= DIAG_DWSYNC_DIS; - dr &= ~DIAG_RTRY_DIS; - rerun = 1; - break; - } - - csr |= PCICTL_ERRINTEN | PCICTL_ARB_4; - csr &= ~(PCICTL_SBHINTEN | PCICTL_WAKEUPEN); -#ifdef PSYCHO_DEBUG - device_printf(dev, "PCI CSR 0x%016llx -> 0x%016llx\n", - (unsigned long long)PCICTL_READ8(sc, PCR_CS), - (unsigned long long)csr); -#endif - PCICTL_WRITE8(sc, PCR_CS, csr); - - dr &= ~DIAG_ISYNC_DIS; -#ifdef PSYCHO_DEBUG - device_printf(dev, "PCI DR 0x%016llx -> 0x%016llx\n", - (unsigned long long)PCICTL_READ8(sc, PCR_DIAG), - (unsigned long long)dr); -#endif - PCICTL_WRITE8(sc, PCR_DIAG, dr); - - if (sc->sc_mode == PSYCHO_MODE_SABRE) { - /* Use the PROM preset for now. */ - csr = PCICTL_READ8(sc, PCR_TAS); - if (csr == 0) - panic("%s: Hummingbird/Sabre TAS not initialized.", - __func__); - dvmabase = (ffs(csr) - 1) << PCITAS_ADDR_SHIFT; - } else - dvmabase = -1; - - /* - * If we're a Hummingbird/Sabre or the first of a pair of Psychos - * to arrive here, do the interrupt setup and start up the IOMMU. - */ - if (osc == NULL) { - /* - * Hunt through all the interrupt mapping regs and register - * our interrupt controller for the corresponding interrupt - * vectors. We do this early in order to be able to catch - * stray interrupts. - */ - for (i = 0; i <= PSYCHO_MAX_INO; i++) { - if (psycho_find_intrmap(sc, i, &intrmap, &intrclr, - NULL) == 0) - continue; - pica = malloc(sizeof(*pica), M_DEVBUF, M_NOWAIT); - if (pica == NULL) - panic("%s: could not allocate interrupt " - "controller argument", __func__); - pica->pica_sc = sc; - pica->pica_map = intrmap; - pica->pica_clr = intrclr; -#ifdef PSYCHO_DEBUG - /* - * Enable all interrupts and clear all interrupt - * states. This aids the debugging of interrupt - * routing problems. - */ - device_printf(dev, - "intr map (INO %d, %s) %#lx: %#lx, clr: %#lx\n", - i, intrmap <= PSR_PCIB3_INT_MAP ? "PCI" : "OBIO", - (u_long)intrmap, (u_long)PSYCHO_READ8(sc, - intrmap), (u_long)intrclr); - PSYCHO_WRITE8(sc, intrmap, INTMAP_VEC(sc->sc_ign, i)); - PSYCHO_WRITE8(sc, intrclr, INTCLR_IDLE); - PSYCHO_WRITE8(sc, intrmap, - INTMAP_ENABLE(INTMAP_VEC(sc->sc_ign, i), - PCPU_GET(mid))); -#endif - j = intr_controller_register(INTMAP_VEC(sc->sc_ign, - i), &psycho_ic, pica); - if (j != 0) - device_printf(dev, "could not register " - "interrupt controller for INO %d (%d)\n", - i, j); - } - - if (sc->sc_mode == PSYCHO_MODE_PSYCHO) - sparc64_counter_init(device_get_nameunit(dev), - rman_get_bustag(sc->sc_mem_res), - rman_get_bushandle(sc->sc_mem_res), PSR_TC0); - - /* - * Set up IOMMU and PCI configuration if we're the first - * of a pair of Psychos to arrive here or a Hummingbird - * or Sabre. - * - * We should calculate a TSB size based on amount of RAM - * and number of bus controllers and number and type of - * child devices. - * - * For the moment, 32KB should be more than enough. - */ - sc->sc_is = malloc(sizeof(*sc->sc_is), M_DEVBUF, M_NOWAIT | - M_ZERO); - if (sc->sc_is == NULL) - panic("%s: could not malloc IOMMU state", __func__); - sc->sc_is->is_flags = IOMMU_PRESERVE_PROM; - if (sc->sc_mode == PSYCHO_MODE_SABRE) { - sc->sc_dma_methods = - malloc(sizeof(*sc->sc_dma_methods), M_DEVBUF, - M_NOWAIT); - if (sc->sc_dma_methods == NULL) - panic("%s: could not malloc DMA methods", - __func__); - memcpy(sc->sc_dma_methods, &iommu_dma_methods, - sizeof(*sc->sc_dma_methods)); - sc->sc_dma_methods->dm_dmamap_sync = - sabre_dmamap_sync; - sc->sc_is->is_pmaxaddr = - IOMMU_MAXADDR(SABRE_IOMMU_BITS); - } else { - sc->sc_dma_methods = &iommu_dma_methods; - sc->sc_is->is_pmaxaddr = - IOMMU_MAXADDR(PSYCHO_IOMMU_BITS); - } - sc->sc_is->is_sb[0] = sc->sc_is->is_sb[1] = 0; - if (OF_getproplen(node, "no-streaming-cache") < 0) - sc->sc_is->is_sb[0] = sc->sc_pcictl + PCR_STRBUF; - sc->sc_is->is_flags |= (rerun != 1) ? IOMMU_RERUN_DISABLE : 0; - psycho_iommu_init(sc, 3, dvmabase); - } else { - /* Just copy IOMMU state, config tag and address. */ - sc->sc_dma_methods = &iommu_dma_methods; - sc->sc_is = osc->sc_is; - if (OF_getproplen(node, "no-streaming-cache") < 0) - sc->sc_is->is_sb[1] = sc->sc_pcictl + PCR_STRBUF; - iommu_reset(sc->sc_is); - } - - /* Create our DMA tag. */ - if (bus_dma_tag_create(bus_get_dma_tag(dev), 8, 0, - sc->sc_is->is_pmaxaddr, ~0, NULL, NULL, sc->sc_is->is_pmaxaddr, - 0xff, 0xffffffff, 0, NULL, NULL, &dmat) != 0) - panic("%s: could not create PCI DMA tag", __func__); - dmat->dt_cookie = sc->sc_is; - dmat->dt_mt = sc->sc_dma_methods; - - if (ofw_pci_attach_common(dev, dmat, PSYCHO_IO_SIZE, - PSYCHO_MEM_SIZE) != 0) - panic("%s: ofw_pci_attach_common() failed", __func__); - - /* Clear any pending PCI error bits. */ - PCIB_WRITE_CONFIG(dev, sc->sc_ops.sc_pci_secbus, PCS_DEVICE, PCS_FUNC, - PCIR_STATUS, PCIB_READ_CONFIG(dev, sc->sc_ops.sc_pci_secbus, - PCS_DEVICE, PCS_FUNC, PCIR_STATUS, 2), 2); - PCICTL_WRITE8(sc, PCR_CS, PCICTL_READ8(sc, PCR_CS)); - PCICTL_WRITE8(sc, PCR_AFS, PCICTL_READ8(sc, PCR_AFS)); - - if (osc == NULL) { - /* - * Establish handlers for interesting interrupts... - * - * XXX We need to remember these and remove this to support - * hotplug on the UPA/FHC bus. - * - * XXX Not all controllers have these, but installing them - * is better than trying to sort through this mess. - */ - psycho_set_intr(sc, 1, PSR_UE_INT_MAP, psycho_ue, NULL); - psycho_set_intr(sc, 2, PSR_CE_INT_MAP, psycho_ce, NULL); - switch (psycho_powerfail) { - case 0: - break; - case 2: - psycho_set_intr(sc, 3, PSR_POWER_INT_MAP, - psycho_powerdebug, NULL); - break; - default: - psycho_set_intr(sc, 3, PSR_POWER_INT_MAP, NULL, - psycho_powerdown); - break; - } - if (sc->sc_mode == PSYCHO_MODE_PSYCHO) { - /* - * Hummingbirds/Sabres do not have the following two - * interrupts. - */ - - /* - * The spare hardware interrupt is used for the - * over-temperature interrupt. - */ - psycho_set_intr(sc, 4, PSR_SPARE_INT_MAP, NULL, - psycho_overtemp); -#ifdef PSYCHO_MAP_WAKEUP - /* - * psycho_wakeup() doesn't do anything useful right - * now. - */ - psycho_set_intr(sc, 5, PSR_PWRMGT_INT_MAP, - psycho_wakeup, NULL); -#endif /* PSYCHO_MAP_WAKEUP */ - } - } - /* - * Register a PCI bus error interrupt handler according to which - * half this is. Hummingbird/Sabre don't have a PCI bus B error - * interrupt but they are also only used for PCI bus A. - */ - psycho_set_intr(sc, 0, sc->sc_half == 0 ? PSR_PCIAERR_INT_MAP : - PSR_PCIBERR_INT_MAP, psycho_pci_bus, NULL); - - /* - * Set the latency timer register as this isn't always done by the - * firmware. - */ - PCIB_WRITE_CONFIG(dev, sc->sc_ops.sc_pci_secbus, PCS_DEVICE, PCS_FUNC, - PCIR_LATTIMER, OFW_PCI_LATENCY, 1); - - for (i = PCIR_VENDOR; i < PCIR_STATUS; i += sizeof(uint16_t)) - le16enc(&sc->sc_pci_hpbcfg[i], - bus_space_read_2(sc->sc_ops.sc_pci_cfgt, - sc->sc_ops.sc_pci_bh[OFW_PCI_CS_CONFIG], - PSYCHO_CONF_OFF(sc->sc_ops.sc_pci_secbus, PCS_DEVICE, - PCS_FUNC, i))); - for (i = PCIR_REVID; i <= PCIR_BIST; i += sizeof(uint8_t)) - sc->sc_pci_hpbcfg[i] = bus_space_read_1(sc->sc_ops.sc_pci_cfgt, - sc->sc_ops.sc_pci_bh[OFW_PCI_CS_CONFIG], PSYCHO_CONF_OFF( - sc->sc_ops.sc_pci_secbus, PCS_DEVICE, PCS_FUNC, i)); - - /* - * On E250 the interrupt map entry for the EBus bridge is wrong, - * causing incorrect interrupts to be assigned to some devices on - * the EBus. Work around it by changing our copy of the interrupt - * map mask to perform a full comparison of the INO. That way - * the interrupt map entry for the EBus bridge won't match at all - * and the INOs specified in the "interrupts" properties of the - * EBus devices will be used directly instead. - */ - if (strcmp(sparc64_model, "SUNW,Ultra-250") == 0 && - sc->sc_ops.sc_pci_iinfo.opi_imapmsk != NULL) - *(ofw_pci_intr_t *)(&sc->sc_ops.sc_pci_iinfo.opi_imapmsk[ - sc->sc_ops.sc_pci_iinfo.opi_addrc]) = INTMAP_INO_MASK; - - device_add_child(dev, "pci", -1); - return (bus_generic_attach(dev)); -} - -static void -psycho_set_intr(struct psycho_softc *sc, u_int index, bus_addr_t intrmap, - driver_filter_t filt, driver_intr_t intr) -{ - u_long vec; - int rid; - - rid = index; - sc->sc_irq_res[index] = bus_alloc_resource_any(sc->sc_dev, - SYS_RES_IRQ, &rid, RF_ACTIVE); - if (sc->sc_irq_res[index] == NULL && intrmap >= PSR_POWER_INT_MAP) { - /* - * These interrupts aren't mandatory and not available - * with all controllers (not even Psychos). - */ - return; - } - if (sc->sc_irq_res[index] == NULL || - INTIGN(vec = rman_get_start(sc->sc_irq_res[index])) != - sc->sc_ign || - INTVEC(PSYCHO_READ8(sc, intrmap)) != vec || - intr_vectors[vec].iv_ic != &psycho_ic || - bus_setup_intr(sc->sc_dev, sc->sc_irq_res[index], - INTR_TYPE_MISC | INTR_BRIDGE | INTR_MPSAFE, filt, intr, sc, - &sc->sc_ihand[index]) != 0) - panic("%s: failed to set up interrupt %d", __func__, index); -} - -static int -psycho_find_intrmap(struct psycho_softc *sc, u_int ino, - bus_addr_t *intrmapptr, bus_addr_t *intrclrptr, bus_addr_t *intrdiagptr) -{ - bus_addr_t intrclr, intrmap; - uint64_t diag; - int found; - - /* - * XXX we only compare INOs rather than INRs since the firmware may - * not provide the IGN and the IGN is constant for all devices on - * that PCI controller. - * This could cause problems for the FFB/external interrupt which - * has a full vector that can be set arbitrarily. - */ - - if (ino > PSYCHO_MAX_INO) { - device_printf(sc->sc_dev, "out of range INO %d requested\n", - ino); - return (0); - } - - found = 0; - /* Hunt through OBIO first. */ - diag = PSYCHO_READ8(sc, PSR_OBIO_INT_DIAG); - for (intrmap = PSR_SCSI_INT_MAP, intrclr = PSR_SCSI_INT_CLR; - intrmap <= PSR_PWRMGT_INT_MAP; intrmap += 8, intrclr += 8, - diag >>= 2) { - if (sc->sc_mode == PSYCHO_MODE_SABRE && - (intrmap == PSR_TIMER0_INT_MAP || - intrmap == PSR_TIMER1_INT_MAP || - intrmap == PSR_PCIBERR_INT_MAP || - intrmap == PSR_PWRMGT_INT_MAP)) - continue; - if (INTINO(PSYCHO_READ8(sc, intrmap)) == ino) { - diag &= 2; - found = 1; - break; - } - } - - if (!found) { - diag = PSYCHO_READ8(sc, PSR_PCI_INT_DIAG); - /* Now do PCI interrupts. */ - for (intrmap = PSR_PCIA0_INT_MAP, intrclr = PSR_PCIA0_INT_CLR; - intrmap <= PSR_PCIB3_INT_MAP; intrmap += 8, intrclr += 32, - diag >>= 8) { - if (sc->sc_mode == PSYCHO_MODE_PSYCHO && - (intrmap == PSR_PCIA2_INT_MAP || - intrmap == PSR_PCIA3_INT_MAP)) - continue; - if (((PSYCHO_READ8(sc, intrmap) ^ ino) & 0x3c) == 0) { - intrclr += 8 * (ino & 3); - diag = (diag >> ((ino & 3) * 2)) & 2; - found = 1; - break; - } - } - } - if (intrmapptr != NULL) - *intrmapptr = intrmap; - if (intrclrptr != NULL) - *intrclrptr = intrclr; - if (intrdiagptr != NULL) - *intrdiagptr = diag; - return (found); -} - -/* - * Interrupt handlers - */ -static int -psycho_ue(void *arg) -{ - struct psycho_softc *sc = arg; - uint64_t afar, afsr; - - afar = PSYCHO_READ8(sc, PSR_UE_AFA); - afsr = PSYCHO_READ8(sc, PSR_UE_AFS); - /* - * On the UltraSPARC-IIi/IIe, IOMMU misses/protection faults cause - * the AFAR to be set to the physical address of the TTE entry that - * was invalid/write protected. Call into the IOMMU code to have - * them decoded to virtual I/O addresses. - */ - if ((afsr & UEAFSR_P_DTE) != 0) - iommu_decode_fault(sc->sc_is, afar); - panic("%s: uncorrectable DMA error AFAR %#lx AFSR %#lx", - device_get_nameunit(sc->sc_dev), (u_long)afar, (u_long)afsr); - return (FILTER_HANDLED); -} - -static int -psycho_ce(void *arg) -{ - struct psycho_softc *sc = arg; - uint64_t afar, afsr; - - mtx_lock_spin(sc->sc_mtx); - afar = PSYCHO_READ8(sc, PSR_CE_AFA); - afsr = PSYCHO_READ8(sc, PSR_CE_AFS); - device_printf(sc->sc_dev, "correctable DMA error AFAR %#lx " - "AFSR %#lx\n", (u_long)afar, (u_long)afsr); - /* Clear the error bits that we caught. */ - PSYCHO_WRITE8(sc, PSR_CE_AFS, afsr); - mtx_unlock_spin(sc->sc_mtx); - return (FILTER_HANDLED); -} - -static int -psycho_pci_bus(void *arg) -{ - struct psycho_softc *sc = arg; - uint64_t afar, afsr; - - afar = PCICTL_READ8(sc, PCR_AFA); - afsr = PCICTL_READ8(sc, PCR_AFS); - panic("%s: PCI bus %c error AFAR %#lx AFSR %#lx", - device_get_nameunit(sc->sc_dev), 'A' + sc->sc_half, (u_long)afar, - (u_long)afsr); - return (FILTER_HANDLED); -} - -static int -psycho_powerdebug(void *arg __unused) -{ - - kdb_enter(KDB_WHY_POWERFAIL, "powerfail"); - return (FILTER_HANDLED); -} - -static void -psycho_powerdown(void *arg __unused) -{ - static int shutdown; - - /* As the interrupt is cleared we may be called multiple times. */ - if (shutdown != 0) - return; - shutdown++; - printf("Power Failure Detected: Shutting down NOW.\n"); - shutdown_nice(RB_POWEROFF); -} - -static void -psycho_overtemp(void *arg __unused) -{ - static int shutdown; - - /* As the interrupt is cleared we may be called multiple times. */ - if (shutdown != 0) - return; - shutdown++; - printf("DANGER: OVER TEMPERATURE detected.\nShutting down NOW.\n"); - shutdown_nice(RB_POWEROFF); -} - -#ifdef PSYCHO_MAP_WAKEUP -static int -psycho_wakeup(void *arg) -{ - struct psycho_softc *sc = arg; - - /* We don't really have a framework to deal with this properly. */ - device_printf(sc->sc_dev, "power management wakeup\n"); - return (FILTER_HANDLED); -} -#endif /* PSYCHO_MAP_WAKEUP */ - -static void -psycho_iommu_init(struct psycho_softc *sc, int tsbsize, uint32_t dvmabase) -{ - struct iommu_state *is = sc->sc_is; - - /* Punch in our copies. */ - is->is_bustag = rman_get_bustag(sc->sc_mem_res); - is->is_bushandle = rman_get_bushandle(sc->sc_mem_res); - is->is_iommu = PSR_IOMMU; - is->is_dtag = PSR_IOMMU_TLB_TAG_DIAG; - is->is_ddram = PSR_IOMMU_TLB_DATA_DIAG; - is->is_dqueue = PSR_IOMMU_QUEUE_DIAG; - is->is_dva = PSR_IOMMU_SVADIAG; - is->is_dtcmp = PSR_IOMMU_TLB_CMP_DIAG; - - iommu_init(device_get_nameunit(sc->sc_dev), is, tsbsize, dvmabase, 0); -} - -static int -psycho_maxslots(device_t dev) -{ - - /* XXX: is this correct? */ - return (PCI_SLOTMAX); -} - -static uint32_t -psycho_read_config(device_t dev, u_int bus, u_int slot, u_int func, u_int reg, - int width) -{ - struct psycho_softc *sc; - - sc = device_get_softc(dev); - /* - * The Hummingbird and Sabre bridges are picky in that they - * only allow their config space to be accessed using the - * "native" width of the respective register being accessed - * and return semi-random other content of their config space - * otherwise. Given that the PCI specs don't say anything - * about such a (unusual) limitation and lots of stuff expects - * to be able to access the contents of the config space at - * any width we allow just that. We do this by using a copy - * of the header of the bridge (the rest is all zero anyway) - * read during attach (expect for PCIR_STATUS) in order to - * simplify things. - * The Psycho bridges contain a dupe of their header at 0x80 - * which we nullify that way also. - */ - if (bus == sc->sc_ops.sc_pci_secbus && slot == PCS_DEVICE && - func == PCS_FUNC) { - if (reg % width != 0) - return (-1); - - if (reg >= sizeof(sc->sc_pci_hpbcfg)) - return (0); - - if ((reg < PCIR_STATUS && reg + width > PCIR_STATUS) || - reg == PCIR_STATUS || reg == PCIR_STATUS + 1) - le16enc(&sc->sc_pci_hpbcfg[PCIR_STATUS], - bus_space_read_2(sc->sc_ops.sc_pci_cfgt, - sc->sc_ops.sc_pci_bh[OFW_PCI_CS_CONFIG], - PSYCHO_CONF_OFF(sc->sc_ops.sc_pci_secbus, - PCS_DEVICE, PCS_FUNC, PCIR_STATUS))); - - switch (width) { - case 1: - return (sc->sc_pci_hpbcfg[reg]); - case 2: - return (le16dec(&sc->sc_pci_hpbcfg[reg])); - case 4: - return (le32dec(&sc->sc_pci_hpbcfg[reg])); - } - } - - return (ofw_pci_read_config_common(dev, PCI_REGMAX, - PSYCHO_CONF_OFF(bus, slot, func, reg), bus, slot, func, reg, - width)); -} - -static void -psycho_write_config(device_t dev, u_int bus, u_int slot, u_int func, - u_int reg, uint32_t val, int width) -{ - - ofw_pci_write_config_common(dev, PCI_REGMAX, PSYCHO_CONF_OFF(bus, - slot, func, reg), bus, slot, func, reg, val, width); -} - -static int -psycho_route_interrupt(device_t bridge, device_t dev, int pin) -{ - struct psycho_softc *sc; - bus_addr_t intrmap; - ofw_pci_intr_t mintr; - - mintr = ofw_pci_route_interrupt_common(bridge, dev, pin); - if (PCI_INTERRUPT_VALID(mintr)) - return (mintr); - /* - * If this is outside of the range for an intpin, it's likely a full - * INO, and no mapping is required at all; this happens on the U30, - * where there's no interrupt map at the Psycho node. Fortunately, - * there seem to be no INOs in the intpin range on this boxen, so - * this easy heuristics will do. - */ - if (pin > 4) - return (pin); - /* - * Guess the INO; we always assume that this is a non-OBIO device, - * and that pin is a "real" intpin number. Determine the mapping - * register to be used by the slot number. - * We only need to do this on E450s and U30s, though; here, the - * slot numbers for bus A are one-based, while those for bus B - * seemingly have an offset of 2 (hence the factor of 3 below). - */ - sc = device_get_softc(bridge); - intrmap = PSR_PCIA0_INT_MAP + - 8 * (pci_get_slot(dev) - 1 + 3 * sc->sc_half); - mintr = INTINO(PSYCHO_READ8(sc, intrmap)) + pin - 1; - device_printf(bridge, - "guessing interrupt %d for device %d.%d pin %d\n", - (int)mintr, pci_get_slot(dev), pci_get_function(dev), pin); - return (mintr); -} - -static void -sabre_dmamap_sync(bus_dma_tag_t dt, bus_dmamap_t map, bus_dmasync_op_t op) -{ - struct iommu_state *is = dt->dt_cookie; - - if ((map->dm_flags & DMF_LOADED) == 0) - return; - - if ((op & BUS_DMASYNC_POSTREAD) != 0) - (void)bus_space_read_8(is->is_bustag, is->is_bushandle, - PSR_DMA_WRITE_SYNC); - - if ((op & BUS_DMASYNC_PREWRITE) != 0) - membar(Sync); -} - -static void -psycho_intr_enable(void *arg) -{ - struct intr_vector *iv = arg; - struct psycho_icarg *pica = iv->iv_icarg; - - PSYCHO_WRITE8(pica->pica_sc, pica->pica_map, - INTMAP_ENABLE(iv->iv_vec, iv->iv_mid)); -} - -static void -psycho_intr_disable(void *arg) -{ - struct intr_vector *iv = arg; - struct psycho_icarg *pica = iv->iv_icarg; - - PSYCHO_WRITE8(pica->pica_sc, pica->pica_map, iv->iv_vec); -} - -static void -psycho_intr_assign(void *arg) -{ - struct intr_vector *iv = arg; - struct psycho_icarg *pica = iv->iv_icarg; - - PSYCHO_WRITE8(pica->pica_sc, pica->pica_map, INTMAP_TID( - PSYCHO_READ8(pica->pica_sc, pica->pica_map), iv->iv_mid)); -} - -static void -psycho_intr_clear(void *arg) -{ - struct intr_vector *iv = arg; - struct psycho_icarg *pica = iv->iv_icarg; - - PSYCHO_WRITE8(pica->pica_sc, pica->pica_clr, INTCLR_IDLE); -} - -static int -psycho_setup_intr(device_t dev, device_t child, struct resource *ires, - int flags, driver_filter_t *filt, driver_intr_t *intr, void *arg, - void **cookiep) -{ - struct psycho_softc *sc; - u_long vec; - - sc = device_get_softc(dev); - /* - * Make sure the vector is fully specified and we registered - * our interrupt controller for it. - */ - vec = rman_get_start(ires); - if (INTIGN(vec) != sc->sc_ign || - intr_vectors[vec].iv_ic != &psycho_ic) { - device_printf(dev, "invalid interrupt vector 0x%lx\n", vec); - return (EINVAL); - } - return (bus_generic_setup_intr(dev, child, ires, flags, filt, intr, - arg, cookiep)); -} - -static struct resource * -psycho_alloc_resource(device_t bus, device_t child, int type, int *rid, - rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) -{ - struct psycho_softc *sc; - - if (type == SYS_RES_IRQ) { - sc = device_get_softc(bus); - start = end = INTMAP_VEC(sc->sc_ign, end); - } - return (ofw_pci_alloc_resource(bus, child, type, rid, start, end, - count, flags)); -} - -static void -psycho_setup_device(device_t bus, device_t child) -{ - struct psycho_softc *sc; - uint32_t rev; - - sc = device_get_softc(bus); - /* - * Revision 0 EBus bridges have a bug which prevents them from - * working when bus parking is enabled. - */ - if ((strcmp(ofw_bus_get_name(child), "ebus") == 0 || - strcmp(ofw_bus_get_name(child), "pci108e,1000") == 0) && - OF_getprop(ofw_bus_get_node(child), "revision-id", &rev, - sizeof(rev)) > 0 && rev == 0) - PCICTL_WRITE8(sc, PCR_CS, PCICTL_READ8(sc, PCR_CS) & - ~PCICTL_ARB_PARK); -} diff --git a/sys/sparc64/pci/psychoreg.h b/sys/sparc64/pci/psychoreg.h deleted file mode 100644 index ec7fe29aa1b03b..00000000000000 --- a/sys/sparc64/pci/psychoreg.h +++ /dev/null @@ -1,330 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1999 Matthew R. Green - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*- - * Copyright (c) 1998, 1999 Eduardo E. Horvath - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: NetBSD: psychoreg.h,v 1.14 2008/05/30 02:29:37 mrg Exp - * - * $FreeBSD$ - */ - -#ifndef _SPARC64_PCI_PSYCHOREG_H_ -#define _SPARC64_PCI_PSYCHOREG_H_ - -/* - * Sun4u PCI definitions. Here's where we deal w/the machine - * dependencies of Psycho and the PCI controller on the UltraIIi. - * - * All PCI registers are bit-swapped, however they are not byte-swapped. - * This means that they must be accessed using little-endian access modes, - * either map the pages little-endian or use little-endian ASIs. - * - * PSYCHO implements two PCI buses, A and B. - */ - -#define PSYCHO_NINTR 6 - -/* - * Psycho register offsets - * - * NB: FFB0 and FFB1 intr map regs also appear at 0x6000 and 0x8000 - * respectively. - */ -#define PSR_UPA_PORTID 0x0000 /* UPA port ID register */ -#define PSR_UPA_CONFIG 0x0008 /* UPA config register */ -#define PSR_CS 0x0010 /* PSYCHO control/status register */ -#define PSR_ECCC 0x0020 /* ECC control register */ -#define PSR_UE_AFS 0x0030 /* Uncorrectable Error AFSR */ -#define PSR_UE_AFA 0x0038 /* Uncorrectable Error AFAR */ -#define PSR_CE_AFS 0x0040 /* Correctable Error AFSR */ -#define PSR_CE_AFA 0x0048 /* Correctable Error AFAR */ -#define PSR_PM_CTL 0x0100 /* Performance monitor control reg */ -#define PSR_PM_COUNT 0x0108 /* Performance monitor counter reg */ -#define PSR_IOMMU 0x0200 /* IOMMU registers */ -#define PSR_PCIA0_INT_MAP 0x0c00 /* PCI bus a slot 0 irq map reg */ -#define PSR_PCIA1_INT_MAP 0x0c08 /* PCI bus a slot 1 irq map reg */ -#define PSR_PCIA2_INT_MAP 0x0c10 /* PCI bus a slot 2 irq map reg (IIi) */ -#define PSR_PCIA3_INT_MAP 0x0c18 /* PCI bus a slot 3 irq map reg (IIi) */ -#define PSR_PCIB0_INT_MAP 0x0c20 /* PCI bus b slot 0 irq map reg */ -#define PSR_PCIB1_INT_MAP 0x0c28 /* PCI bus b slot 1 irq map reg */ -#define PSR_PCIB2_INT_MAP 0x0c30 /* PCI bus b slot 2 irq map reg */ -#define PSR_PCIB3_INT_MAP 0x0c38 /* PCI bus b slot 3 irq map reg */ -#define PSR_SCSI_INT_MAP 0x1000 /* SCSI interrupt map reg */ -#define PSR_ETHER_INT_MAP 0x1008 /* ethernet interrupt map reg */ -#define PSR_BPP_INT_MAP 0x1010 /* parallel interrupt map reg */ -#define PSR_AUDIOR_INT_MAP 0x1018 /* audio record interrupt map reg */ -#define PSR_AUDIOP_INT_MAP 0x1020 /* audio playback interrupt map reg */ -#define PSR_POWER_INT_MAP 0x1028 /* power fail interrupt map reg */ -#define PSR_SKBDMS_INT_MAP 0x1030 /* serial/kbd/mouse interrupt map reg */ -#define PSR_FD_INT_MAP 0x1038 /* floppy interrupt map reg */ -#define PSR_SPARE_INT_MAP 0x1040 /* spare interrupt map reg */ -#define PSR_KBD_INT_MAP 0x1048 /* kbd [unused] interrupt map reg */ -#define PSR_MOUSE_INT_MAP 0x1050 /* mouse [unused] interrupt map reg */ -#define PSR_SERIAL_INT_MAP 0x1058 /* second serial interrupt map reg */ -#define PSR_TIMER0_INT_MAP 0x1060 /* timer 0 interrupt map reg */ -#define PSR_TIMER1_INT_MAP 0x1068 /* timer 1 interrupt map reg */ -#define PSR_UE_INT_MAP 0x1070 /* UE interrupt map reg */ -#define PSR_CE_INT_MAP 0x1078 /* CE interrupt map reg */ -#define PSR_PCIAERR_INT_MAP 0x1080 /* PCI bus a error interrupt map reg */ -#define PSR_PCIBERR_INT_MAP 0x1088 /* PCI bus b error interrupt map reg */ -#define PSR_PWRMGT_INT_MAP 0x1090 /* power mgmt wake interrupt map reg */ -#define PSR_FFB0_INT_MAP 0x1098 /* FFB0 graphics interrupt map reg */ -#define PSR_FFB1_INT_MAP 0x10a0 /* FFB1 graphics interrupt map reg */ -/* Note: Clear interrupt 0 registers are not really used. */ -#define PSR_PCIA0_INT_CLR 0x1400 /* PCI a slot 0 clear int regs 0..3 */ -#define PSR_PCIA1_INT_CLR 0x1420 /* PCI a slot 1 clear int regs 0..3 */ -#define PSR_PCIA2_INT_CLR 0x1440 /* PCI a slot 2 clear int regs 0..3 */ -#define PSR_PCIA3_INT_CLR 0x1460 /* PCI a slot 3 clear int regs 0..3 */ -#define PSR_PCIB0_INT_CLR 0x1480 /* PCI b slot 0 clear int regs 0..3 */ -#define PSR_PCIB1_INT_CLR 0x14a0 /* PCI b slot 1 clear int regs 0..3 */ -#define PSR_PCIB2_INT_CLR 0x14c0 /* PCI b slot 2 clear int regs 0..3 */ -#define PSR_PCIB3_INT_CLR 0x14d0 /* PCI b slot 3 clear int regs 0..3 */ -#define PSR_SCSI_INT_CLR 0x1800 /* SCSI clear int reg */ -#define PSR_ETHER_INT_CLR 0x1808 /* ethernet clear int reg */ -#define PSR_BPP_INT_CLR 0x1810 /* parallel clear int reg */ -#define PSR_AUDIOR_INT_CLR 0x1818 /* audio record clear int reg */ -#define PSR_AUDIOP_INT_CLR 0x1820 /* audio playback clear int reg */ -#define PSR_POWER_INT_CLR 0x1828 /* power fail clear int reg */ -#define PSR_SKBDMS_INT_CLR 0x1830 /* serial/kbd/mouse clear int reg */ -#define PSR_FD_INT_CLR 0x1838 /* floppy clear int reg */ -#define PSR_SPARE_INT_CLR 0x1840 /* spare clear int reg */ -#define PSR_KBD_INT_CLR 0x1848 /* kbd [unused] clear int reg */ -#define PSR_MOUSE_INT_CLR 0x1850 /* mouse [unused] clear int reg */ -#define PSR_SERIAL_INT_CLR 0x1858 /* second serial clear int reg */ -#define PSR_TIMER0_INT_CLR 0x1860 /* timer 0 clear int reg */ -#define PSR_TIMER1_INT_CLR 0x1868 /* timer 1 clear int reg */ -#define PSR_UE_INT_CLR 0x1870 /* UE clear int reg */ -#define PSR_CE_INT_CLR 0x1878 /* CE clear int reg */ -#define PSR_PCIAERR_INT_CLR 0x1880 /* PCI bus a error clear int reg */ -#define PSR_PCIBERR_INT_CLR 0x1888 /* PCI bus b error clear int reg */ -#define PSR_PWRMGT_INT_CLR 0x1890 /* power mgmt wake clr interrupt reg */ -#define PSR_INTR_RETRY_TIM 0x1a00 /* interrupt retry timer */ -#define PSR_TC0 0x1c00 /* timer/counter 0 */ -#define PSR_TC1 0x1c10 /* timer/counter 1 */ -#define PSR_DMA_WRITE_SYNC 0x1c20 /* PCI DMA write sync register (IIi) */ -#define PSR_PCICTL0 0x2000 /* PCICTL registers for 1st Psycho */ -#define PSR_PCICTL1 0x4000 /* PCICTL registers for 2nd Psycho */ -#define PSR_DMA_SCB_DIAG0 0xa000 /* DMA scoreboard diag reg 0 */ -#define PSR_DMA_SCB_DIAG1 0xa008 /* DMA scoreboard diag reg 1 */ -#define PSR_IOMMU_SVADIAG 0xa400 /* IOMMU virtual addr diag reg */ -#define PSR_IOMMU_TLB_CMP_DIAG 0xa408 /* IOMMU TLB tag compare diag reg */ -#define PSR_IOMMU_QUEUE_DIAG 0xa500 /* IOMMU LRU queue diag regs 0..15 */ -#define PSR_IOMMU_TLB_TAG_DIAG 0xa580 /* TLB tag diag regs 0..15 */ -#define PSR_IOMMU_TLB_DATA_DIAG 0xa600 /* TLB data RAM diag regs 0..15 */ -#define PSR_PCI_INT_DIAG 0xa800 /* PCI int state diag reg */ -#define PSR_OBIO_INT_DIAG 0xa808 /* OBIO and misc int state diag reg */ -#define PSR_STRBUF_DIAG 0xb000 /* Streaming buffer diag regs */ - -/* - * Here is the rest of the map, which we're not specifying: - * - * 1fe.0100.0000 - 1fe.01ff.ffff PCI configuration space - * 1fe.0100.0000 - 1fe.0100.00ff PCI B configuration header - * 1fe.0101.0000 - 1fe.0101.00ff PCI A configuration header - * 1fe.0200.0000 - 1fe.0200.ffff PCI A I/O space - * 1fe.0201.0000 - 1fe.0201.ffff PCI B I/O space - * 1ff.0000.0000 - 1ff.7fff.ffff PCI A memory space - * 1ff.8000.0000 - 1ff.ffff.ffff PCI B memory space - * - * NB: Config and I/O space can use 1-4 byte accesses, not 8 byte - * accesses. Memory space can use any sized accesses. - * - * Note that the SUNW,sabre/SUNW,simba combinations found on the - * Ultra5 and Ultra10 machines uses slightly differrent addresses - * than the above. This is mostly due to the fact that the APB is - * a multi-function PCI device with two PCI bridges, and the U2P is - * two separate PCI bridges. It uses the same PCI configuration - * space, though the configuration header for each PCI bus is - * located differently due to the SUNW,simba PCI busses being - * function 0 and function 1 of the APB, whereas the Psycho's are - * each their own PCI device. The I/O and memory spaces are each - * split into 8 equally sized areas (8x2MB blocks for I/O space, - * and 8x512MB blocks for memory space). These are allocated in to - * either PCI A or PCI B, or neither in the APB's `I/O Address Map - * Register A/B' (0xde) and `Memory Address Map Register A/B' (0xdf) - * registers of each Simba. We must ensure that both of the - * following are correct (the prom should do this for us): - * - * (PCI A Memory Address Map) & (PCI B Memory Address Map) == 0 - * - * (PCI A I/O Address Map) & (PCI B I/O Address Map) == 0 - * - * 1fe.0100.0000 - 1fe.01ff.ffff PCI configuration space - * 1fe.0100.0800 - 1fe.0100.08ff PCI B configuration header - * 1fe.0100.0900 - 1fe.0100.09ff PCI A configuration header - * 1fe.0200.0000 - 1fe.02ff.ffff PCI I/O space (divided) - * 1ff.0000.0000 - 1ff.ffff.ffff PCI memory space (divided) - */ - -/* - * PSR_CS defines: - * - * 63 59 55 50 45 4 3 2 1 0 - * +------+------+------+------+--//---+--------+-------+-----+------+ - * | IMPL | VERS | MID | IGN | xxx | APCKEN | APERR | IAP | MODE | - * +------+------+------+------+--//---+--------+-------+-----+------+ - * - */ -#define PSYCHO_GCSR_IMPL(csr) ((u_int)(((csr) >> 60) & 0xf)) -#define PSYCHO_GCSR_VERS(csr) ((u_int)(((csr) >> 56) & 0xf)) -#define PSYCHO_GCSR_MID(csr) ((u_int)(((csr) >> 51) & 0x1f)) -#define PSYCHO_GCSR_IGN(csr) ((u_int)(((csr) >> 46) & 0x1f)) -#define PSYCHO_CSR_APCKEN 8 /* UPA addr parity check enable */ -#define PSYCHO_CSR_APERR 4 /* UPA addr parity error */ -#define PSYCHO_CSR_IAP 2 /* invert UPA address parity */ -#define PSYCHO_CSR_MODE 1 /* UPA/PCI handshake */ - -/* Offsets into the PSR_PCICTL* register block */ -#define PCR_CS 0x0000 /* PCI control/status register */ -#define PCR_AFS 0x0010 /* PCI AFSR register */ -#define PCR_AFA 0x0018 /* PCI AFAR register */ -#define PCR_DIAG 0x0020 /* PCI diagnostic register */ -#define PCR_TAS 0x0028 /* PCI target address space reg (IIi) */ -#define PCR_STRBUF 0x0800 /* IOMMU streaming buffer registers. */ - -/* INO defines */ -#define PSYCHO_MAX_INO 0x3f - -/* Device space defines */ -#define PSYCHO_CONF_SIZE 0x1000000 -#define PSYCHO_CONF_BUS_SHIFT 16 -#define PSYCHO_CONF_DEV_SHIFT 11 -#define PSYCHO_CONF_FUNC_SHIFT 8 -#define PSYCHO_CONF_REG_SHIFT 0 -#define PSYCHO_IO_SIZE 0x1000000 -#define PSYCHO_MEM_SIZE 0x100000000 - -#define PSYCHO_CONF_OFF(bus, slot, func, reg) \ - (((bus) << PSYCHO_CONF_BUS_SHIFT) | \ - ((slot) << PSYCHO_CONF_DEV_SHIFT) | \ - ((func) << PSYCHO_CONF_FUNC_SHIFT) | \ - ((reg) << PSYCHO_CONF_REG_SHIFT)) - -/* what the bits mean! */ - -/* - * PCI [a|b] control/status register - * Note that the Hummingbird/Sabre only has one set of PCI control/status - * registers. - */ -#define PCICTL_SBHERR 0x0000000800000000 /* strm. byte hole error; W1C */ -#define PCICTL_SERR 0x0000000400000000 /* SERR asserted; W1C */ -#define PCICTL_PCISPEED 0x0000000200000000 /* 0:half 1:full bus speed */ -#define PCICTL_ARB_PARK 0x0000000000200000 /* PCI arbitration parking */ -#define PCICTL_SBHINTEN 0x0000000000000400 /* strm. byte hole int. en. */ -#define PCICTL_WAKEUPEN 0x0000000000000200 /* power mgmt. wakeup enable */ -#define PCICTL_ERRINTEN 0x0000000000000100 /* PCI error interrupt enable */ -#define PCICTL_ARB_4 0x000000000000000f /* DVMA arb. 4 PCI slots mask */ -#define PCICTL_ARB_6 0x000000000000003f /* DVMA arb. 6 PCI slots mask */ -/* The following are Hummingbird/Sabre only. */ -#define PCICTL_MRLM 0x0000001000000000 /* Memory Read Line/Multiple */ -#define PCICTL_CPU_PRIO 0x0000000000100000 /* CPU extra arb. prio. en. */ -#define PCICTL_ARB_PRIO 0x00000000000f0000 /* PCI extra arb. prio. en. */ -#define PCICTL_RTRYWAIT 0x0000000000000080 /* 0:wait 1:retry DMA write */ - -/* Uncorrectable error asynchronous fault status register */ -#define UEAFSR_BLK (1UL << 23) /* Error caused by block transaction */ -#define UEAFSR_P_DTE (1UL << 56) /* Pri. DVMA translation error */ -#define UEAFSR_S_DTE (1UL << 57) /* Sec. DVMA translation error */ -#define UEAFSR_S_DWR (1UL << 58) /* Sec. error during DVMA write */ -#define UEAFSR_S_DRD (1UL << 59) /* Sec. error during DVMA read */ -#define UEAFSR_S_PIO (1UL << 60) /* Sec. error during PIO access */ -#define UEAFSR_P_DWR (1UL << 61) /* Pri. error during DVMA write */ -#define UEAFSR_P_DRD (1UL << 62) /* Pri. error during DVMA read */ -#define UEAFSR_P_PIO (1UL << 63) /* Pri. error during PIO access */ - -/* Correctable error asynchronous fault status register */ -#define CEAFSR_BLK (1UL << 23) /* Error caused by block transaction */ -#define CEAFSR_S_DWR (1UL << 58) /* Sec. error caused by DVMA write */ -#define CEAFSR_S_DRD (1UL << 59) /* Sec. error caused by DVMA read */ -#define CEAFSR_S_PIO (1UL << 60) /* Sec. error caused by PIO access */ -#define CEAFSR_P_DWR (1UL << 61) /* Pri. error caused by DVMA write */ -#define CEAFSR_P_DRD (1UL << 62) /* Pri. error caused by DVMA read */ -#define CEAFSR_P_PIO (1UL << 63) /* Pri. error caused by PIO access */ - -/* PCI asynchronous fault status register */ -#define PCIAFSR_P_MA (1UL << 63) /* Pri. master abort */ -#define PCIAFSR_P_TA (1UL << 62) /* Pri. target abort */ -#define PCIAFSR_P_RTRY (1UL << 61) /* Pri. excessive retries */ -#define PCIAFSR_P_RERR (1UL << 60) /* Pri. parity error */ -#define PCIAFSR_S_MA (1UL << 59) /* Sec. master abort */ -#define PCIAFSR_S_TA (1UL << 58) /* Sec. target abort */ -#define PCIAFSR_S_RTRY (1UL << 57) /* Sec. excessive retries */ -#define PCIAFSR_S_RERR (1UL << 56) /* Sec. parity error */ -#define PCIAFSR_BMASK (0xffffUL << 32)/* Bytemask of failed pri. transfer */ -#define PCIAFSR_BLK (1UL << 31) /* failed pri. transfer was block r/w */ -#define PCIAFSR_MID (0x3eUL << 25) /* UPA MID causing error transaction */ - -/* PCI diagnostic register */ -#define DIAG_RTRY_DIS 0x0000000000000040 /* dis. retry limit */ -#define DIAG_ISYNC_DIS 0x0000000000000020 /* dis. DMA write / int sync */ -#define DIAG_DWSYNC_DIS 0x0000000000000010 /* dis. DMA write / PIO sync */ - -/* Definitions for the target address space register */ -#define PCITAS_ADDR_SHIFT 29 - -/* Definitions for the Psycho configuration space */ -#define PCS_DEVICE 0 /* Device number of Psycho CS entry */ -#define PCS_FUNC 0 /* Function number of Psycho CS entry */ - -/* Non-Standard registers in the configration space */ -#define PCSR_SECBUS 0x40 /* Secondary bus number register */ -#define PCSR_SUBBUS 0x41 /* Subordinate bus number register */ - -/* Width of the physical addresses the IOMMU translates to */ -#define PSYCHO_IOMMU_BITS 41 -#define SABRE_IOMMU_BITS 34 - -#endif /* !_SPARC64_PCI_PSYCHOREG_H_ */ diff --git a/sys/sparc64/pci/psychovar.h b/sys/sparc64/pci/psychovar.h deleted file mode 100644 index 1b82136dfc2433..00000000000000 --- a/sys/sparc64/pci/psychovar.h +++ /dev/null @@ -1,75 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-NetBSD - * - * Copyright (c) 1999, 2000 Matthew R. Green - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: NetBSD: psychovar.h,v 1.15 2008/05/29 14:51:26 mrg Exp - * - * $FreeBSD$ - */ - -#ifndef _SPARC64_PCI_PSYCHOVAR_H_ -#define _SPARC64_PCI_PSYCHOVAR_H_ - -/* - * Per-PCI bus on mainbus softc structure; one for sabre, or two - * per pair of psychos. - */ -struct psycho_softc { - /* - * This is here so that we can hook up the common bus interface - * methods in ofw_pci.c directly. - */ - struct ofw_pci_softc sc_ops; - - struct iommu_state *sc_is; - struct bus_dma_methods *sc_dma_methods; - - struct mtx *sc_mtx; - - struct resource *sc_mem_res; - struct resource *sc_irq_res[PSYCHO_NINTR]; - void *sc_ihand[PSYCHO_NINTR]; - - uint8_t sc_pci_hpbcfg[16]; - - SLIST_ENTRY(psycho_softc) sc_link; - - device_t sc_dev; - - bus_addr_t sc_pcictl; - - u_int sc_mode; -#define PSYCHO_MODE_SABRE 0 -#define PSYCHO_MODE_PSYCHO 1 - - /* Bus A or B of a psycho pair? */ - u_int sc_half; - - /* Interrupt Group Number for this device */ - uint32_t sc_ign; -}; - -#endif /* !_SPARC64_PCI_PSYCHOVAR_H_ */ diff --git a/sys/sparc64/pci/sbbc.c b/sys/sparc64/pci/sbbc.c deleted file mode 100644 index a5975fff82a3a1..00000000000000 --- a/sys/sparc64/pci/sbbc.c +++ /dev/null @@ -1,1113 +0,0 @@ -/* $OpenBSD: sbbc.c,v 1.7 2009/11/09 17:53:39 nicm Exp $ */ -/*- - * SPDX-License-Identifier: (ISC AND BSD-2-Clause-FreeBSD) - * - * Copyright (c) 2008 Mark Kettenis - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ -/*- - * Copyright (c) 2010 Marius Strobl - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include - -#include -#include -#include -#include -#include - -#include "clock_if.h" -#include "uart_if.h" - -#define SBBC_PCI_BAR PCIR_BAR(0) -#define SBBC_PCI_VENDOR 0x108e -#define SBBC_PCI_PRODUCT 0xc416 - -#define SBBC_REGS_OFFSET 0x800000 -#define SBBC_REGS_SIZE 0x6230 -#define SBBC_EPLD_OFFSET 0x8e0000 -#define SBBC_EPLD_SIZE 0x20 -#define SBBC_SRAM_OFFSET 0x900000 -#define SBBC_SRAM_SIZE 0x20000 /* 128KB SRAM */ - -#define SBBC_PCI_INT_STATUS 0x2320 -#define SBBC_PCI_INT_ENABLE 0x2330 -#define SBBC_PCI_ENABLE_INT_A 0x11 - -#define SBBC_EPLD_INTERRUPT 0x13 -#define SBBC_EPLD_INTERRUPT_ON 0x01 - -#define SBBC_SRAM_CONS_IN 0x00000001 -#define SBBC_SRAM_CONS_OUT 0x00000002 -#define SBBC_SRAM_CONS_BRK 0x00000004 -#define SBBC_SRAM_CONS_SPACE_IN 0x00000008 -#define SBBC_SRAM_CONS_SPACE_OUT 0x00000010 - -#define SBBC_TAG_KEY_SIZE 8 -#define SBBC_TAG_KEY_SCSOLIE "SCSOLIE" /* SC -> OS int. enable */ -#define SBBC_TAG_KEY_SCSOLIR "SCSOLIR" /* SC -> OS int. reason */ -#define SBBC_TAG_KEY_SOLCONS "SOLCONS" /* OS console buffer */ -#define SBBC_TAG_KEY_SOLSCIE "SOLSCIE" /* OS -> SC int. enable */ -#define SBBC_TAG_KEY_SOLSCIR "SOLSCIR" /* OS -> SC int. reason */ -#define SBBC_TAG_KEY_TODDATA "TODDATA" /* OS TOD struct */ -#define SBBC_TAG_OFF(x) offsetof(struct sbbc_sram_tag, x) - -struct sbbc_sram_tag { - char tag_key[SBBC_TAG_KEY_SIZE]; - uint32_t tag_size; - uint32_t tag_offset; -} __packed; - -#define SBBC_TOC_MAGIC "TOCSRAM" -#define SBBC_TOC_MAGIC_SIZE 8 -#define SBBC_TOC_TAGS_MAX 32 -#define SBBC_TOC_OFF(x) offsetof(struct sbbc_sram_toc, x) - -struct sbbc_sram_toc { - char toc_magic[SBBC_TOC_MAGIC_SIZE]; - uint8_t toc_reserved; - uint8_t toc_type; - uint16_t toc_version; - uint32_t toc_ntags; - struct sbbc_sram_tag toc_tag[SBBC_TOC_TAGS_MAX]; -} __packed; - -#define SBBC_TOD_MAGIC 0x54443100 /* "TD1" */ -#define SBBC_TOD_VERSION 1 -#define SBBC_TOD_OFF(x) offsetof(struct sbbc_sram_tod, x) - -struct sbbc_sram_tod { - uint32_t tod_magic; - uint32_t tod_version; - uint64_t tod_time; - uint64_t tod_skew; - uint32_t tod_reserved; - uint32_t tod_heartbeat; - uint32_t tod_timeout; -} __packed; - -#define SBBC_CONS_MAGIC 0x434f4e00 /* "CON" */ -#define SBBC_CONS_VERSION 1 -#define SBBC_CONS_OFF(x) offsetof(struct sbbc_sram_cons, x) - -struct sbbc_sram_cons { - uint32_t cons_magic; - uint32_t cons_version; - uint32_t cons_size; - - uint32_t cons_in_begin; - uint32_t cons_in_end; - uint32_t cons_in_rdptr; - uint32_t cons_in_wrptr; - - uint32_t cons_out_begin; - uint32_t cons_out_end; - uint32_t cons_out_rdptr; - uint32_t cons_out_wrptr; -} __packed; - -struct sbbc_softc { - struct resource *sc_res; -}; - -#define SBBC_READ_N(wdth, offs) \ - bus_space_read_ ## wdth((bst), (bsh), (offs)) -#define SBBC_WRITE_N(wdth, offs, val) \ - bus_space_write_ ## wdth((bst), (bsh), (offs), (val)) - -#define SBBC_READ_1(offs) \ - SBBC_READ_N(1, (offs)) -#define SBBC_READ_2(offs) \ - bswap16(SBBC_READ_N(2, (offs))) -#define SBBC_READ_4(offs) \ - bswap32(SBBC_READ_N(4, (offs))) -#define SBBC_READ_8(offs) \ - bswap64(SBBC_READ_N(8, (offs))) -#define SBBC_WRITE_1(offs, val) \ - SBBC_WRITE_N(1, (offs), (val)) -#define SBBC_WRITE_2(offs, val) \ - SBBC_WRITE_N(2, (offs), bswap16(val)) -#define SBBC_WRITE_4(offs, val) \ - SBBC_WRITE_N(4, (offs), bswap32(val)) -#define SBBC_WRITE_8(offs, val) \ - SBBC_WRITE_N(8, (offs), bswap64(val)) - -#define SBBC_REGS_READ_1(offs) \ - SBBC_READ_1((offs) + SBBC_REGS_OFFSET) -#define SBBC_REGS_READ_2(offs) \ - SBBC_READ_2((offs) + SBBC_REGS_OFFSET) -#define SBBC_REGS_READ_4(offs) \ - SBBC_READ_4((offs) + SBBC_REGS_OFFSET) -#define SBBC_REGS_READ_8(offs) \ - SBBC_READ_8((offs) + SBBC_REGS_OFFSET) -#define SBBC_REGS_WRITE_1(offs, val) \ - SBBC_WRITE_1((offs) + SBBC_REGS_OFFSET, (val)) -#define SBBC_REGS_WRITE_2(offs, val) \ - SBBC_WRITE_2((offs) + SBBC_REGS_OFFSET, (val)) -#define SBBC_REGS_WRITE_4(offs, val) \ - SBBC_WRITE_4((offs) + SBBC_REGS_OFFSET, (val)) -#define SBBC_REGS_WRITE_8(offs, val) \ - SBBC_WRITE_8((offs) + SBBC_REGS_OFFSET, (val)) - -#define SBBC_EPLD_READ_1(offs) \ - SBBC_READ_1((offs) + SBBC_EPLD_OFFSET) -#define SBBC_EPLD_READ_2(offs) \ - SBBC_READ_2((offs) + SBBC_EPLD_OFFSET) -#define SBBC_EPLD_READ_4(offs) \ - SBBC_READ_4((offs) + SBBC_EPLD_OFFSET) -#define SBBC_EPLD_READ_8(offs) \ - SBBC_READ_8((offs) + SBBC_EPLD_OFFSET) -#define SBBC_EPLD_WRITE_1(offs, val) \ - SBBC_WRITE_1((offs) + SBBC_EPLD_OFFSET, (val)) -#define SBBC_EPLD_WRITE_2(offs, val) \ - SBBC_WRITE_2((offs) + SBBC_EPLD_OFFSET, (val)) -#define SBBC_EPLD_WRITE_4(offs, val) \ - SBBC_WRITE_4((offs) + SBBC_EPLD_OFFSET, (val)) -#define SBBC_EPLD_WRITE_8(offs, val) \ - SBBC_WRITE_8((offs) + SBBC_EPLD_OFFSET, (val)) - -#define SBBC_SRAM_READ_1(offs) \ - SBBC_READ_1((offs) + SBBC_SRAM_OFFSET) -#define SBBC_SRAM_READ_2(offs) \ - SBBC_READ_2((offs) + SBBC_SRAM_OFFSET) -#define SBBC_SRAM_READ_4(offs) \ - SBBC_READ_4((offs) + SBBC_SRAM_OFFSET) -#define SBBC_SRAM_READ_8(offs) \ - SBBC_READ_8((offs) + SBBC_SRAM_OFFSET) -#define SBBC_SRAM_WRITE_1(offs, val) \ - SBBC_WRITE_1((offs) + SBBC_SRAM_OFFSET, (val)) -#define SBBC_SRAM_WRITE_2(offs, val) \ - SBBC_WRITE_2((offs) + SBBC_SRAM_OFFSET, (val)) -#define SBBC_SRAM_WRITE_4(offs, val) \ - SBBC_WRITE_4((offs) + SBBC_SRAM_OFFSET, (val)) -#define SBBC_SRAM_WRITE_8(offs, val) \ - SBBC_WRITE_8((offs) + SBBC_SRAM_OFFSET, (val)) - -#define SUNW_SETCONSINPUT "SUNW,set-console-input" -#define SUNW_SETCONSINPUT_CLNT "CON_CLNT" -#define SUNW_SETCONSINPUT_OBP "CON_OBP" - -static u_int sbbc_console; - -static uint32_t sbbc_scsolie; -static uint32_t sbbc_scsolir; -static uint32_t sbbc_solcons; -static uint32_t sbbc_solscie; -static uint32_t sbbc_solscir; -static uint32_t sbbc_toddata; - -/* - * internal helpers - */ -static int sbbc_parse_toc(bus_space_tag_t bst, bus_space_handle_t bsh); -static inline void sbbc_send_intr(bus_space_tag_t bst, - bus_space_handle_t bsh); -static const char *sbbc_serengeti_set_console_input(char *new); - -/* - * SBBC PCI interface - */ -static bus_activate_resource_t sbbc_bus_activate_resource; -static bus_adjust_resource_t sbbc_bus_adjust_resource; -static bus_deactivate_resource_t sbbc_bus_deactivate_resource; -static bus_alloc_resource_t sbbc_bus_alloc_resource; -static bus_release_resource_t sbbc_bus_release_resource; -static bus_get_resource_list_t sbbc_bus_get_resource_list; -static bus_setup_intr_t sbbc_bus_setup_intr; -static bus_teardown_intr_t sbbc_bus_teardown_intr; - -static device_attach_t sbbc_pci_attach; -static device_probe_t sbbc_pci_probe; - -static clock_gettime_t sbbc_tod_gettime; -static clock_settime_t sbbc_tod_settime; - -static device_method_t sbbc_pci_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, sbbc_pci_probe), - DEVMETHOD(device_attach, sbbc_pci_attach), - - DEVMETHOD(bus_alloc_resource, sbbc_bus_alloc_resource), - DEVMETHOD(bus_activate_resource,sbbc_bus_activate_resource), - DEVMETHOD(bus_deactivate_resource,sbbc_bus_deactivate_resource), - DEVMETHOD(bus_adjust_resource, sbbc_bus_adjust_resource), - DEVMETHOD(bus_release_resource, sbbc_bus_release_resource), - DEVMETHOD(bus_setup_intr, sbbc_bus_setup_intr), - DEVMETHOD(bus_teardown_intr, sbbc_bus_teardown_intr), - DEVMETHOD(bus_get_resource, bus_generic_rl_get_resource), - DEVMETHOD(bus_get_resource_list, sbbc_bus_get_resource_list), - - /* clock interface */ - DEVMETHOD(clock_gettime, sbbc_tod_gettime), - DEVMETHOD(clock_settime, sbbc_tod_settime), - - DEVMETHOD_END -}; - -static devclass_t sbbc_devclass; - -DEFINE_CLASS_0(sbbc, sbbc_driver, sbbc_pci_methods, sizeof(struct sbbc_softc)); -DRIVER_MODULE(sbbc, pci, sbbc_driver, sbbc_devclass, NULL, NULL); - -static int -sbbc_pci_probe(device_t dev) -{ - - if (pci_get_vendor(dev) == SBBC_PCI_VENDOR && - pci_get_device(dev) == SBBC_PCI_PRODUCT) { - device_set_desc(dev, "Sun BootBus controller"); - return (BUS_PROBE_DEFAULT); - } - return (ENXIO); -} - -static int -sbbc_pci_attach(device_t dev) -{ - struct sbbc_softc *sc; - struct timespec ts; - device_t child; - bus_space_tag_t bst; - bus_space_handle_t bsh; - phandle_t node; - int error, rid; - uint32_t val; - - /* Nothing to do if we're not the chosen one. */ - if ((node = OF_finddevice("/chosen")) == -1) { - device_printf(dev, "failed to find /chosen\n"); - return (ENXIO); - } - if (OF_getprop(node, "iosram", &node, sizeof(node)) == -1) { - device_printf(dev, "failed to get iosram\n"); - return (ENXIO); - } - if (node != ofw_bus_get_node(dev)) - return (0); - - sc = device_get_softc(dev); - rid = SBBC_PCI_BAR; - sc->sc_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, - RF_ACTIVE); - if (sc->sc_res == NULL) { - device_printf(dev, "failed to allocate resources\n"); - return (ENXIO); - } - bst = rman_get_bustag(sc->sc_res); - bsh = rman_get_bushandle(sc->sc_res); - if (sbbc_console != 0) { - /* Once again the interrupt pin isn't set. */ - if (pci_get_intpin(dev) == 0) - pci_set_intpin(dev, 1); - child = device_add_child(dev, NULL, -1); - if (child == NULL) - device_printf(dev, "failed to add UART device\n"); - error = bus_generic_attach(dev); - if (error != 0) - device_printf(dev, "failed to attach UART device\n"); - } else { - error = sbbc_parse_toc(bst, bsh); - if (error != 0) { - device_printf(dev, "failed to parse TOC\n"); - if (sbbc_console != 0) { - bus_release_resource(dev, SYS_RES_MEMORY, rid, - sc->sc_res); - return (error); - } - } - } - if (sbbc_toddata != 0) { - if ((val = SBBC_SRAM_READ_4(sbbc_toddata + - SBBC_TOD_OFF(tod_magic))) != SBBC_TOD_MAGIC) - device_printf(dev, "invalid TOD magic %#x\n", val); - else if ((val = SBBC_SRAM_READ_4(sbbc_toddata + - SBBC_TOD_OFF(tod_version))) < SBBC_TOD_VERSION) - device_printf(dev, "invalid TOD version %#x\n", val); - else { - clock_register(dev, 1000000); /* 1 sec. resolution */ - if (bootverbose) { - sbbc_tod_gettime(dev, &ts); - device_printf(dev, - "current time: %ld.%09ld\n", - (long)ts.tv_sec, ts.tv_nsec); - } - } - } - return (0); -} - -/* - * Note that the bus methods don't pass-through the uart(4) requests but act - * as if they would come from sbbc(4) in order to avoid complications with - * pci(4) (actually, uart(4) isn't a real child but rather a function of - * sbbc(4) anyway). - */ - -static struct resource * -sbbc_bus_alloc_resource(device_t dev, device_t child __unused, int type, - int *rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) -{ - struct sbbc_softc *sc; - - sc = device_get_softc(dev); - switch (type) { - case SYS_RES_IRQ: - return (bus_generic_alloc_resource(dev, dev, type, rid, start, - end, count, flags)); - case SYS_RES_MEMORY: - return (sc->sc_res); - default: - return (NULL); - } -} - -static int -sbbc_bus_activate_resource(device_t bus, device_t child, int type, int rid, - struct resource *res) -{ - - if (type == SYS_RES_MEMORY) - return (0); - return (bus_generic_activate_resource(bus, child, type, rid, res)); -} - -static int -sbbc_bus_deactivate_resource(device_t bus, device_t child, int type, int rid, - struct resource *res) -{ - - if (type == SYS_RES_MEMORY) - return (0); - return (bus_generic_deactivate_resource(bus, child, type, rid, res)); -} - -static int -sbbc_bus_adjust_resource(device_t bus __unused, device_t child __unused, - int type __unused, struct resource *res __unused, rman_res_t start __unused, - rman_res_t end __unused) -{ - - return (ENXIO); -} - -static int -sbbc_bus_release_resource(device_t dev, device_t child __unused, int type, - int rid, struct resource *res) -{ - - if (type == SYS_RES_IRQ) - return (bus_generic_release_resource(dev, dev, type, rid, - res)); - return (0); -} - -static struct resource_list * -sbbc_bus_get_resource_list(device_t dev, device_t child __unused) -{ - - return (bus_generic_get_resource_list(dev, dev)); -} - -static int -sbbc_bus_setup_intr(device_t dev, device_t child __unused, - struct resource *res, int flags, driver_filter_t *filt, - driver_intr_t *intr, void *arg, void **cookiep) -{ - - return (bus_generic_setup_intr(dev, dev, res, flags, filt, intr, arg, - cookiep)); -} - -static int -sbbc_bus_teardown_intr(device_t dev, device_t child __unused, - struct resource *res, void *cookie) -{ - - return (bus_generic_teardown_intr(dev, dev, res, cookie)); -} - -/* - * internal helpers - */ -static int -sbbc_parse_toc(bus_space_tag_t bst, bus_space_handle_t bsh) -{ - char buf[MAX(SBBC_TAG_KEY_SIZE, SBBC_TOC_MAGIC_SIZE)]; - bus_size_t tag; - phandle_t node; - uint32_t off, sram_toc; - u_int i, tags; - - if ((node = OF_finddevice("/chosen")) == -1) - return (ENXIO); - /* SRAM TOC offset defaults to 0. */ - if (OF_getprop(node, "iosram-toc", &sram_toc, sizeof(sram_toc)) <= 0) - sram_toc = 0; - - bus_space_read_region_1(bst, bsh, SBBC_SRAM_OFFSET + sram_toc + - SBBC_TOC_OFF(toc_magic), buf, SBBC_TOC_MAGIC_SIZE); - buf[SBBC_TOC_MAGIC_SIZE - 1] = '\0'; - if (strcmp(buf, SBBC_TOC_MAGIC) != 0) - return (ENXIO); - - tags = SBBC_SRAM_READ_4(sram_toc + SBBC_TOC_OFF(toc_ntags)); - for (i = 0; i < tags; i++) { - tag = sram_toc + SBBC_TOC_OFF(toc_tag) + - i * sizeof(struct sbbc_sram_tag); - bus_space_read_region_1(bst, bsh, SBBC_SRAM_OFFSET + tag + - SBBC_TAG_OFF(tag_key), buf, SBBC_TAG_KEY_SIZE); - buf[SBBC_TAG_KEY_SIZE - 1] = '\0'; - off = SBBC_SRAM_READ_4(tag + SBBC_TAG_OFF(tag_offset)); - if (strcmp(buf, SBBC_TAG_KEY_SCSOLIE) == 0) - sbbc_scsolie = off; - else if (strcmp(buf, SBBC_TAG_KEY_SCSOLIR) == 0) - sbbc_scsolir = off; - else if (strcmp(buf, SBBC_TAG_KEY_SOLCONS) == 0) - sbbc_solcons = off; - else if (strcmp(buf, SBBC_TAG_KEY_SOLSCIE) == 0) - sbbc_solscie = off; - else if (strcmp(buf, SBBC_TAG_KEY_SOLSCIR) == 0) - sbbc_solscir = off; - else if (strcmp(buf, SBBC_TAG_KEY_TODDATA) == 0) - sbbc_toddata = off; - } - return (0); -} - -static const char * -sbbc_serengeti_set_console_input(char *new) -{ - struct { - cell_t name; - cell_t nargs; - cell_t nreturns; - cell_t new; - cell_t old; - } args = { - (cell_t)SUNW_SETCONSINPUT, - 1, - 1, - }; - - args.new = (cell_t)new; - if (ofw_entry(&args) == -1) - return (NULL); - return ((const char *)args.old); -} - -static inline void -sbbc_send_intr(bus_space_tag_t bst, bus_space_handle_t bsh) -{ - - SBBC_EPLD_WRITE_1(SBBC_EPLD_INTERRUPT, SBBC_EPLD_INTERRUPT_ON); - bus_space_barrier(bst, bsh, SBBC_EPLD_OFFSET + SBBC_EPLD_INTERRUPT, 1, - BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); -} - -/* - * TOD interface - */ -static int -sbbc_tod_gettime(device_t dev, struct timespec *ts) -{ - struct sbbc_softc *sc; - bus_space_tag_t bst; - bus_space_handle_t bsh; - - sc = device_get_softc(dev); - bst = rman_get_bustag(sc->sc_res); - bsh = rman_get_bushandle(sc->sc_res); - - ts->tv_sec = SBBC_SRAM_READ_8(sbbc_toddata + SBBC_TOD_OFF(tod_time)) + - SBBC_SRAM_READ_8(sbbc_toddata + SBBC_TOD_OFF(tod_skew)); - ts->tv_nsec = 0; - return (0); -} - -static int -sbbc_tod_settime(device_t dev, struct timespec *ts) -{ - struct sbbc_softc *sc; - bus_space_tag_t bst; - bus_space_handle_t bsh; - - sc = device_get_softc(dev); - bst = rman_get_bustag(sc->sc_res); - bsh = rman_get_bushandle(sc->sc_res); - - SBBC_SRAM_WRITE_8(sbbc_toddata + SBBC_TOD_OFF(tod_skew), ts->tv_sec - - SBBC_SRAM_READ_8(sbbc_toddata + SBBC_TOD_OFF(tod_time))); - return (0); -} - -/* - * UART bus front-end - */ -static device_probe_t sbbc_uart_sbbc_probe; - -static device_method_t sbbc_uart_sbbc_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, sbbc_uart_sbbc_probe), - DEVMETHOD(device_attach, uart_bus_attach), - DEVMETHOD(device_detach, uart_bus_detach), - - DEVMETHOD_END -}; - -DEFINE_CLASS_0(uart, sbbc_uart_driver, sbbc_uart_sbbc_methods, - sizeof(struct uart_softc)); -DRIVER_MODULE(uart, sbbc, sbbc_uart_driver, uart_devclass, NULL, NULL); - -static int -sbbc_uart_sbbc_probe(device_t dev) -{ - struct uart_softc *sc; - - sc = device_get_softc(dev); - sc->sc_class = &uart_sbbc_class; - device_set_desc(dev, "Serengeti console"); - return (uart_bus_probe(dev, 0, 0, 0, SBBC_PCI_BAR, 0, 0)); -} - -/* - * Low-level UART interface - */ -static int sbbc_uart_probe(struct uart_bas *bas); -static void sbbc_uart_init(struct uart_bas *bas, int baudrate, int databits, - int stopbits, int parity); -static void sbbc_uart_term(struct uart_bas *bas); -static void sbbc_uart_putc(struct uart_bas *bas, int c); -static int sbbc_uart_rxready(struct uart_bas *bas); -static int sbbc_uart_getc(struct uart_bas *bas, struct mtx *hwmtx); - -static struct uart_ops sbbc_uart_ops = { - .probe = sbbc_uart_probe, - .init = sbbc_uart_init, - .term = sbbc_uart_term, - .putc = sbbc_uart_putc, - .rxready = sbbc_uart_rxready, - .getc = sbbc_uart_getc, -}; - -static int -sbbc_uart_probe(struct uart_bas *bas) -{ - bus_space_tag_t bst; - bus_space_handle_t bsh; - int error; - - sbbc_console = 1; - bst = bas->bst; - bsh = bas->bsh; - error = sbbc_parse_toc(bst, bsh); - if (error != 0) - return (error); - - if (sbbc_scsolie == 0 || sbbc_scsolir == 0 || sbbc_solcons == 0 || - sbbc_solscie == 0 || sbbc_solscir == 0) - return (ENXIO); - - if (SBBC_SRAM_READ_4(sbbc_solcons + SBBC_CONS_OFF(cons_magic)) != - SBBC_CONS_MAGIC || SBBC_SRAM_READ_4(sbbc_solcons + - SBBC_CONS_OFF(cons_version)) < SBBC_CONS_VERSION) - return (ENXIO); - return (0); -} - -static void -sbbc_uart_init(struct uart_bas *bas, int baudrate __unused, - int databits __unused, int stopbits __unused, int parity __unused) -{ - bus_space_tag_t bst; - bus_space_handle_t bsh; - - bst = bas->bst; - bsh = bas->bsh; - - /* Enable output to and space in from the SC interrupts. */ - SBBC_SRAM_WRITE_4(sbbc_solscie, SBBC_SRAM_READ_4(sbbc_solscie) | - SBBC_SRAM_CONS_OUT | SBBC_SRAM_CONS_SPACE_IN); - uart_barrier(bas); - - /* Take over the console input. */ - sbbc_serengeti_set_console_input(SUNW_SETCONSINPUT_CLNT); -} - -static void -sbbc_uart_term(struct uart_bas *bas __unused) -{ - - /* Give back the console input. */ - sbbc_serengeti_set_console_input(SUNW_SETCONSINPUT_OBP); -} - -static void -sbbc_uart_putc(struct uart_bas *bas, int c) -{ - bus_space_tag_t bst; - bus_space_handle_t bsh; - uint32_t wrptr; - - bst = bas->bst; - bsh = bas->bsh; - - wrptr = SBBC_SRAM_READ_4(sbbc_solcons + - SBBC_CONS_OFF(cons_out_wrptr)); - SBBC_SRAM_WRITE_1(sbbc_solcons + wrptr, c); - uart_barrier(bas); - if (++wrptr == SBBC_SRAM_READ_4(sbbc_solcons + - SBBC_CONS_OFF(cons_out_end))) - wrptr = SBBC_SRAM_READ_4(sbbc_solcons + - SBBC_CONS_OFF(cons_out_begin)); - SBBC_SRAM_WRITE_4(sbbc_solcons + SBBC_CONS_OFF(cons_out_wrptr), - wrptr); - uart_barrier(bas); - - SBBC_SRAM_WRITE_4(sbbc_solscir, SBBC_SRAM_READ_4(sbbc_solscir) | - SBBC_SRAM_CONS_OUT); - uart_barrier(bas); - sbbc_send_intr(bst, bsh); -} - -static int -sbbc_uart_rxready(struct uart_bas *bas) -{ - bus_space_tag_t bst; - bus_space_handle_t bsh; - - bst = bas->bst; - bsh = bas->bsh; - - if (SBBC_SRAM_READ_4(sbbc_solcons + SBBC_CONS_OFF(cons_in_rdptr)) == - SBBC_SRAM_READ_4(sbbc_solcons + SBBC_CONS_OFF(cons_in_wrptr))) - return (0); - return (1); -} - -static int -sbbc_uart_getc(struct uart_bas *bas, struct mtx *hwmtx) -{ - bus_space_tag_t bst; - bus_space_handle_t bsh; - int c; - uint32_t rdptr; - - bst = bas->bst; - bsh = bas->bsh; - - uart_lock(hwmtx); - - while (sbbc_uart_rxready(bas) == 0) { - uart_unlock(hwmtx); - DELAY(4); - uart_lock(hwmtx); - } - - rdptr = SBBC_SRAM_READ_4(sbbc_solcons + SBBC_CONS_OFF(cons_in_rdptr)); - c = SBBC_SRAM_READ_1(sbbc_solcons + rdptr); - uart_barrier(bas); - if (++rdptr == SBBC_SRAM_READ_4(sbbc_solcons + - SBBC_CONS_OFF(cons_in_end))) - rdptr = SBBC_SRAM_READ_4(sbbc_solcons + - SBBC_CONS_OFF(cons_in_begin)); - SBBC_SRAM_WRITE_4(sbbc_solcons + SBBC_CONS_OFF(cons_in_rdptr), - rdptr); - uart_barrier(bas); - SBBC_SRAM_WRITE_4(sbbc_solscir, SBBC_SRAM_READ_4(sbbc_solscir) | - SBBC_SRAM_CONS_SPACE_IN); - uart_barrier(bas); - sbbc_send_intr(bst, bsh); - - uart_unlock(hwmtx); - return (c); -} - -/* - * High-level UART interface - */ -static int sbbc_uart_bus_attach(struct uart_softc *sc); -static int sbbc_uart_bus_detach(struct uart_softc *sc); -static int sbbc_uart_bus_flush(struct uart_softc *sc, int what); -static int sbbc_uart_bus_getsig(struct uart_softc *sc); -static int sbbc_uart_bus_ioctl(struct uart_softc *sc, int request, - intptr_t data); -static int sbbc_uart_bus_ipend(struct uart_softc *sc); -static int sbbc_uart_bus_param(struct uart_softc *sc, int baudrate, - int databits, int stopbits, int parity); -static int sbbc_uart_bus_probe(struct uart_softc *sc); -static int sbbc_uart_bus_receive(struct uart_softc *sc); -static int sbbc_uart_bus_setsig(struct uart_softc *sc, int sig); -static int sbbc_uart_bus_transmit(struct uart_softc *sc); - -static kobj_method_t sbbc_uart_methods[] = { - KOBJMETHOD(uart_attach, sbbc_uart_bus_attach), - KOBJMETHOD(uart_detach, sbbc_uart_bus_detach), - KOBJMETHOD(uart_flush, sbbc_uart_bus_flush), - KOBJMETHOD(uart_getsig, sbbc_uart_bus_getsig), - KOBJMETHOD(uart_ioctl, sbbc_uart_bus_ioctl), - KOBJMETHOD(uart_ipend, sbbc_uart_bus_ipend), - KOBJMETHOD(uart_param, sbbc_uart_bus_param), - KOBJMETHOD(uart_probe, sbbc_uart_bus_probe), - KOBJMETHOD(uart_receive, sbbc_uart_bus_receive), - KOBJMETHOD(uart_setsig, sbbc_uart_bus_setsig), - KOBJMETHOD(uart_transmit, sbbc_uart_bus_transmit), - - DEVMETHOD_END -}; - -struct uart_class uart_sbbc_class = { - "sbbc", - sbbc_uart_methods, - sizeof(struct uart_softc), - .uc_ops = &sbbc_uart_ops, - .uc_range = 1, - .uc_rclk = 0x5bbc, /* arbitrary */ - .uc_rshift = 0 -}; - -#define SIGCHG(c, i, s, d) \ - if ((c) != 0) { \ - i |= (((i) & (s)) != 0) ? (s) : (s) | (d); \ - } else { \ - i = (((i) & (s)) != 0) ? ((i) & ~(s)) | (d) : (i); \ - } - -static int -sbbc_uart_bus_attach(struct uart_softc *sc) -{ - struct uart_bas *bas; - bus_space_tag_t bst; - bus_space_handle_t bsh; - uint32_t wrptr; - - bas = &sc->sc_bas; - bst = bas->bst; - bsh = bas->bsh; - - uart_lock(sc->sc_hwmtx); - - /* - * Let the current output drain before enabling interrupts. Not - * doing so tends to cause lost output when turning them on. - */ - wrptr = SBBC_SRAM_READ_4(sbbc_solcons + - SBBC_CONS_OFF(cons_out_wrptr)); - while (SBBC_SRAM_READ_4(sbbc_solcons + - SBBC_CONS_OFF(cons_out_rdptr)) != wrptr); - cpu_spinwait(); - - /* Clear and acknowledge possibly outstanding interrupts. */ - SBBC_SRAM_WRITE_4(sbbc_scsolir, 0); - uart_barrier(bas); - SBBC_REGS_WRITE_4(SBBC_PCI_INT_STATUS, - SBBC_SRAM_READ_4(sbbc_scsolir)); - uart_barrier(bas); - /* Enable PCI interrupts. */ - SBBC_REGS_WRITE_4(SBBC_PCI_INT_ENABLE, SBBC_PCI_ENABLE_INT_A); - uart_barrier(bas); - /* Enable input from and output to SC as well as break interrupts. */ - SBBC_SRAM_WRITE_4(sbbc_scsolie, SBBC_SRAM_READ_4(sbbc_scsolie) | - SBBC_SRAM_CONS_IN | SBBC_SRAM_CONS_BRK | - SBBC_SRAM_CONS_SPACE_OUT); - uart_barrier(bas); - - uart_unlock(sc->sc_hwmtx); - return (0); -} - -static int -sbbc_uart_bus_detach(struct uart_softc *sc) -{ - - /* Give back the console input. */ - sbbc_serengeti_set_console_input(SUNW_SETCONSINPUT_OBP); - return (0); -} - -static int -sbbc_uart_bus_flush(struct uart_softc *sc, int what) -{ - struct uart_bas *bas; - bus_space_tag_t bst; - bus_space_handle_t bsh; - - bas = &sc->sc_bas; - bst = bas->bst; - bsh = bas->bsh; - - if ((what & UART_FLUSH_TRANSMITTER) != 0) - return (ENODEV); - if ((what & UART_FLUSH_RECEIVER) != 0) { - SBBC_SRAM_WRITE_4(sbbc_solcons + - SBBC_CONS_OFF(cons_in_rdptr), - SBBC_SRAM_READ_4(sbbc_solcons + - SBBC_CONS_OFF(cons_in_wrptr))); - uart_barrier(bas); - } - return (0); -} - -static int -sbbc_uart_bus_getsig(struct uart_softc *sc) -{ - uint32_t dummy, new, old, sig; - - do { - old = sc->sc_hwsig; - sig = old; - dummy = 0; - SIGCHG(dummy, sig, SER_CTS, SER_DCTS); - SIGCHG(dummy, sig, SER_DCD, SER_DDCD); - SIGCHG(dummy, sig, SER_DSR, SER_DDSR); - new = sig & ~SER_MASK_DELTA; - } while (!atomic_cmpset_32(&sc->sc_hwsig, old, new)); - return (sig); -} - -static int -sbbc_uart_bus_ioctl(struct uart_softc *sc, int request, intptr_t data) -{ - int error; - - error = 0; - uart_lock(sc->sc_hwmtx); - switch (request) { - case UART_IOCTL_BAUD: - *(int*)data = 9600; /* arbitrary */ - break; - default: - error = EINVAL; - break; - } - uart_unlock(sc->sc_hwmtx); - return (error); -} - -static int -sbbc_uart_bus_ipend(struct uart_softc *sc) -{ - struct uart_bas *bas; - bus_space_tag_t bst; - bus_space_handle_t bsh; - int ipend; - uint32_t reason, status; - - bas = &sc->sc_bas; - bst = bas->bst; - bsh = bas->bsh; - - uart_lock(sc->sc_hwmtx); - status = SBBC_REGS_READ_4(SBBC_PCI_INT_STATUS); - if (status == 0) { - uart_unlock(sc->sc_hwmtx); - return (0); - } - - /* - * Unfortunately, we can't use compare and swap for non-cachable - * memory. - */ - reason = SBBC_SRAM_READ_4(sbbc_scsolir); - SBBC_SRAM_WRITE_4(sbbc_scsolir, 0); - uart_barrier(bas); - /* Acknowledge the interrupt. */ - SBBC_REGS_WRITE_4(SBBC_PCI_INT_STATUS, status); - uart_barrier(bas); - - uart_unlock(sc->sc_hwmtx); - - ipend = 0; - if ((reason & SBBC_SRAM_CONS_IN) != 0) - ipend |= SER_INT_RXREADY; - if ((reason & SBBC_SRAM_CONS_BRK) != 0) - ipend |= SER_INT_BREAK; - if ((reason & SBBC_SRAM_CONS_SPACE_OUT) != 0 && - SBBC_SRAM_READ_4(sbbc_solcons + SBBC_CONS_OFF(cons_out_rdptr)) == - SBBC_SRAM_READ_4(sbbc_solcons + SBBC_CONS_OFF(cons_out_wrptr))) - ipend |= SER_INT_TXIDLE; - return (ipend); -} - -static int -sbbc_uart_bus_param(struct uart_softc *sc __unused, int baudrate __unused, - int databits __unused, int stopbits __unused, int parity __unused) -{ - - return (0); -} - -static int -sbbc_uart_bus_probe(struct uart_softc *sc) -{ - struct uart_bas *bas; - bus_space_tag_t bst; - bus_space_handle_t bsh; - - if (sbbc_console != 0) { - bas = &sc->sc_bas; - bst = bas->bst; - bsh = bas->bsh; - sc->sc_rxfifosz = SBBC_SRAM_READ_4(sbbc_solcons + - SBBC_CONS_OFF(cons_in_end)) - SBBC_SRAM_READ_4(sbbc_solcons + - SBBC_CONS_OFF(cons_in_begin)) - 1; - sc->sc_txfifosz = SBBC_SRAM_READ_4(sbbc_solcons + - SBBC_CONS_OFF(cons_out_end)) - SBBC_SRAM_READ_4(sbbc_solcons + - SBBC_CONS_OFF(cons_out_begin)) - 1; - return (0); - } - return (ENXIO); -} - -static int -sbbc_uart_bus_receive(struct uart_softc *sc) -{ - struct uart_bas *bas; - bus_space_tag_t bst; - bus_space_handle_t bsh; - int c; - uint32_t end, rdptr, wrptr; - - bas = &sc->sc_bas; - bst = bas->bst; - bsh = bas->bsh; - - uart_lock(sc->sc_hwmtx); - - end = SBBC_SRAM_READ_4(sbbc_solcons + SBBC_CONS_OFF(cons_in_end)); - rdptr = SBBC_SRAM_READ_4(sbbc_solcons + SBBC_CONS_OFF(cons_in_rdptr)); - wrptr = SBBC_SRAM_READ_4(sbbc_solcons + SBBC_CONS_OFF(cons_in_wrptr)); - while (rdptr != wrptr) { - if (uart_rx_full(sc) != 0) { - sc->sc_rxbuf[sc->sc_rxput] = UART_STAT_OVERRUN; - break; - } - c = SBBC_SRAM_READ_1(sbbc_solcons + rdptr); - uart_rx_put(sc, c); - if (++rdptr == end) - rdptr = SBBC_SRAM_READ_4(sbbc_solcons + - SBBC_CONS_OFF(cons_in_begin)); - } - uart_barrier(bas); - SBBC_SRAM_WRITE_4(sbbc_solcons + SBBC_CONS_OFF(cons_in_rdptr), - rdptr); - uart_barrier(bas); - SBBC_SRAM_WRITE_4(sbbc_solscir, SBBC_SRAM_READ_4(sbbc_solscir) | - SBBC_SRAM_CONS_SPACE_IN); - uart_barrier(bas); - sbbc_send_intr(bst, bsh); - - uart_unlock(sc->sc_hwmtx); - return (0); -} - -static int -sbbc_uart_bus_setsig(struct uart_softc *sc, int sig) -{ - struct uart_bas *bas; - uint32_t new, old; - - bas = &sc->sc_bas; - do { - old = sc->sc_hwsig; - new = old; - if ((sig & SER_DDTR) != 0) { - SIGCHG(sig & SER_DTR, new, SER_DTR, SER_DDTR); - } - if ((sig & SER_DRTS) != 0) { - SIGCHG(sig & SER_RTS, new, SER_RTS, SER_DRTS); - } - } while (!atomic_cmpset_32(&sc->sc_hwsig, old, new)); - return (0); -} - -static int -sbbc_uart_bus_transmit(struct uart_softc *sc) -{ - struct uart_bas *bas; - bus_space_tag_t bst; - bus_space_handle_t bsh; - int i; - uint32_t end, wrptr; - - bas = &sc->sc_bas; - bst = bas->bst; - bsh = bas->bsh; - - uart_lock(sc->sc_hwmtx); - - end = SBBC_SRAM_READ_4(sbbc_solcons + SBBC_CONS_OFF(cons_out_end)); - wrptr = SBBC_SRAM_READ_4(sbbc_solcons + - SBBC_CONS_OFF(cons_out_wrptr)); - for (i = 0; i < sc->sc_txdatasz; i++) { - SBBC_SRAM_WRITE_1(sbbc_solcons + wrptr, sc->sc_txbuf[i]); - if (++wrptr == end) - wrptr = SBBC_SRAM_READ_4(sbbc_solcons + - SBBC_CONS_OFF(cons_out_begin)); - } - uart_barrier(bas); - SBBC_SRAM_WRITE_4(sbbc_solcons + SBBC_CONS_OFF(cons_out_wrptr), - wrptr); - uart_barrier(bas); - SBBC_SRAM_WRITE_4(sbbc_solscir, SBBC_SRAM_READ_4(sbbc_solscir) | - SBBC_SRAM_CONS_OUT); - uart_barrier(bas); - sbbc_send_intr(bst, bsh); - sc->sc_txbusy = 1; - - uart_unlock(sc->sc_hwmtx); - return (0); -} diff --git a/sys/sparc64/pci/schizo.c b/sys/sparc64/pci/schizo.c deleted file mode 100644 index 09987b10f421e3..00000000000000 --- a/sys/sparc64/pci/schizo.c +++ /dev/null @@ -1,1260 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1999, 2000 Matthew R. Green - * Copyright (c) 2001 - 2003 by Thomas Moestl - * Copyright (c) 2005 - 2011 by Marius Strobl - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: NetBSD: psycho.c,v 1.39 2001/10/07 20:30:41 eeh Exp - * from: FreeBSD: psycho.c 183152 2008-09-18 19:45:22Z marius - */ - -#include -__FBSDID("$FreeBSD$"); - -/* - * Driver for `Schizo' Fireplane/Safari to PCI 2.1, `Tomatillo' JBus to - * PCI 2.2 and `XMITS' Fireplane/Safari to PCI-X bridges - */ - -#include "opt_ofw_pci.h" -#include "opt_schizo.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include - -#include "pcib_if.h" - -static const struct schizo_desc *schizo_get_desc(device_t); -static void schizo_set_intr(struct schizo_softc *, u_int, u_int, - driver_filter_t); -static void schizo_dmamap_sync(bus_dma_tag_t dt, bus_dmamap_t map, - bus_dmasync_op_t op); -static void ichip_dmamap_sync(bus_dma_tag_t dt, bus_dmamap_t map, - bus_dmasync_op_t op); -static void schizo_intr_enable(void *); -static void schizo_intr_disable(void *); -static void schizo_intr_assign(void *); -static void schizo_intr_clear(void *); -static int schizo_intr_register(struct schizo_softc *sc, u_int ino); -static int schizo_get_intrmap(struct schizo_softc *, u_int, - bus_addr_t *, bus_addr_t *); -static timecounter_get_t schizo_get_timecount; - -/* Interrupt handlers */ -static driver_filter_t schizo_pci_bus; -static driver_filter_t schizo_ue; -static driver_filter_t schizo_ce; -static driver_filter_t schizo_host_bus; -static driver_filter_t schizo_cdma; - -/* IOMMU support */ -static void schizo_iommu_init(struct schizo_softc *, int, uint32_t); - -/* - * Methods - */ -static device_probe_t schizo_probe; -static device_attach_t schizo_attach; -static bus_setup_intr_t schizo_setup_intr; -static bus_alloc_resource_t schizo_alloc_resource; -static pcib_maxslots_t schizo_maxslots; -static pcib_read_config_t schizo_read_config; -static pcib_write_config_t schizo_write_config; -static pcib_route_interrupt_t schizo_route_interrupt; -static ofw_pci_setup_device_t schizo_setup_device; - -static device_method_t schizo_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, schizo_probe), - DEVMETHOD(device_attach, schizo_attach), - DEVMETHOD(device_shutdown, bus_generic_shutdown), - DEVMETHOD(device_suspend, bus_generic_suspend), - DEVMETHOD(device_resume, bus_generic_resume), - - /* Bus interface */ - DEVMETHOD(bus_read_ivar, ofw_pci_read_ivar), - DEVMETHOD(bus_setup_intr, schizo_setup_intr), - DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), - DEVMETHOD(bus_alloc_resource, schizo_alloc_resource), - DEVMETHOD(bus_activate_resource, ofw_pci_activate_resource), - DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), - DEVMETHOD(bus_adjust_resource, ofw_pci_adjust_resource), - DEVMETHOD(bus_release_resource, bus_generic_release_resource), - DEVMETHOD(bus_get_dma_tag, ofw_pci_get_dma_tag), - - /* pcib interface */ - DEVMETHOD(pcib_maxslots, schizo_maxslots), - DEVMETHOD(pcib_read_config, schizo_read_config), - DEVMETHOD(pcib_write_config, schizo_write_config), - DEVMETHOD(pcib_route_interrupt, schizo_route_interrupt), - DEVMETHOD(pcib_request_feature, pcib_request_feature_allow), - - /* ofw_bus interface */ - DEVMETHOD(ofw_bus_get_node, ofw_pci_get_node), - - /* ofw_pci interface */ - DEVMETHOD(ofw_pci_setup_device, schizo_setup_device), - - DEVMETHOD_END -}; - -static devclass_t schizo_devclass; - -DEFINE_CLASS_0(pcib, schizo_driver, schizo_methods, - sizeof(struct schizo_softc)); -EARLY_DRIVER_MODULE(schizo, nexus, schizo_driver, schizo_devclass, 0, 0, - BUS_PASS_BUS); - -static SLIST_HEAD(, schizo_softc) schizo_softcs = - SLIST_HEAD_INITIALIZER(schizo_softcs); - -static const struct intr_controller schizo_ic = { - schizo_intr_enable, - schizo_intr_disable, - schizo_intr_assign, - schizo_intr_clear -}; - -struct schizo_icarg { - struct schizo_softc *sica_sc; - bus_addr_t sica_map; - bus_addr_t sica_clr; -}; - -#define SCHIZO_CDMA_TIMEOUT 1 /* 1 second per try */ -#define SCHIZO_CDMA_TRIES 15 -#define SCHIZO_PERF_CNT_QLTY 100 - -#define SCHIZO_SPC_BARRIER(spc, sc, offs, len, flags) \ - bus_barrier((sc)->sc_mem_res[(spc)], (offs), (len), (flags)) -#define SCHIZO_SPC_READ_8(spc, sc, offs) \ - bus_read_8((sc)->sc_mem_res[(spc)], (offs)) -#define SCHIZO_SPC_WRITE_8(spc, sc, offs, v) \ - bus_write_8((sc)->sc_mem_res[(spc)], (offs), (v)) - -#ifndef SCHIZO_DEBUG -#define SCHIZO_SPC_SET(spc, sc, offs, reg, v) \ - SCHIZO_SPC_WRITE_8((spc), (sc), (offs), (v)) -#else -#define SCHIZO_SPC_SET(spc, sc, offs, reg, v) do { \ - device_printf((sc)->sc_dev, reg " 0x%016llx -> 0x%016llx\n", \ - (unsigned long long)SCHIZO_SPC_READ_8((spc), (sc), (offs)), \ - (unsigned long long)(v)); \ - SCHIZO_SPC_WRITE_8((spc), (sc), (offs), (v)); \ - } while (0) -#endif - -#define SCHIZO_PCI_READ_8(sc, offs) \ - SCHIZO_SPC_READ_8(STX_PCI, (sc), (offs)) -#define SCHIZO_PCI_WRITE_8(sc, offs, v) \ - SCHIZO_SPC_WRITE_8(STX_PCI, (sc), (offs), (v)) -#define SCHIZO_CTRL_READ_8(sc, offs) \ - SCHIZO_SPC_READ_8(STX_CTRL, (sc), (offs)) -#define SCHIZO_CTRL_WRITE_8(sc, offs, v) \ - SCHIZO_SPC_WRITE_8(STX_CTRL, (sc), (offs), (v)) -#define SCHIZO_PCICFG_READ_8(sc, offs) \ - SCHIZO_SPC_READ_8(STX_PCICFG, (sc), (offs)) -#define SCHIZO_PCICFG_WRITE_8(sc, offs, v) \ - SCHIZO_SPC_WRITE_8(STX_PCICFG, (sc), (offs), (v)) -#define SCHIZO_ICON_READ_8(sc, offs) \ - SCHIZO_SPC_READ_8(STX_ICON, (sc), (offs)) -#define SCHIZO_ICON_WRITE_8(sc, offs, v) \ - SCHIZO_SPC_WRITE_8(STX_ICON, (sc), (offs), (v)) - -#define SCHIZO_PCI_SET(sc, offs, v) \ - SCHIZO_SPC_SET(STX_PCI, (sc), (offs), # offs, (v)) -#define SCHIZO_CTRL_SET(sc, offs, v) \ - SCHIZO_SPC_SET(STX_CTRL, (sc), (offs), # offs, (v)) - -struct schizo_desc { - const char *sd_string; - int sd_mode; - const char *sd_name; -}; - -static const struct schizo_desc schizo_compats[] = { - { "pci108e,8001", SCHIZO_MODE_SCZ, "Schizo" }, -#if 0 - { "pci108e,8002", SCHIZO_MODE_XMS, "XMITS" }, -#endif - { "pci108e,a801", SCHIZO_MODE_TOM, "Tomatillo" }, - { NULL, 0, NULL } -}; - -static const struct schizo_desc * -schizo_get_desc(device_t dev) -{ - const struct schizo_desc *desc; - const char *compat; - - compat = ofw_bus_get_compat(dev); - if (compat == NULL) - return (NULL); - for (desc = schizo_compats; desc->sd_string != NULL; desc++) - if (strcmp(desc->sd_string, compat) == 0) - return (desc); - return (NULL); -} - -static int -schizo_probe(device_t dev) -{ - const char *dtype; - - dtype = ofw_bus_get_type(dev); - if (dtype != NULL && strcmp(dtype, OFW_TYPE_PCI) == 0 && - schizo_get_desc(dev) != NULL) { - device_set_desc(dev, "Sun Host-PCI bridge"); - return (0); - } - return (ENXIO); -} - -static int -schizo_attach(device_t dev) -{ - const struct schizo_desc *desc; - struct schizo_softc *asc, *sc, *osc; - struct timecounter *tc; - bus_dma_tag_t dmat; - uint64_t ino_bitmap, reg; - phandle_t node; - uint32_t prop, prop_array[2]; - int i, j, mode, rid, tsbsize; - - sc = device_get_softc(dev); - node = ofw_bus_get_node(dev); - desc = schizo_get_desc(dev); - mode = desc->sd_mode; - - sc->sc_dev = dev; - sc->sc_mode = mode; - sc->sc_flags = 0; - - /* - * The Schizo has three register banks: - * (0) per-PBM PCI configuration and status registers, but for bus B - * shared with the UPA64s interrupt mapping register banks - * (1) shared Schizo controller configuration and status registers - * (2) per-PBM PCI configuration space - * - * The Tomatillo has four register banks: - * (0) per-PBM PCI configuration and status registers - * (1) per-PBM Tomatillo controller configuration registers, but on - * machines having the `jbusppm' device shared with its Estar - * register bank for bus A - * (2) per-PBM PCI configuration space - * (3) per-PBM interrupt concentrator registers - */ - sc->sc_half = (bus_get_resource_start(dev, SYS_RES_MEMORY, STX_PCI) >> - 20) & 1; - for (i = 0; i < (mode == SCHIZO_MODE_SCZ ? SCZ_NREG : TOM_NREG); - i++) { - rid = i; - sc->sc_mem_res[i] = bus_alloc_resource_any(dev, - SYS_RES_MEMORY, &rid, - (((mode == SCHIZO_MODE_SCZ && ((sc->sc_half == 1 && - i == STX_PCI) || i == STX_CTRL)) || - (mode == SCHIZO_MODE_TOM && sc->sc_half == 0 && - i == STX_CTRL)) ? RF_SHAREABLE : 0) | RF_ACTIVE); - if (sc->sc_mem_res[i] == NULL) - panic("%s: could not allocate register bank %d", - __func__, i); - } - - /* - * Match other Schizos that are already configured against - * the controller base physical address. This will be the - * same for a pair of devices that share register space. - */ - osc = NULL; - SLIST_FOREACH(asc, &schizo_softcs, sc_link) { - if (rman_get_start(asc->sc_mem_res[STX_CTRL]) == - rman_get_start(sc->sc_mem_res[STX_CTRL])) { - /* Found partner. */ - osc = asc; - break; - } - } - if (osc == NULL) { - sc->sc_mtx = malloc(sizeof(*sc->sc_mtx), M_DEVBUF, - M_NOWAIT | M_ZERO); - if (sc->sc_mtx == NULL) - panic("%s: could not malloc mutex", __func__); - mtx_init(sc->sc_mtx, "pcib_mtx", NULL, MTX_SPIN); - } else { - if (sc->sc_mode != SCHIZO_MODE_SCZ) - panic("%s: no partner expected", __func__); - if (mtx_initialized(osc->sc_mtx) == 0) - panic("%s: mutex not initialized", __func__); - sc->sc_mtx = osc->sc_mtx; - } - SLIST_INSERT_HEAD(&schizo_softcs, sc, sc_link); - - if (OF_getprop(node, "portid", &sc->sc_ign, sizeof(sc->sc_ign)) == -1) - panic("%s: could not determine IGN", __func__); - if (OF_getprop(node, "version#", &sc->sc_ver, sizeof(sc->sc_ver)) == - -1) - panic("%s: could not determine version", __func__); - if (mode == SCHIZO_MODE_XMS && OF_getprop(node, "module-revision#", - &sc->sc_mrev, sizeof(sc->sc_mrev)) == -1) - panic("%s: could not determine module-revision", __func__); - if (OF_getprop(node, "clock-frequency", &prop, sizeof(prop)) == -1) - prop = 33000000; - - if (mode == SCHIZO_MODE_XMS && (SCHIZO_PCI_READ_8(sc, STX_PCI_CTRL) & - XMS_PCI_CTRL_X_MODE) != 0) { - if (sc->sc_mrev < 1) - panic("PCI-X mode unsupported"); - sc->sc_flags |= SCHIZO_FLAGS_XMODE; - } - - device_printf(dev, "%s, version %d, ", desc->sd_name, sc->sc_ver); - if (mode == SCHIZO_MODE_XMS) - printf("module-revision %d, ", sc->sc_mrev); - printf("IGN %#x, bus %c, PCI%s mode, %dMHz\n", sc->sc_ign, - 'A' + sc->sc_half, (sc->sc_flags & SCHIZO_FLAGS_XMODE) != 0 ? - "-X" : "", prop / 1000 / 1000); - - /* Set up the PCI interrupt retry timer. */ - SCHIZO_PCI_SET(sc, STX_PCI_INTR_RETRY_TIM, 5); - - /* Set up the PCI control register. */ - reg = SCHIZO_PCI_READ_8(sc, STX_PCI_CTRL); - reg &= ~(TOM_PCI_CTRL_DTO_IEN | STX_PCI_CTRL_ARB_PARK | - STX_PCI_CTRL_ARB_MASK); - reg |= STX_PCI_CTRL_MMU_IEN | STX_PCI_CTRL_SBH_IEN | - STX_PCI_CTRL_ERR_IEN; - if (OF_getproplen(node, "no-bus-parking") < 0) - reg |= STX_PCI_CTRL_ARB_PARK; - if (mode == SCHIZO_MODE_XMS && sc->sc_mrev == 1) - reg |= XMS_PCI_CTRL_XMITS10_ARB_MASK; - else - reg |= STX_PCI_CTRL_ARB_MASK; - if (mode == SCHIZO_MODE_TOM) { - reg |= TOM_PCI_CTRL_PRM | TOM_PCI_CTRL_PRO | TOM_PCI_CTRL_PRL; - if (sc->sc_ver <= 1) /* revision <= 2.0 */ - reg |= TOM_PCI_CTRL_DTO_IEN; - else - reg |= STX_PCI_CTRL_PTO; - } else if (mode == SCHIZO_MODE_XMS) { - SCHIZO_PCI_SET(sc, XMS_PCI_PARITY_DETECT, 0x3fff); - SCHIZO_PCI_SET(sc, XMS_PCI_UPPER_RETRY_COUNTER, 0x3e8); - reg |= XMS_PCI_CTRL_X_ERRINT_EN; - } - SCHIZO_PCI_SET(sc, STX_PCI_CTRL, reg); - - /* Set up the PCI diagnostic register. */ - reg = SCHIZO_PCI_READ_8(sc, STX_PCI_DIAG); - reg &= ~(SCZ_PCI_DIAG_RTRYARB_DIS | STX_PCI_DIAG_RETRY_DIS | - STX_PCI_DIAG_INTRSYNC_DIS); - SCHIZO_PCI_SET(sc, STX_PCI_DIAG, reg); - - /* - * Enable DMA write parity error interrupts of version >= 7 (i.e. - * revision >= 2.5) Schizo and XMITS (enabling it on XMITS < 3.0 has - * no effect though). - */ - if ((mode == SCHIZO_MODE_SCZ && sc->sc_ver >= 7) || - mode == SCHIZO_MODE_XMS) { - reg = SCHIZO_PCI_READ_8(sc, SX_PCI_CFG_ICD); - reg |= SX_PCI_CFG_ICD_DMAW_PERR_IEN; - SCHIZO_PCI_SET(sc, SX_PCI_CFG_ICD, reg); - } - - /* - * On Tomatillo clear the I/O prefetch lengths (workaround for a - * Jalapeno bug). - */ - if (mode == SCHIZO_MODE_TOM) - SCHIZO_PCI_SET(sc, TOM_PCI_IOC_CSR, TOM_PCI_IOC_PW | - (1 << TOM_PCI_IOC_PREF_OFF_SHIFT) | TOM_PCI_IOC_CPRM | - TOM_PCI_IOC_CPRO | TOM_PCI_IOC_CPRL); - - /* - * Hunt through all the interrupt mapping regs and register - * the interrupt controller for our interrupt vectors. We do - * this early in order to be able to catch stray interrupts. - * This is complicated by the fact that a pair of Schizo PBMs - * shares one IGN. - */ - i = OF_getprop(node, "ino-bitmap", (void *)prop_array, - sizeof(prop_array)); - if (i != -1) - ino_bitmap = ((uint64_t)prop_array[1] << 32) | prop_array[0]; - else { - /* - * If the ino-bitmap property is missing, just provide the - * default set of interrupts for this controller and let - * schizo_setup_intr() take care of child interrupts. - */ - if (sc->sc_half == 0) - ino_bitmap = (1ULL << STX_UE_INO) | - (1ULL << STX_CE_INO) | - (1ULL << STX_PCIERR_A_INO) | - (1ULL << STX_BUS_INO); - else - ino_bitmap = 1ULL << STX_PCIERR_B_INO; - } - for (i = 0; i <= STX_MAX_INO; i++) { - if ((ino_bitmap & (1ULL << i)) == 0) - continue; - if (i == STX_FB0_INO || i == STX_FB1_INO) - /* Leave for upa(4). */ - continue; - j = schizo_intr_register(sc, i); - if (j != 0) - device_printf(dev, "could not register interrupt " - "controller for INO %d (%d)\n", i, j); - } - - /* - * Setup Safari/JBus performance counter 0 in bus cycle counting - * mode as timecounter. Unfortunately, this is broken with at - * least the version 4 Tomatillos found in Fire V120 and Blade - * 1500, which apparently actually count some different event at - * ~0.5 and 3MHz respectively instead (also when running in full - * power mode). Besides, one counter seems to be shared by a - * "pair" of Tomatillos, too. - */ - if (sc->sc_half == 0) { - SCHIZO_CTRL_SET(sc, STX_CTRL_PERF, - (STX_CTRL_PERF_DIS << STX_CTRL_PERF_CNT1_SHIFT) | - (STX_CTRL_PERF_BUSCYC << STX_CTRL_PERF_CNT0_SHIFT)); - tc = malloc(sizeof(*tc), M_DEVBUF, M_NOWAIT | M_ZERO); - if (tc == NULL) - panic("%s: could not malloc timecounter", __func__); - tc->tc_get_timecount = schizo_get_timecount; - tc->tc_counter_mask = STX_CTRL_PERF_CNT_MASK; - if (OF_getprop(OF_peer(0), "clock-frequency", &prop, - sizeof(prop)) == -1) - panic("%s: could not determine clock frequency", - __func__); - tc->tc_frequency = prop; - tc->tc_name = strdup(device_get_nameunit(dev), M_DEVBUF); - if (mode == SCHIZO_MODE_SCZ) - tc->tc_quality = SCHIZO_PERF_CNT_QLTY; - else - tc->tc_quality = -SCHIZO_PERF_CNT_QLTY; - tc->tc_priv = sc; - tc_init(tc); - } - - /* - * Set up the IOMMU. Schizo, Tomatillo and XMITS all have - * one per PBM. Schizo and XMITS additionally have a streaming - * buffer, in Schizo version < 5 (i.e. revision < 2.3) it's - * affected by several errata though. However, except for context - * flushes, taking advantage of it should be okay even with those. - */ - memcpy(&sc->sc_dma_methods, &iommu_dma_methods, - sizeof(sc->sc_dma_methods)); - sc->sc_is.sis_sc = sc; - sc->sc_is.sis_is.is_flags = IOMMU_PRESERVE_PROM; - sc->sc_is.sis_is.is_pmaxaddr = IOMMU_MAXADDR(STX_IOMMU_BITS); - sc->sc_is.sis_is.is_sb[0] = sc->sc_is.sis_is.is_sb[1] = 0; - if (OF_getproplen(node, "no-streaming-cache") < 0) - sc->sc_is.sis_is.is_sb[0] = STX_PCI_STRBUF; - -#define TSBCASE(x) \ - case (IOTSB_BASESZ << (x)) << (IO_PAGE_SHIFT - IOTTE_SHIFT): \ - tsbsize = (x); \ - break; \ - - i = OF_getprop(node, "virtual-dma", (void *)prop_array, - sizeof(prop_array)); - if (i == -1 || i != sizeof(prop_array)) - schizo_iommu_init(sc, 7, -1); - else { - switch (prop_array[1]) { - TSBCASE(1); - TSBCASE(2); - TSBCASE(3); - TSBCASE(4); - TSBCASE(5); - TSBCASE(6); - TSBCASE(7); - TSBCASE(8); - default: - panic("%s: unsupported DVMA size 0x%x", - __func__, prop_array[1]); - /* NOTREACHED */ - } - schizo_iommu_init(sc, tsbsize, prop_array[0]); - } - -#undef TSBCASE - - /* Create our DMA tag. */ - if (bus_dma_tag_create(bus_get_dma_tag(dev), 8, 0, - sc->sc_is.sis_is.is_pmaxaddr, ~0, NULL, NULL, - sc->sc_is.sis_is.is_pmaxaddr, 0xff, 0xffffffff, 0, NULL, NULL, - &dmat) != 0) - panic("%s: could not create PCI DMA tag", __func__); - dmat->dt_cookie = &sc->sc_is; - dmat->dt_mt = &sc->sc_dma_methods; - - if (ofw_pci_attach_common(dev, dmat, STX_IO_SIZE, STX_MEM_SIZE) != 0) - panic("%s: ofw_pci_attach_common() failed", __func__); - - /* Clear any pending PCI error bits. */ - PCIB_WRITE_CONFIG(dev, sc->sc_ops.sc_pci_secbus, STX_CS_DEVICE, - STX_CS_FUNC, PCIR_STATUS, PCIB_READ_CONFIG(dev, - sc->sc_ops.sc_pci_secbus, STX_CS_DEVICE, STX_CS_FUNC, PCIR_STATUS, - 2), 2); - SCHIZO_PCI_SET(sc, STX_PCI_CTRL, SCHIZO_PCI_READ_8(sc, STX_PCI_CTRL)); - SCHIZO_PCI_SET(sc, STX_PCI_AFSR, SCHIZO_PCI_READ_8(sc, STX_PCI_AFSR)); - - /* - * Establish handlers for interesting interrupts... - * Someone at Sun clearly was smoking crack; with Schizos PCI - * bus error interrupts for one PBM can be routed to the other - * PBM though we obviously need to use the softc of the former - * as the argument for the interrupt handler and the softc of - * the latter as the argument for the interrupt controller. - */ - if (sc->sc_half == 0) { - if ((ino_bitmap & (1ULL << STX_PCIERR_A_INO)) != 0 || - (osc != NULL && ((struct schizo_icarg *)intr_vectors[ - INTMAP_VEC(sc->sc_ign, STX_PCIERR_A_INO)].iv_icarg)-> - sica_sc == osc)) - /* - * We are the driver for PBM A and either also - * registered the interrupt controller for us or - * the driver for PBM B has probed first and - * registered it for us. - */ - schizo_set_intr(sc, 0, STX_PCIERR_A_INO, - schizo_pci_bus); - if ((ino_bitmap & (1ULL << STX_PCIERR_B_INO)) != 0 && - osc != NULL) - /* - * We are the driver for PBM A but registered - * the interrupt controller for PBM B, i.e. the - * driver for PBM B attached first but couldn't - * set up a handler for PBM B. - */ - schizo_set_intr(osc, 0, STX_PCIERR_B_INO, - schizo_pci_bus); - } else { - if ((ino_bitmap & (1ULL << STX_PCIERR_B_INO)) != 0 || - (osc != NULL && ((struct schizo_icarg *)intr_vectors[ - INTMAP_VEC(sc->sc_ign, STX_PCIERR_B_INO)].iv_icarg)-> - sica_sc == osc)) - /* - * We are the driver for PBM B and either also - * registered the interrupt controller for us or - * the driver for PBM A has probed first and - * registered it for us. - */ - schizo_set_intr(sc, 0, STX_PCIERR_B_INO, - schizo_pci_bus); - if ((ino_bitmap & (1ULL << STX_PCIERR_A_INO)) != 0 && - osc != NULL) - /* - * We are the driver for PBM B but registered - * the interrupt controller for PBM A, i.e. the - * driver for PBM A attached first but couldn't - * set up a handler for PBM A. - */ - schizo_set_intr(osc, 0, STX_PCIERR_A_INO, - schizo_pci_bus); - } - if ((ino_bitmap & (1ULL << STX_UE_INO)) != 0) - schizo_set_intr(sc, 1, STX_UE_INO, schizo_ue); - if ((ino_bitmap & (1ULL << STX_CE_INO)) != 0) - schizo_set_intr(sc, 2, STX_CE_INO, schizo_ce); - if ((ino_bitmap & (1ULL << STX_BUS_INO)) != 0) - schizo_set_intr(sc, 3, STX_BUS_INO, schizo_host_bus); - - /* - * According to the Schizo Errata I-13, consistent DMA flushing/ - * syncing is FUBAR in version < 5 (i.e. revision < 2.3) bridges, - * so we can't use it and need to live with the consequences. With - * Schizo version >= 5, CDMA flushing/syncing is usable but requires - * the workaround described in Schizo Errata I-23. With Tomatillo - * and XMITS, CDMA flushing/syncing works as expected, Tomatillo - * version <= 4 (i.e. revision <= 2.3) bridges additionally require - * a block store after a write to TOMXMS_PCI_DMA_SYNC_PEND though. - */ - if ((sc->sc_mode == SCHIZO_MODE_SCZ && sc->sc_ver >= 5) || - sc->sc_mode == SCHIZO_MODE_TOM || - sc->sc_mode == SCHIZO_MODE_XMS) { - if (sc->sc_mode == SCHIZO_MODE_SCZ) { - sc->sc_dma_methods.dm_dmamap_sync = - schizo_dmamap_sync; - sc->sc_cdma_state = SCHIZO_CDMA_STATE_IDLE; - /* - * Some firmware versions include the CDMA interrupt - * at RID 4 but most don't. With the latter we add - * it ourselves at the spare RID 5. - */ - i = INTINO(bus_get_resource_start(dev, SYS_RES_IRQ, - 4)); - if (i == STX_CDMA_A_INO || i == STX_CDMA_B_INO) { - sc->sc_cdma_vec = INTMAP_VEC(sc->sc_ign, i); - (void)schizo_get_intrmap(sc, i, - &sc->sc_cdma_map, &sc->sc_cdma_clr); - schizo_set_intr(sc, 4, i, schizo_cdma); - } else { - i = STX_CDMA_A_INO + sc->sc_half; - sc->sc_cdma_vec = INTMAP_VEC(sc->sc_ign, i); - if (bus_set_resource(dev, SYS_RES_IRQ, 5, - sc->sc_cdma_vec, 1) != 0) - panic("%s: failed to add CDMA " - "interrupt", __func__); - j = schizo_intr_register(sc, i); - if (j != 0) - panic("%s: could not register " - "interrupt controller for CDMA " - "(%d)", __func__, j); - (void)schizo_get_intrmap(sc, i, - &sc->sc_cdma_map, &sc->sc_cdma_clr); - schizo_set_intr(sc, 5, i, schizo_cdma); - } - } else { - if (sc->sc_mode == SCHIZO_MODE_XMS) - mtx_init(&sc->sc_sync_mtx, "pcib_sync_mtx", - NULL, MTX_SPIN); - sc->sc_sync_val = 1ULL << (STX_PCIERR_A_INO + - sc->sc_half); - sc->sc_dma_methods.dm_dmamap_sync = - ichip_dmamap_sync; - } - if (sc->sc_mode == SCHIZO_MODE_TOM && sc->sc_ver <= 4) - sc->sc_flags |= SCHIZO_FLAGS_BSWAR; - } - - /* - * Set the latency timer register as this isn't always done by the - * firmware. - */ - PCIB_WRITE_CONFIG(dev, sc->sc_ops.sc_pci_secbus, STX_CS_DEVICE, - STX_CS_FUNC, PCIR_LATTIMER, OFW_PCI_LATENCY, 1); - -#define SCHIZO_SYSCTL_ADD_UINT(name, arg, desc) \ - SYSCTL_ADD_UINT(device_get_sysctl_ctx(dev), \ - SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, \ - (name), CTLFLAG_RD, (arg), 0, (desc)) - - SCHIZO_SYSCTL_ADD_UINT("dma_ce", &sc->sc_stats_dma_ce, - "DMA correctable errors"); - SCHIZO_SYSCTL_ADD_UINT("pci_non_fatal", &sc->sc_stats_pci_non_fatal, - "PCI bus non-fatal errors"); - -#undef SCHIZO_SYSCTL_ADD_UINT - - device_add_child(dev, "pci", -1); - return (bus_generic_attach(dev)); -} - -static void -schizo_set_intr(struct schizo_softc *sc, u_int index, u_int ino, - driver_filter_t handler) -{ - u_long vec; - int rid; - - rid = index; - sc->sc_irq_res[index] = bus_alloc_resource_any(sc->sc_dev, - SYS_RES_IRQ, &rid, RF_ACTIVE); - if (sc->sc_irq_res[index] == NULL || - INTINO(vec = rman_get_start(sc->sc_irq_res[index])) != ino || - INTIGN(vec) != sc->sc_ign || - intr_vectors[vec].iv_ic != &schizo_ic || - bus_setup_intr(sc->sc_dev, sc->sc_irq_res[index], - INTR_TYPE_MISC | INTR_BRIDGE, handler, NULL, sc, - &sc->sc_ihand[index]) != 0) - panic("%s: failed to set up interrupt %d", __func__, index); -} - -static int -schizo_intr_register(struct schizo_softc *sc, u_int ino) -{ - struct schizo_icarg *sica; - bus_addr_t intrclr, intrmap; - int error; - - if (schizo_get_intrmap(sc, ino, &intrmap, &intrclr) == 0) - return (ENXIO); - sica = malloc(sizeof(*sica), M_DEVBUF, M_NOWAIT); - if (sica == NULL) - return (ENOMEM); - sica->sica_sc = sc; - sica->sica_map = intrmap; - sica->sica_clr = intrclr; -#ifdef SCHIZO_DEBUG - device_printf(sc->sc_dev, "intr map (INO %d) %#lx: %#lx, clr: %#lx\n", - ino, (u_long)intrmap, (u_long)SCHIZO_PCI_READ_8(sc, intrmap), - (u_long)intrclr); -#endif - error = (intr_controller_register(INTMAP_VEC(sc->sc_ign, ino), - &schizo_ic, sica)); - if (error != 0) - free(sica, M_DEVBUF); - return (error); -} - -static int -schizo_get_intrmap(struct schizo_softc *sc, u_int ino, - bus_addr_t *intrmapptr, bus_addr_t *intrclrptr) -{ - bus_addr_t intrclr, intrmap; - uint64_t mr; - - /* - * XXX we only look for INOs rather than INRs since the firmware - * may not provide the IGN and the IGN is constant for all devices - * on that PCI controller. - */ - - if (ino > STX_MAX_INO) { - device_printf(sc->sc_dev, "out of range INO %d requested\n", - ino); - return (0); - } - - intrmap = STX_PCI_IMAP_BASE + (ino << 3); - intrclr = STX_PCI_ICLR_BASE + (ino << 3); - mr = SCHIZO_PCI_READ_8(sc, intrmap); - if (INTINO(mr) != ino) { - device_printf(sc->sc_dev, - "interrupt map entry does not match INO (%d != %d)\n", - (int)INTINO(mr), ino); - return (0); - } - - if (intrmapptr != NULL) - *intrmapptr = intrmap; - if (intrclrptr != NULL) - *intrclrptr = intrclr; - return (1); -} - -/* - * Interrupt handlers - */ -static int -schizo_pci_bus(void *arg) -{ - struct schizo_softc *sc = arg; - uint64_t afar, afsr, csr, iommu, xstat; - uint32_t status; - u_int fatal; - - fatal = 0; - - mtx_lock_spin(sc->sc_mtx); - - afar = SCHIZO_PCI_READ_8(sc, STX_PCI_AFAR); - afsr = SCHIZO_PCI_READ_8(sc, STX_PCI_AFSR); - csr = SCHIZO_PCI_READ_8(sc, STX_PCI_CTRL); - iommu = SCHIZO_PCI_READ_8(sc, STX_PCI_IOMMU); - if ((sc->sc_flags & SCHIZO_FLAGS_XMODE) != 0) - xstat = SCHIZO_PCI_READ_8(sc, XMS_PCI_X_ERR_STAT); - else - xstat = 0; - status = PCIB_READ_CONFIG(sc->sc_dev, sc->sc_ops.sc_pci_secbus, - STX_CS_DEVICE, STX_CS_FUNC, PCIR_STATUS, 2); - - /* - * IOMMU errors are only fatal on Tomatillo and there also only if - * target abort was not signaled. - */ - if ((csr & STX_PCI_CTRL_MMU_ERR) != 0 && - (iommu & TOM_PCI_IOMMU_ERR) != 0 && - ((status & PCIM_STATUS_STABORT) == 0 || - ((iommu & TOM_PCI_IOMMU_ERRMASK) != TOM_PCI_IOMMU_INVALID_ERR && - (iommu & TOM_PCI_IOMMU_ERR_ILLTSBTBW) == 0 && - (iommu & TOM_PCI_IOMMU_ERR_BAD_VA) == 0))) - fatal = 1; - else if ((status & PCIM_STATUS_STABORT) != 0) - fatal = 1; - if ((status & (PCIM_STATUS_PERR | PCIM_STATUS_SERR | - PCIM_STATUS_RMABORT | PCIM_STATUS_RTABORT | - PCIM_STATUS_MDPERR)) != 0 || - (csr & (SCZ_PCI_CTRL_BUS_UNUS | TOM_PCI_CTRL_DTO_ERR | - STX_PCI_CTRL_TTO_ERR | STX_PCI_CTRL_RTRY_ERR | - SCZ_PCI_CTRL_SBH_ERR | STX_PCI_CTRL_SERR)) != 0 || - (afsr & (STX_PCI_AFSR_P_MA | STX_PCI_AFSR_P_TA | - STX_PCI_AFSR_P_RTRY | STX_PCI_AFSR_P_PERR | STX_PCI_AFSR_P_TTO | - STX_PCI_AFSR_P_UNUS)) != 0) - fatal = 1; - if (xstat & (XMS_PCI_X_ERR_STAT_P_SC_DSCRD | - XMS_PCI_X_ERR_STAT_P_SC_TTO | XMS_PCI_X_ERR_STAT_P_SDSTAT | - XMS_PCI_X_ERR_STAT_P_SMMU | XMS_PCI_X_ERR_STAT_P_CDSTAT | - XMS_PCI_X_ERR_STAT_P_CMMU | XMS_PCI_X_ERR_STAT_PERR_RCV)) - fatal = 1; - if (fatal == 0) - sc->sc_stats_pci_non_fatal++; - - device_printf(sc->sc_dev, "PCI bus %c error AFAR %#llx AFSR %#llx " - "PCI CSR %#llx IOMMU %#llx PCI-X %#llx STATUS %#x\n", - 'A' + sc->sc_half, (unsigned long long)afar, - (unsigned long long)afsr, (unsigned long long)csr, - (unsigned long long)iommu, (unsigned long long)xstat, status); - - /* Clear the error bits that we caught. */ - PCIB_WRITE_CONFIG(sc->sc_dev, sc->sc_ops.sc_pci_secbus, STX_CS_DEVICE, - STX_CS_FUNC, PCIR_STATUS, status, 2); - SCHIZO_PCI_WRITE_8(sc, STX_PCI_CTRL, csr); - SCHIZO_PCI_WRITE_8(sc, STX_PCI_AFSR, afsr); - SCHIZO_PCI_WRITE_8(sc, STX_PCI_IOMMU, iommu); - if ((sc->sc_flags & SCHIZO_FLAGS_XMODE) != 0) - SCHIZO_PCI_WRITE_8(sc, XMS_PCI_X_ERR_STAT, xstat); - - mtx_unlock_spin(sc->sc_mtx); - - if (fatal != 0) - panic("%s: fatal PCI bus error", - device_get_nameunit(sc->sc_dev)); - return (FILTER_HANDLED); -} - -static int -schizo_ue(void *arg) -{ - struct schizo_softc *sc = arg; - uint64_t afar, afsr; - int i; - - afar = SCHIZO_CTRL_READ_8(sc, STX_CTRL_UE_AFAR); - for (i = 0; i < 1000; i++) - if (((afsr = SCHIZO_CTRL_READ_8(sc, STX_CTRL_UE_AFSR)) & - STX_CTRL_CE_AFSR_ERRPNDG) == 0) - break; - panic("%s: uncorrectable DMA error AFAR %#llx AFSR %#llx", - device_get_nameunit(sc->sc_dev), (unsigned long long)afar, - (unsigned long long)afsr); - return (FILTER_HANDLED); -} - -static int -schizo_ce(void *arg) -{ - struct schizo_softc *sc = arg; - uint64_t afar, afsr; - int i; - - mtx_lock_spin(sc->sc_mtx); - - afar = SCHIZO_CTRL_READ_8(sc, STX_CTRL_CE_AFAR); - for (i = 0; i < 1000; i++) - if (((afsr = SCHIZO_CTRL_READ_8(sc, STX_CTRL_UE_AFSR)) & - STX_CTRL_CE_AFSR_ERRPNDG) == 0) - break; - sc->sc_stats_dma_ce++; - device_printf(sc->sc_dev, - "correctable DMA error AFAR %#llx AFSR %#llx\n", - (unsigned long long)afar, (unsigned long long)afsr); - - /* Clear the error bits that we caught. */ - SCHIZO_CTRL_WRITE_8(sc, STX_CTRL_UE_AFSR, afsr); - - mtx_unlock_spin(sc->sc_mtx); - - return (FILTER_HANDLED); -} - -static int -schizo_host_bus(void *arg) -{ - struct schizo_softc *sc = arg; - uint64_t errlog; - - errlog = SCHIZO_CTRL_READ_8(sc, STX_CTRL_BUS_ERRLOG); - panic("%s: %s error %#llx", device_get_nameunit(sc->sc_dev), - sc->sc_mode == SCHIZO_MODE_TOM ? "JBus" : "Safari", - (unsigned long long)errlog); - return (FILTER_HANDLED); -} - -static int -schizo_cdma(void *arg) -{ - struct schizo_softc *sc = arg; - - atomic_cmpset_32(&sc->sc_cdma_state, SCHIZO_CDMA_STATE_PENDING, - SCHIZO_CDMA_STATE_RECEIVED); - return (FILTER_HANDLED); -} - -static void -schizo_iommu_init(struct schizo_softc *sc, int tsbsize, uint32_t dvmabase) -{ - - /* Punch in our copies. */ - sc->sc_is.sis_is.is_bustag = rman_get_bustag(sc->sc_mem_res[STX_PCI]); - sc->sc_is.sis_is.is_bushandle = - rman_get_bushandle(sc->sc_mem_res[STX_PCI]); - sc->sc_is.sis_is.is_iommu = STX_PCI_IOMMU; - sc->sc_is.sis_is.is_dtag = STX_PCI_IOMMU_TLB_TAG_DIAG; - sc->sc_is.sis_is.is_ddram = STX_PCI_IOMMU_TLB_DATA_DIAG; - sc->sc_is.sis_is.is_dqueue = STX_PCI_IOMMU_QUEUE_DIAG; - sc->sc_is.sis_is.is_dva = STX_PCI_IOMMU_SVADIAG; - sc->sc_is.sis_is.is_dtcmp = STX_PCI_IOMMU_TLB_CMP_DIAG; - - iommu_init(device_get_nameunit(sc->sc_dev), - (struct iommu_state *)&sc->sc_is, tsbsize, dvmabase, 0); -} - -static int -schizo_maxslots(device_t dev) -{ - struct schizo_softc *sc; - - sc = device_get_softc(dev); - if (sc->sc_mode == SCHIZO_MODE_SCZ) - return (sc->sc_half == 0 ? 4 : 6); - - /* XXX: is this correct? */ - return (PCI_SLOTMAX); -} - -static uint32_t -schizo_read_config(device_t dev, u_int bus, u_int slot, u_int func, u_int reg, - int width) -{ - struct schizo_softc *sc; - - sc = device_get_softc(dev); - /* - * The Schizo bridges contain a dupe of their header at 0x80. - */ - if (sc->sc_mode == SCHIZO_MODE_SCZ && - bus == sc->sc_ops.sc_pci_secbus && slot == STX_CS_DEVICE && - func == STX_CS_FUNC && reg + width > 0x80) - return (0); - - return (ofw_pci_read_config_common(dev, PCI_REGMAX, STX_CONF_OFF(bus, - slot, func, reg), bus, slot, func, reg, width)); -} - -static void -schizo_write_config(device_t dev, u_int bus, u_int slot, u_int func, - u_int reg, uint32_t val, int width) -{ - - ofw_pci_write_config_common(dev, PCI_REGMAX, STX_CONF_OFF(bus, slot, - func, reg), bus, slot, func, reg, val, width); -} - -static int -schizo_route_interrupt(device_t bridge, device_t dev, int pin) -{ - ofw_pci_intr_t mintr; - - mintr = ofw_pci_route_interrupt_common(bridge, dev, pin); - if (!PCI_INTERRUPT_VALID(mintr)) - device_printf(bridge, - "could not route pin %d for device %d.%d\n", - pin, pci_get_slot(dev), pci_get_function(dev)); - return (mintr); -} - -static void -schizo_dmamap_sync(bus_dma_tag_t dt, bus_dmamap_t map, bus_dmasync_op_t op) -{ - struct timeval cur, end; - struct schizo_iommu_state *sis = dt->dt_cookie; - struct schizo_softc *sc = sis->sis_sc; - int i, res; -#ifdef INVARIANTS - register_t pil; -#endif - - if ((map->dm_flags & DMF_STREAMED) != 0) { - iommu_dma_methods.dm_dmamap_sync(dt, map, op); - return; - } - - if ((map->dm_flags & DMF_LOADED) == 0) - return; - - if ((op & BUS_DMASYNC_POSTREAD) != 0) { - /* - * Note that in order to allow this function to be called from - * filters we would need to use a spin mutex for serialization - * but given that these disable interrupts we have to emulate - * one. - */ - critical_enter(); - KASSERT((rdpr(pstate) & PSTATE_IE) != 0, - ("%s: interrupts disabled", __func__)); - KASSERT((pil = rdpr(pil)) <= PIL_BRIDGE, - ("%s: PIL too low (%ld)", __func__, pil)); - for (; atomic_cmpset_acq_32(&sc->sc_cdma_state, - SCHIZO_CDMA_STATE_IDLE, SCHIZO_CDMA_STATE_PENDING) == 0;) - ; - SCHIZO_PCI_WRITE_8(sc, sc->sc_cdma_map, - INTMAP_ENABLE(sc->sc_cdma_vec, PCPU_GET(mid))); - for (i = 0; i < SCHIZO_CDMA_TRIES; i++) { - if (i > 0) - printf("%s: try %d\n", __func__, i); - SCHIZO_PCI_WRITE_8(sc, sc->sc_cdma_clr, - INTCLR_RECEIVED); - microuptime(&cur); - end.tv_sec = SCHIZO_CDMA_TIMEOUT; - end.tv_usec = 0; - timevaladd(&end, &cur); - for (; (res = atomic_cmpset_rel_32(&sc->sc_cdma_state, - SCHIZO_CDMA_STATE_RECEIVED, - SCHIZO_CDMA_STATE_IDLE)) == 0 && - timevalcmp(&cur, &end, <=);) - microuptime(&cur); - if (res != 0) - break; - } - if (res == 0) - panic("%s: DMA does not sync", __func__); - critical_exit(); - } - - if ((op & BUS_DMASYNC_PREWRITE) != 0) - membar(Sync); -} - -static void -ichip_dmamap_sync(bus_dma_tag_t dt, bus_dmamap_t map, bus_dmasync_op_t op) -{ - struct timeval cur, end; - struct schizo_iommu_state *sis = dt->dt_cookie; - struct schizo_softc *sc = sis->sis_sc; - uint64_t reg; - - if ((map->dm_flags & DMF_STREAMED) != 0) { - iommu_dma_methods.dm_dmamap_sync(dt, map, op); - return; - } - - if ((map->dm_flags & DMF_LOADED) == 0) - return; - - if ((op & BUS_DMASYNC_POSTREAD) != 0) { - if (sc->sc_mode == SCHIZO_MODE_XMS) - mtx_lock_spin(&sc->sc_sync_mtx); - SCHIZO_PCI_WRITE_8(sc, TOMXMS_PCI_DMA_SYNC_PEND, - sc->sc_sync_val); - microuptime(&cur); - end.tv_sec = 1; - end.tv_usec = 0; - timevaladd(&end, &cur); - for (; ((reg = SCHIZO_PCI_READ_8(sc, - TOMXMS_PCI_DMA_SYNC_PEND)) & sc->sc_sync_val) != 0 && - timevalcmp(&cur, &end, <=);) - microuptime(&cur); - if ((reg & sc->sc_sync_val) != 0) - panic("%s: DMA does not sync", __func__); - if (sc->sc_mode == SCHIZO_MODE_XMS) - mtx_unlock_spin(&sc->sc_sync_mtx); - else if ((sc->sc_flags & SCHIZO_FLAGS_BSWAR) != 0) { - ofw_pci_dmamap_sync_stst_order_common(); - return; - } - } - - if ((op & BUS_DMASYNC_PREWRITE) != 0) - membar(Sync); -} - -static void -schizo_intr_enable(void *arg) -{ - struct intr_vector *iv = arg; - struct schizo_icarg *sica = iv->iv_icarg; - - SCHIZO_PCI_WRITE_8(sica->sica_sc, sica->sica_map, - INTMAP_ENABLE(iv->iv_vec, iv->iv_mid)); -} - -static void -schizo_intr_disable(void *arg) -{ - struct intr_vector *iv = arg; - struct schizo_icarg *sica = iv->iv_icarg; - - SCHIZO_PCI_WRITE_8(sica->sica_sc, sica->sica_map, iv->iv_vec); -} - -static void -schizo_intr_assign(void *arg) -{ - struct intr_vector *iv = arg; - struct schizo_icarg *sica = iv->iv_icarg; - - SCHIZO_PCI_WRITE_8(sica->sica_sc, sica->sica_map, INTMAP_TID( - SCHIZO_PCI_READ_8(sica->sica_sc, sica->sica_map), iv->iv_mid)); -} - -static void -schizo_intr_clear(void *arg) -{ - struct intr_vector *iv = arg; - struct schizo_icarg *sica = iv->iv_icarg; - - SCHIZO_PCI_WRITE_8(sica->sica_sc, sica->sica_clr, INTCLR_IDLE); -} - -static int -schizo_setup_intr(device_t dev, device_t child, struct resource *ires, - int flags, driver_filter_t *filt, driver_intr_t *intr, void *arg, - void **cookiep) -{ - struct schizo_softc *sc; - u_long vec; - int error; - - sc = device_get_softc(dev); - /* - * Make sure the vector is fully specified. - */ - vec = rman_get_start(ires); - if (INTIGN(vec) != sc->sc_ign) { - device_printf(dev, "invalid interrupt vector 0x%lx\n", vec); - return (EINVAL); - } - - if (intr_vectors[vec].iv_ic == &schizo_ic) { - /* - * Ensure we use the right softc in case the interrupt - * is routed to our companion PBM for some odd reason. - */ - sc = ((struct schizo_icarg *)intr_vectors[vec].iv_icarg)-> - sica_sc; - } else if (intr_vectors[vec].iv_ic == NULL) { - /* - * Work around broken firmware which misses entries in - * the ino-bitmap. - */ - error = schizo_intr_register(sc, INTINO(vec)); - if (error != 0) { - device_printf(dev, "could not register interrupt " - "controller for vector 0x%lx (%d)\n", vec, error); - return (error); - } - if (bootverbose) - device_printf(dev, "belatedly registered as " - "interrupt controller for vector 0x%lx\n", vec); - } else { - device_printf(dev, - "invalid interrupt controller for vector 0x%lx\n", vec); - return (EINVAL); - } - return (bus_generic_setup_intr(dev, child, ires, flags, filt, intr, - arg, cookiep)); -} - -static struct resource * -schizo_alloc_resource(device_t bus, device_t child, int type, int *rid, - rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) -{ - struct schizo_softc *sc; - - if (type == SYS_RES_IRQ) { - sc = device_get_softc(bus); - start = end = INTMAP_VEC(sc->sc_ign, end); - } - return (ofw_pci_alloc_resource(bus, child, type, rid, start, end, - count, flags)); -} - -static void -schizo_setup_device(device_t bus, device_t child) -{ - struct schizo_softc *sc; - uint64_t reg; - int capreg; - - sc = device_get_softc(bus); - /* - * Disable bus parking in order to work around a bus hang caused by - * Casinni/Skyhawk combinations. - */ - if (OF_getproplen(ofw_bus_get_node(child), "pci-req-removal") >= 0) - SCHIZO_PCI_SET(sc, STX_PCI_CTRL, SCHIZO_PCI_READ_8(sc, - STX_PCI_CTRL) & ~STX_PCI_CTRL_ARB_PARK); - - if (sc->sc_mode == SCHIZO_MODE_XMS) { - /* XMITS NCPQ WAR: set outstanding split transactions to 1. */ - if ((sc->sc_flags & SCHIZO_FLAGS_XMODE) != 0 && - (pci_read_config(child, PCIR_HDRTYPE, 1) & - PCIM_HDRTYPE) != PCIM_HDRTYPE_BRIDGE && - pci_find_cap(child, PCIY_PCIX, &capreg) == 0) - pci_write_config(child, capreg + PCIXR_COMMAND, - pci_read_config(child, capreg + PCIXR_COMMAND, - 2) & 0x7c, 2); - /* XMITS 3.x WAR: set BUGCNTL iff value is unexpected. */ - if (sc->sc_mrev >= 4) { - reg = ((sc->sc_flags & SCHIZO_FLAGS_XMODE) != 0 ? - 0xa0UL : 0xffUL) << XMS_PCI_X_DIAG_BUGCNTL_SHIFT; - if ((SCHIZO_PCI_READ_8(sc, XMS_PCI_X_DIAG) & - XMS_PCI_X_DIAG_BUGCNTL_MASK) != reg) - SCHIZO_PCI_SET(sc, XMS_PCI_X_DIAG, reg); - } - } -} - -static u_int -schizo_get_timecount(struct timecounter *tc) -{ - struct schizo_softc *sc; - - sc = tc->tc_priv; - return ((SCHIZO_CTRL_READ_8(sc, STX_CTRL_PERF_CNT) & - (STX_CTRL_PERF_CNT_MASK << STX_CTRL_PERF_CNT_CNT0_SHIFT)) >> - STX_CTRL_PERF_CNT_CNT0_SHIFT); -} diff --git a/sys/sparc64/pci/schizoreg.h b/sys/sparc64/pci/schizoreg.h deleted file mode 100644 index 0640df4b744f01..00000000000000 --- a/sys/sparc64/pci/schizoreg.h +++ /dev/null @@ -1,359 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2002 Jason L. Wright (jason@thought.net) - * Copyright (c) 2005 by Marius Strobl - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULLAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * from: OpenBSD: schizoreg.h,v 1.8 2005/05/19 18:28:59 mickey Exp - * $FreeBSD$ - */ - -#ifndef _SPARC64_PCI_SCHIZOREG_H_ -#define _SPARC64_PCI_SCHIZOREG_H_ - -#define STX_NINTR 5 /* 4 via OFW + 1 CDMA */ -#define SCZ_NREG 3 -#define TOM_NREG 4 - -#define STX_PCI 0 -#define STX_CTRL 1 -#define STX_PCICFG 2 -#define STX_ICON 3 - -/* PCI configuration and status registers */ -#define SX_PCI_CFG_ICD 0x00110 -#define STX_PCI_IOMMU 0x00200 -#define STX_PCI_IOMMU_CTXFLUSH 0x00218 -#define STX_PCI_IMAP_BASE 0x01000 -#define STX_PCI_ICLR_BASE 0x01400 -#define STX_PCI_INTR_RETRY_TIM 0x01a00 -#define SCZ_PCI_DMA_SYNC 0x01a08 -#define TOM_PCI_DMA_SYNC_COMP 0x01a10 -#define TOMXMS_PCI_DMA_SYNC_PEND 0x01a18 -#define STX_PCI_CTRL 0x02000 -#define STX_PCI_AFSR 0x02010 -#define STX_PCI_AFAR 0x02018 -#define STX_PCI_DIAG 0x02020 -#define XMS_PCI_PARITY_DETECT 0x02040 -#define TOM_PCI_IOC_CSR 0x02248 -#define TOM_PCI_IOC_TAG 0x02290 -#define TOM_PCI_IOC_DATA 0x02290 -#define XMS_PCI_X_ERR_STAT 0x02300 -#define XMS_PCI_X_DIAG 0x02308 -#define XMS_PCI_UPPER_RETRY_COUNTER 0x02310 -#define STX_PCI_STRBUF 0x02800 -#define STX_PCI_STRBUF_CTXFLUSH 0x02818 -#define STX_PCI_IOMMU_SVADIAG 0x0a400 -#define STX_PCI_IOMMU_TLB_CMP_DIAG 0x0a408 -#define STX_PCI_IOMMU_QUEUE_DIAG 0x0a500 -#define STX_PCI_IOMMU_TLB_TAG_DIAG 0x0a580 -#define STX_PCI_IOMMU_TLB_DATA_DIAG 0x0a600 -#define STX_PCI_IOBIO_DIAG 0x0a808 -#define STX_PCI_STRBUF_CTXMATCH 0x10000 - -/* PCI configuration/idle check diagnostic register */ -#define SX_PCI_CFG_ICD_PCI_2_0_COMPAT 0x0000000000008000ULL -#define SX_PCI_CFG_ICD_DMAW_PERR_IEN 0x0000000000004000ULL -#define SX_PCI_CFG_ICD_IFC_NOT_IDLE 0x0000000000000010ULL -#define SX_PCI_CFG_ICD_MDU_NOT_IDLE 0x0000000000000008ULL -#define SX_PCI_CFG_ICD_MMU_NOT_IDLE 0x0000000000000004ULL -#define SX_PCI_CFG_ICD_PBM_NOT_IDLE 0x0000000000000002ULL -#define SX_PCI_CFG_ICD_STC_NOT_IDLE 0x0000000000000001ULL - -/* PCI IOMMU control register */ -#define TOM_PCI_IOMMU_ERR_BAD_VA 0x0000000010000000ULL -#define TOM_PCI_IOMMU_ERR_ILLTSBTBW 0x0000000008000000ULL -#define TOM_PCI_IOMMU_ECC_ERR 0x0000000006000000ULL -#define TOM_PCI_IOMMU_TIMEOUT_ERR 0x0000000004000000ULL -#define TOM_PCI_IOMMU_INVALID_ERR 0x0000000002000000ULL -#define TOM_PCI_IOMMU_PROTECTION_ERR 0x0000000000000000ULL -#define TOM_PCI_IOMMU_ERRMASK \ - (TOM_PCI_IOMMU_PROTECTION_ERR | TOM_PCI_IOMMU_INVALID_ERR | \ - TOM_PCI_IOMMU_TIMEOUT_ERR | TOM_PCI_IOMMU_ECC_ERR) -#define TOM_PCI_IOMMU_ERR 0x0000000001000000ULL - -/* PCI control/status register */ -#define SCZ_PCI_CTRL_BUS_UNUS 0x8000000000000000ULL -#define TOM_PCI_CTRL_DTO_ERR 0x4000000000000000ULL -#define TOM_PCI_CTRL_DTO_IEN 0x2000000000000000ULL -#define SCZ_PCI_CTRL_ESLCK 0x0008000000000000ULL -#define XMS_PCI_CTRL_DMA_WR_PERR 0x0008000000000000ULL -#define SCZ_PCI_CTRL_ERRSLOT 0x0007000000000000ULL -#define STX_PCI_CTRL_TTO_ERR 0x0000004000000000ULL -#define STX_PCI_CTRL_RTRY_ERR 0x0000002000000000ULL -#define STX_PCI_CTRL_MMU_ERR 0x0000001000000000ULL -#define SCZ_PCI_CTRL_SBH_ERR 0x0000000800000000ULL -#define STX_PCI_CTRL_SERR 0x0000000400000000ULL -#define SCZ_PCI_CTRL_PCISPD 0x0000000200000000ULL -#define XMS_PCI_CTRL_X_MODE 0x0000000100000000ULL -#define TOM_PCI_CTRL_PRM 0x0000000040000000ULL -#define TOM_PCI_CTRL_PRO 0x0000000020000000ULL -#define TOM_PCI_CTRL_PRL 0x0000000010000000ULL -#define STX_PCI_CTRL_PTO 0x0000000003000000ULL -#define XMS_PCI_CTRL_X_ERRINT_EN 0x0000000000100000ULL -#define STX_PCI_CTRL_MMU_IEN 0x0000000000080000ULL -#define STX_PCI_CTRL_SBH_IEN 0x0000000000040000ULL -#define STX_PCI_CTRL_ERR_IEN 0x0000000000020000ULL -#define STX_PCI_CTRL_ARB_PARK 0x0000000000010000ULL -#define SCZ_PCI_CTRL_PCIRST 0x0000000000000100ULL -#define STX_PCI_CTRL_ARB_MASK 0x00000000000000ffULL -#define XMS_PCI_CTRL_XMITS10_ARB_MASK 0x000000000000000fULL - -/* PCI asynchronous fault status register */ -#define STX_PCI_AFSR_P_MA 0x8000000000000000ULL -#define STX_PCI_AFSR_P_TA 0x4000000000000000ULL -#define STX_PCI_AFSR_P_RTRY 0x2000000000000000ULL -#define STX_PCI_AFSR_P_PERR 0x1000000000000000ULL -#define STX_PCI_AFSR_P_TTO 0x0800000000000000ULL -#define STX_PCI_AFSR_P_UNUS 0x0400000000000000ULL -#define STX_PCI_AFSR_S_MA 0x0200000000000000ULL -#define STX_PCI_AFSR_S_TA 0x0100000000000000ULL -#define STX_PCI_AFSR_S_RTRY 0x0080000000000000ULL -#define STX_PCI_AFSR_S_PERR 0x0040000000000000ULL -#define STX_PCI_AFSR_S_TTO 0x0020000000000000ULL -#define STX_PCI_AFSR_S_UNUS 0x0010000000000000ULL -#define STX_PCI_AFSR_DWMASK 0x0000030000000000ULL -#define STX_PCI_AFSR_BMASK 0x000000ff00000000ULL -#define STX_PCI_AFSR_BLK 0x0000000080000000ULL -#define STX_PCI_AFSR_CFG 0x0000000040000000ULL -#define STX_PCI_AFSR_MEM 0x0000000020000000ULL -#define STX_PCI_AFSR_IO 0x0000000010000000ULL - -/* PCI diagnostic register */ -#define SCZ_PCI_DIAG_BADECC_DIS 0x0000000000000400ULL -#define STX_PCI_DIAG_BYPASS_DIS 0x0000000000000200ULL -#define STX_PCI_DIAG_TTO_DIS 0x0000000000000100ULL -#define SCZ_PCI_DIAG_RTRYARB_DIS 0x0000000000000080ULL -#define STX_PCI_DIAG_RETRY_DIS 0x0000000000000040ULL -#define STX_PCI_DIAG_INTRSYNC_DIS 0x0000000000000020ULL -#define STX_PCI_DIAG_DMAPARITY_INV 0x0000000000000008ULL -#define STX_PCI_DIAG_PIODPARITY_INV 0x0000000000000004ULL -#define STX_PCI_DIAG_PIOAPARITY_INV 0x0000000000000002ULL - -/* Tomatillo I/O cache register */ -#define TOM_PCI_IOC_PW 0x0000000000080000ULL -#define TOM_PCI_IOC_PRM 0x0000000000040000ULL -#define TOM_PCI_IOC_PRO 0x0000000000020000ULL -#define TOM_PCI_IOC_PRL 0x0000000000010000ULL -#define TOM_PCI_IOC_PRM_LEN 0x000000000000c000ULL -#define TOM_PCI_IOC_PRM_LEN_SHIFT 14 -#define TOM_PCI_IOC_PRO_LEN 0x0000000000003000ULL -#define TOM_PCI_IOC_PRO_LEN_SHIFT 12 -#define TOM_PCI_IOC_PRL_LEN 0x0000000000000c00ULL -#define TOM_PCI_IOC_PRL_LEN_SHIFT 10 -#define TOM_PCI_IOC_PREF_OFF 0x0000000000000038ULL -#define TOM_PCI_IOC_PREF_OFF_SHIFT 3 -#define TOM_PCI_IOC_CPRM 0x0000000000000004ULL -#define TOM_PCI_IOC_CPRO 0x0000000000000002ULL -#define TOM_PCI_IOC_CPRL 0x0000000000000001ULL - -/* XMITS PCI-X error status register */ -#define XMS_PCI_X_ERR_STAT_P_SC_DSCRD 0x8000000000000000ULL -#define XMS_PCI_X_ERR_STAT_P_SC_TTO 0x4000000000000000ULL -#define XMS_PCI_X_ERR_STAT_P_SDSTAT 0x2000000000000000ULL -#define XMS_PCI_X_ERR_STAT_P_SMMU 0x1000000000000000ULL -#define XMS_PCI_X_ERR_STAT_P_CDSTAT 0x0800000000000000ULL -#define XMS_PCI_X_ERR_STAT_P_CMMU 0x0400000000000000ULL -#define XMS_PCI_X_ERR_STAT_S_SC_DSCRD 0x0080000000000000ULL -#define XMS_PCI_X_ERR_STAT_S_SC_TTO 0x0040000000000000ULL -#define XMS_PCI_X_ERR_STAT_S_SDSTAT 0x0020000000000000ULL -#define XMS_PCI_X_ERR_STAT_S_SMMU 0x0010000000000000ULL -#define XMS_PCI_X_ERR_STAT_S_CDSTAT 0x0008000000000000ULL -#define XMS_PCI_X_ERR_STAT_S_CMMU 0x0004000000000000ULL -#define XMS_PCI_X_ERR_STAT_PERR_RCV_IEN 0x0000000400000000ULL -#define XMS_PCI_X_ERR_STAT_PERR_RCV 0x0000000200000000ULL -#define XMS_PCI_X_ERR_STAT_SERR_ON_PERR 0x0000000100000000ULL - -/* XMITS PCI-X diagnostic register */ -#define XMS_PCI_X_DIAG_DIS_FAIR 0x0000000000080000ULL -#define XMS_PCI_X_DIAG_CRCQ_VALID 0x0000000000040000ULL -#define XMS_PCI_X_DIAG_SRCQ_ONE 0x0000000000000200ULL -#define XMS_PCI_X_DIAG_CRCQ_FLUSH 0x0000000000000100ULL -#define XMS_PCI_X_DIAG_BUGCNTL_MASK 0x0000ffff00000000ULL -#define XMS_PCI_X_DIAG_BUGCNTL_SHIFT 32 -#define XMS_PCI_X_DIAG_SRCQ_MASK 0x00000000000000ffULL - -/* Controller configuration and status registers */ -/* Note that these are shared on Schizo but per-PBM on Tomatillo. */ -#define STX_CTRL_BUS_ERRLOG 0x00018 -#define STX_CTRL_ECCCTRL 0x00020 -#define STX_CTRL_UE_AFSR 0x00030 -#define STX_CTRL_UE_AFAR 0x00038 -#define STX_CTRL_CE_AFSR 0x00040 -#define STX_CTRL_CE_AFAR 0x00048 -#define STX_CTRL_PERF 0x07000 -#define STX_CTRL_PERF_CNT 0x07008 - -/* Safari/JBus error log register */ -#define STX_CTRL_BUS_ERRLOG_BADCMD 0x4000000000000000ULL -#define SCZ_CTRL_BUS_ERRLOG_SSMDIS 0x2000000000000000ULL -#define SCZ_CTRL_BUS_ERRLOG_BADMA 0x1000000000000000ULL -#define SCZ_CTRL_BUS_ERRLOG_BADMB 0x0800000000000000ULL -#define SCZ_CTRL_BUS_ERRLOG_BADMC 0x0400000000000000ULL -#define TOM_CTRL_BUS_ERRLOG_SNOOP_GR 0x0000000000200000ULL -#define TOM_CTRL_BUS_ERRLOG_SNOOP_PCI 0x0000000000100000ULL -#define TOM_CTRL_BUS_ERRLOG_SNOOP_RD 0x0000000000080000ULL -#define TOM_CTRL_BUS_ERRLOG_SNOOP_RDS 0x0000000000020000ULL -#define TOM_CTRL_BUS_ERRLOG_SNOOP_RDSA 0x0000000000010000ULL -#define TOM_CTRL_BUS_ERRLOG_SNOOP_OWN 0x0000000000008000ULL -#define TOM_CTRL_BUS_ERRLOG_SNOOP_RDO 0x0000000000004000ULL -#define SCZ_CTRL_BUS_ERRLOG_CPU1PS 0x0000000000002000ULL -#define TOM_CTRL_BUS_ERRLOG_WDATA_PERR 0x0000000000002000ULL -#define SCZ_CTRL_BUS_ERRLOG_CPU1PB 0x0000000000001000ULL -#define TOM_CTRL_BUS_ERRLOG_CTRL_PERR 0x0000000000001000ULL -#define SCZ_CTRL_BUS_ERRLOG_CPU0PS 0x0000000000000800ULL -#define TOM_CTRL_BUS_ERRLOG_SNOOP_ERR 0x0000000000000800ULL -#define SCZ_CTRL_BUS_ERRLOG_CPU0PB 0x0000000000000400ULL -#define TOM_CTRL_BUS_ERRLOG_JBUS_ILL_B 0x0000000000000400ULL -#define SCZ_CTRL_BUS_ERRLOG_CIQTO 0x0000000000000200ULL -#define SCZ_CTRL_BUS_ERRLOG_LPQTO 0x0000000000000100ULL -#define TOM_CTRL_BUS_ERRLOG_JBUS_ILL_C 0x0000000000000100ULL -#define SCZ_CTRL_BUS_ERRLOG_SFPQTO 0x0000000000000080ULL -#define SCZ_CTRL_BUS_ERRLOG_UFPQTO 0x0000000000000040ULL -#define TOM_CTRL_BUS_ERRLOG_RD_PERR 0x0000000000000040ULL -#define STX_CTRL_BUS_ERRLOG_APERR 0x0000000000000020ULL -#define STX_CTRL_BUS_ERRLOG_UNMAP 0x0000000000000010ULL -#define STX_CTRL_BUS_ERRLOG_BUSERR 0x0000000000000004ULL -#define STX_CTRL_BUS_ERRLOG_TIMEOUT 0x0000000000000002ULL -#define SCZ_CTRL_BUS_ERRLOG_ILL 0x0000000000000001ULL - -/* ECC control register */ -#define STX_CTRL_ECCCTRL_EE 0x8000000000000000ULL -#define STX_CTRL_ECCCTRL_UE 0x4000000000000000ULL -#define STX_CTRL_ECCCTRL_CE 0x2000000000000000ULL - -/* Uncorrectable error asynchronous fault status register */ -#define STX_CTRL_UE_AFSR_P_PIO 0x8000000000000000ULL -#define STX_CTRL_UE_AFSR_P_DRD 0x4000000000000000ULL -#define STX_CTRL_UE_AFSR_P_DWR 0x2000000000000000ULL -#define STX_CTRL_UE_AFSR_S_PIO 0x1000000000000000ULL -#define STX_CTRL_UE_AFSR_S_DRD 0x0800000000000000ULL -#define STX_CTRL_UE_AFSR_S_DWR 0x0400000000000000ULL -#define STX_CTRL_UE_AFSR_ERRPNDG 0x0300000000000000ULL -#define STX_CTRL_UE_AFSR_BMASK 0x000003ff00000000ULL -#define STX_CTRL_UE_AFSR_QOFF 0x00000000c0000000ULL -#define STX_CTRL_UE_AFSR_AID 0x000000001f000000ULL -#define STX_CTRL_UE_AFSR_PARTIAL 0x0000000000800000ULL -#define STX_CTRL_UE_AFSR_OWNEDIN 0x0000000000400000ULL -#define STX_CTRL_UE_AFSR_MTAGSYND 0x00000000000f0000ULL -#define STX_CTRL_UE_AFSR_MTAG 0x000000000000e000ULL -#define STX_CTRL_UE_AFSR_ECCSYND 0x00000000000001ffULL - -/* Correctable error asynchronous fault status register */ -#define STX_CTRL_CE_AFSR_P_PIO 0x8000000000000000ULL -#define STX_CTRL_CE_AFSR_P_DRD 0x4000000000000000ULL -#define STX_CTRL_CE_AFSR_P_DWR 0x2000000000000000ULL -#define STX_CTRL_CE_AFSR_S_PIO 0x1000000000000000ULL -#define STX_CTRL_CE_AFSR_S_DRD 0x0800000000000000ULL -#define STX_CTRL_CE_AFSR_S_DWR 0x0400000000000000ULL -#define STX_CTRL_CE_AFSR_ERRPNDG 0x0300000000000000ULL -#define STX_CTRL_CE_AFSR_BMASK 0x000003ff00000000ULL -#define STX_CTRL_CE_AFSR_QOFF 0x00000000c0000000ULL -#define STX_CTRL_CE_AFSR_AID 0x000000001f000000ULL -#define STX_CTRL_CE_AFSR_PARTIAL 0x0000000000800000ULL -#define STX_CTRL_CE_AFSR_OWNEDIN 0x0000000000400000ULL -#define STX_CTRL_CE_AFSR_MTAGSYND 0x00000000000f0000ULL -#define STX_CTRL_CE_AFSR_MTAG 0x000000000000e000ULL -#define STX_CTRL_CE_AFSR_ECCSYND 0x00000000000001ffULL - -/* - * Safari/JBus performance control register - * NB: For Tomatillo only events 0x00 through 0x08 are documented as - * implemented. - */ -#define SCZ_CTRL_PERF_ZDATA_OUT 0x0000000000000016ULL -#define SCZ_CTRL_PERF_ZDATA_IN 0x0000000000000015ULL -#define SCZ_CTRL_PERF_ORQFULL 0x0000000000000014ULL -#define SCZ_CTRL_PERF_DVMA_WR 0x0000000000000013ULL -#define SCZ_CTRL_PERF_DVMA_RD 0x0000000000000012ULL -#define SCZ_CTRL_PERF_CYCPSESYS 0x0000000000000011ULL -#define STX_CTRL_PERF_PCI_B 0x000000000000000fULL -#define STX_CTRL_PERF_PCI_A 0x000000000000000eULL -#define STX_CTRL_PERF_UPA 0x000000000000000dULL -#define STX_CTRL_PERF_PIOINTRNL 0x000000000000000cULL -#define TOM_CTRL_PERF_WRI_WRIS 0x000000000000000bULL -#define STX_CTRL_PERF_INTRS 0x000000000000000aULL -#define STX_CTRL_PERF_PRTLWRMRGBUF 0x0000000000000009ULL -#define STX_CTRL_PERF_FGN_IO_HITS 0x0000000000000008ULL -#define STX_CTRL_PERF_FGN_IO_TRNS 0x0000000000000007ULL -#define STX_CTRL_PERF_OWN_CHRNT_HITS 0x0000000000000006ULL -#define STX_CTRL_PERF_OWN_CHRNT_TRNS 0x0000000000000005ULL -#define SCZ_CTRL_PERF_FGN_CHRNT_HITS 0x0000000000000004ULL -#define STX_CTRL_PERF_FGN_CHRNT_TRNS 0x0000000000000003ULL -#define STX_CTRL_PERF_CYCLES_PAUSE 0x0000000000000002ULL -#define STX_CTRL_PERF_BUSCYC 0x0000000000000001ULL -#define STX_CTRL_PERF_DIS 0x0000000000000000ULL -#define STX_CTRL_PERF_CNT1_SHIFT 11 -#define STX_CTRL_PERF_CNT0_SHIFT 4 - -/* Safari/JBus performance counter register */ -#define STX_CTRL_PERF_CNT_MASK 0x00000000ffffffffULL -#define STX_CTRL_PERF_CNT_CNT1_SHIFT 32 -#define STX_CTRL_PERF_CNT_CNT0_SHIFT 0 - -/* INO defines */ -#define STX_FB0_INO 0x2a /* FB0 int. shared w/ UPA64s */ -#define STX_FB1_INO 0x2b /* FB1 int. shared w/ UPA64s */ -#define STX_UE_INO 0x30 /* uncorrectable error */ -#define STX_CE_INO 0x31 /* correctable error */ -#define STX_PCIERR_A_INO 0x32 /* PCI bus A error */ -#define STX_PCIERR_B_INO 0x33 /* PCI bus B error */ -#define STX_BUS_INO 0x34 /* Safari/JBus error */ -#define STX_CDMA_A_INO 0x35 /* PCI bus A CDMA */ -#define STX_CDMA_B_INO 0x36 /* PCI bus B CDMA */ -#define STX_MAX_INO 0x37 - -/* Device space defines */ -#define STX_CONF_SIZE 0x1000000 -#define STX_CONF_BUS_SHIFT 16 -#define STX_CONF_DEV_SHIFT 11 -#define STX_CONF_FUNC_SHIFT 8 -#define STX_CONF_REG_SHIFT 0 -#define STX_IO_SIZE 0x1000000 -#define STX_MEM_SIZE 0x100000000 - -#define STX_CONF_OFF(bus, slot, func, reg) \ - (((bus) << STX_CONF_BUS_SHIFT) | \ - ((slot) << STX_CONF_DEV_SHIFT) | \ - ((func) << STX_CONF_FUNC_SHIFT) | \ - ((reg) << STX_CONF_REG_SHIFT)) - -/* Definitions for the Schizo/Tomatillo configuration space */ -#define STX_CS_DEVICE 0 /* bridge CS device number */ -#define STX_CS_FUNC 0 /* brdige CS function number */ - -/* Non-Standard registers in the configration space */ -/* - * NB: For Tomatillo the secondary and subordinate bus number registers - * apparently are read-only although documented otherwise; writing to - * them just triggers a PCI bus error interrupt or has no effect at best. - */ -#define STX_CSR_SECBUS 0x40 /* secondary bus number */ -#define STX_CSR_SUBBUS 0x41 /* subordinate bus number */ - -/* Width of the physical addresses the IOMMU translates to */ -#define STX_IOMMU_BITS 43 - -#endif /* !_SPARC64_PCI_SCHIZOREG_H_ */ diff --git a/sys/sparc64/pci/schizovar.h b/sys/sparc64/pci/schizovar.h deleted file mode 100644 index b153a020dbb41d..00000000000000 --- a/sys/sparc64/pci/schizovar.h +++ /dev/null @@ -1,92 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2005 by Marius Strobl . - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification, immediately at the beginning of the file. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _SPARC64_PCI_SCHIZOVAR_H_ -#define _SPARC64_PCI_SCHIZOVAR_H_ - -struct schizo_softc; - -struct schizo_iommu_state { - struct iommu_state sis_is; - struct schizo_softc *sis_sc; -}; - -struct schizo_softc { - /* - * This is here so that we can hook up the common bus interface - * methods in ofw_pci.c directly. - */ - struct ofw_pci_softc sc_ops; - - struct schizo_iommu_state sc_is; - struct bus_dma_methods sc_dma_methods; - - struct mtx sc_sync_mtx; - uint64_t sc_sync_val; - - struct mtx *sc_mtx; - - struct resource *sc_mem_res[TOM_NREG]; - struct resource *sc_irq_res[STX_NINTR]; - void *sc_ihand[STX_NINTR]; - - SLIST_ENTRY(schizo_softc) sc_link; - - device_t sc_dev; - - u_int sc_mode; -#define SCHIZO_MODE_SCZ 0 -#define SCHIZO_MODE_TOM 1 -#define SCHIZO_MODE_XMS 2 - - u_int sc_flags; -#define SCHIZO_FLAGS_BSWAR (1 << 0) -#define SCHIZO_FLAGS_XMODE (1 << 1) - - bus_addr_t sc_cdma_map; - bus_addr_t sc_cdma_clr; - uint32_t sc_cdma_vec; - uint32_t sc_cdma_state; -#define SCHIZO_CDMA_STATE_IDLE (1 << 0) -#define SCHIZO_CDMA_STATE_PENDING (1 << 1) -#define SCHIZO_CDMA_STATE_RECEIVED (1 << 2) - - u_int sc_half; - uint32_t sc_ign; - uint32_t sc_ver; - uint32_t sc_mrev; - - uint32_t sc_stats_dma_ce; - uint32_t sc_stats_pci_non_fatal; -}; - -#endif /* !_SPARC64_PCI_SCHIZOVAR_H_ */ diff --git a/sys/sparc64/sbus/dma_sbus.c b/sys/sparc64/sbus/dma_sbus.c deleted file mode 100644 index 7e4887e56e246b..00000000000000 --- a/sys/sparc64/sbus/dma_sbus.c +++ /dev/null @@ -1,417 +0,0 @@ -/* $OpenBSD: dma_sbus.c,v 1.16 2008/06/26 05:42:18 ray Exp $ */ -/* $NetBSD: dma_sbus.c,v 1.32 2008/04/28 20:23:57 martin Exp $ */ - -/*- - * SPDX-License-Identifier: BSD-2-Clause-NetBSD AND BSD-2-Clause-FreeBSD - * - * Copyright (c) 1998 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Paul Kranenburg. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -/*- - * Copyright (c) 1994 Peter Galbavy. All rights reserved. - * Copyright (c) 2005 Marius Strobl . All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include - -#include -#include -#include -#include -#include - -struct dma_devinfo { - struct ofw_bus_devinfo ddi_obdinfo; - struct resource_list ddi_rl; -}; - -struct dma_softc { - struct lsi64854_softc sc_lsi64854; /* base device */ - int sc_ign; - int sc_slot; -}; - -static devclass_t dma_devclass; - -static device_probe_t dma_probe; -static device_attach_t dma_attach; -static bus_print_child_t dma_print_child; -static bus_probe_nomatch_t dma_probe_nomatch; -static bus_get_resource_list_t dma_get_resource_list; -static ofw_bus_get_devinfo_t dma_get_devinfo; - -static struct dma_devinfo *dma_setup_dinfo(device_t, struct dma_softc *, - phandle_t); -static void dma_destroy_dinfo(struct dma_devinfo *); -static int dma_print_res(struct dma_devinfo *); - -static device_method_t dma_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, dma_probe), - DEVMETHOD(device_attach, dma_attach), - DEVMETHOD(device_shutdown, bus_generic_shutdown), - DEVMETHOD(device_suspend, bus_generic_suspend), - DEVMETHOD(device_resume, bus_generic_resume), - - /* Bus interface */ - DEVMETHOD(bus_print_child, dma_print_child), - DEVMETHOD(bus_probe_nomatch, dma_probe_nomatch), - DEVMETHOD(bus_alloc_resource, bus_generic_rl_alloc_resource), - DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), - DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), - DEVMETHOD(bus_adjust_resource, bus_generic_adjust_resource), - DEVMETHOD(bus_release_resource, bus_generic_rl_release_resource), - DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), - DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), - DEVMETHOD(bus_get_resource, bus_generic_rl_get_resource), - DEVMETHOD(bus_get_resource_list, dma_get_resource_list), - DEVMETHOD(bus_child_pnpinfo_str, ofw_bus_gen_child_pnpinfo_str), - - /* ofw_bus interface */ - DEVMETHOD(ofw_bus_get_devinfo, dma_get_devinfo), - DEVMETHOD(ofw_bus_get_compat, ofw_bus_gen_get_compat), - DEVMETHOD(ofw_bus_get_model, ofw_bus_gen_get_model), - DEVMETHOD(ofw_bus_get_name, ofw_bus_gen_get_name), - DEVMETHOD(ofw_bus_get_node, ofw_bus_gen_get_node), - DEVMETHOD(ofw_bus_get_type, ofw_bus_gen_get_type), - - DEVMETHOD_END -}; - -static driver_t dma_driver = { - "dma", - dma_methods, - sizeof(struct dma_softc), -}; - -/* - * The probe order is handled by sbus(4) as we don't want the variants - * with children to be attached earlier than the stand-alone controllers - * in order to generally preserve the OFW device tree order. - */ -EARLY_DRIVER_MODULE(dma, sbus, dma_driver, dma_devclass, 0, 0, - BUS_PASS_DEFAULT); -MODULE_DEPEND(dma, sbus, 1, 1, 1); -MODULE_VERSION(dma, 1); - -static int -dma_probe(device_t dev) -{ - const char *name; - - name = ofw_bus_get_name(dev); - if (strcmp(name, "espdma") == 0 || strcmp(name, "dma") == 0 || - strcmp(name, "ledma") == 0) { - device_set_desc_copy(dev, name); - return (0); - } - return (ENXIO); -} - -static int -dma_attach(device_t dev) -{ - struct dma_softc *dsc; - struct lsi64854_softc *lsc; - struct dma_devinfo *ddi; - device_t cdev; - const char *name; - char *cabletype; - uint32_t csr; - phandle_t child, node; - int error, i; - - dsc = device_get_softc(dev); - lsc = &dsc->sc_lsi64854; - - name = ofw_bus_get_name(dev); - node = ofw_bus_get_node(dev); - dsc->sc_ign = sbus_get_ign(dev); - dsc->sc_slot = sbus_get_slot(dev); - - i = 0; - lsc->sc_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &i, - RF_ACTIVE); - if (lsc->sc_res == NULL) { - device_printf(dev, "cannot allocate resources\n"); - return (ENXIO); - } - - if (strcmp(name, "espdma") == 0 || strcmp(name, "dma") == 0) - lsc->sc_channel = L64854_CHANNEL_SCSI; - else if (strcmp(name, "ledma") == 0) { - /* - * Check to see which cable type is currently active and - * set the appropriate bit in the ledma csr so that it - * gets used. If we didn't netboot, the PROM won't have - * the "cable-selection" property; default to TP and then - * the user can change it via a "media" option to ifconfig. - */ - csr = L64854_GCSR(lsc); - if ((OF_getprop_alloc(node, "cable-selection", - (void **)&cabletype)) == -1) { - /* assume TP if nothing there */ - csr |= E_TP_AUI; - } else { - if (strcmp(cabletype, "aui") == 0) - csr &= ~E_TP_AUI; - else - csr |= E_TP_AUI; - OF_prop_free(cabletype); - } - L64854_SCSR(lsc, csr); - DELAY(20000); /* manual says we need a 20ms delay */ - lsc->sc_channel = L64854_CHANNEL_ENET; - } else { - device_printf(dev, "unsupported DMA channel\n"); - error = ENXIO; - goto fail_lres; - } - - error = bus_dma_tag_create( - bus_get_dma_tag(dev), /* parent */ - 1, 0, /* alignment, boundary */ - BUS_SPACE_MAXADDR, /* lowaddr */ - BUS_SPACE_MAXADDR, /* highaddr */ - NULL, NULL, /* filter, filterarg */ - BUS_SPACE_MAXSIZE, /* maxsize */ - BUS_SPACE_UNRESTRICTED, /* nsegments */ - BUS_SPACE_MAXSIZE, /* maxsegsize */ - 0, /* flags */ - NULL, NULL, /* no locking */ - &lsc->sc_parent_dmat); - if (error != 0) { - device_printf(dev, "cannot allocate parent DMA tag\n"); - goto fail_lres; - } - - i = sbus_get_burstsz(dev); - lsc->sc_burst = (i & SBUS_BURST_32) ? 32 : - (i & SBUS_BURST_16) ? 16 : 0; - lsc->sc_dev = dev; - - /* Attach children. */ - i = 0; - for (child = OF_child(node); child != 0; child = OF_peer(child)) { - if ((ddi = dma_setup_dinfo(dev, dsc, child)) == NULL) - continue; - if (i != 0) { - device_printf(dev, - "<%s>: only one child per DMA channel supported\n", - ddi->ddi_obdinfo.obd_name); - dma_destroy_dinfo(ddi); - continue; - } - if ((cdev = device_add_child(dev, NULL, -1)) == NULL) { - device_printf(dev, "<%s>: device_add_child failed\n", - ddi->ddi_obdinfo.obd_name); - dma_destroy_dinfo(ddi); - continue; - } - device_set_ivars(cdev, ddi); - i++; - } - return (bus_generic_attach(dev)); - - fail_lres: - bus_release_resource(dev, SYS_RES_MEMORY, rman_get_rid(lsc->sc_res), - lsc->sc_res); - return (error); -} - -static struct dma_devinfo * -dma_setup_dinfo(device_t dev, struct dma_softc *dsc, phandle_t node) -{ - struct dma_devinfo *ddi; - struct sbus_regs *reg; - uint32_t base, iv, *intr; - int i, nreg, nintr, slot, rslot; - - ddi = malloc(sizeof(*ddi), M_DEVBUF, M_WAITOK | M_ZERO); - if (ofw_bus_gen_setup_devinfo(&ddi->ddi_obdinfo, node) != 0) { - free(ddi, M_DEVBUF); - return (NULL); - } - resource_list_init(&ddi->ddi_rl); - slot = -1; - nreg = OF_getprop_alloc_multi(node, "reg", sizeof(*reg), (void **)®); - if (nreg == -1) { - device_printf(dev, "<%s>: incomplete\n", - ddi->ddi_obdinfo.obd_name); - goto fail; - } - for (i = 0; i < nreg; i++) { - base = reg[i].sbr_offset; - if (SBUS_ABS(base)) { - rslot = SBUS_ABS_TO_SLOT(base); - base = SBUS_ABS_TO_OFFSET(base); - } else - rslot = reg[i].sbr_slot; - if (slot != -1 && slot != rslot) { - device_printf(dev, "<%s>: multiple slots\n", - ddi->ddi_obdinfo.obd_name); - OF_prop_free(reg); - goto fail; - } - slot = rslot; - - resource_list_add(&ddi->ddi_rl, SYS_RES_MEMORY, i, base, - base + reg[i].sbr_size, reg[i].sbr_size); - } - OF_prop_free(reg); - if (slot != dsc->sc_slot) { - device_printf(dev, "<%s>: parent and child slot do not match\n", - ddi->ddi_obdinfo.obd_name); - goto fail; - } - - /* - * The `interrupts' property contains the SBus interrupt level. - */ - nintr = OF_getprop_alloc_multi(node, "interrupts", sizeof(*intr), - (void **)&intr); - if (nintr != -1) { - for (i = 0; i < nintr; i++) { - iv = intr[i]; - /* - * SBus card devices need the slot number encoded into - * the vector as this is generally not done. - */ - if ((iv & INTMAP_OBIO_MASK) == 0) - iv |= slot << 3; - /* Set the IGN as appropriate. */ - iv |= dsc->sc_ign << INTMAP_IGN_SHIFT; - resource_list_add(&ddi->ddi_rl, SYS_RES_IRQ, i, - iv, iv, 1); - } - OF_prop_free(intr); - } - return (ddi); - - fail: - dma_destroy_dinfo(ddi); - return (NULL); -} - -static void -dma_destroy_dinfo(struct dma_devinfo *dinfo) -{ - - resource_list_free(&dinfo->ddi_rl); - ofw_bus_gen_destroy_devinfo(&dinfo->ddi_obdinfo); - free(dinfo, M_DEVBUF); -} - -static int -dma_print_child(device_t dev, device_t child) -{ - int rv; - - rv = bus_print_child_header(dev, child); - rv += dma_print_res(device_get_ivars(child)); - rv += bus_print_child_footer(dev, child); - return (rv); -} - -static void -dma_probe_nomatch(device_t dev, device_t child) -{ - const char *type; - - device_printf(dev, "<%s>", ofw_bus_get_name(child)); - dma_print_res(device_get_ivars(child)); - type = ofw_bus_get_type(child); - printf(" type %s (no driver attached)\n", - type != NULL ? type : "unknown"); -} - -static struct resource_list * -dma_get_resource_list(device_t dev, device_t child) -{ - struct dma_devinfo *ddi; - - ddi = device_get_ivars(child); - return (&ddi->ddi_rl); -} - -static const struct ofw_bus_devinfo * -dma_get_devinfo(device_t bus, device_t child) -{ - struct dma_devinfo *ddi; - - ddi = device_get_ivars(child); - return (&ddi->ddi_obdinfo); -} - -static int -dma_print_res(struct dma_devinfo *ddi) -{ - int rv; - - rv = 0; - rv += resource_list_print_type(&ddi->ddi_rl, "mem", SYS_RES_MEMORY, - "%#jx"); - rv += resource_list_print_type(&ddi->ddi_rl, "irq", SYS_RES_IRQ, "%jd"); - return (rv); -} diff --git a/sys/sparc64/sbus/lsi64854.c b/sys/sparc64/sbus/lsi64854.c deleted file mode 100644 index 866f6c3cac18e0..00000000000000 --- a/sys/sparc64/sbus/lsi64854.c +++ /dev/null @@ -1,764 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD AND BSD-2-Clause-NetBSD - * - * Copyright (c) 2004 Scott Long - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ - -/* $NetBSD: lsi64854.c,v 1.33 2008/04/28 20:23:50 martin Exp $ */ - -/*- - * Copyright (c) 1998 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Paul Kranenburg. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include -#include - -#include -#include - -#include -#include - -#ifdef DEBUG -#define LDB_SCSI 1 -#define LDB_ENET 2 -#define LDB_PP 4 -#define LDB_ANY 0xff -int lsi64854debug = 0; -#define DPRINTF(a,x) \ - do { \ - if ((lsi64854debug & (a)) != 0) \ - printf x; \ - } while (/* CONSTCOND */0) -#else -#define DPRINTF(a,x) -#endif - -/* - * The rules say we cannot transfer more than the limit of this DMA chip (64k - * for old and 16Mb for new), and we cannot cross a 16Mb boundary. - */ -#define MAX_DMA_SZ (64 * 1024) -#define BOUNDARY (16 * 1024 * 1024) - -static void lsi64854_reset(struct lsi64854_softc *); -static void lsi64854_map_scsi(void *, bus_dma_segment_t *, int, int); -static int lsi64854_setup(struct lsi64854_softc *, void **, size_t *, - int, size_t *); -static int lsi64854_scsi_intr(void *); -static int lsi64854_enet_intr(void *); -static int lsi64854_setup_pp(struct lsi64854_softc *, void **, - size_t *, int, size_t *); -static int lsi64854_pp_intr(void *); - -/* - * Finish attaching this DMA device. - * Front-end must fill in these fields: - * sc_res - * sc_burst - * sc_channel (one of SCSI, ENET, PP) - * sc_client (one of SCSI, ENET, PP `soft_c' pointers) - */ -int -lsi64854_attach(struct lsi64854_softc *sc) -{ - bus_dma_lock_t *lockfunc; - struct ncr53c9x_softc *nsc; - void *lockfuncarg; - uint32_t csr; - int error; - - lockfunc = NULL; - lockfuncarg = NULL; - sc->sc_maxdmasize = MAX_DMA_SZ; - - switch (sc->sc_channel) { - case L64854_CHANNEL_SCSI: - nsc = sc->sc_client; - if (NCR_LOCK_INITIALIZED(nsc) == 0) { - device_printf(sc->sc_dev, "mutex not initialized\n"); - return (ENXIO); - } - lockfunc = busdma_lock_mutex; - lockfuncarg = &nsc->sc_lock; - sc->sc_maxdmasize = nsc->sc_maxxfer; - sc->intr = lsi64854_scsi_intr; - sc->setup = lsi64854_setup; - break; - case L64854_CHANNEL_ENET: - sc->intr = lsi64854_enet_intr; - break; - case L64854_CHANNEL_PP: - sc->intr = lsi64854_pp_intr; - sc->setup = lsi64854_setup_pp; - break; - default: - device_printf(sc->sc_dev, "unknown channel\n"); - } - sc->reset = lsi64854_reset; - - if (sc->setup != NULL) { - error = bus_dma_tag_create( - sc->sc_parent_dmat, /* parent */ - 1, BOUNDARY, /* alignment, boundary */ - BUS_SPACE_MAXADDR_32BIT, /* lowaddr */ - BUS_SPACE_MAXADDR, /* highaddr */ - NULL, NULL, /* filter, filterarg */ - sc->sc_maxdmasize, /* maxsize */ - 1, /* nsegments */ - sc->sc_maxdmasize, /* maxsegsize */ - BUS_DMA_ALLOCNOW, /* flags */ - lockfunc, lockfuncarg, /* lockfunc, lockfuncarg */ - &sc->sc_buffer_dmat); - if (error != 0) { - device_printf(sc->sc_dev, - "cannot allocate buffer DMA tag\n"); - return (error); - } - - error = bus_dmamap_create(sc->sc_buffer_dmat, 0, - &sc->sc_dmamap); - if (error != 0) { - device_printf(sc->sc_dev, "DMA map create failed\n"); - bus_dma_tag_destroy(sc->sc_buffer_dmat); - return (error); - } - } - - csr = L64854_GCSR(sc); - sc->sc_rev = csr & L64854_DEVID; - if (sc->sc_rev == DMAREV_HME) - return (0); - device_printf(sc->sc_dev, "DMA rev. "); - switch (sc->sc_rev) { - case DMAREV_0: - printf("0"); - break; - case DMAREV_ESC: - printf("ESC"); - break; - case DMAREV_1: - printf("1"); - break; - case DMAREV_PLUS: - printf("1+"); - break; - case DMAREV_2: - printf("2"); - break; - default: - printf("unknown (0x%x)", sc->sc_rev); - } - - DPRINTF(LDB_ANY, (", burst 0x%x, csr 0x%x", sc->sc_burst, csr)); - printf("\n"); - - return (0); -} - -int -lsi64854_detach(struct lsi64854_softc *sc) -{ - - if (sc->setup != NULL) { - bus_dmamap_sync(sc->sc_buffer_dmat, sc->sc_dmamap, - (L64854_GCSR(sc) & L64854_WRITE) != 0 ? - BUS_DMASYNC_PREREAD : BUS_DMASYNC_PREWRITE); - bus_dmamap_unload(sc->sc_buffer_dmat, sc->sc_dmamap); - bus_dmamap_destroy(sc->sc_buffer_dmat, sc->sc_dmamap); - bus_dma_tag_destroy(sc->sc_buffer_dmat); - } - - return (0); -} - -/* - * DMAWAIT waits while condition is true. - */ -#define DMAWAIT(SC, COND, MSG, DONTPANIC) do if (COND) { \ - int count = 500000; \ - while ((COND) && --count > 0) DELAY(1); \ - if (count == 0) { \ - printf("%s: line %d: CSR = 0x%lx\n", __FILE__, __LINE__, \ - (u_long)L64854_GCSR(SC)); \ - if (DONTPANIC) \ - printf(MSG); \ - else \ - panic(MSG); \ - } \ -} while (/* CONSTCOND */0) - -#define DMA_DRAIN(sc, dontpanic) do { \ - uint32_t csr; \ - /* \ - * DMA rev0 & rev1: we are not allowed to touch the DMA "flush" \ - * and "drain" bits while it is still thinking about a \ - * request. \ - * other revs: D_ESC_R_PEND bit reads as 0 \ - */ \ - DMAWAIT(sc, L64854_GCSR(sc) & D_ESC_R_PEND, "R_PEND", dontpanic);\ - if (sc->sc_rev != DMAREV_HME) { \ - /* \ - * Select drain bit based on revision \ - * also clears errors and D_TC flag \ - */ \ - csr = L64854_GCSR(sc); \ - if (sc->sc_rev == DMAREV_1 || sc->sc_rev == DMAREV_0) \ - csr |= D_ESC_DRAIN; \ - else \ - csr |= L64854_INVALIDATE; \ - \ - L64854_SCSR(sc, csr); \ - } \ - /* \ - * Wait for draining to finish \ - * rev0 & rev1 call this PACKCNT \ - */ \ - DMAWAIT(sc, L64854_GCSR(sc) & L64854_DRAINING, "DRAINING", \ - dontpanic); \ -} while (/* CONSTCOND */0) - -#define DMA_FLUSH(sc, dontpanic) do { \ - uint32_t csr; \ - /* \ - * DMA rev0 & rev1: we are not allowed to touch the DMA "flush" \ - * and "drain" bits while it is still thinking about a \ - * request. \ - * other revs: D_ESC_R_PEND bit reads as 0 \ - */ \ - DMAWAIT(sc, L64854_GCSR(sc) & D_ESC_R_PEND, "R_PEND", dontpanic);\ - csr = L64854_GCSR(sc); \ - csr &= ~(L64854_WRITE|L64854_EN_DMA); /* no-ops on ENET */ \ - csr |= L64854_INVALIDATE; /* XXX FAS ? */ \ - L64854_SCSR(sc, csr); \ -} while (/* CONSTCOND */0) - -static void -lsi64854_reset(struct lsi64854_softc *sc) -{ - bus_dma_tag_t dmat; - bus_dmamap_t dmam; - uint32_t csr; - - DMA_FLUSH(sc, 1); - csr = L64854_GCSR(sc); - - DPRINTF(LDB_ANY, ("%s: csr 0x%x\n", __func__, csr)); - - if (sc->sc_dmasize != 0) { - dmat = sc->sc_buffer_dmat; - dmam = sc->sc_dmamap; - bus_dmamap_sync(dmat, dmam, (csr & D_WRITE) != 0 ? - BUS_DMASYNC_PREREAD : BUS_DMASYNC_PREWRITE); - bus_dmamap_unload(dmat, dmam); - } - - if (sc->sc_rev == DMAREV_HME) - L64854_SCSR(sc, csr | D_HW_RESET_FAS366); - - csr |= L64854_RESET; /* reset DMA */ - L64854_SCSR(sc, csr); - DELAY(200); /* > 10 Sbus clocks(?) */ - - /*DMAWAIT1(sc); why was this here? */ - csr = L64854_GCSR(sc); - csr &= ~L64854_RESET; /* de-assert reset line */ - L64854_SCSR(sc, csr); - DELAY(5); /* allow a few ticks to settle */ - - csr = L64854_GCSR(sc); - csr |= L64854_INT_EN; /* enable interrupts */ - if (sc->sc_rev > DMAREV_1 && sc->sc_channel == L64854_CHANNEL_SCSI) { - if (sc->sc_rev == DMAREV_HME) - csr |= D_TWO_CYCLE; - else - csr |= D_FASTER; - } - - /* Set burst */ - switch (sc->sc_rev) { - case DMAREV_HME: - case DMAREV_2: - csr &= ~L64854_BURST_SIZE; - if (sc->sc_burst == 32) - csr |= L64854_BURST_32; - else if (sc->sc_burst == 16) - csr |= L64854_BURST_16; - else - csr |= L64854_BURST_0; - break; - case DMAREV_ESC: - csr |= D_ESC_AUTODRAIN; /* Auto-drain */ - if (sc->sc_burst == 32) - csr &= ~D_ESC_BURST; - else - csr |= D_ESC_BURST; - break; - default: - break; - } - L64854_SCSR(sc, csr); - - if (sc->sc_rev == DMAREV_HME) { - bus_write_4(sc->sc_res, L64854_REG_ADDR, 0); - sc->sc_dmactl = csr; - } - sc->sc_active = 0; - - DPRINTF(LDB_ANY, ("%s: done, csr 0x%x\n", __func__, csr)); -} - -static void -lsi64854_map_scsi(void *arg, bus_dma_segment_t *segs, int nseg, int error) -{ - struct lsi64854_softc *sc; - - sc = (struct lsi64854_softc *)arg; - - if (error != 0) - return; - if (nseg != 1) - panic("%s: cannot map %d segments\n", __func__, nseg); - - bus_dmamap_sync(sc->sc_buffer_dmat, sc->sc_dmamap, - sc->sc_datain != 0 ? BUS_DMASYNC_PREREAD : BUS_DMASYNC_PREWRITE); - bus_write_4(sc->sc_res, L64854_REG_ADDR, segs[0].ds_addr); -} - -/* - * setup a DMA transfer - */ -static int -lsi64854_setup(struct lsi64854_softc *sc, void **addr, size_t *len, - int datain, size_t *dmasize) -{ - long bcnt; - int error; - uint32_t csr; - - DMA_FLUSH(sc, 0); - -#if 0 - DMACSR(sc) &= ~D_INT_EN; -#endif - sc->sc_dmaaddr = addr; - sc->sc_dmalen = len; - sc->sc_datain = datain; - - KASSERT(*dmasize <= sc->sc_maxdmasize, - ("%s: transfer size %ld too large", __func__, (long)*dmasize)); - - sc->sc_dmasize = *dmasize; - - DPRINTF(LDB_ANY, ("%s: dmasize=%ld\n", __func__, (long)*dmasize)); - - /* - * XXX what length? - */ - if (sc->sc_rev == DMAREV_HME) { - L64854_SCSR(sc, sc->sc_dmactl | L64854_RESET); - L64854_SCSR(sc, sc->sc_dmactl); - - bus_write_4(sc->sc_res, L64854_REG_CNT, *dmasize); - } - - /* - * Load the transfer buffer and program the DMA address. - * Note that the NCR53C9x core can't handle EINPROGRESS so we set - * BUS_DMA_NOWAIT. - */ - if (*dmasize != 0) { - error = bus_dmamap_load(sc->sc_buffer_dmat, sc->sc_dmamap, - *sc->sc_dmaaddr, *dmasize, lsi64854_map_scsi, sc, - BUS_DMA_NOWAIT); - if (error != 0) - return (error); - } - - if (sc->sc_rev == DMAREV_ESC) { - /* DMA ESC chip bug work-around */ - bcnt = *dmasize; - if (((bcnt + (long)*sc->sc_dmaaddr) & PAGE_MASK_8K) != 0) - bcnt = roundup(bcnt, PAGE_SIZE_8K); - bus_write_4(sc->sc_res, L64854_REG_CNT, bcnt); - } - - /* Setup the DMA control register. */ - csr = L64854_GCSR(sc); - - if (datain != 0) - csr |= L64854_WRITE; - else - csr &= ~L64854_WRITE; - csr |= L64854_INT_EN; - - if (sc->sc_rev == DMAREV_HME) - csr |= (D_DSBL_SCSI_DRN | D_EN_DMA); - - L64854_SCSR(sc, csr); - - return (0); -} - -/* - * Pseudo (chained) interrupt from the esp driver to kick the - * current running DMA transfer. Called from ncr53c9x_intr() - * for now. - * - * return 1 if it was a DMA continue. - */ -static int -lsi64854_scsi_intr(void *arg) -{ - struct lsi64854_softc *sc = arg; - struct ncr53c9x_softc *nsc = sc->sc_client; - bus_dma_tag_t dmat; - bus_dmamap_t dmam; - size_t dmasize; - int lxfer, resid, trans; - uint32_t csr; - - csr = L64854_GCSR(sc); - - DPRINTF(LDB_SCSI, ("%s: addr 0x%x, csr %b\n", __func__, - bus_read_4(sc->sc_res, L64854_REG_ADDR), csr, DDMACSR_BITS)); - - if (csr & (D_ERR_PEND | D_SLAVE_ERR)) { - device_printf(sc->sc_dev, "error: csr=%b\n", csr, - DDMACSR_BITS); - csr &= ~D_EN_DMA; /* Stop DMA. */ - /* Invalidate the queue; SLAVE_ERR bit is write-to-clear */ - csr |= D_INVALIDATE | D_SLAVE_ERR; - L64854_SCSR(sc, csr); - return (-1); - } - - /* This is an "assertion" :) */ - if (sc->sc_active == 0) - panic("%s: DMA wasn't active", __func__); - - DMA_DRAIN(sc, 0); - - /* DMA has stopped */ - csr &= ~D_EN_DMA; - L64854_SCSR(sc, csr); - sc->sc_active = 0; - - dmasize = sc->sc_dmasize; - if (dmasize == 0) { - /* A "Transfer Pad" operation completed. */ - DPRINTF(LDB_SCSI, ("%s: discarded %d bytes (tcl=%d, " - "tcm=%d)\n", __func__, NCR_READ_REG(nsc, NCR_TCL) | - (NCR_READ_REG(nsc, NCR_TCM) << 8), - NCR_READ_REG(nsc, NCR_TCL), NCR_READ_REG(nsc, NCR_TCM))); - return (0); - } - - resid = 0; - /* - * If a transfer onto the SCSI bus gets interrupted by the device - * (e.g. for a SAVEPOINTER message), the data in the FIFO counts - * as residual since the NCR53C9X counter registers get decremented - * as bytes are clocked into the FIFO. - */ - if ((csr & D_WRITE) == 0 && - (resid = (NCR_READ_REG(nsc, NCR_FFLAG) & NCRFIFO_FF)) != 0) { - DPRINTF(LDB_SCSI, ("%s: empty esp FIFO of %d ", __func__, - resid)); - if (nsc->sc_rev == NCR_VARIANT_FAS366 && - (NCR_READ_REG(nsc, NCR_CFG3) & NCRFASCFG3_EWIDE)) - resid <<= 1; - } - - if ((nsc->sc_espstat & NCRSTAT_TC) == 0) { - lxfer = nsc->sc_features & NCR_F_LARGEXFER; - /* - * "Terminal count" is off, so read the residue - * out of the NCR53C9X counter registers. - */ - resid += (NCR_READ_REG(nsc, NCR_TCL) | - (NCR_READ_REG(nsc, NCR_TCM) << 8) | - (lxfer != 0 ? (NCR_READ_REG(nsc, NCR_TCH) << 16) : 0)); - - if (resid == 0 && dmasize == 65536 && lxfer == 0) - /* A transfer of 64k is encoded as TCL=TCM=0. */ - resid = 65536; - } - - trans = dmasize - resid; - if (trans < 0) { /* transferred < 0? */ -#if 0 - /* - * This situation can happen in perfectly normal operation - * if the ESP is reselected while using DMA to select - * another target. As such, don't print the warning. - */ - device_printf(sc->sc_dev, "xfer (%d) > req (%d)\n", trans, - dmasize); -#endif - trans = dmasize; - } - - DPRINTF(LDB_SCSI, ("%s: tcl=%d, tcm=%d, tch=%d; trans=%d, resid=%d\n", - __func__, NCR_READ_REG(nsc, NCR_TCL), NCR_READ_REG(nsc, NCR_TCM), - (nsc->sc_features & NCR_F_LARGEXFER) != 0 ? - NCR_READ_REG(nsc, NCR_TCH) : 0, trans, resid)); - - if (dmasize != 0) { - dmat = sc->sc_buffer_dmat; - dmam = sc->sc_dmamap; - bus_dmamap_sync(dmat, dmam, (csr & D_WRITE) != 0 ? - BUS_DMASYNC_POSTREAD : BUS_DMASYNC_POSTWRITE); - bus_dmamap_unload(dmat, dmam); - } - - *sc->sc_dmalen -= trans; - *sc->sc_dmaaddr = (char *)*sc->sc_dmaaddr + trans; - -#if 0 /* this is not normal operation just yet */ - if (*sc->sc_dmalen == 0 || nsc->sc_phase != nsc->sc_prevphase) - return (0); - - /* and again */ - dma_start(sc, sc->sc_dmaaddr, sc->sc_dmalen, DMACSR(sc) & D_WRITE); - return (1); -#endif - return (0); -} - -/* - * Pseudo (chained) interrupt to le(4) driver to handle DMA errors - */ -static int -lsi64854_enet_intr(void *arg) -{ - struct lsi64854_softc *sc = arg; - uint32_t csr; - int i, rv; - - csr = L64854_GCSR(sc); - - /* If the DMA logic shows an interrupt, claim it */ - rv = ((csr & E_INT_PEND) != 0) ? 1 : 0; - - if (csr & (E_ERR_PEND | E_SLAVE_ERR)) { - device_printf(sc->sc_dev, "error: csr=%b\n", csr, - EDMACSR_BITS); - csr &= ~L64854_EN_DMA; /* Stop DMA. */ - /* Invalidate the queue; SLAVE_ERR bit is write-to-clear */ - csr |= E_INVALIDATE | E_SLAVE_ERR; - L64854_SCSR(sc, csr); - /* Will be drained with the LE_C0_IDON interrupt. */ - sc->sc_dodrain = 1; - return (-1); - } - - /* XXX - is this necessary with E_DSBL_WR_INVAL on? */ - if (sc->sc_dodrain) { - i = 10; - csr |= E_DRAIN; - L64854_SCSR(sc, csr); - while (i-- > 0 && (L64854_GCSR(sc) & E_DRAINING)) - DELAY(1); - sc->sc_dodrain = 0; - } - - return (rv); -} - -static void -lsi64854_map_pp(void *arg, bus_dma_segment_t *segs, int nsegs, int error) -{ - struct lsi64854_softc *sc; - - sc = (struct lsi64854_softc *)arg; - - if (error != 0) - return; - if (nsegs != 1) - panic("%s: cannot map %d segments\n", __func__, nsegs); - - bus_dmamap_sync(sc->sc_buffer_dmat, sc->sc_dmamap, - sc->sc_datain != 0 ? BUS_DMASYNC_PREREAD : BUS_DMASYNC_PREWRITE); - bus_write_4(sc->sc_res, L64854_REG_ADDR, segs[0].ds_addr); - - bus_write_4(sc->sc_res, L64854_REG_CNT, sc->sc_dmasize); -} - -/* - * Setup a DMA transfer. - */ -static int -lsi64854_setup_pp(struct lsi64854_softc *sc, void **addr, size_t *len, - int datain, size_t *dmasize) -{ - int error; - uint32_t csr; - - DMA_FLUSH(sc, 0); - - sc->sc_dmaaddr = addr; - sc->sc_dmalen = len; - sc->sc_datain = datain; - - DPRINTF(LDB_PP, ("%s: pp start %ld@%p,%d\n", __func__, - (long)*sc->sc_dmalen, *sc->sc_dmaaddr, datain != 0 ? 1 : 0)); - - KASSERT(*dmasize <= sc->sc_maxdmasize, - ("%s: transfer size %ld too large", __func__, (long)*dmasize)); - - sc->sc_dmasize = *dmasize; - - DPRINTF(LDB_PP, ("%s: dmasize=%ld\n", __func__, (long)*dmasize)); - - /* Load the transfer buffer and program the DMA address. */ - if (*dmasize != 0) { - error = bus_dmamap_load(sc->sc_buffer_dmat, sc->sc_dmamap, - *sc->sc_dmaaddr, *dmasize, lsi64854_map_pp, sc, - BUS_DMA_NOWAIT); - if (error != 0) - return (error); - } - - /* Setup the DMA control register. */ - csr = L64854_GCSR(sc); - csr &= ~L64854_BURST_SIZE; - if (sc->sc_burst == 32) - csr |= L64854_BURST_32; - else if (sc->sc_burst == 16) - csr |= L64854_BURST_16; - else - csr |= L64854_BURST_0; - csr |= P_EN_DMA | P_INT_EN | P_EN_CNT; -#if 0 - /* This bit is read-only in PP csr register. */ - if (datain != 0) - csr |= P_WRITE; - else - csr &= ~P_WRITE; -#endif - L64854_SCSR(sc, csr); - - return (0); -} - -/* - * Parallel port DMA interrupt - */ -static int -lsi64854_pp_intr(void *arg) -{ - struct lsi64854_softc *sc = arg; - bus_dma_tag_t dmat; - bus_dmamap_t dmam; - size_t dmasize; - int ret, trans, resid = 0; - uint32_t csr; - - csr = L64854_GCSR(sc); - - DPRINTF(LDB_PP, ("%s: addr 0x%x, csr %b\n", __func__, - bus_read_4(sc->sc_res, L64854_REG_ADDR), csr, PDMACSR_BITS)); - - if ((csr & (P_ERR_PEND | P_SLAVE_ERR)) != 0) { - resid = bus_read_4(sc->sc_res, L64854_REG_CNT); - device_printf(sc->sc_dev, "error: resid %d csr=%b\n", resid, - csr, PDMACSR_BITS); - csr &= ~P_EN_DMA; /* Stop DMA. */ - /* Invalidate the queue; SLAVE_ERR bit is write-to-clear */ - csr |= P_INVALIDATE | P_SLAVE_ERR; - L64854_SCSR(sc, csr); - return (-1); - } - - ret = (csr & P_INT_PEND) != 0; - - if (sc->sc_active != 0) { - DMA_DRAIN(sc, 0); - resid = bus_read_4(sc->sc_res, L64854_REG_CNT); - } - - /* DMA has stopped */ - csr &= ~D_EN_DMA; - L64854_SCSR(sc, csr); - sc->sc_active = 0; - - dmasize = sc->sc_dmasize; - trans = dmasize - resid; - if (trans < 0) /* transferred < 0? */ - trans = dmasize; - *sc->sc_dmalen -= trans; - *sc->sc_dmaaddr = (char *)*sc->sc_dmaaddr + trans; - - if (dmasize != 0) { - dmat = sc->sc_buffer_dmat; - dmam = sc->sc_dmamap; - bus_dmamap_sync(dmat, dmam, (csr & D_WRITE) != 0 ? - BUS_DMASYNC_POSTREAD : BUS_DMASYNC_POSTWRITE); - bus_dmamap_unload(dmat, dmam); - } - - return (ret != 0); -} diff --git a/sys/sparc64/sbus/lsi64854reg.h b/sys/sparc64/sbus/lsi64854reg.h deleted file mode 100644 index 9726ec07d1e494..00000000000000 --- a/sys/sparc64/sbus/lsi64854reg.h +++ /dev/null @@ -1,200 +0,0 @@ -/* $NetBSD: lsi64854reg.h,v 1.6 2008/04/28 20:23:50 martin Exp $ */ - -/*- - * SPDX-License-Identifier: BSD-2-Clause-NetBSD - * - * Copyright (c) 1998 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Paul Kranenburg. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -/* $FreeBSD$ */ - -/* - * LSI 64854 DMA engine. Contains three independent channels - * designed to interface with (a) a NCR539X SCSI controller, - * (b) a AM7990 Ethernet controller, (c) Parallel port hardware.. - */ - -/* - * Register offsets to bus handle. - */ -#define L64854_REG_CSR 0 /* Control bits */ -#define L64854_REG_ADDR 4 /* DMA Address */ -#define L64854_REG_CNT 8 /* DMA count */ -#define L64854_REG_CNT_MASK 0x00ffffff /* only 24 bits */ -#define L64854_REG_ENBAR 12 /* ENET Base register */ -#define L64854_REG_TEST 12 /* SCSI Test register */ -#define L64854_REG_HCR 16 /* PP Hardware Configuration */ -#define L64854_REG_OCR 18 /* PP Operation Configuration */ -#define L64854_REG_DR 20 /* PP Data register */ -#define L64854_REG_TCR 21 /* PP Transfer Control */ -#define L64854_REG_OR 22 /* PP Output register */ -#define L64854_REG_IR 23 /* PP Input register */ -#define L64854_REG_ICR 24 /* PP Interrupt Control */ - - -/* - * Control bits common to all three channels. - */ -#define L64854_INT_PEND 0x00000001 /* Interrupt pending */ -#define L64854_ERR_PEND 0x00000002 /* Error pending */ -#define L64854_DRAINING 0x0000000c /* FIFO draining */ -#define L64854_INT_EN 0x00000010 /* Interrupt enable */ -#define L64854_INVALIDATE 0x00000020 /* Invalidate FIFO */ -#define L64854_SLAVE_ERR 0x00000040 /* Slave access size error */ -#define L64854_RESET 0x00000080 /* Reset device */ -#define L64854_WRITE 0x00000100 /* 1: xfer to memory */ -#define L64854_EN_DMA 0x00000200 /* enable DMA transfers */ - -#define L64854_BURST_SIZE 0x000c0000 /* Read/write burst size */ -#define L64854_BURST_0 0x00080000 /* no bursts (SCSI-only) */ -#define L64854_BURST_16 0x00000000 /* 16-byte bursts */ -#define L64854_BURST_32 0x00040000 /* 32-byte bursts */ -#define L64854_BURST_64 0x000c0000 /* 64-byte bursts (fas) */ - -#define L64854_RST_FAS366 0x08000000 /* FAS366 hardware reset */ - -#define L64854_DEVID 0xf0000000 /* device ID bits */ - -/* - * SCSI DMA control bits. - */ -#define D_INT_PEND L64854_INT_PEND /* interrupt pending */ -#define D_ERR_PEND L64854_ERR_PEND /* error pending */ -#define D_DRAINING L64854_DRAINING /* fifo draining */ -#define D_INT_EN L64854_INT_EN /* interrupt enable */ -#define D_INVALIDATE L64854_INVALIDATE/* invalidate fifo */ -#define D_SLAVE_ERR L64854_SLAVE_ERR/* slave access size error */ -#define D_RESET L64854_RESET /* reset scsi */ -#define D_WRITE L64854_WRITE /* 1 = dev -> mem */ -#define D_EN_DMA L64854_EN_DMA /* enable DMA requests */ -#define D_EN_CNT 0x00002000 /* enable byte counter */ -#define D_TC 0x00004000 /* terminal count */ -#define D_WIDE_EN 0x00008000 /* enable wide mode SBUS DMA (fas) */ -#define D_DSBL_CSR_DRN 0x00010000 /* disable fifo drain on csr */ -#define D_DSBL_SCSI_DRN 0x00020000 /* disable fifo drain on reg */ - -#define D_DIAG 0x00100000 /* disable fifo drain on addr */ -#define D_TWO_CYCLE 0x00200000 /* 2 clocks per transfer */ -#define D_FASTER 0x00400000 /* 3 clocks per transfer */ -#define D_TCI_DIS 0x00800000 /* disable intr on D_TC */ -#define D_EN_NEXT 0x01000000 /* enable auto next address */ -#define D_DMA_ON 0x02000000 /* enable dma from scsi XXX */ -#define D_DSBL_PARITY_CHK \ - 0x02000000 /* disable checking for parity on bus (default 1:fas) */ -#define D_A_LOADED 0x04000000 /* address loaded */ -#define D_NA_LOADED 0x08000000 /* next address loaded */ -#define D_HW_RESET_FAS366 \ - 0x08000000 /* hardware reset FAS366 (fas) */ -#define D_DEV_ID L64854_DEVID /* device ID */ -#define DMAREV_0 0x00000000 /* Sunray DMA */ -#define DMAREV_ESC 0x40000000 /* DMA ESC array */ -#define DMAREV_1 0x80000000 /* 'DMA' */ -#define DMAREV_PLUS 0x90000000 /* 'DMA+' */ -#define DMAREV_2 0xa0000000 /* 'DMA2' */ -#define DMAREV_HME 0xb0000000 /* 'HME' */ - -/* - * revisions 0,1 and ESC have different bits. - */ -#define D_ESC_DRAIN 0x00000040 /* rev0,1,esc: drain fifo */ -#define D_ESC_R_PEND 0x00000400 /* rev0,1: request pending */ -#define D_ESC_BURST 0x00000800 /* DMA ESC: 16 byte bursts */ -#define D_ESC_AUTODRAIN 0x00040000 /* DMA ESC: Auto-drain */ - -#define DDMACSR_BITS "\177\020" \ - "b\00INT\0b\01ERR\0f\02\02DRAINING\0b\04IEN\0" \ - "b\06SLVERR\0b\07RST\0b\10WRITE\0b\11ENDMA\0" \ - "b\15ENCNT\0b\16TC\0\b\20DSBL_CSR_DRN\0" \ - "b\21DSBL_SCSI_DRN\0f\22\2BURST\0b\25TWOCYCLE\0" \ - "b\26FASTER\0b\27TCIDIS\0b\30ENNXT\0b\031DMAON\0" \ - "b\32ALOADED\0b\33NALOADED\0" - - -/* - * ENET DMA control bits. - */ -#define E_INT_PEND L64854_INT_PEND /* interrupt pending */ -#define E_ERR_PEND L64854_ERR_PEND /* error pending */ -#define E_DRAINING L64854_DRAINING /* fifo draining */ -#define E_INT_EN L64854_INT_EN /* interrupt enable */ -#define E_INVALIDATE L64854_INVALIDATE/* invalidate fifo */ -#define E_SLAVE_ERR L64854_SLAVE_ERR/* slave access size error */ -#define E_RESET L64854_RESET /* reset ENET */ -#define E_reserved1 0x00000300 /* */ -#define E_DRAIN 0x00000400 /* force Ecache drain */ -#define E_DSBL_WR_DRN 0x00000800 /* disable Ecache drain on .. */ -#define E_DSBL_RD_DRN 0x00001000 /* disable Ecache drain on .. */ -#define E_reserved2 0x00006000 /* */ -#define E_ILACC 0x00008000 /* ... */ -#define E_DSBL_BUF_WR 0x00010000 /* no buffering of slave writes */ -#define E_DSBL_WR_INVAL 0x00020000 /* no Ecache invalidate on slave writes */ - -#define E_reserved3 0x00100000 /* */ -#define E_LOOP_TEST 0x00200000 /* loopback mode */ -#define E_TP_AUI 0x00400000 /* 1 for TP, 0 for AUI */ -#define E_reserved4 0x0c800000 /* */ -#define E_DEV_ID L64854_DEVID /* ID bits */ - -#define EDMACSR_BITS "\177\020" \ - "b\00INT\0b\01ERR\0f\02\02DRAINING\0b\04IEN\0" \ - "b\06SLVERR\0b\07RST\0b\10WRITE\0b\12DRAIN\0" \ - "b\13DSBL_WR_DRN\0b\14DSBL_RD_DRN\0b\17ILACC\0" \ - "b\20DSBL_BUF_WR\0b\21DSBL_WR_INVAL\0" \ - "b\25LOOPTEST\0b\26TP\0" - -/* - * PP DMA control bits. - */ -#define P_INT_PEND L64854_INT_PEND /* interrupt pending */ -#define P_ERR_PEND L64854_ERR_PEND /* error pending */ -#define P_DRAINING L64854_DRAINING /* fifo draining */ -#define P_INT_EN L64854_INT_EN /* interrupt enable */ -#define P_INVALIDATE L64854_INVALIDATE/* invalidate fifo */ -#define P_SLAVE_ERR L64854_SLAVE_ERR/* slave access size error */ -#define P_RESET L64854_RESET /* reset PP */ -#define P_WRITE L64854_WRITE /* 1: xfer to memory */ -#define P_EN_DMA L64854_EN_DMA /* enable DMA transfers */ -#define P_reserved1 0x00001c00 /* */ -#define P_EN_CNT 0x00002000 /* enable counter */ -#define P_TC 0x00004000 /* terminal count */ -#define P_reserved2 0x00038000 /* */ - -#define P_DIAG 0x00100000 /* ... */ -#define P_reserved3 0x00600000 /* */ -#define P_TCI_DIS 0x00800000 /* no interrupt on terminal count */ -#define P_EN_NEXT 0x01000000 /* enable DMA chaining */ -#define P_DMA_ON 0x02000000 /* DMA xfers enabled */ -#define P_A_LOADED 0x04000000 /* addr and byte count valid */ -#define P_NA_LOADED 0x08000000 /* next addr & count valid but not used */ -#define P_DEV_ID L64854_DEVID /* ID bits */ - -#define PDMACSR_BITS "\177\020" \ - "b\00INT\0b\01ERR\0f\02\02DRAINING\0b\04IEN\0" \ - "b\06SLVERR\0b\07RST\0b\10WRITE\0b\11ENDMA\0" \ - "b\15ENCNT\0b\16TC\0\b\24DIAG\0b\27TCIDIS\0" \ - "b\30ENNXT\0b\031DMAON\0b\32ALOADED\0b\33NALOADED\0" diff --git a/sys/sparc64/sbus/lsi64854var.h b/sys/sparc64/sbus/lsi64854var.h deleted file mode 100644 index b47a013957af71..00000000000000 --- a/sys/sparc64/sbus/lsi64854var.h +++ /dev/null @@ -1,96 +0,0 @@ -/* $NetBSD: lsi64854var.h,v 1.12 2008/04/28 20:23:50 martin Exp $ */ - -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 1998 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Paul Kranenburg. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -/* $FreeBSD$ */ - -struct lsi64854_softc { - device_t sc_dev; - - struct resource *sc_res; - u_int sc_rev; /* revision */ - int sc_burst; /* max suported burst size */ - - int sc_channel; -#define L64854_CHANNEL_SCSI 1 -#define L64854_CHANNEL_ENET 2 -#define L64854_CHANNEL_PP 3 - void *sc_client; - - int sc_active; /* DMA active? */ - bus_dmamap_t sc_dmamap; /* DMA map for bus_dma_* */ - - bus_dma_tag_t sc_parent_dmat; - bus_dma_tag_t sc_buffer_dmat; - bus_size_t sc_maxdmasize; - int sc_datain; - size_t sc_dmasize; - void **sc_dmaaddr; - size_t *sc_dmalen; - - void (*reset)(struct lsi64854_softc *);/* reset routine */ - int (*setup)(struct lsi64854_softc *, void **, size_t *, - int, size_t *); /* DMA setup */ - int (*intr)(void *); /* interrupt handler */ - - u_int sc_dmactl; - int sc_dodrain; -}; - -#define L64854_GCSR(sc) bus_read_4((sc)->sc_res, L64854_REG_CSR) -#define L64854_SCSR(sc, csr) bus_write_4((sc)->sc_res, L64854_REG_CSR, csr) - -/* - * DMA engine interface functions. - */ -#define DMA_RESET(sc) (((sc)->reset)(sc)) -#define DMA_INTR(sc) (((sc)->intr)(sc)) -#define DMA_SETUP(sc, a, l, d, s) (((sc)->setup)(sc, a, l, d, s)) -#define DMA_ISACTIVE(sc) ((sc)->sc_active) - -#define DMA_ENINTR(sc) do { \ - uint32_t csr = L64854_GCSR(sc); \ - csr |= L64854_INT_EN; \ - L64854_SCSR(sc, csr); \ -} while (/* CONSTCOND */0) - -#define DMA_ISINTR(sc) (L64854_GCSR(sc) & (D_INT_PEND|D_ERR_PEND)) - -#define DMA_GO(sc) do { \ - uint32_t csr = L64854_GCSR(sc); \ - csr |= D_EN_DMA; \ - L64854_SCSR(sc, csr); \ - sc->sc_active = 1; \ -} while (/* CONSTCOND */0) - -int lsi64854_attach(struct lsi64854_softc *); -int lsi64854_detach(struct lsi64854_softc *); diff --git a/sys/sparc64/sbus/ofw_sbus.h b/sys/sparc64/sbus/ofw_sbus.h deleted file mode 100644 index 38cad40a6839d5..00000000000000 --- a/sys/sparc64/sbus/ofw_sbus.h +++ /dev/null @@ -1,55 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 1998 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Paul Kranenburg. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * from: NetBSD: sbusvar.h,v 1.15 2008/04/28 20:23:36 martin Exp - * - * $FreeBSD$ - */ - -#ifndef _SPARC64_SBUS_OFW_SBUS_H_ -#define _SPARC64_SBUS_OFW_SBUS_H_ - -/* Device register space description */ -struct sbus_regs { - u_int32_t sbr_slot; - u_int32_t sbr_offset; - u_int32_t sbr_size; -}; - -/* Address translation across busses */ -struct sbus_ranges { - u_int32_t cspace; /* Client space */ - u_int32_t coffset; /* Client offset */ - u_int32_t pspace; /* Parent space */ - u_int32_t poffset; /* Parent offset */ - u_int32_t size; /* Size in bytes of this range */ -}; - -#endif /* ! _SPARC64_SBUS_OFW_SBUS_H_ */ diff --git a/sys/sparc64/sbus/sbus.c b/sys/sparc64/sbus/sbus.c deleted file mode 100644 index 7731d97fb4712e..00000000000000 --- a/sys/sparc64/sbus/sbus.c +++ /dev/null @@ -1,938 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1999-2002 Eduardo Horvath - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: NetBSD: sbus.c,v 1.50 2002/06/20 18:26:24 eeh Exp - */ -/*- - * Copyright (c) 2002 by Thomas Moestl . - * Copyright (c) 2005 Marius Strobl - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -__FBSDID("$FreeBSD$"); - -/* - * SBus support. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -struct sbus_devinfo { - int sdi_burstsz; - int sdi_clockfreq; - int sdi_slot; - - struct ofw_bus_devinfo sdi_obdinfo; - struct resource_list sdi_rl; -}; - -/* Range descriptor, allocated for each sc_range. */ -struct sbus_rd { - bus_addr_t rd_poffset; - bus_addr_t rd_pend; - int rd_slot; - bus_addr_t rd_coffset; - bus_addr_t rd_cend; - struct rman rd_rman; - bus_space_handle_t rd_bushandle; - struct resource *rd_res; -}; - -struct sbus_softc { - device_t sc_dev; - bus_dma_tag_t sc_cdmatag; - int sc_clockfreq; /* clock frequency (in Hz) */ - int sc_nrange; - struct sbus_rd *sc_rd; - int sc_burst; /* burst transfer sizes supp. */ - - struct resource *sc_sysio_res; - int sc_ign; /* IGN for this sysio */ - struct iommu_state sc_is; /* IOMMU state (iommuvar.h) */ - - struct resource *sc_ot_ires; - void *sc_ot_ihand; - struct resource *sc_pf_ires; - void *sc_pf_ihand; -}; - -#define SYSIO_READ8(sc, off) \ - bus_read_8((sc)->sc_sysio_res, (off)) -#define SYSIO_WRITE8(sc, off, v) \ - bus_write_8((sc)->sc_sysio_res, (off), (v)) - -static device_probe_t sbus_probe; -static device_attach_t sbus_attach; -static bus_print_child_t sbus_print_child; -static bus_probe_nomatch_t sbus_probe_nomatch; -static bus_read_ivar_t sbus_read_ivar; -static bus_get_resource_list_t sbus_get_resource_list; -static bus_setup_intr_t sbus_setup_intr; -static bus_alloc_resource_t sbus_alloc_resource; -static bus_activate_resource_t sbus_activate_resource; -static bus_adjust_resource_t sbus_adjust_resource; -static bus_release_resource_t sbus_release_resource; -static bus_get_dma_tag_t sbus_get_dma_tag; -static ofw_bus_get_devinfo_t sbus_get_devinfo; - -static int sbus_inlist(const char *, const char *const *); -static struct sbus_devinfo * sbus_setup_dinfo(device_t, struct sbus_softc *, - phandle_t); -static void sbus_destroy_dinfo(struct sbus_devinfo *); -static void sbus_intr_enable(void *); -static void sbus_intr_disable(void *); -static void sbus_intr_assign(void *); -static void sbus_intr_clear(void *); -static int sbus_find_intrmap(struct sbus_softc *, u_int, bus_addr_t *, - bus_addr_t *); -static driver_intr_t sbus_overtemp; -static driver_intr_t sbus_pwrfail; -static int sbus_print_res(struct sbus_devinfo *); - -static device_method_t sbus_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, sbus_probe), - DEVMETHOD(device_attach, sbus_attach), - DEVMETHOD(device_shutdown, bus_generic_shutdown), - DEVMETHOD(device_suspend, bus_generic_suspend), - DEVMETHOD(device_resume, bus_generic_resume), - - /* Bus interface */ - DEVMETHOD(bus_print_child, sbus_print_child), - DEVMETHOD(bus_probe_nomatch, sbus_probe_nomatch), - DEVMETHOD(bus_read_ivar, sbus_read_ivar), - DEVMETHOD(bus_alloc_resource, sbus_alloc_resource), - DEVMETHOD(bus_activate_resource, sbus_activate_resource), - DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), - DEVMETHOD(bus_adjust_resource, sbus_adjust_resource), - DEVMETHOD(bus_release_resource, sbus_release_resource), - DEVMETHOD(bus_setup_intr, sbus_setup_intr), - DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), - DEVMETHOD(bus_get_resource, bus_generic_rl_get_resource), - DEVMETHOD(bus_get_resource_list, sbus_get_resource_list), - DEVMETHOD(bus_child_pnpinfo_str, ofw_bus_gen_child_pnpinfo_str), - DEVMETHOD(bus_get_dma_tag, sbus_get_dma_tag), - - /* ofw_bus interface */ - DEVMETHOD(ofw_bus_get_devinfo, sbus_get_devinfo), - DEVMETHOD(ofw_bus_get_compat, ofw_bus_gen_get_compat), - DEVMETHOD(ofw_bus_get_model, ofw_bus_gen_get_model), - DEVMETHOD(ofw_bus_get_name, ofw_bus_gen_get_name), - DEVMETHOD(ofw_bus_get_node, ofw_bus_gen_get_node), - DEVMETHOD(ofw_bus_get_type, ofw_bus_gen_get_type), - - DEVMETHOD_END -}; - -static driver_t sbus_driver = { - "sbus", - sbus_methods, - sizeof(struct sbus_softc), -}; - -static devclass_t sbus_devclass; - -EARLY_DRIVER_MODULE(sbus, nexus, sbus_driver, sbus_devclass, NULL, NULL, - BUS_PASS_BUS); -MODULE_DEPEND(sbus, nexus, 1, 1, 1); -MODULE_VERSION(sbus, 1); - -#define OFW_SBUS_TYPE "sbus" -#define OFW_SBUS_NAME "sbus" - -static const struct intr_controller sbus_ic = { - sbus_intr_enable, - sbus_intr_disable, - sbus_intr_assign, - sbus_intr_clear -}; - -struct sbus_icarg { - struct sbus_softc *sica_sc; - bus_addr_t sica_map; - bus_addr_t sica_clr; -}; - -static const char *const sbus_order_first[] = { - "auxio", - "dma", - NULL -}; - -static int -sbus_inlist(const char *name, const char *const *list) -{ - int i; - - if (name == NULL) - return (0); - for (i = 0; list[i] != NULL; i++) { - if (strcmp(name, list[i]) == 0) - return (1); - } - return (0); -} - -static int -sbus_probe(device_t dev) -{ - const char *t; - - t = ofw_bus_get_type(dev); - if (((t == NULL || strcmp(t, OFW_SBUS_TYPE) != 0)) && - strcmp(ofw_bus_get_name(dev), OFW_SBUS_NAME) != 0) - return (ENXIO); - device_set_desc(dev, "U2S UPA-SBus bridge"); - return (0); -} - -static int -sbus_attach(device_t dev) -{ - struct sbus_softc *sc; - struct sbus_devinfo *sdi; - struct sbus_icarg *sica; - struct sbus_ranges *range; - struct resource *res; - struct resource_list *rl; - device_t cdev; - bus_addr_t intrclr, intrmap, phys; - bus_size_t size; - u_long vec; - phandle_t child, node; - uint32_t prop; - int i, j; - - sc = device_get_softc(dev); - sc->sc_dev = dev; - node = ofw_bus_get_node(dev); - - i = 0; - sc->sc_sysio_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &i, - RF_ACTIVE); - if (sc->sc_sysio_res == NULL) - panic("%s: cannot allocate device memory", __func__); - - if (OF_getprop(node, "interrupts", &prop, sizeof(prop)) == -1) - panic("%s: cannot get IGN", __func__); - sc->sc_ign = INTIGN(prop); - - /* - * Record clock frequency for synchronous SCSI. - * IS THIS THE CORRECT DEFAULT?? - */ - if (OF_getprop(node, "clock-frequency", &prop, sizeof(prop)) == -1) - prop = 25000000; - sc->sc_clockfreq = prop; - prop /= 1000; - device_printf(dev, "clock %d.%03d MHz\n", prop / 1000, prop % 1000); - - /* - * Collect address translations from the OBP. - */ - if ((sc->sc_nrange = OF_getprop_alloc_multi(node, "ranges", - sizeof(*range), (void **)&range)) == -1) { - panic("%s: error getting ranges property", __func__); - } - sc->sc_rd = malloc(sizeof(*sc->sc_rd) * sc->sc_nrange, M_DEVBUF, - M_NOWAIT | M_ZERO); - if (sc->sc_rd == NULL) - panic("%s: cannot allocate rmans", __func__); - /* - * Preallocate all space that the SBus bridge decodes, so that nothing - * else gets in the way; set up rmans etc. - */ - rl = BUS_GET_RESOURCE_LIST(device_get_parent(dev), dev); - for (i = 0; i < sc->sc_nrange; i++) { - phys = range[i].poffset | ((bus_addr_t)range[i].pspace << 32); - size = range[i].size; - sc->sc_rd[i].rd_slot = range[i].cspace; - sc->sc_rd[i].rd_coffset = range[i].coffset; - sc->sc_rd[i].rd_cend = sc->sc_rd[i].rd_coffset + size; - j = resource_list_add_next(rl, SYS_RES_MEMORY, phys, - phys + size - 1, size); - if ((res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &j, - RF_ACTIVE)) == NULL) - panic("%s: cannot allocate decoded range", __func__); - sc->sc_rd[i].rd_bushandle = rman_get_bushandle(res); - sc->sc_rd[i].rd_rman.rm_type = RMAN_ARRAY; - sc->sc_rd[i].rd_rman.rm_descr = "SBus Device Memory"; - if (rman_init(&sc->sc_rd[i].rd_rman) != 0 || - rman_manage_region(&sc->sc_rd[i].rd_rman, 0, size) != 0) - panic("%s: failed to set up memory rman", __func__); - sc->sc_rd[i].rd_poffset = phys; - sc->sc_rd[i].rd_pend = phys + size; - sc->sc_rd[i].rd_res = res; - } - OF_prop_free(range); - - /* - * Get the SBus burst transfer size if burst transfers are supported. - */ - if (OF_getprop(node, "up-burst-sizes", &sc->sc_burst, - sizeof(sc->sc_burst)) == -1 || sc->sc_burst == 0) - sc->sc_burst = - (SBUS_BURST64_DEF << SBUS_BURST64_SHIFT) | SBUS_BURST_DEF; - - /* initialise the IOMMU */ - - /* punch in our copies */ - sc->sc_is.is_pmaxaddr = IOMMU_MAXADDR(SBUS_IOMMU_BITS); - sc->sc_is.is_bustag = rman_get_bustag(sc->sc_sysio_res); - sc->sc_is.is_bushandle = rman_get_bushandle(sc->sc_sysio_res); - sc->sc_is.is_iommu = SBR_IOMMU; - sc->sc_is.is_dtag = SBR_IOMMU_TLB_TAG_DIAG; - sc->sc_is.is_ddram = SBR_IOMMU_TLB_DATA_DIAG; - sc->sc_is.is_dqueue = SBR_IOMMU_QUEUE_DIAG; - sc->sc_is.is_dva = SBR_IOMMU_SVADIAG; - sc->sc_is.is_dtcmp = 0; - sc->sc_is.is_sb[0] = SBR_STRBUF; - sc->sc_is.is_sb[1] = 0; - - /* - * Note: the SBus IOMMU ignores the high bits of an address, so a NULL - * DMA pointer will be translated by the first page of the IOTSB. - * To detect bugs we'll allocate and ignore the first entry. - */ - iommu_init(device_get_nameunit(dev), &sc->sc_is, 3, -1, 1); - - /* Create the DMA tag. */ - if (bus_dma_tag_create(bus_get_dma_tag(dev), 8, 0, - sc->sc_is.is_pmaxaddr, ~0, NULL, NULL, sc->sc_is.is_pmaxaddr, - 0xff, 0xffffffff, 0, NULL, NULL, &sc->sc_cdmatag) != 0) - panic("%s: bus_dma_tag_create failed", __func__); - /* Customize the tag. */ - sc->sc_cdmatag->dt_cookie = &sc->sc_is; - sc->sc_cdmatag->dt_mt = &iommu_dma_methods; - - /* - * Hunt through all the interrupt mapping regs and register our - * interrupt controller for the corresponding interrupt vectors. - * We do this early in order to be able to catch stray interrupts. - */ - for (i = 0; i <= SBUS_MAX_INO; i++) { - if (sbus_find_intrmap(sc, i, &intrmap, &intrclr) == 0) - continue; - sica = malloc(sizeof(*sica), M_DEVBUF, M_NOWAIT); - if (sica == NULL) - panic("%s: could not allocate interrupt controller " - "argument", __func__); - sica->sica_sc = sc; - sica->sica_map = intrmap; - sica->sica_clr = intrclr; -#ifdef SBUS_DEBUG - device_printf(dev, - "intr map (INO %d, %s) %#lx: %#lx, clr: %#lx\n", - i, (i & INTMAP_OBIO_MASK) == 0 ? "SBus slot" : "OBIO", - (u_long)intrmap, (u_long)SYSIO_READ8(sc, intrmap), - (u_long)intrclr); -#endif - j = intr_controller_register(INTMAP_VEC(sc->sc_ign, i), - &sbus_ic, sica); - if (j != 0) - device_printf(dev, "could not register interrupt " - "controller for INO %d (%d)\n", i, j); - } - - /* Enable the over-temperature and power-fail interrupts. */ - i = 4; - sc->sc_ot_ires = bus_alloc_resource_any(dev, SYS_RES_IRQ, &i, - RF_ACTIVE); - if (sc->sc_ot_ires == NULL || - INTIGN(vec = rman_get_start(sc->sc_ot_ires)) != sc->sc_ign || - INTVEC(SYSIO_READ8(sc, SBR_THERM_INT_MAP)) != vec || - intr_vectors[vec].iv_ic != &sbus_ic || - bus_setup_intr(dev, sc->sc_ot_ires, INTR_TYPE_MISC | INTR_BRIDGE | INTR_MPSAFE, - NULL, sbus_overtemp, sc, &sc->sc_ot_ihand) != 0) - panic("%s: failed to set up temperature interrupt", __func__); - i = 3; - sc->sc_pf_ires = bus_alloc_resource_any(dev, SYS_RES_IRQ, &i, - RF_ACTIVE); - if (sc->sc_pf_ires == NULL || - INTIGN(vec = rman_get_start(sc->sc_pf_ires)) != sc->sc_ign || - INTVEC(SYSIO_READ8(sc, SBR_POWER_INT_MAP)) != vec || - intr_vectors[vec].iv_ic != &sbus_ic || - bus_setup_intr(dev, sc->sc_pf_ires, INTR_TYPE_MISC | INTR_BRIDGE | INTR_MPSAFE, - NULL, sbus_pwrfail, sc, &sc->sc_pf_ihand) != 0) - panic("%s: failed to set up power fail interrupt", __func__); - - /* Initialize the counter-timer. */ - sparc64_counter_init(device_get_nameunit(dev), - rman_get_bustag(sc->sc_sysio_res), - rman_get_bushandle(sc->sc_sysio_res), SBR_TC0); - - /* - * Loop through ROM children, fixing any relative addresses - * and then configuring each device. - */ - for (child = OF_child(node); child != 0; child = OF_peer(child)) { - if ((sdi = sbus_setup_dinfo(dev, sc, child)) == NULL) - continue; - /* - * For devices where there are variants that are actually - * split into two SBus devices (as opposed to the first - * half of the device being a SBus device and the second - * half hanging off of the first one) like 'auxio' and - * 'SUNW,fdtwo' or 'dma' and 'esp' probe the SBus device - * which is a prerequisite to the driver attaching to the - * second one with a lower order. Saves us from dealing - * with different probe orders in the respective device - * drivers which generally is more hackish. - */ - cdev = device_add_child_ordered(dev, (OF_child(child) == 0 && - sbus_inlist(sdi->sdi_obdinfo.obd_name, sbus_order_first)) ? - SBUS_ORDER_FIRST : SBUS_ORDER_NORMAL, NULL, -1); - if (cdev == NULL) { - device_printf(dev, - "<%s>: device_add_child_ordered failed\n", - sdi->sdi_obdinfo.obd_name); - sbus_destroy_dinfo(sdi); - continue; - } - device_set_ivars(cdev, sdi); - } - return (bus_generic_attach(dev)); -} - -static struct sbus_devinfo * -sbus_setup_dinfo(device_t dev, struct sbus_softc *sc, phandle_t node) -{ - struct sbus_devinfo *sdi; - struct sbus_regs *reg; - u_int32_t base, iv, *intr; - int i, nreg, nintr, slot, rslot; - - sdi = malloc(sizeof(*sdi), M_DEVBUF, M_ZERO | M_WAITOK); - if (ofw_bus_gen_setup_devinfo(&sdi->sdi_obdinfo, node) != 0) { - free(sdi, M_DEVBUF); - return (NULL); - } - resource_list_init(&sdi->sdi_rl); - slot = -1; - nreg = OF_getprop_alloc_multi(node, "reg", sizeof(*reg), (void **)®); - if (nreg == -1) { - if (sdi->sdi_obdinfo.obd_type == NULL || - strcmp(sdi->sdi_obdinfo.obd_type, "hierarchical") != 0) { - device_printf(dev, "<%s>: incomplete\n", - sdi->sdi_obdinfo.obd_name); - goto fail; - } - } else { - for (i = 0; i < nreg; i++) { - base = reg[i].sbr_offset; - if (SBUS_ABS(base)) { - rslot = SBUS_ABS_TO_SLOT(base); - base = SBUS_ABS_TO_OFFSET(base); - } else - rslot = reg[i].sbr_slot; - if (slot != -1 && slot != rslot) { - device_printf(dev, "<%s>: multiple slots\n", - sdi->sdi_obdinfo.obd_name); - OF_prop_free(reg); - goto fail; - } - slot = rslot; - - resource_list_add(&sdi->sdi_rl, SYS_RES_MEMORY, i, - base, base + reg[i].sbr_size, reg[i].sbr_size); - } - OF_prop_free(reg); - } - sdi->sdi_slot = slot; - - /* - * The `interrupts' property contains the SBus interrupt level. - */ - nintr = OF_getprop_alloc_multi(node, "interrupts", sizeof(*intr), - (void **)&intr); - if (nintr != -1) { - for (i = 0; i < nintr; i++) { - iv = intr[i]; - /* - * SBus card devices need the slot number encoded into - * the vector as this is generally not done. - */ - if ((iv & INTMAP_OBIO_MASK) == 0) - iv |= slot << 3; - iv = INTMAP_VEC(sc->sc_ign, iv); - resource_list_add(&sdi->sdi_rl, SYS_RES_IRQ, i, - iv, iv, 1); - } - OF_prop_free(intr); - } - if (OF_getprop(node, "burst-sizes", &sdi->sdi_burstsz, - sizeof(sdi->sdi_burstsz)) == -1) - sdi->sdi_burstsz = sc->sc_burst; - else - sdi->sdi_burstsz &= sc->sc_burst; - if (OF_getprop(node, "clock-frequency", &sdi->sdi_clockfreq, - sizeof(sdi->sdi_clockfreq)) == -1) - sdi->sdi_clockfreq = sc->sc_clockfreq; - - return (sdi); - -fail: - sbus_destroy_dinfo(sdi); - return (NULL); -} - -static void -sbus_destroy_dinfo(struct sbus_devinfo *dinfo) -{ - - resource_list_free(&dinfo->sdi_rl); - ofw_bus_gen_destroy_devinfo(&dinfo->sdi_obdinfo); - free(dinfo, M_DEVBUF); -} - -static int -sbus_print_child(device_t dev, device_t child) -{ - int rv; - - rv = bus_print_child_header(dev, child); - rv += sbus_print_res(device_get_ivars(child)); - rv += bus_print_child_footer(dev, child); - return (rv); -} - -static void -sbus_probe_nomatch(device_t dev, device_t child) -{ - const char *type; - - device_printf(dev, "<%s>", ofw_bus_get_name(child)); - sbus_print_res(device_get_ivars(child)); - type = ofw_bus_get_type(child); - printf(" type %s (no driver attached)\n", - type != NULL ? type : "unknown"); -} - -static int -sbus_read_ivar(device_t dev, device_t child, int which, uintptr_t *result) -{ - struct sbus_softc *sc; - struct sbus_devinfo *dinfo; - - sc = device_get_softc(dev); - if ((dinfo = device_get_ivars(child)) == NULL) - return (ENOENT); - switch (which) { - case SBUS_IVAR_BURSTSZ: - *result = dinfo->sdi_burstsz; - break; - case SBUS_IVAR_CLOCKFREQ: - *result = dinfo->sdi_clockfreq; - break; - case SBUS_IVAR_IGN: - *result = sc->sc_ign; - break; - case SBUS_IVAR_SLOT: - *result = dinfo->sdi_slot; - break; - default: - return (ENOENT); - } - return (0); -} - -static struct resource_list * -sbus_get_resource_list(device_t dev, device_t child) -{ - struct sbus_devinfo *sdi; - - sdi = device_get_ivars(child); - return (&sdi->sdi_rl); -} - -static void -sbus_intr_enable(void *arg) -{ - struct intr_vector *iv = arg; - struct sbus_icarg *sica = iv->iv_icarg; - - SYSIO_WRITE8(sica->sica_sc, sica->sica_map, - INTMAP_ENABLE(iv->iv_vec, iv->iv_mid)); -} - -static void -sbus_intr_disable(void *arg) -{ - struct intr_vector *iv = arg; - struct sbus_icarg *sica = iv->iv_icarg; - - SYSIO_WRITE8(sica->sica_sc, sica->sica_map, iv->iv_vec); -} - -static void -sbus_intr_assign(void *arg) -{ - struct intr_vector *iv = arg; - struct sbus_icarg *sica = iv->iv_icarg; - - SYSIO_WRITE8(sica->sica_sc, sica->sica_map, INTMAP_TID( - SYSIO_READ8(sica->sica_sc, sica->sica_map), iv->iv_mid)); -} - -static void -sbus_intr_clear(void *arg) -{ - struct intr_vector *iv = arg; - struct sbus_icarg *sica = iv->iv_icarg; - - SYSIO_WRITE8(sica->sica_sc, sica->sica_clr, INTCLR_IDLE); -} - -static int -sbus_find_intrmap(struct sbus_softc *sc, u_int ino, bus_addr_t *intrmapptr, - bus_addr_t *intrclrptr) -{ - bus_addr_t intrclr, intrmap; - int i; - - if (ino > SBUS_MAX_INO) { - device_printf(sc->sc_dev, "out of range INO %d requested\n", - ino); - return (0); - } - - if ((ino & INTMAP_OBIO_MASK) == 0) { - intrmap = SBR_SLOT0_INT_MAP + INTSLOT(ino) * 8; - intrclr = SBR_SLOT0_INT_CLR + - (INTSLOT(ino) * 8 * 8) + (INTPRI(ino) * 8); - } else { - intrclr = 0; - for (i = 0, intrmap = SBR_SCSI_INT_MAP; - intrmap <= SBR_RESERVED_INT_MAP; intrmap += 8, i++) { - if (INTVEC(SYSIO_READ8(sc, intrmap)) == - INTMAP_VEC(sc->sc_ign, ino)) { - intrclr = SBR_SCSI_INT_CLR + i * 8; - break; - } - } - if (intrclr == 0) - return (0); - } - if (intrmapptr != NULL) - *intrmapptr = intrmap; - if (intrclrptr != NULL) - *intrclrptr = intrclr; - return (1); -} - -static int -sbus_setup_intr(device_t dev, device_t child, struct resource *ires, int flags, - driver_filter_t *filt, driver_intr_t *intr, void *arg, void **cookiep) -{ - struct sbus_softc *sc; - u_long vec; - - sc = device_get_softc(dev); - /* - * Make sure the vector is fully specified and we registered - * our interrupt controller for it. - */ - vec = rman_get_start(ires); - if (INTIGN(vec) != sc->sc_ign || intr_vectors[vec].iv_ic != &sbus_ic) { - device_printf(dev, "invalid interrupt vector 0x%lx\n", vec); - return (EINVAL); - } - return (bus_generic_setup_intr(dev, child, ires, flags, filt, intr, - arg, cookiep)); -} - -static struct resource * -sbus_alloc_resource(device_t bus, device_t child, int type, int *rid, - rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) -{ - struct sbus_softc *sc; - struct rman *rm; - struct resource *rv; - struct resource_list *rl; - struct resource_list_entry *rle; - device_t schild; - bus_addr_t toffs; - bus_size_t tend; - int i, slot; - int isdefault, passthrough; - - isdefault = RMAN_IS_DEFAULT_RANGE(start, end); - passthrough = (device_get_parent(child) != bus); - rle = NULL; - sc = device_get_softc(bus); - rl = BUS_GET_RESOURCE_LIST(bus, child); - switch (type) { - case SYS_RES_IRQ: - return (resource_list_alloc(rl, bus, child, type, rid, start, - end, count, flags)); - case SYS_RES_MEMORY: - if (!passthrough) { - rle = resource_list_find(rl, type, *rid); - if (rle == NULL) - return (NULL); - if (rle->res != NULL) - panic("%s: resource entry is busy", __func__); - if (isdefault) { - start = rle->start; - count = ulmax(count, rle->count); - end = ulmax(rle->end, start + count - 1); - } - } - rm = NULL; - schild = child; - while (device_get_parent(schild) != bus) - schild = device_get_parent(schild); - slot = sbus_get_slot(schild); - for (i = 0; i < sc->sc_nrange; i++) { - if (sc->sc_rd[i].rd_slot != slot || - start < sc->sc_rd[i].rd_coffset || - start > sc->sc_rd[i].rd_cend) - continue; - /* Disallow cross-range allocations. */ - if (end > sc->sc_rd[i].rd_cend) - return (NULL); - /* We've found the connection to the parent bus */ - toffs = start - sc->sc_rd[i].rd_coffset; - tend = end - sc->sc_rd[i].rd_coffset; - rm = &sc->sc_rd[i].rd_rman; - break; - } - if (rm == NULL) - return (NULL); - - rv = rman_reserve_resource(rm, toffs, tend, count, flags & - ~RF_ACTIVE, child); - if (rv == NULL) - return (NULL); - rman_set_rid(rv, *rid); - - if ((flags & RF_ACTIVE) != 0 && bus_activate_resource(child, - type, *rid, rv)) { - rman_release_resource(rv); - return (NULL); - } - if (!passthrough) - rle->res = rv; - return (rv); - default: - return (NULL); - } -} - -static int -sbus_activate_resource(device_t bus, device_t child, int type, int rid, - struct resource *r) -{ - struct sbus_softc *sc; - struct bus_space_tag *tag; - int i; - - switch (type) { - case SYS_RES_IRQ: - return (bus_generic_activate_resource(bus, child, type, rid, - r)); - case SYS_RES_MEMORY: - sc = device_get_softc(bus); - for (i = 0; i < sc->sc_nrange; i++) { - if (rman_is_region_manager(r, - &sc->sc_rd[i].rd_rman) != 0) { - tag = sparc64_alloc_bus_tag(r, SBUS_BUS_SPACE); - if (tag == NULL) - return (ENOMEM); - rman_set_bustag(r, tag); - rman_set_bushandle(r, - sc->sc_rd[i].rd_bushandle + - rman_get_start(r)); - return (rman_activate_resource(r)); - } - } - /* FALLTHROUGH */ - default: - return (EINVAL); - } -} - -static int -sbus_adjust_resource(device_t bus, device_t child, int type, - struct resource *r, rman_res_t start, rman_res_t end) -{ - struct sbus_softc *sc; - int i; - - if (type == SYS_RES_MEMORY) { - sc = device_get_softc(bus); - for (i = 0; i < sc->sc_nrange; i++) - if (rman_is_region_manager(r, - &sc->sc_rd[i].rd_rman) != 0) - return (rman_adjust_resource(r, start, end)); - return (EINVAL); - } - return (bus_generic_adjust_resource(bus, child, type, r, start, end)); -} - -static int -sbus_release_resource(device_t bus, device_t child, int type, int rid, - struct resource *r) -{ - struct resource_list *rl; - struct resource_list_entry *rle; - int error, passthrough; - - passthrough = (device_get_parent(child) != bus); - rl = BUS_GET_RESOURCE_LIST(bus, child); - if (type == SYS_RES_MEMORY) { - if ((rman_get_flags(r) & RF_ACTIVE) != 0) { - error = bus_deactivate_resource(child, type, rid, r); - if (error) - return (error); - } - error = rman_release_resource(r); - if (error != 0) - return (error); - if (!passthrough) { - rle = resource_list_find(rl, type, rid); - KASSERT(rle != NULL, - ("%s: resource entry not found!", __func__)); - KASSERT(rle->res != NULL, - ("%s: resource entry is not busy", __func__)); - rle->res = NULL; - } - return (0); - } - return (resource_list_release(rl, bus, child, type, rid, r)); -} - -static bus_dma_tag_t -sbus_get_dma_tag(device_t bus, device_t child) -{ - struct sbus_softc *sc; - - sc = device_get_softc(bus); - return (sc->sc_cdmatag); -} - -static const struct ofw_bus_devinfo * -sbus_get_devinfo(device_t bus, device_t child) -{ - struct sbus_devinfo *sdi; - - sdi = device_get_ivars(child); - return (&sdi->sdi_obdinfo); -} - -/* - * Handle an overtemp situation. - * - * SPARCs have temperature sensors which generate interrupts - * if the machine's temperature exceeds a certain threshold. - * This handles the interrupt and powers off the machine. - * The same needs to be done to PCI controller drivers. - */ -static void -sbus_overtemp(void *arg __unused) -{ - static int shutdown; - - /* As the interrupt is cleared we may be called multiple times. */ - if (shutdown != 0) - return; - shutdown++; - printf("DANGER: OVER TEMPERATURE detected\nShutting down NOW.\n"); - shutdown_nice(RB_POWEROFF); -} - -/* Try to shut down in time in case of power failure. */ -static void -sbus_pwrfail(void *arg __unused) -{ - static int shutdown; - - /* As the interrupt is cleared we may be called multiple times. */ - if (shutdown != 0) - return; - shutdown++; - printf("Power failure detected\nShutting down NOW.\n"); - shutdown_nice(RB_POWEROFF); -} - -static int -sbus_print_res(struct sbus_devinfo *sdi) -{ - int rv; - - rv = 0; - rv += resource_list_print_type(&sdi->sdi_rl, "mem", SYS_RES_MEMORY, - "%#jx"); - rv += resource_list_print_type(&sdi->sdi_rl, "irq", SYS_RES_IRQ, - "%jd"); - return (rv); -} diff --git a/sys/sparc64/sbus/sbusreg.h b/sys/sparc64/sbus/sbusreg.h deleted file mode 100644 index 7271d697f913a8..00000000000000 --- a/sys/sparc64/sbus/sbusreg.h +++ /dev/null @@ -1,145 +0,0 @@ -/*- - * Copyright (c) 1996-1999 Eduardo Horvath - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: NetBSD: sbusreg.h,v 1.7 1999/06/07 05:28:03 eeh Exp - * - * $FreeBSD$ - */ - -#ifndef _SPARC64_SBUS_SBUSREG_H_ -#define _SPARC64_SBUS_SBUSREG_H_ - -/* - * Sbus device addresses are obtained from the FORTH PROMs. They come - * in `absolute' and `relative' address flavors, so we have to handle both. - * Relative addresses do *not* include the slot number. - */ -#define SBUS_BASE 0xf8000000 -#define SBUS_ADDR(slot, off) (SBUS_BASE + ((slot) << 25) + (off)) -#define SBUS_ABS(a) ((unsigned)(a) >= SBUS_BASE) -#define SBUS_ABS_TO_SLOT(a) (((a) - SBUS_BASE) >> 25) -#define SBUS_ABS_TO_OFFSET(a) (((a) - SBUS_BASE) & 0x1ffffff) - -/* - * Sun4u S-bus definitions. Here's where we deal w/the machine - * dependencies of sysio. - * - * SYSIO implements or is the interface to several things: - * - * o The SBUS interface itself - * o The IOMMU - * o The DVMA units - * o The interrupt controller - * o The counter/timers - * - * Since it has registers to control lots of different things - * as well as several on-board SBUS devices and external SBUS - * slots scattered throughout its address space, it's a pain. - * - * One good point, however, is that all registers are 64-bit. - */ -#define SBR_UPA_PORTID 0x0000 /* UPA port ID register */ -#define SBR_UPA_CONFIG 0x0008 /* UPA config register */ -#define SBR_CS 0x0010 /* SYSIO control/status register */ -#define SBR_ECCC 0x0020 /* ECC control register */ -#define SBR_UE_AFS 0x0030 /* Uncorrectable Error AFSR */ -#define SBR_UE_AFA 0x0038 /* Uncorrectable Error AFAR */ -#define SBR_CE_AFS 0x0040 /* Correctable Error AFSR */ -#define SBR_CE_AFA 0x0048 /* Correctable Error AFAR */ -#define SBR_PM_CTL 0x0100 /* Performance monitor control reg */ -#define SBR_PM_COUNT 0x0108 /* Performance monitor counter reg */ -#define SBR_CTL 0x2000 /* SBUS Control Register */ -#define SBR_AFS 0x2010 /* SBUS AFSR */ -#define SBR_AFA 0x2018 /* SBUS AFAR */ -#define SBR_CONFIG0 0x2020 /* SBUS Slot 0 config register */ -#define SBR_CONFIG1 0x2028 /* SBUS Slot 1 config register */ -#define SBR_CONFIG2 0x2030 /* SBUS Slot 2 config register */ -#define SBR_CONFIG3 0x2038 /* SBUS Slot 3 config register */ -#define SBR_CONFIG13 0x2040 /* Slot 13 config register