Remove sparc64 kernel support
Remove all sparc64 specific files Remove all sparc64 ifdefs Removee indireeect sparc64 ifdefs
This commit is contained in:
parent
e4792f367c
commit
48b94864c5
@ -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
|
||||
|
@ -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}
|
||||
|
@ -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:
|
||||
{
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
*/
|
||||
|
@ -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.
|
||||
|
@ -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"
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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}
|
@ -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}}
|
||||
|
@ -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
|
||||
|
||||
|
@ -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 . */
|
||||
}
|
@ -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
|
@ -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__)
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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,
|
||||
|
@ -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
|
||||
|
@ -52,13 +52,7 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
#include <dev/atkbdc/atkbdcreg.h>
|
||||
|
||||
#ifdef __sparc64__
|
||||
#include <dev/ofw/openfirm.h>
|
||||
#include <machine/bus_private.h>
|
||||
#include <machine/ofw_machdep.h>
|
||||
#else
|
||||
#include <isa/isareg.h>
|
||||
#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__)
|
||||
/*
|
||||
|
@ -1,307 +0,0 @@
|
||||
/*-
|
||||
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
|
||||
*
|
||||
* Copyright (c) 1999 Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp>
|
||||
* Copyright (c) 2005 Marius Strobl <marius@FreeBSD.org>
|
||||
* 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 <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include "opt_kbd.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/module.h>
|
||||
#include <sys/bus.h>
|
||||
#include <sys/kbio.h>
|
||||
#include <sys/malloc.h>
|
||||
|
||||
#include <dev/ofw/ofw_bus.h>
|
||||
|
||||
#include <machine/resource.h>
|
||||
#include <machine/ver.h>
|
||||
|
||||
#include <sys/rman.h>
|
||||
|
||||
#include <dev/kbd/kbdreg.h>
|
||||
#include <dev/atkbdc/atkbdreg.h>
|
||||
#include <dev/atkbdc/atkbdc_subr.h>
|
||||
#include <dev/atkbdc/atkbdcreg.h>
|
||||
#include <dev/atkbdc/psm.h>
|
||||
|
||||
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);
|
||||
}
|
@ -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 <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/bus.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/lock.h>
|
||||
#include <sys/module.h>
|
||||
#include <sys/mutex.h>
|
||||
#include <sys/resource.h>
|
||||
#include <sys/rman.h>
|
||||
|
||||
#include <dev/led/led.h>
|
||||
#include <dev/ofw/ofw_bus.h>
|
||||
#include <dev/ofw/openfirm.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
#include <machine/ofw_machdep.h>
|
||||
#include <machine/resource.h>
|
||||
|
||||
#include <sparc64/sbus/sbusvar.h>
|
||||
#include <dev/auxio/auxioreg.h>
|
||||
|
||||
/*
|
||||
* 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));
|
||||
}
|
@ -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
|
@ -112,13 +112,6 @@ __FBSDID("$FreeBSD$");
|
||||
#include "miidevs.h"
|
||||
#include <dev/mii/brgphyreg.h>
|
||||
|
||||
#ifdef __sparc64__
|
||||
#include <dev/ofw/ofw_bus.h>
|
||||
#include <dev/ofw/openfirm.h>
|
||||
#include <machine/ofw_machdep.h>
|
||||
#include <machine/ver.h>
|
||||
#endif
|
||||
|
||||
#include <dev/pci/pcireg.h>
|
||||
#include <dev/pci/pcivar.h>
|
||||
|
||||
@ -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
|
||||
|
@ -78,7 +78,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <netinet/udp.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
#if defined(__powerpc__) || defined(__sparc64__)
|
||||
#if defined(__powerpc__)
|
||||
#include <dev/ofw/ofw_bus.h>
|
||||
#include <dev/ofw/openfirm.h>
|
||||
#include <machine/ofw_machdep.h>
|
||||
@ -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),
|
||||
|
@ -135,11 +135,6 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
#include <dev/dc/if_dcreg.h>
|
||||
|
||||
#ifdef __sparc64__
|
||||
#include <dev/ofw/openfirm.h>
|
||||
#include <machine/ofw_machdep.h>
|
||||
#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:
|
||||
|
@ -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 <marius@FreeBSD.org>
|
||||
* 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 <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/bus.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/lock.h>
|
||||
#include <sys/module.h>
|
||||
#include <sys/mutex.h>
|
||||
#include <sys/rman.h>
|
||||
|
||||
#include <dev/ofw/ofw_bus.h>
|
||||
#include <dev/ofw/openfirm.h>
|
||||
#include <machine/bus.h>
|
||||
#include <machine/ofw_machdep.h>
|
||||
#include <machine/resource.h>
|
||||
|
||||
#include <cam/cam.h>
|
||||
#include <cam/cam_ccb.h>
|
||||
#include <cam/scsi/scsi_all.h>
|
||||
#include <cam/scsi/scsi_message.h>
|
||||
|
||||
#include <sparc64/sbus/lsi64854reg.h>
|
||||
#include <sparc64/sbus/lsi64854var.h>
|
||||
#include <sparc64/sbus/sbusvar.h>
|
||||
|
||||
#include <dev/esp/ncr53c9xreg.h>
|
||||
#include <dev/esp/ncr53c9xvar.h>
|
||||
|
||||
/* #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));
|
||||
}
|
1130
sys/dev/fb/creator.c
1130
sys/dev/fb/creator.c
File diff suppressed because it is too large
Load Diff
@ -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 <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/fbio.h>
|
||||
|
||||
#include <dev/vt/vt.h>
|
||||
#include <dev/vt/hw/fb/vt_fb.h>
|
||||
#include <dev/vt/colors/vt_termcolors.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
#include <machine/bus_private.h>
|
||||
|
||||
#include <dev/ofw/openfirm.h>
|
||||
#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
|
||||
}
|
@ -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_ */
|
@ -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))
|
||||
|
1581
sys/dev/fb/machfb.c
1581
sys/dev/fb/machfb.c
File diff suppressed because it is too large
Load Diff
@ -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_ */
|
@ -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;
|
||||
|
@ -53,7 +53,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <net/if.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
#if defined(__powerpc__) || defined(__sparc64__)
|
||||
#if defined(__powerpc__)
|
||||
#include <dev/ofw/ofw_bus.h>
|
||||
#include <dev/ofw/openfirm.h>
|
||||
#include <machine/ofw_machdep.h>
|
||||
@ -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) {
|
||||
|
@ -1,210 +0,0 @@
|
||||
/*-
|
||||
* SPDX-License-Identifier: BSD-2-Clause-NetBSD
|
||||
*
|
||||
* Copyright (C) 2001 Eduardo Horvath.
|
||||
* Copyright (c) 2007 Marius Strobl <marius@FreeBSD.org>
|
||||
* 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 <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
/*
|
||||
* SBus bindings for Sun GEM Ethernet controllers
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/bus.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/lock.h>
|
||||
#include <sys/module.h>
|
||||
#include <sys/mutex.h>
|
||||
#include <sys/resource.h>
|
||||
#include <sys/rman.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include <net/ethernet.h>
|
||||
#include <net/if.h>
|
||||
|
||||
#include <dev/ofw/ofw_bus.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
#include <machine/ofw_machdep.h>
|
||||
#include <machine/resource.h>
|
||||
|
||||
#include <sparc64/sbus/sbusvar.h>
|
||||
|
||||
#include <dev/gem/if_gemreg.h>
|
||||
#include <dev/gem/if_gemvar.h>
|
||||
|
||||
#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);
|
||||
}
|
@ -50,7 +50,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
#if defined(__powerpc__) || defined(__sparc64__)
|
||||
#if defined(__powerpc__)
|
||||
#include <dev/ofw/openfirm.h>
|
||||
#include <machine/ofw_machdep.h>
|
||||
#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
|
||||
/*
|
||||
|
@ -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 <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
/*
|
||||
* SBus front-end device driver for the HME ethernet device.
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/bus.h>
|
||||
#include <sys/lock.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/module.h>
|
||||
#include <sys/mutex.h>
|
||||
#include <sys/resource.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include <dev/ofw/ofw_bus.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
#include <machine/ofw_machdep.h>
|
||||
#include <machine/resource.h>
|
||||
|
||||
#include <sys/rman.h>
|
||||
|
||||
#include <net/if.h>
|
||||
#include <net/if_media.h>
|
||||
#include <net/ethernet.h>
|
||||
|
||||
#include <dev/mii/mii.h>
|
||||
#include <dev/mii/miivar.h>
|
||||
|
||||
#include <sparc64/sbus/sbusvar.h>
|
||||
|
||||
#include <dev/hme/if_hmereg.h>
|
||||
#include <dev/hme/if_hmevar.h>
|
||||
|
||||
#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);
|
||||
}
|
@ -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 <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/pmc.h>
|
||||
|
||||
#include <machine/pmc_mdep.h>
|
||||
|
||||
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);
|
||||
}
|
@ -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
|
||||
|
||||
|
@ -48,12 +48,6 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/rman.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/uio.h>
|
||||
|
||||
#ifdef __sparc64__
|
||||
#include <dev/ofw/openfirm.h>
|
||||
#include <machine/ofw_machdep.h>
|
||||
#endif
|
||||
|
||||
#include <dev/isp/isp_freebsd.h>
|
||||
|
||||
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)) {
|
||||
|
@ -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 <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/linker.h>
|
||||
#include <sys/firmware.h>
|
||||
#include <sys/bus.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/module.h>
|
||||
#include <sys/resource.h>
|
||||
|
||||
#include <dev/ofw/ofw_bus.h>
|
||||
#include <dev/ofw/openfirm.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
#include <machine/ofw_machdep.h>
|
||||
#include <machine/resource.h>
|
||||
#include <sys/rman.h>
|
||||
#include <sparc64/sbus/sbusvar.h>
|
||||
|
||||
#include <dev/isp/isp_freebsd.h>
|
||||
|
||||
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));
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -39,9 +39,6 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/systm.h>
|
||||
|
||||
#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 <dev/ispfw/asm_1000.h>
|
||||
#else
|
||||
#error "firmware not compatible with this platform"
|
||||
#endif
|
||||
#endif
|
||||
#if defined(ISP_1040) || defined(ISP_1040_IT)
|
||||
#include <dev/ispfw/asm_1040.h>
|
||||
#endif
|
||||
@ -95,9 +85,6 @@ __FBSDID("$FreeBSD$");
|
||||
#include <dev/ispfw/asm_2500.h>
|
||||
#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)
|
||||
|
@ -1,393 +0,0 @@
|
||||
/*-
|
||||
* SPDX-License-Identifier: BSD-2-Clause-NetBSD
|
||||
*
|
||||
* Copyright (c) 2006 Marius Strobl <marius@FreeBSD.org>
|
||||
* 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 <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/bus.h>
|
||||
#include <sys/endian.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/lock.h>
|
||||
#include <sys/module.h>
|
||||
#include <sys/mutex.h>
|
||||
#include <sys/resource.h>
|
||||
#include <sys/rman.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include <dev/ofw/ofw_bus.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
#include <machine/ofw_machdep.h>
|
||||
#include <machine/resource.h>
|
||||
|
||||
#include <net/ethernet.h>
|
||||
#include <net/if.h>
|
||||
#include <net/if_media.h>
|
||||
|
||||
#include <dev/le/lancereg.h>
|
||||
#include <dev/le/lancevar.h>
|
||||
#include <dev/le/am7990reg.h>
|
||||
#include <dev/le/am7990var.h>
|
||||
|
||||
/*
|
||||
* 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);
|
||||
}
|
@ -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 <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/bus.h>
|
||||
#include <sys/endian.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/lock.h>
|
||||
#include <sys/module.h>
|
||||
#include <sys/mutex.h>
|
||||
#include <sys/resource.h>
|
||||
#include <sys/rman.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include <dev/ofw/ofw_bus.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
#include <machine/ofw_machdep.h>
|
||||
#include <machine/resource.h>
|
||||
|
||||
#include <net/ethernet.h>
|
||||
#include <net/if.h>
|
||||
#include <net/if_var.h>
|
||||
#include <net/if_media.h>
|
||||
|
||||
#include <sparc64/sbus/lsi64854reg.h>
|
||||
#include <sparc64/sbus/lsi64854var.h>
|
||||
|
||||
#include <dev/le/lancereg.h>
|
||||
#include <dev/le/lancevar.h>
|
||||
#include <dev/le/am7990var.h>
|
||||
|
||||
#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);
|
||||
}
|
@ -1,305 +0,0 @@
|
||||
/*-
|
||||
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
|
||||
*
|
||||
* Copyright (c) 2006 Marius Strobl <marius@FreeBSD.org>
|
||||
* 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 <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/bus.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/module.h>
|
||||
#include <sys/resource.h>
|
||||
#include <sys/rman.h>
|
||||
|
||||
#include <dev/ofw/ofw_bus.h>
|
||||
#include <dev/ofw/ofw_bus_subr.h>
|
||||
#include <dev/ofw/openfirm.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
#include <machine/bus_common.h>
|
||||
#include <machine/resource.h>
|
||||
|
||||
#include <sparc64/sbus/ofw_sbus.h>
|
||||
#include <sparc64/sbus/sbusreg.h>
|
||||
#include <sparc64/sbus/sbusvar.h>
|
||||
|
||||
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);
|
||||
}
|
@ -122,11 +122,6 @@
|
||||
#include <machine/cpu.h>
|
||||
#include <machine/resource.h>
|
||||
|
||||
#ifdef __sparc64__
|
||||
#include <dev/ofw/openfirm.h>
|
||||
#include <machine/ofw_machdep.h>
|
||||
#endif
|
||||
|
||||
#include <dev/pci/pcireg.h>
|
||||
#include <dev/pci/pcivar.h>
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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_ */
|
||||
|
@ -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 <sys/cdefs.h>
|
||||
__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 <sys/param.h>
|
||||
#include <sys/bus.h>
|
||||
#include <sys/conf.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/lock.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/module.h>
|
||||
#include <sys/mutex.h>
|
||||
#include <sys/resource.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/uio.h>
|
||||
|
||||
#include <dev/ofw/ofw_bus.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
#include <machine/resource.h>
|
||||
|
||||
#include <sys/rman.h>
|
||||
|
||||
#include <dev/iicbus/iicbus.h>
|
||||
#include <dev/iicbus/iiconf.h>
|
||||
#include <dev/pcf/pcfvar.h>
|
||||
#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);
|
@ -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 <sys/cdefs.h>
|
||||
__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 <sys/param.h>
|
||||
#include <sys/bus.h>
|
||||
#include <sys/lock.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/module.h>
|
||||
#include <sys/mutex.h>
|
||||
#include <sys/resource.h>
|
||||
#include <sys/systm.h>
|
||||
|
||||
#include <dev/ofw/ofw_bus.h>
|
||||
#include <dev/ofw/openfirm.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
#include <machine/resource.h>
|
||||
|
||||
#include <sys/rman.h>
|
||||
|
||||
#include <dev/iicbus/iiconf.h>
|
||||
#include <dev/pcf/pcfvar.h>
|
||||
#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);
|
@ -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))
|
||||
|
@ -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 <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/bus.h>
|
||||
#include <sys/conf.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/module.h>
|
||||
|
||||
#include <dev/ofw/ofw_bus.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
#include <sys/rman.h>
|
||||
#include <machine/resource.h>
|
||||
|
||||
#include <dev/scc/scc_bfe.h>
|
||||
|
||||
#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);
|
@ -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 <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/bus.h>
|
||||
#include <sys/conf.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/module.h>
|
||||
|
||||
#include <dev/ofw/ofw_bus.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
#include <sys/rman.h>
|
||||
#include <machine/resource.h>
|
||||
|
||||
#include <dev/scc/scc_bfe.h>
|
||||
|
||||
#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);
|
@ -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)
|
||||
|
@ -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 {
|
||||
|
@ -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 )
|
File diff suppressed because it is too large
Load Diff
@ -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
|
@ -90,11 +90,6 @@ __FBSDID("$FreeBSD$");
|
||||
#include <machine/resource.h>
|
||||
#include <machine/atomic.h>
|
||||
|
||||
#ifdef __sparc64__
|
||||
#include <dev/ofw/openfirm.h>
|
||||
#include <machine/ofw_machdep.h>
|
||||
#endif
|
||||
|
||||
#include <sys/rman.h>
|
||||
|
||||
#include <cam/cam.h>
|
||||
@ -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?).
|
||||
|
@ -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 */
|
||||
|
@ -44,8 +44,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/malloc.h>
|
||||
|
||||
#if defined(__arm__) || defined(__mips__) || \
|
||||
defined(__powerpc__) || defined(__sparc64__)
|
||||
#if defined(__arm__) || defined(__mips__) || defined(__powerpc__)
|
||||
#include <machine/sc_machdep.h>
|
||||
#else
|
||||
#include <machine/pc/display.h>
|
||||
|
@ -35,8 +35,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/module.h>
|
||||
#include <sys/consio.h>
|
||||
|
||||
#if defined(__arm__) || defined(__mips__) || \
|
||||
defined(__powerpc__) || defined(__sparc64__)
|
||||
#if defined(__arm__) || defined(__mips__) || defined(__powerpc__)
|
||||
#include <machine/sc_machdep.h>
|
||||
#else
|
||||
#include <machine/pc/display.h>
|
||||
|
@ -36,8 +36,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/module.h>
|
||||
#include <sys/consio.h>
|
||||
|
||||
#if defined(__arm__) || defined(__mips__) || \
|
||||
defined(__powerpc__) || defined(__sparc64__)
|
||||
#if defined(__arm__) || defined(__mips__) || defined(__powerpc__)
|
||||
#include <machine/sc_machdep.h>
|
||||
#else
|
||||
#include <machine/pc/display.h>
|
||||
|
@ -42,8 +42,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/consio.h>
|
||||
#include <sys/kbio.h>
|
||||
|
||||
#if defined(__arm__) || defined(__mips__) || \
|
||||
defined(__powerpc__) || defined(__sparc64__)
|
||||
#if defined(__arm__) || defined(__mips__) || defined(__powerpc__)
|
||||
#include <machine/sc_machdep.h>
|
||||
#else
|
||||
#include <machine/pc/display.h>
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -65,8 +65,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/power.h>
|
||||
|
||||
#include <machine/clock.h>
|
||||
#if defined(__arm__) || defined(__mips__) || defined(__powerpc__) || \
|
||||
defined(__sparc64__)
|
||||
#if defined(__arm__) || defined(__mips__) || defined(__powerpc__)
|
||||
#include <machine/sc_machdep.h>
|
||||
#else
|
||||
#include <machine/pc/display.h>
|
||||
@ -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);
|
||||
|
||||
|
@ -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 */
|
||||
|
@ -1,108 +0,0 @@
|
||||
/*-
|
||||
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
|
||||
*
|
||||
* Copyright (c) 2001 by Thomas Moestl <tmm@FreeBSD.org>.
|
||||
* 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 <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/bus.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/module.h>
|
||||
|
||||
#include <dev/ofw/ofw_bus.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
#include <sys/rman.h>
|
||||
#include <machine/resource.h>
|
||||
#include <machine/ver.h>
|
||||
|
||||
#include <dev/uart/uart.h>
|
||||
#include <dev/uart/uart_bus.h>
|
||||
#include <dev/uart/uart_cpu.h>
|
||||
|
||||
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);
|
@ -1,307 +0,0 @@
|
||||
/*-
|
||||
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
|
||||
*
|
||||
* Copyright (c) 2003, 2004 Marcel Moolenaar
|
||||
* Copyright (c) 2004 - 2006 Marius Strobl <marius@FreeBSD.org>
|
||||
* 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 <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
#include <machine/bus_private.h>
|
||||
|
||||
#include <dev/ofw/openfirm.h>
|
||||
#include <machine/ofw_machdep.h>
|
||||
|
||||
#include <dev/uart/uart.h>
|
||||
#include <dev/uart/uart_cpu.h>
|
||||
|
||||
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);
|
||||
}
|
@ -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 <sys/cdefs.h>
|
||||
__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 <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/bus.h>
|
||||
#include <sys/interrupt.h>
|
||||
#include <sys/kbio.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/limits.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
|
||||
#include <dev/kbd/kbdreg.h>
|
||||
#include <dev/kbd/kbdtables.h>
|
||||
|
||||
#include <dev/uart/uart.h>
|
||||
#include <dev/uart/uart_bus.h>
|
||||
#include <dev/uart/uart_cpu.h>
|
||||
|
||||
#include <dev/uart/uart_kbd_sun.h>
|
||||
#if !defined(SUNKBD_EMULATE_ATKBD)
|
||||
#include <dev/uart/uart_kbd_sun_tables.h>
|
||||
#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
|
@ -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)
|
@ -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 };
|
||||
|
@ -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,
|
||||
|
@ -1,4 +1,4 @@
|
||||
/*-
|
||||
e/*-
|
||||
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
|
||||
*
|
||||
* Copyright (c) 2011 Nathan Whitehorn
|
||||
@ -42,9 +42,6 @@ __FBSDID("$FreeBSD$");
|
||||
#include <vm/pmap.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
#ifdef __sparc64__
|
||||
#include <machine/bus_private.h>
|
||||
#endif
|
||||
#include <machine/cpu.h>
|
||||
|
||||
#include <dev/ofw/openfirm.h>
|
||||
@ -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,
|
||||
|
@ -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);
|
||||
|
@ -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.
|
||||
|
@ -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;
|
||||
|
@ -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 */
|
||||
|
@ -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 },
|
||||
|
@ -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
|
||||
|
@ -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 <bsd.kmod.mk>
|
@ -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 <bsd.kmod.mk>
|
||||
|
@ -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
|
||||
|
||||
|
@ -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 <bsd.kmod.mk>
|
@ -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 <bsd.kmod.mk>
|
||||
|
@ -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
|
||||
|
||||
|
@ -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 <bsd.kmod.mk>
|
||||
|
@ -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 <bsd.kmod.mk>
|
||||
|
@ -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 <bsd.kmod.mk>
|
||||
|
@ -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 <bsd.kmod.mk>
|
||||
|
@ -37,8 +37,5 @@ SUBDIR += isp_2300
|
||||
SUBDIR += isp_2322
|
||||
SUBDIR += isp_2400
|
||||
SUBDIR += isp_2500
|
||||
.if ${MACHINE} == "sparc64"
|
||||
SUBDIR += isp_1000
|
||||
.endif
|
||||
|
||||
.include <bsd.subdir.mk>
|
||||
|
@ -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 <bsd.kmod.mk>
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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 <bsd.kmod.mk>
|
@ -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 <bsd.subdir.mk>
|
||||
|
@ -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
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user