Merge ^/head r357389 through r357407.

This commit is contained in:
Dimitry Andric 2020-02-02 12:54:38 +00:00
commit 310fc6c533
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/projects/clang1000-import/; revision=357408
73 changed files with 96 additions and 14107 deletions

View file

@ -89,7 +89,7 @@
#
# See src/UPDATING `COMMON ITEMS' for more complete information.
#
# If TARGET=machine (e.g. powerpc, sparc64, ...) is specified you can
# If TARGET=machine (e.g. powerpc, arm64, ...) is specified you can
# cross build world for other machine types using the buildworld target,
# and once the world is built you can cross build a kernel using the
# buildkernel target.
@ -488,7 +488,7 @@ worlds: .PHONY
# In all cases, if the user specifies TARGETS on the command line,
# honor that most of all.
#
TARGETS?=amd64 arm arm64 i386 mips powerpc riscv sparc64
TARGETS?=amd64 arm arm64 i386 mips powerpc riscv
_UNIVERSE_TARGETS= ${TARGETS}
TARGET_ARCHES_arm?= armv6 armv7
TARGET_ARCHES_arm64?= aarch64
@ -501,14 +501,12 @@ TARGET_ARCHES_${target}?= ${target}
.endfor
MAKE_PARAMS_mips?= CROSS_TOOLCHAIN=mips-gcc6
MAKE_PARAMS_sparc64?= CROSS_TOOLCHAIN=sparc64-gcc6
TOOLCHAINS_mips= mips-gcc6
TOOLCHAINS_sparc64= sparc64-gcc6
# Remove architectures only supported by external toolchain from
# universe if required toolchain packages are missing.
.for target in mips sparc64
.for target in mips
.if ${_UNIVERSE_TARGETS:M${target}}
.for toolchain in ${TOOLCHAINS_${target}}
.if !exists(/usr/local/share/toolchains/${toolchain}.mk)

View file

@ -153,8 +153,7 @@ KNOWN_ARCHES?= aarch64/arm64 \
powerpc64/powerpc \
powerpcspe/powerpc \
riscv64/riscv \
riscv64sf/riscv \
sparc64
riscv64sf/riscv
.if ${TARGET} == ${TARGET_ARCH}
_t= ${TARGET}
@ -2290,8 +2289,6 @@ _basic_bootstrap_tools_multilink+=bin/test test,[
_basic_bootstrap_tools=usr.bin/awk usr.bin/cut bin/expr usr.bin/gencat \
usr.bin/join usr.bin/mktemp bin/rmdir usr.bin/sed usr.bin/sort \
usr.bin/truncate usr.bin/tsort
# elf2aout is required for sparc64 build
_basic_bootstrap_tools+=usr.bin/elf2aout
# file2c is required for building usr.sbin/config:
_basic_bootstrap_tools+=usr.bin/file2c
# uuencode/uudecode required for share/tabset
@ -2915,14 +2912,10 @@ _cddl_lib_libctf= cddl/lib/libctf
_cddl_lib= cddl/lib
cddl/lib/libctf__L: lib/libz__L
.endif
# cddl/lib/libdtrace requires lib/libproc and lib/librtld_db; it's only built
# on select architectures though (see cddl/lib/Makefile)
.if ${MACHINE_CPUARCH} != "sparc64"
_prebuild_libs+= lib/libprocstat lib/libproc lib/librtld_db
lib/libprocstat__L: lib/libelf__L lib/libkvm__L lib/libutil__L
lib/libproc__L: lib/libprocstat__L
lib/librtld_db__L: lib/libprocstat__L
.endif
.if ${MK_CRYPT} != "no"
.if ${MK_OPENSSL} != "no"

View file

@ -272,6 +272,10 @@ OLD_FILES+=usr/lib/clang/9.0.1/lib/freebsd/libclang_rt.xray-x86_64.a
OLD_DIRS+=usr/lib/clang/9.0.1/lib/freebsd
OLD_DIRS+=usr/lib/clang/9.0.1/lib
OLD_DIRS+=usr/lib/clang/9.0.1
# 20200127: vpo removed
OLD_FILES+=usr/share/man/man4/imm.4.gz
OLD_FILES+=usr/share/man/man4/vpo.4.gz
# 20200104: gcc libssp removed
OLD_FILES+=usr/include/ssp/ssp.h
OLD_FILES+=usr/include/ssp/stdio.h

View file

@ -553,7 +553,6 @@ MAN= aac.4 \
${_vmd.4} \
${_vmm.4} \
${_vmx.4} \
vpo.4 \
vr.4 \
vt.4 \
vte.4 \
@ -740,7 +739,6 @@ MLINKS+=vge.4 if_vge.4
MLINKS+=vlan.4 if_vlan.4
MLINKS+=vxlan.4 if_vxlan.4
MLINKS+=${_vmx.4} ${_if_vmx.4}
MLINKS+=vpo.4 imm.4
MLINKS+=vr.4 if_vr.4
MLINKS+=vte.4 if_vte.4
MLINKS+=${_vtnet.4} ${_if_vtnet.4}

View file

@ -33,8 +33,6 @@
.Sh SYNOPSIS
.Cd "device ppbus"
.Pp
.Cd "device vpo"
.Pp
.Cd "device lpt"
.Cd "device plip"
.Cd "device ppi"
@ -66,8 +64,6 @@ and non-standard software:
.Pp
.Bl -column "Driver" -compact
.It Em Driver Ta Em Description
.It Sy vpo Ta "VPI0 parallel to Adaptec AIC-7110 SCSI controller driver" .
It uses standard and non-standard parallel port accesses.
.It Sy ppi Ta "Parallel port interface for general I/O"
.It Sy pps Ta "Pulse per second Timing Interface"
.It Sy lpbb Ta "Philips official parallel port I2C bit-banging interface"
@ -336,22 +332,11 @@ operation (opcodes are described in
.Xr microseq 9 ) .
Standard I/O operations are implemented at ppbus level whereas basic I/O
operations and microseq language are coded at adapter level for efficiency.
.Pp
As an example, the
.Xr vpo 4
driver uses microsequences to implement:
.Bl -bullet -offset indent
.It
a modified version of the NIBBLE transfer mode
.It
various I/O sequences to initialize, select and allocate the peripheral
.El
.Sh SEE ALSO
.Xr lpt 4 ,
.Xr plip 4 ,
.Xr ppc 4 ,
.Xr ppi 4 ,
.Xr vpo 4
.Sh HISTORY
The
.Nm

View file

@ -1,105 +0,0 @@
.\" Copyright (c) 1998, 1999, Nicolas Souchu
.\" 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$
.\"
.Dd December 14, 2004
.Dt VPO 4
.Os
.Sh NAME
.Nm vpo
.Nd parallel to SCSI interface driver
.Sh SYNOPSIS
.Cd "device vpo"
.Pp
For one or more SCSI busses:
.Cd "device scbus"
.Sh DESCRIPTION
The
.Nm
driver provide access to parallel port Iomega Zip and Jaz drives.
.Sh HARDWARE
The
.Nm
driver supports the following parallel to SCSI interfaces:
.Pp
.Bl -bullet -compact
.It
Adaptec AIC-7110 Parallel to SCSI interface (built-in to Iomega ZIP
drives)
.It
Iomega Jaz Traveller interface
.It
Iomega MatchMaker SCSI interface (built-in to Iomega ZIP+ drives)
.El
.Sh USAGE
The driver should let you use a printer connected to the drive while
transferring data.
.Pp
DOS and
.Fx
file systems are supported.
When mounting a DOS file system or
formatting a
.Fx
file system, check the slice of the disk with the
.Xr gpart 8
utility.
.Pp
In order to unixify a ZIP disk, put the following in /etc/disktab:
.Bd -literal
zip|zip 100:\\
:ty=removable:se#512:nc#96:nt#64:ns#32:\\
:pa#196608:oa#0:ba#4096:fa#512:\\
:pb#196608:ob#0:bb#4096:fb#512:\\
:pc#196608:oc#0:bc#4096:fc#512:
.Ed
.Pp
and use
.Xr bsdlabel 8 .
.Pp
If you have trouble with your driver, your parallel chipset may not run
properly at the detected mode (NIBBLE, PS2 or EPP).
Tune the
.Xr ppc 4
bootflags to force other modes.
.Sh SEE ALSO
.Xr da 4 ,
.Xr lpt 4 ,
.Xr ppbus 4 ,
.Xr ppc 4 ,
.Xr scsi 4
.Sh HISTORY
The
.Nm
manual page first appeared in
.Fx 3.0 .
.Sh AUTHORS
This
manual page was written by
.An Nicolas Souchu .
.Sh BUGS
During boot, the driver first tries to detect a classic ZIP, then a ZIP+.
The ZIP+ detection is intrusive and may send erroneous characters to your
printer if the drive is not connected to your parallel port.

View file

@ -51,7 +51,7 @@ efficient code
Before using microsequences, you are encouraged to look at
.Xr ppc 4
microsequencer implementation and an example of how using it in
.Xr vpo 4 .
.Xr ppi 4 .
.Sh PPBUS register model
.Ss Background
The parallel port model chosen for ppbus is the PC parallel port model.
@ -477,7 +477,7 @@ executed at ppbus layer.
.Sh SEE ALSO
.Xr ppbus 4 ,
.Xr ppc 4 ,
.Xr vpo 4
.Xr ppi 4
.Sh HISTORY
The
.Nm

File diff suppressed because it is too large Load diff

View file

@ -1,81 +0,0 @@
#
# Custom kernel for Marvell DB-78xx boards.
#
# $FreeBSD$
#
#NO_UNIVERSE
ident DB-88F78XX
include "std.arm"
include "../mv/discovery/std.db78xxx"
options SOC_MV_DISCOVERY
options SCHED_4BSD # 4BSD scheduler
options INET # InterNETworking
options INET6 # IPv6 communications protocols
options TCP_HHOOK # hhook(9) framework for TCP
options GEOM_PART_BSD # BSD partition scheme
options GEOM_PART_MBR # MBR partition scheme
options TMPFS # Efficient memory filesystem
options FFS # Berkeley Fast Filesystem
options NFSCL # Network Filesystem Client
options NFSLOCKD # Network Lock Manager
options NFS_ROOT # NFS usable as /, requires NFSCL
options BOOTP
options BOOTP_NFSROOT
options BOOTP_NFSV3
options BOOTP_WIRED_TO=mge0
#options ROOTDEVNAME=\"ufs:/dev/da0a\"
options SYSVSHM # SYSV-style shared memory
options SYSVMSG # SYSV-style message queues
options SYSVSEM # SYSV-style semaphores
options _KPOSIX_PRIORITY_SCHEDULING # Posix P1003_1B real-time extensions
options MUTEX_NOINLINE
options RWLOCK_NOINLINE
options NO_FFS_SNAPSHOT
options NO_SWAPPING
device pci
# Pseudo devices
device loop
device md
# Serial ports
device uart
# Networking
device ether
device mge # Marvell Gigabit Ethernet controller
device mii
device mdio
device e1000phy
device bpf
# USB
device usb
device ehci
device umass
device scbus
device pass
device da
# I2C (TWSI)
device iic
device iicbus
device twsi
device ds133x
# SATA
device mvs
# GPIO
device gpio
# Flattened Device Tree
options FDT
options FDT_DTB_STATIC
makeoptions FDT_DTS_FILE=db78100.dts

View file

@ -1,82 +0,0 @@
#
# Custom kernel for Marvell DB-88F5xxx boards.
#
# $FreeBSD$
#
#NO_UNIVERSE
ident DB-88F5XXX
include "std.arm"
include "../mv/orion/std.db88f5xxx"
options SOC_MV_ORION
options SCHED_4BSD # 4BSD scheduler
options INET # InterNETworking
options INET6 # IPv6 communications protocols
options TCP_HHOOK # hhook(9) framework for TCP
options GEOM_PART_BSD # BSD partition scheme
options GEOM_PART_MBR # MBR partition scheme
options TMPFS # Efficient memory filesystem
options FFS # Berkeley Fast Filesystem
options NFSCL # Network Filesystem Client
options NFSLOCKD # Network Lock Manager
options NFS_ROOT # NFS usable as /, requires NFSCL
options BOOTP
options BOOTP_NFSROOT
options BOOTP_NFSV3
options BOOTP_WIRED_TO=mge0
#options ROOTDEVNAME=\"ufs:/dev/da0a\"
options SYSVSHM # SYSV-style shared memory
options SYSVMSG # SYSV-style message queues
options SYSVSEM # SYSV-style semaphores
options _KPOSIX_PRIORITY_SCHEDULING # Posix P1003_1B real-time extensions
options MUTEX_NOINLINE
options RWLOCK_NOINLINE
options NO_FFS_SNAPSHOT
options NO_SWAPPING
device pci
# Pseudo devices
device md
device loop
# Serial ports
device uart
# Networking
device ether
device mge # Marvell Gigabit Ethernet controller
device mii
device mdio
device e1000phy
device bpf
options DEVICE_POLLING
options HZ=1000
# I2C (TWSI)
device iic
device iicbus
device twsi
device ds133x
# USB
device usb
device ehci
device umass
device scbus
device pass
device da
# SATA
device mvs
# GPIO
device gpio
# Flattened Device Tree
options FDT
makeoptions FDT_DTS_FILE=db88f5281.dts

View file

@ -1,85 +0,0 @@
#
# Custom kernel for Marvell DB-88F6xxx boards.
#
# $FreeBSD$
#
#NO_UNIVERSE
ident DB-88F6XXX
include "std.arm"
include "../mv/kirkwood/std.db88f6xxx"
options SOC_MV_KIRKWOOD
options SCHED_4BSD # 4BSD scheduler
options INET # InterNETworking
options INET6 # IPv6 communications protocols
options TCP_HHOOK # hhook(9) framework for TCP
options FFS # Berkeley Fast Filesystem
options NFSCL # Network Filesystem Client
options NFSLOCKD # Network Lock Manager
options NFS_ROOT # NFS usable as /, requires NFSCL
options TMPFS # Efficient memory filesystem
options GEOM_PART_BSD # BSD partition scheme
options GEOM_PART_MBR # MBR partition scheme
options SYSVSHM # SYSV-style shared memory
options SYSVMSG # SYSV-style message queues
options SYSVSEM # SYSV-style semaphores
options _KPOSIX_PRIORITY_SCHEDULING # POSIX P1003_1B real-time extensions
options MUTEX_NOINLINE
options RWLOCK_NOINLINE
options NO_FFS_SNAPSHOT
options NO_SWAPPING
# NFS root from boopt/dhcp
options BOOTP
options BOOTP_NFSROOT
options BOOTP_NFSV3
options BOOTP_WIRED_TO=mge0
#options ROOTDEVNAME=\"ufs:/dev/da0a\"
device pci
# Pseudo devices
device loop
device md
# Serial ports
device uart
# Networking
device ether
device mge # Marvell Gigabit Ethernet controller
device mii
device mdio
device e1000phy
device bpf
device cesa # Marvell security engine
device crypto
device cryptodev
# USB
device usb
device ehci
device umass
device scbus
device pass
device da
# I2C (TWSI)
device iic
device iicbus
device twsi
# SATA
device mvs
# GPIO
device gpio
# Flattened Device Tree
options FDT # Configure using FDT/DTB data
options FDT_DTB_STATIC
makeoptions FDT_DTS_FILE=db88f6281.dts

View file

@ -1,155 +0,0 @@
#
# Custom kernel for Seagate DockStar (Marvell SheevaPlug based) devices.
#
# $FreeBSD$
#
# https://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html
#
# The handbook is also available locally in /usr/share/doc/handbook
# if you've installed the doc distribution, otherwise always see the
# FreeBSD World Wide Web server (https://www.FreeBSD.org/) for the
# latest information.
#
# An exhaustive list of options and more detailed explanations of the
# device lines is also present in the ../../conf/NOTES and NOTES files.
# If you are in doubt as to the purpose or necessity of a line, check first
# in NOTES.
#
# $FreeBSD$
#
#NO_UNIVERSE
ident DOCKSTAR
include "std.arm"
include "../mv/kirkwood/std.db88f6xxx"
options SOC_MV_KIRKWOOD
options SCHED_4BSD # 4BSD scheduler
options INET # InterNETworking
options INET6 # IPv6 communications protocols
options TCP_HHOOK # hhook(9) framework for TCP
options FFS # Berkeley Fast Filesystem
options SOFTUPDATES # Enable FFS soft updates support
options NFSCL # Network Filesystem Client
options NFSLOCKD # Network Lock Manager
#options NFS_ROOT # NFS usable as /, requires NFSCL
options MSDOSFS # MSDOS Filesystem
options CD9660 # ISO 9660 filesystem
options NULLFS # NULL filesystem
options TMPFS # Efficient memory filesystem
options GEOM_PART_GPT # GUID Partition Tables
options GEOM_PART_BSD # BSD partition scheme
options GEOM_PART_MBR # MBR partition scheme
options GEOM_LABEL # Provides labelization
options GEOM_ELI # Disk encryption
options SYSVSHM # SYSV-style shared memory
options SYSVMSG # SYSV-style message queues
options SYSVSEM # SYSV-style semaphores
options _KPOSIX_PRIORITY_SCHEDULING # POSIX P1003_1B real-time extensions
# Enable these options for nfs root configured via BOOTP.
#options BOOTP
#options BOOTP_NFSROOT
#options BOOTP_NFSV3
#options BOOTP_WIRED_TO=mge0
# If not using BOOTP, use something like one of these...
#options ROOTDEVNAME=\"ufs:/dev/da0a\"
options ROOTDEVNAME=\"ufs:/dev/da0s1a\"
#options ROOTDEVNAME=\"ufs:/dev/da0p10\"
#options ROOTDEVNAME=\"nfs:192.168.0.254/dreamplug\"
# Misc pseudo devices
device bpf # Required for DHCP
device firmware # firmware(9) required for USB wlan
device gif # IPv6 and IPv4 tunneling
device loop # Network loopback
device md # Memory/malloc disk
device pty # BSD-style compatibility pseudo ttys
device tuntap # Packet tunnel.
device ether # Required for all ethernet devices
device vlan # 802.1Q VLAN support
device wlan # 802.11 WLAN support
# cam support for umass and ahci
device scbus
device pass
device da
# Serial ports
device uart
# Networking
device mge # Marvell Gigabit Ethernet controller
device mii
device mdio
device e1000phy
# USB
options USB_HOST_ALIGN=32 # Align DMA to cacheline
device usb # Basic usb support
device ehci # USB host controller
device umass # Mass storage
device uhid # Human-interface devices
device rum # Ralink Technology RT2501USB wireless NICs
device uath # Atheros AR5523 wireless NICs
device ural # Ralink Technology RT2500USB wireless NICs
device zyd # ZyDAS zb1211/zb1211b wireless NICs
device urtw # Realtek RTL8187B/L USB
device upgt # Conexant/Intersil PrismGT SoftMAC USB
device u3g # USB-based 3G modems (Option, Huawei, Sierra)
# I2C (TWSI)
device iic
device iicbus
device twsi
# Sound
device sound
device snd_uaudio
#crypto
device cesa # Marvell security engine
device crypto
device cryptodev
# IPSec
device enc
options IPSEC
options TCP_SIGNATURE # include support for RFC 2385
# IPFW
options IPFIREWALL
options IPFIREWALL_DEFAULT_TO_ACCEPT
options IPFIREWALL_VERBOSE
options IPFIREWALL_VERBOSE_LIMIT=100
options IPFIREWALL_NAT
options LIBALIAS
options DUMMYNET
options IPDIVERT
#PF
device pf
device pflog
device pfsync
# GPIO
device gpio
# ALTQ, required for PF
options ALTQ # Basic ALTQ support
options ALTQ_CBQ # Class Based Queueing
options ALTQ_RED # Random Early Detection
options ALTQ_RIO # RED In/Out
options ALTQ_HFSC # Hierarchical Packet Scheduler
options ALTQ_CDNR # Traffic conditioner
options ALTQ_PRIQ # Priority Queueing
options ALTQ_NOPCC # Required if the TSC is unusable
#options ALTQ_DEBUG
# Flattened Device Tree
options FDT # Configure using FDT/DTB data
options FDT_DTB_STATIC
makeoptions FDT_DTS_FILE=dockstar.dts

View file

@ -1,163 +0,0 @@
# Kernel config for GlobalScale Technologies DreamPlug version 1001.
#
# This is for units that are version 10, revision 01, with NOR SPI flash.
# These units are identified with the number "1001" on the S/N label.
#
# For more information on this file, please read the handbook section on
# Kernel Configuration Files:
#
# https://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html
#
# The handbook is also available locally in /usr/share/doc/handbook
# if you've installed the doc distribution, otherwise always see the
# FreeBSD World Wide Web server (https://www.FreeBSD.org/) for the
# latest information.
#
# An exhaustive list of options and more detailed explanations of the
# device lines is also present in the ../../conf/NOTES and NOTES files.
# If you are in doubt as to the purpose or necessity of a line, check first
# in NOTES.
#
# $FreeBSD$
#
#NO_UNIVERSE
ident DREAMPLUG-1001
include "std.arm"
include "../mv/kirkwood/std.db88f6xxx"
options SOC_MV_KIRKWOOD
options SCHED_4BSD # 4BSD scheduler
options INET # InterNETworking
options INET6 # IPv6 communications protocols
options TCP_HHOOK # hhook(9) framework for TCP
options FFS # Berkeley Fast Filesystem
options SOFTUPDATES # Enable FFS soft updates support
options NFSCL # Network Filesystem Client
options NFSLOCKD # Network Lock Manager
#options NFS_ROOT # NFS usable as /, requires NFSCL
options MSDOSFS # MSDOS Filesystem
options CD9660 # ISO 9660 filesystem
options NULLFS # NULL filesystem
options TMPFS # Efficient memory filesystem
options GEOM_PART_GPT # GUID Partition Tables
options GEOM_PART_BSD # BSD partition scheme
options GEOM_PART_MBR # MBR partition scheme
options GEOM_LABEL # Provides labelization
options GEOM_ELI # Disk encryption
options SYSVSHM # SYSV-style shared memory
options SYSVMSG # SYSV-style message queues
options SYSVSEM # SYSV-style semaphores
options _KPOSIX_PRIORITY_SCHEDULING # POSIX P1003_1B real-time extensions
# Enable these options for nfs root configured via BOOTP.
#options BOOTP
#options BOOTP_NFSROOT
#options BOOTP_NFSV3
#options BOOTP_WIRED_TO=mge0
# If not using BOOTP, use something like one of these...
#options ROOTDEVNAME=\"ufs:/dev/da1a\"
options ROOTDEVNAME=\"ufs:/dev/da1s1a\"
#options ROOTDEVNAME=\"ufs:/dev/da1p10\"
#options ROOTDEVNAME=\"nfs:192.168.0.254/dreamplug\"
# Misc pseudo devices
device bpf # Required for DHCP
device firmware # firmware(9) required for USB wlan
device gif # IPv6 and IPv4 tunneling
device loop # Network loopback
device md # Memory/malloc disk
device pty # BSD-style compatibility pseudo ttys
device tuntap # Packet tunnel.
device ether # Required for all ethernet devices
device vlan # 802.1Q VLAN support
device wlan # 802.11 WLAN support
# cam support for umass and ahci
device scbus
device pass
device da
device cd
# Serial ports
device uart
# Networking
device mge # Marvell Gigabit Ethernet controller
device mii
device mdio
device e1000phy
# USB
options USB_HOST_ALIGN=32 # Align DMA to cacheline
device usb # Basic usb support
device ehci # USB host controller
device umass # Mass storage
device uhid # Human-interface devices
device rum # Ralink Technology RT2501USB wireless NICs
device uath # Atheros AR5523 wireless NICs
device ural # Ralink Technology RT2500USB wireless NICs
device zyd # ZyDAS zb1211/zb1211b wireless NICs
device urtw # Realtek RTL8187B/L USB
device upgt # Conexant/Intersil PrismGT SoftMAC USB
device u3g # USB-based 3G modems (Option, Huawei, Sierra)
# I2C (TWSI)
device iic
device iicbus
device twsi
# GPIO
device gpio
# SATA
device mvs
device ahci
# Sound
device sound
device snd_uaudio
#crypto
device cesa # Marvell security engine
device crypto
device cryptodev
# IPSec
device enc
options IPSEC
options TCP_SIGNATURE # include support for RFC 2385
# IPFW
options IPFIREWALL
options IPFIREWALL_DEFAULT_TO_ACCEPT
options IPFIREWALL_VERBOSE
options IPFIREWALL_VERBOSE_LIMIT=100
options IPFIREWALL_NAT
options LIBALIAS
options DUMMYNET
options IPDIVERT
#PF
device pf
device pflog
device pfsync
# ALTQ, required for PF
options ALTQ # Basic ALTQ support
options ALTQ_CBQ # Class Based Queueing
options ALTQ_RED # Random Early Detection
options ALTQ_RIO # RED In/Out
options ALTQ_HFSC # Hierarchical Packet Scheduler
options ALTQ_CDNR # Traffic conditioner
options ALTQ_PRIQ # Priority Queueing
options ALTQ_NOPCC # Required if the TSC is unusable
#options ALTQ_DEBUG
# Flattened Device Tree
options FDT # Configure using FDT/DTB data
options FDT_DTB_STATIC
makeoptions FDT_DTS_FILE=dreamplug-1001.dts

View file

@ -1,6 +1,49 @@
# arm-specific changes for doing a LINT build.
# $FreeBSD$
options FDT
machine arm armv7
cpu CPU_CORTEXA
cpu CPU_MV_PJ4B
makeoptions CONF_CFLAGS+="-march=armv7a"
# Add options for armv7 that are not in sys/conf/NOTES...
options ARM_L2_PIPT # Only L2 PIPT is supported
options FDT # Flattened device tree support
options FREEBSD_BOOT_LOADER # Process metadata passed from loader(8)
options INTRNG # Include INTRNG framework
options LINUX_BOOT_ABI # Process metadata passed from U-Boot
options PLATFORM # Include platform_if support
options SMP # Nearly all v7 SoCs are multicore
options VFP # Enable floating point hardware support
# NOTE: dtrace introduces CDDL-licensed components into the kernel
device dtrace # dtrace core
device dtraceall # include all dtrace modules
options KDTRACE_HOOKS
# Add misc devices which are specific to various arm platforms...
device generic_timer # ARM Generic Timer
device gic # Interrupt controller
device gpio # gpio interface and bus
device mpcore_timer # ARM MPCore Timer
device pl310 # PL310 L2 cache controller
device pl330 # ARM PL330 dma controller
device pmu # PMU support (for CCNT).
device twsi # i2c controller on Marvel and Allwinner
device xdma # xDMA framework for SoC on-chip dma controllers
# Add EXT_RESOURCES pseudo devices...
options EXT_RESOURCES
device clk
device phy
device hwreset
device nvmem
device regulator
device syscon
# Undo options from sys/conf/NOTES that we do not want...
@ -12,9 +55,6 @@ nooptions COMPAT_FREEBSD9
nooptions PPC_PROBE_CHIPSET
nooptions MAXCPU # value is set in machine/param.h
# Devices in sys/conf/NOTES for which no such hardware exists on arm,
# or the drivers don't compile...
nodevice sym
nodevice ccr
@ -25,10 +65,18 @@ nodevice snd_cmi
nodevice mpr
nodevice mps
# Add devices which are specific to various arm platforms...
# Build SOC-specific modules...
device twsi # i2c controller on Marvel and Allwinner
makeoptions MODULES_EXTRA+="allwinner"
makeoptions MODULES_EXTRA+="arm_ti"
makeoptions MODULES_EXTRA+="imx"
device pl330 # ARM PL330 dma controller
device xdma # xDMA framework for SoC on-chip dma controllers
# Build dtb files...
makeoptions MODULES_EXTRA+="dtb/allwinner"
makeoptions MODULES_EXTRA+="dtb/am335x"
makeoptions MODULES_EXTRA+="dtb/imx6"
makeoptions MODULES_EXTRA+="dtb/nvidia"
makeoptions MODULES_EXTRA+="dtb/omap4"
makeoptions MODULES_EXTRA+="dtb/rpi"
makeoptions MODULES_EXTRA+="dtb/zynq"

View file

@ -1,64 +0,0 @@
# armv7-specific changes for doing a LINT build.
#
# The contents of sys/conf/NOTES, sys/arm/conf/NOTES, and this file are
# concatenated (in that order) to create the LINT-V7 kernel config file.
#
# $FreeBSD$
#NO_UNIVERSE
machine arm armv7
cpu CPU_CORTEXA
cpu CPU_MV_PJ4B
makeoptions CONF_CFLAGS+="-march=armv7a"
# Add options for armv7 that are not in sys/conf/NOTES...
options ARM_L2_PIPT # Only L2 PIPT is supported
options FREEBSD_BOOT_LOADER # Process metadata passed from loader(8)
options INTRNG # Include INTRNG framework
options LINUX_BOOT_ABI # Process metadata passed from U-Boot
options PLATFORM # Include platform_if support
options SMP # Most v7 SoCs are multicore
options VFP # Enable floating point hardware support
# NOTE: dtrace introduces CDDL-licensed components into the kernel
device dtrace # dtrace core
device dtraceall # include all dtrace modules
options KDTRACE_HOOKS
# Add misc devices which are specific to various arm platforms...
device generic_timer # ARM Generic Timer
device gic # Interrupt controller
device gpio # gpio interface and bus
device mpcore_timer # ARM MPCore Timer
device pl310 # PL310 L2 cache controller
device pmu # PMU support (for CCNT).
# Add EXT_RESOURCES pseudo devices...
options EXT_RESOURCES
device clk
device phy
device hwreset
device nvmem
device regulator
device syscon
# Build SOC-specific modules...
makeoptions MODULES_EXTRA+="allwinner"
makeoptions MODULES_EXTRA+="arm_ti"
makeoptions MODULES_EXTRA+="imx"
# Build dtb files...
makeoptions MODULES_EXTRA+="dtb/allwinner"
makeoptions MODULES_EXTRA+="dtb/am335x"
makeoptions MODULES_EXTRA+="dtb/imx6"
makeoptions MODULES_EXTRA+="dtb/nvidia"
makeoptions MODULES_EXTRA+="dtb/omap4"
makeoptions MODULES_EXTRA+="dtb/rpi"
makeoptions MODULES_EXTRA+="dtb/zynq"

View file

@ -1,79 +0,0 @@
#
# Custom kernel for RT1310 boards.
#
# $FreeBSD$
#
#NO_UNIVERSE
ident RT1310
include "std.arm"
include "../ralink/std.ralink"
# Flattened Device Tree
options FDT
options FDT_DTB_STATIC
makeoptions FDT_DTS_FILE=wzr2-g300n.dts
makeoptions MODULES_OVERRIDE=""
#makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols
options SCHED_4BSD # 4BSD scheduler
options INET # InterNETworking
options FFS # Berkeley Fast Filesystem
options TMPFS # Efficient memory filesystem
options MSDOSFS
options ROOTDEVNAME=\"cd9660:/dev/cfid0s.rootfs.uzip\"
options SYSVSHM # SYSV-style shared memory
options SYSVMSG # SYSV-style message queues
options SYSVSEM # SYSV-style semaphores
options _KPOSIX_PRIORITY_SCHEDULING # Posix P1003_1B real-time extensions
options MUTEX_NOINLINE
options RWLOCK_NOINLINE
options NO_FFS_SNAPSHOT
options NO_SWAPPING
# Debugging
options ALT_BREAK_TO_DEBUGGER
options DDB
#options DEADLKRES # Enable the deadlock resolver
#options DIAGNOSTIC
#options INVARIANTS # Enable calls of extra sanity checking
#options INVARIANT_SUPPORT # Extra sanity checks of internal structures, required by INVARIANTS
options KDB
options WITNESS # Enable checks to detect deadlocks and cycles
options WITNESS_SKIPSPIN # Don't run witness on spinlocks for speed
#options WITNESS_KDB
# Pseudo devices
device loop
device md
device pty
# Serial ports
device uart
device uart_ns8250
# Flash
device cfi
device cfid
# Networking
device ether
device mii
device bpf
device fv
# etherswitch
device mdio
device etherswitch
device miiproxy
device ip17x
# GPIO
device gpio
device gpioled
device rt1310gpio

View file

@ -1,78 +0,0 @@
#
# Custom kernel for Marvell SheevaPlug devices.
#
# $FreeBSD$
#
#NO_UNIVERSE
ident SHEEVAPLUG
include "std.arm"
include "../mv/kirkwood/std.db88f6xxx"
options SOC_MV_KIRKWOOD
options HZ=1000
options SCHED_4BSD # 4BSD scheduler
options INET # InterNETworking
options INET6 # IPv6 communications protocols
options TCP_HHOOK # hhook(9) framework for TCP
options FFS # Berkeley Fast Filesystem
options NFSCL # Network Filesystem Client
options NFSLOCKD # Network Lock Manager
options NFS_ROOT # NFS usable as /, requires NFSCL
options TMPFS # Efficient memory filesystem
options GEOM_PART_BSD # BSD partition scheme
options GEOM_PART_MBR # MBR partition scheme
options SYSVSHM # SYSV-style shared memory
options SYSVMSG # SYSV-style message queues
options SYSVSEM # SYSV-style semaphores
options _KPOSIX_PRIORITY_SCHEDULING # POSIX P1003_1B real-time extensions
options MUTEX_NOINLINE
options RWLOCK_NOINLINE
options NO_FFS_SNAPSHOT
options NO_SWAPPING
# NFS root from boopt/dhcp
options BOOTP
options BOOTP_NFSROOT
options BOOTP_NFSV3
options BOOTP_WIRED_TO=mge0
# Root fs on USB device
#options ROOTDEVNAME=\"ufs:/dev/da0a\"
# Pseudo devices
device loop
# Serial ports
device uart
# Networking
device ether
device mge # Marvell Gigabit Ethernet controller
device mii
device mdio
device e1000phy
device bpf
options DEVICE_POLLING
device vlan
device cesa # Marvell security engine
device crypto
device cryptodev
# USB
device usb
device ehci
device umass
device scbus
device pass
device da
# GPIO
device gpio
# Flattened Device Tree
options FDT # Configure using FDT/DTB data
options FDT_DTB_STATIC
makeoptions FDT_DTS_FILE=sheevaplug.dts

View file

@ -1,78 +0,0 @@
#
# Custom kernel for the TS-7800 board.
#
# $FreeBSD$
#
#NO_UNIVERSE
ident TS7800
include "std.arm"
include "../mv/orion/std.ts7800"
options SOC_MV_ORION
options SCHED_4BSD # 4BSD scheduler
options INET # InterNETworking
options INET6 # IPv6 communications protocols
options TCP_HHOOK # hhook(9) framework for TCP
options FFS # Berkeley Fast Filesystem
options SOFTUPDATES # Enable FFS soft updates support
options NFSCL # Network Filesystem Client
options NFSLOCKD # Network Lock Manager
options NFS_ROOT # NFS usable as /, requires NFSCL
options BOOTP
options BOOTP_NFSROOT
options BOOTP_NFSV3
options BOOTP_WIRED_TO=mge0
options GEOM_PART_BSD # BSD partition scheme
options GEOM_PART_MBR # MBR partition scheme
options TMPFS # Efficient memory filesystem
options SYSVSHM # SYSV-style shared memory
options SYSVMSG # SYSV-style message queues
options SYSVSEM # SYSV-style semaphores
options _KPOSIX_PRIORITY_SCHEDULING # Posix P1003_1B real-time extensions
options MUTEX_NOINLINE
options RWLOCK_NOINLINE
options NO_FFS_SNAPSHOT
options NO_SWAPPING
device mvs
device pci
# Pseudo devices
device md
device loop
# Serial ports
device uart
# Networking
device ether
device mge # Marvell Gigabit Ethernet controller
device mii
device mdio
device e1000phy
device bpf
options HZ=1000
# USB
device usb
device ehci
device umass
device scbus
device pass
device da
# SATA
device ata
# GPIO
device gpio
# Flattened Device Tree
options FDT
options FDT_DTB_STATIC
makeoptions FDT_DTS_FILE=ts7800.dts

View file

@ -1,57 +0,0 @@
#!/bin/awk
# $FreeBSD$
#-
# SPDX-License-Identifier: BSD-2-Clause-FreeBSD
#
# Copyright (c) 2012 M. Warner Losh <imp@FreeBSD.org>
#
# 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.
#
#
# Generate FreeBSD's board ID's defines from Linux's
# arm board list.
#
# You can grab a new copy any time with:
# fetch -o sys/arm/conf/mach-types http://www.arm.linux.org.uk/developer/machines/download.php
#
BEGIN { nr = 0; boardid[nr] = "ARM_BOARD_ID_NONE"; num[nr++] = 0; }
/^#/ { next; }
/^[ ]*$/ { next; }
NF == 4 {
boardid[nr] = "ARM_BOARD_ID_"$3;
num[nr] = $4;
nr++
}
END {
printf("/* Arm board ID file generated automatically from Linux's mach-types file. */\n\n");
printf("#ifndef _SYS_ARM_ARM_BOARDID_H\n");
printf("#define _SYS_ARM_ARM_BOARDID_H\n\n");
for (i = 0; i < nr; i++) {
printf("#define %-30s %d\n", boardid[i], num[i]);
}
printf("\n#endif /* _SYS_ARM_ARM_BOARDID_H */\n");
}

File diff suppressed because it is too large Load diff

View file

@ -1,38 +0,0 @@
# Standard kernel config items for all ARMv4/v5 systems.
#
# $FreeBSD$
options COMPAT_FREEBSD10 # Compatible with FreeBSD10
options COMPAT_FREEBSD11 # Compatible with FreeBSD11
options COMPAT_FREEBSD12 # Compatible with FreeBSD12
# Debugging support. Always need this:
makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols
options KDB # Enable kernel debugger support.
options KDB_TRACE # Print a stack trace for a panic.
# For full debugger support use (turn off in stable branch):
options DDB # Support DDB
#options DEADLKRES # Enable the deadlock resolver
options INVARIANTS # Enable calls of extra sanity checking
options INVARIANT_SUPPORT # Extra sanity checks of internal structures, required by INVARIANTS
options WITNESS # Enable checks to detect deadlocks and cycles
options WITNESS_SKIPSPIN # Don't run witness on spinlocks for speed
#options MALLOC_DEBUG_MAXZONES=8 # Separate malloc(9) zones
options ALT_BREAK_TO_DEBUGGER # Enter debugger on keyboard escape sequence
options USB_DEBUG # Enable usb debug support code
options VERBOSE_SYSINIT=0 # Support debug.verbose_sysinit, off by default
# Optional extras, never enabled by default:
#options BOOTVERBOSE
#options DEBUG # May result in extreme spewage
#options KTR
#options KTR_COMPILE=KTR_ALL
#options KTR_ENTRIES=16384
#options KTR_MASK=(KTR_SPARE2)
#options KTR_VERBOSE=0
#options USB_REQ_DEBUG
#options USB_VERBOSE

View file

@ -1,64 +0,0 @@
/*-
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
*
* Copyright (c) 2012 M. Warner Losh <imp@FreeBSD.org>
*
* 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 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 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 _ARM_INCLUDE_BOARD_H_
#define _ARM_INCLUDE_BOARD_H_
#include <sys/linker_set.h>
typedef long (arm_board_init_fn)(void);
struct arm_board {
int board_id; /* Board ID from the boot loader */
const char *board_name; /* Human readable name */
arm_board_init_fn *board_init; /* Board initialize code */
};
#if defined(ARM_MANY_BOARD)
#include "board_id.h"
#define ARM_BOARD(id, name) \
static struct arm_board this_board = { \
.board_id = ARM_BOARD_ID_ ## id, \
.board_name = name, \
.board_init = board_init, \
}; \
DATA_SET(arm_boards, this_board);
#define BOARD_INIT static
#else /* !ARM_MANY_BOARD */
#define ARM_BOARD(id, name)
extern arm_board_init_fn board_init;
#define BOARD_INIT
#endif /* ARM_MANY_BOARD */
#endif /* _ARM_INCLUDE_BOARD_H_ */

View file

@ -1,500 +0,0 @@
/*-
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
*
* Copyright (c) 1994-1998 Mark Brinicombe.
* Copyright (c) 1994 Brini.
* All rights reserved.
*
* This code is derived from software written for Brini by Mark Brinicombe
*
* 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 Brini.
* 4. The name of the company nor the name of the author may be used to
* endorse or promote products derived from this software without specific
* prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY BRINI ``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 BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: FreeBSD: //depot/projects/arm/src/sys/arm/at91/kb920x_machdep.c, rev 45
*/
#include "opt_ddb.h"
#include "opt_platform.h"
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#define _ARM32_BUS_DMA_PRIVATE
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/bus.h>
#include <sys/devmap.h>
#include <sys/kernel.h>
#include <vm/vm.h>
#include <vm/pmap.h>
#include <arm/arm/mpcore_timervar.h>
#include <arm/arm/nexusvar.h>
#include <machine/bus.h>
#include <machine/fdt.h>
#include <machine/machdep.h>
#include <machine/platform.h>
#include <machine/cpu-v4.h>
#include <arm/mv/mvreg.h> /* XXX */
#include <arm/mv/mvvar.h> /* XXX eventually this should be eliminated */
#include <arm/mv/mvwin.h>
#include <dev/fdt/fdt_common.h>
#include <dev/ofw/ofw_bus_subr.h>
static int platform_mpp_init(void);
void cpu_reset(void);
#define MPP_PIN_MAX 68
#define MPP_PIN_CELLS 2
#define MPP_PINS_PER_REG 8
#define MPP_SEL(pin,func) (((func) & 0xf) << \
(((pin) % MPP_PINS_PER_REG) * 4))
static void
mv_busdma_tag_init(void *arg __unused)
{
phandle_t node;
bus_dma_tag_t dmat;
/*
* If this platform has coherent DMA, create the parent DMA tag to pass
* down the coherent flag to all busses and devices on the platform,
* otherwise return without doing anything. By default create tag
* for all A38x-based platforms only.
*/
if ((node = OF_finddevice("/")) == -1)
return;
if (ofw_bus_node_is_compatible(node, "marvell,armada380") == 0)
return;
bus_dma_tag_create(NULL, /* No parent tag */
1, 0, /* alignment, bounds */
BUS_SPACE_MAXADDR, /* lowaddr */
BUS_SPACE_MAXADDR, /* highaddr */
NULL, NULL, /* filter, filterarg */
BUS_SPACE_MAXSIZE, /* maxsize */
BUS_SPACE_UNRESTRICTED, /* nsegments */
BUS_SPACE_MAXSIZE, /* maxsegsize */
BUS_DMA_COHERENT, /* flags */
NULL, NULL, /* lockfunc, lockarg */
&dmat);
nexus_set_dma_tag(dmat);
}
SYSINIT(mv_busdma_tag, SI_SUB_DRIVERS, SI_ORDER_ANY, mv_busdma_tag_init, NULL);
static int
platform_mpp_init(void)
{
pcell_t pinmap[MPP_PIN_MAX * MPP_PIN_CELLS];
int mpp[MPP_PIN_MAX];
uint32_t ctrl_val, ctrl_offset;
pcell_t reg[4];
u_long start, size;
phandle_t node;
pcell_t pin_cells, *pinmap_ptr, pin_count;
ssize_t len;
int par_addr_cells, par_size_cells;
int tuple_size, tuples, rv, pins, i, j;
int mpp_pin, mpp_function;
/*
* Try to access the MPP node directly i.e. through /aliases/mpp.
*/
if ((node = OF_finddevice("mpp")) != -1)
if (ofw_bus_node_is_compatible(node, "mrvl,mpp"))
goto moveon;
/*
* Find the node the long way.
*/
if ((node = OF_finddevice("/")) == -1)
return (ENXIO);
if ((node = fdt_find_compatible(node, "simple-bus", 0)) == 0)
return (ENXIO);
if ((node = fdt_find_compatible(node, "mrvl,mpp", 0)) == 0)
/*
* No MPP node. Fall back to how MPP got set by the
* first-stage loader and try to continue booting.
*/
return (0);
moveon:
/*
* Process 'reg' prop.
*/
if ((rv = fdt_addrsize_cells(OF_parent(node), &par_addr_cells,
&par_size_cells)) != 0)
return(ENXIO);
tuple_size = sizeof(pcell_t) * (par_addr_cells + par_size_cells);
len = OF_getprop(node, "reg", reg, sizeof(reg));
tuples = len / tuple_size;
if (tuple_size <= 0)
return (EINVAL);
/*
* Get address/size. XXX we assume only the first 'reg' tuple is used.
*/
rv = fdt_data_to_res(reg, par_addr_cells, par_size_cells,
&start, &size);
if (rv != 0)
return (rv);
start += fdt_immr_va;
/*
* Process 'pin-count' and 'pin-map' props.
*/
if (OF_getencprop(node, "pin-count", &pin_count, sizeof(pin_count)) <= 0)
return (ENXIO);
if (pin_count > MPP_PIN_MAX)
return (ERANGE);
if (OF_getencprop(node, "#pin-cells", &pin_cells, sizeof(pin_cells)) <= 0)
pin_cells = MPP_PIN_CELLS;
if (pin_cells > MPP_PIN_CELLS)
return (ERANGE);
tuple_size = sizeof(pcell_t) * pin_cells;
bzero(pinmap, sizeof(pinmap));
len = OF_getencprop(node, "pin-map", pinmap, sizeof(pinmap));
if (len <= 0)
return (ERANGE);
if (len % tuple_size)
return (ERANGE);
pins = len / tuple_size;
if (pins > pin_count)
return (ERANGE);
/*
* Fill out a "mpp[pin] => function" table. All pins unspecified in
* the 'pin-map' property are defaulted to 0 function i.e. GPIO.
*/
bzero(mpp, sizeof(mpp));
pinmap_ptr = pinmap;
for (i = 0; i < pins; i++) {
mpp_pin = *pinmap_ptr;
mpp_function = *(pinmap_ptr + 1);
mpp[mpp_pin] = mpp_function;
pinmap_ptr += pin_cells;
}
/*
* Prepare and program MPP control register values.
*/
ctrl_offset = 0;
for (i = 0; i < pin_count;) {
ctrl_val = 0;
for (j = 0; j < MPP_PINS_PER_REG; j++) {
if (i + j == pin_count - 1)
break;
ctrl_val |= MPP_SEL(i + j, mpp[i + j]);
}
i += MPP_PINS_PER_REG;
bus_space_write_4(fdtbus_bs_tag, start, ctrl_offset,
ctrl_val);
#if defined(SOC_MV_ORION)
/*
* Third MPP reg on Orion SoC is placed
* non-linearly (with different offset).
*/
if (i == (2 * MPP_PINS_PER_REG))
ctrl_offset = 0x50;
else
#endif
ctrl_offset += 4;
}
return (0);
}
vm_offset_t
platform_lastaddr(void)
{
return (fdt_immr_va);
}
void
platform_probe_and_attach(void)
{
if (fdt_immr_addr(MV_BASE) != 0)
while (1);
}
void
platform_gpio_init(void)
{
/*
* Re-initialise MPP. It is important to call this prior to using
* console as the physical connection can be routed via MPP.
*/
if (platform_mpp_init() != 0)
while (1);
}
void
platform_late_init(void)
{
/*
* Re-initialise decode windows
*/
if (mv_check_soc_family() == MV_SOC_UNSUPPORTED)
panic("Unsupported SoC family\n");
if (soc_decode_win() != 0)
printf("WARNING: could not re-initialise decode windows! "
"Running with existing settings...\n");
}
#define FDT_DEVMAP_MAX (MV_WIN_CPU_MAX + 2)
static struct devmap_entry fdt_devmap[FDT_DEVMAP_MAX] = {
{ 0, 0, 0, }
};
static int
platform_sram_devmap(struct devmap_entry *map)
{
phandle_t child, root;
u_long base, size;
/*
* SRAM range.
*/
if ((root = OF_finddevice("/")) == 0)
return (ENXIO);
if ((child = OF_finddevice("/sram")) != 0)
if (ofw_bus_node_is_compatible(child, "mrvl,cesa-sram") ||
ofw_bus_node_is_compatible(child, "mrvl,scratchpad"))
goto moveon;
if ((child = fdt_find_compatible(root, "mrvl,cesa-sram", 0)) == 0 &&
(child = fdt_find_compatible(root, "mrvl,scratchpad", 0)) == 0)
goto out;
moveon:
if (fdt_regsize(child, &base, &size) != 0)
return (EINVAL);
map->pd_va = MV_CESA_SRAM_BASE; /* XXX */
map->pd_pa = base;
map->pd_size = size;
return (0);
out:
return (ENOENT);
}
/*
* Supply a default do-nothing implementation of mv_pci_devmap() via a weak
* alias. Many Marvell platforms don't support a PCI interface, but to support
* those that do, we end up with a reference to this function below, in
* platform_devmap_init(). If "device pci" appears in the kernel config, the
* real implementation of this function in arm/mv/mv_pci.c overrides the weak
* alias defined here.
*/
int mv_default_fdt_pci_devmap(phandle_t node, struct devmap_entry *devmap,
vm_offset_t io_va, vm_offset_t mem_va);
int
mv_default_fdt_pci_devmap(phandle_t node, struct devmap_entry *devmap,
vm_offset_t io_va, vm_offset_t mem_va)
{
return (0);
}
__weak_reference(mv_default_fdt_pci_devmap, mv_pci_devmap);
/*
* XXX: When device entry in devmap has pd_size smaller than section size,
* system will freeze during initialization
*/
/*
* Construct devmap table with DT-derived config data.
*/
int
platform_devmap_init(void)
{
phandle_t root, child;
pcell_t bank_count;
int i, num_mapped;
i = 0;
devmap_register_table(&fdt_devmap[0]);
if ((root = OF_finddevice("/")) == -1)
return (ENXIO);
/*
* IMMR range.
*/
fdt_devmap[i].pd_va = fdt_immr_va;
fdt_devmap[i].pd_pa = fdt_immr_pa;
fdt_devmap[i].pd_size = fdt_immr_size;
i++;
/*
* SRAM range.
*/
if (i < FDT_DEVMAP_MAX)
if (platform_sram_devmap(&fdt_devmap[i]) == 0)
i++;
/*
* PCI range(s).
* PCI range(s) and localbus.
*/
for (child = OF_child(root); child != 0; child = OF_peer(child)) {
if (mv_fdt_is_type(child, "pci") ||
mv_fdt_is_type(child, "pciep")) {
/*
* Check space: each PCI node will consume 2 devmap
* entries.
*/
if (i + 1 >= FDT_DEVMAP_MAX)
return (ENOMEM);
/*
* XXX this should account for PCI and multiple ranges
* of a given kind.
*/
if (mv_pci_devmap(child, &fdt_devmap[i], MV_PCI_VA_IO_BASE,
MV_PCI_VA_MEM_BASE) != 0)
return (ENXIO);
i += 2;
}
if (ofw_bus_node_is_compatible(child, "mrvl,lbc")) {
/* Check available space */
if (OF_getencprop(child, "bank-count", &bank_count,
sizeof(bank_count)) <= 0)
/* If no property, use default value */
bank_count = 1;
if ((i + bank_count) >= FDT_DEVMAP_MAX)
return (ENOMEM);
/* Add all localbus ranges to device map */
num_mapped = 0;
if (fdt_localbus_devmap(child, &fdt_devmap[i],
(int)bank_count, &num_mapped) != 0)
return (ENXIO);
i += num_mapped;
}
}
return (0);
}
struct arm32_dma_range *
bus_dma_get_range(void)
{
return (NULL);
}
int
bus_dma_get_range_nb(void)
{
return (0);
}
void
cpu_reset(void)
{
write_cpu_ctrl(RSTOUTn_MASK, SOFT_RST_OUT_EN);
write_cpu_ctrl(SYSTEM_SOFT_RESET, SYS_SOFT_RST);
while(1);
}
#ifdef DDB
#include <ddb/ddb.h>
DB_SHOW_COMMAND(cp15, db_show_cp15)
{
u_int reg;
__asm __volatile("mrc p15, 0, %0, c0, c0, 0" : "=r" (reg));
db_printf("Cpu ID: 0x%08x\n", reg);
__asm __volatile("mrc p15, 0, %0, c0, c0, 1" : "=r" (reg));
db_printf("Current Cache Lvl ID: 0x%08x\n",reg);
reg = cp15_sctlr_get();
db_printf("Ctrl: 0x%08x\n",reg);
reg = cp15_actlr_get();
db_printf("Aux Ctrl: 0x%08x\n",reg);
__asm __volatile("mrc p15, 0, %0, c0, c1, 0" : "=r" (reg));
db_printf("Processor Feat 0: 0x%08x\n", reg);
__asm __volatile("mrc p15, 0, %0, c0, c1, 1" : "=r" (reg));
db_printf("Processor Feat 1: 0x%08x\n", reg);
__asm __volatile("mrc p15, 0, %0, c0, c1, 2" : "=r" (reg));
db_printf("Debug Feat 0: 0x%08x\n", reg);
__asm __volatile("mrc p15, 0, %0, c0, c1, 3" : "=r" (reg));
db_printf("Auxiliary Feat 0: 0x%08x\n", reg);
__asm __volatile("mrc p15, 0, %0, c0, c1, 4" : "=r" (reg));
db_printf("Memory Model Feat 0: 0x%08x\n", reg);
__asm __volatile("mrc p15, 0, %0, c0, c1, 5" : "=r" (reg));
db_printf("Memory Model Feat 1: 0x%08x\n", reg);
__asm __volatile("mrc p15, 0, %0, c0, c1, 6" : "=r" (reg));
db_printf("Memory Model Feat 2: 0x%08x\n", reg);
__asm __volatile("mrc p15, 0, %0, c0, c1, 7" : "=r" (reg));
db_printf("Memory Model Feat 3: 0x%08x\n", reg);
__asm __volatile("mrc p15, 1, %0, c15, c2, 0" : "=r" (reg));
db_printf("Aux Func Modes Ctrl 0: 0x%08x\n",reg);
__asm __volatile("mrc p15, 1, %0, c15, c2, 1" : "=r" (reg));
db_printf("Aux Func Modes Ctrl 1: 0x%08x\n",reg);
__asm __volatile("mrc p15, 1, %0, c15, c12, 0" : "=r" (reg));
db_printf("CPU ID code extension: 0x%08x\n",reg);
}
DB_SHOW_COMMAND(vtop, db_show_vtop)
{
u_int reg;
if (have_addr) {
__asm __volatile("mcr p15, 0, %0, c7, c8, 0" : : "r" (addr));
__asm __volatile("mrc p15, 0, %0, c7, c4, 0" : "=r" (reg));
db_printf("Physical address reg: 0x%08x\n",reg);
} else
db_printf("show vtop <virt_addr>\n");
}
#endif /* DDB */

View file

@ -1,120 +0,0 @@
/*-
* SPDX-License-Identifier: BSD-3-Clause
*
* Copyright (C) 2008 MARVELL INTERNATIONAL LTD.
* All rights reserved.
*
* Developed by Semihalf.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of MARVELL nor the names of contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY 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 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 <machine/bus.h>
#include <machine/fdt.h>
#include <arm/mv/mvreg.h>
#include <arm/mv/mvvar.h>
#include <arm/mv/mvwin.h>
/*
* Virtual address space layout:
* -----------------------------
* 0x0000_0000 - 0xBFFF_FFFF : User Process (3 GB)
* 0xC000_0000 - virtual_avail : Kernel Reserved (text, data, page tables,
* : stack etc.)
* virtual-avail - 0xEFFF_FFFF : KVA (virtual_avail is typically < 0xc0a0_0000)
* 0xF000_0000 - 0xF0FF_FFFF : No-Cache allocation area (16 MB)
* 0xF100_0000 - 0xF10F_FFFF : SoC Integrated devices registers range (1 MB)
* 0xF110_0000 - 0xF11F_FFFF : PCI-Express I/O space (1MB)
* 0xF120_0000 - 0xF12F_FFFF : PCI I/O space (1MB)
* 0xF130_0000 - 0xF52F_FFFF : PCI-Express memory space (64MB)
* 0xF530_0000 - 0xF92F_FFFF : PCI memory space (64MB)
* 0xF930_0000 - 0xF93F_FFFF : Device Bus: BOOT (1 MB)
* 0xF940_0000 - 0xF94F_FFFF : Device Bus: CS0 (1 MB)
* 0xF950_0000 - 0xFB4F_FFFF : Device Bus: CS1 (32 MB)
* 0xFB50_0000 - 0xFB5F_FFFF : Device Bus: CS2 (1 MB)
* 0xFB60_0000 - 0xFFFE_FFFF : Unused (~74MB)
* 0xFFFF_0000 - 0xFFFF_0FFF : 'High' vectors page (4 kB)
* 0xFFFF_1000 - 0xFFFF_1FFF : ARM_TP_ADDRESS/RAS page (4 kB)
* 0xFFFF_2000 - 0xFFFF_FFFF : Unused (56 kB)
*/
struct resource_spec mv_gpio_res[] = {
{ SYS_RES_MEMORY, 0, RF_ACTIVE },
{ SYS_RES_IRQ, 0, RF_ACTIVE },
{ SYS_RES_IRQ, 1, RF_ACTIVE },
{ SYS_RES_IRQ, 2, RF_ACTIVE },
{ SYS_RES_IRQ, 3, RF_ACTIVE },
{ -1, 0 }
};
const struct decode_win idma_win_tbl[] = {
{ 0 },
};
const struct decode_win *idma_wins = idma_win_tbl;
int idma_wins_no = 0;
const struct decode_win xor_win_tbl[] = {
{ 0 },
};
const struct decode_win *xor_wins = xor_win_tbl;
int xor_wins_no = 0;
uint32_t
get_tclk(void)
{
uint32_t sar;
/*
* On Discovery TCLK is can be configured to 166 MHz or 200 MHz.
* Current setting is read from Sample At Reset register.
*/
sar = bus_space_read_4(fdtbus_bs_tag, MV_MPP_BASE, SAMPLE_AT_RESET_HI);
sar = (sar & TCLK_MASK) >> TCLK_SHIFT;
switch (sar) {
case 0:
return (TCLK_166MHZ);
case 1:
return (TCLK_200MHZ);
default:
panic("Unknown TCLK settings!");
}
}
uint32_t
get_cpu_freq(void)
{
return (0);
}

View file

@ -1,5 +0,0 @@
# $FreeBSD$
arm/mv/discovery/discovery.c standard
arm/mv/ic.c standard

View file

@ -1,7 +0,0 @@
# $FreeBSD$
include "../mv/std.mv"
files "../mv/discovery/files.db78xxx"
makeoptions KERNVIRTADDR=0xc0900000
options KERNVIRTADDR=0xc0900000

View file

@ -1,34 +0,0 @@
# $FreeBSD$
#
# The Marvell CPU cores
# - Compliant with V5TE architecture
# - Super scalar dual issue CPU
# - Big/Little Endian
# - MMU/MPU
# - L1 Cache: Supports streaming and write allocate
# - Variable pipeline stages
# - Out-of-order execution
# - Branch Prediction
# - JTAG/ICE
# - Vector Floating Point (VFP) unit
#
arm/mv/gpio.c optional gpio
arm/mv/mv_common.c standard
arm/mv/mv_localbus.c standard
arm/mv/armv5_machdep.c standard
arm/mv/mv_pci_ctrl.c optional pci | fdt
arm/mv/mv_pci.c optional pci
arm/mv/mv_ts.c standard
arm/mv/timer.c optional !soc_mv_armada38x
dev/cesa/cesa.c optional cesa
dev/iicbus/twsi/mv_twsi.c optional twsi
dev/mge/if_mge.c optional mge
dev/neta/if_mvneta_fdt.c optional neta fdt
dev/neta/if_mvneta.c optional neta mdio mii
dev/mvs/mvs_soc.c optional mvs
dev/uart/uart_dev_ns8250.c optional uart
dev/uart/uart_dev_snps.c optional uart
dev/usb/controller/ehci_mv.c optional ehci
dev/usb/controller/generic_xhci.c optional xhci
dev/ahci/ahci_mv_fdt.c optional ahci

View file

@ -1,5 +0,0 @@
# $FreeBSD$
arm/mv/ic.c standard
arm/mv/rtc.c standard
arm/mv/kirkwood/kirkwood.c standard

View file

@ -1,90 +0,0 @@
/*-
* SPDX-License-Identifier: BSD-3-Clause
*
* Copyright (C) 2008 MARVELL INTERNATIONAL LTD.
* All rights reserved.
*
* Developed by Semihalf.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of MARVELL nor the names of contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY 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 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 <machine/bus.h>
#include <arm/mv/mvreg.h>
#include <arm/mv/mvvar.h>
#include <arm/mv/mvwin.h>
struct resource_spec mv_gpio_res[] = {
{ SYS_RES_MEMORY, 0, RF_ACTIVE },
{ SYS_RES_IRQ, 0, RF_ACTIVE },
{ SYS_RES_IRQ, 1, RF_ACTIVE },
{ SYS_RES_IRQ, 2, RF_ACTIVE },
{ SYS_RES_IRQ, 3, RF_ACTIVE },
{ SYS_RES_IRQ, 4, RF_ACTIVE },
{ SYS_RES_IRQ, 5, RF_ACTIVE },
{ SYS_RES_IRQ, 6, RF_ACTIVE },
{ -1, 0 }
};
const struct decode_win xor_win_tbl[] = {
{ 0 },
};
const struct decode_win *xor_wins = xor_win_tbl;
int xor_wins_no = 0;
uint32_t
get_tclk(void)
{
uint32_t dev, rev;
/*
* On Kirkwood TCLK is not configurable and depends on silicon
* revision:
* - A0 and A1 have TCLK hardcoded to 200 MHz.
* - Z0 and others have TCLK hardcoded to 166 MHz.
*/
soc_id(&dev, &rev);
if (dev == MV_DEV_88F6281 && (rev == 2 || rev == 3))
return (TCLK_200MHZ);
if (dev == MV_DEV_88F6282)
return (TCLK_200MHZ);
return (TCLK_166MHZ);
}
uint32_t
get_cpu_freq(void)
{
return (0);
}

View file

@ -1,5 +0,0 @@
# $FreeBSD$
include "../mv/std.mv"
include "../mv/kirkwood/std.kirkwood"
files "../mv/kirkwood/files.kirkwood"

View file

@ -1,4 +0,0 @@
# $FreeBSD$
makeoptions KERNVIRTADDR=0xc0000000
options KERNVIRTADDR=0xc0000000

View file

@ -1,175 +0,0 @@
/*-
* SPDX-License-Identifier: BSD-3-Clause
*
* Copyright (C) 2008 MARVELL INTERNATIONAL LTD.
* All rights reserved.
*
* Developed by Semihalf.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of MARVELL nor the names of contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY 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 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 <vm/vm.h>
#include <vm/pmap.h>
#include <machine/bus.h>
#include <machine/intr.h>
#include <machine/vmparam.h>
#include <arm/mv/mvreg.h>
#include <arm/mv/mvvar.h>
#include <arm/mv/mvwin.h>
/*
* Virtual address space layout:
* -----------------------------
* 0x0000_0000 - 0xbfff_ffff : user process
*
* 0xc040_0000 - virtual_avail : kernel reserved (text, data, page tables
* : structures, ARM stacks etc.)
* virtual_avail - 0xefff_ffff : KVA (virtual_avail is typically < 0xc0a0_0000)
* 0xf000_0000 - 0xf0ff_ffff : no-cache allocation area (16MB)
* 0xf100_0000 - 0xf10f_ffff : SoC integrated devices registers range (1MB)
* 0xf110_0000 - 0xf11f_ffff : PCI-Express I/O space (1MB)
* 0xf120_0000 - 0xf12f_ffff : PCI I/O space (1MB)
* 0xf130_0000 - 0xf52f_ffff : PCI-Express memory space (64MB)
* 0xf530_0000 - 0xf92f_ffff : PCI memory space (64MB)
* 0xf930_0000 - 0xfffe_ffff : unused (~108MB)
* 0xffff_0000 - 0xffff_0fff : 'high' vectors page (4KB)
* 0xffff_1000 - 0xffff_1fff : ARM_TP_ADDRESS/RAS page (4KB)
* 0xffff_2000 - 0xffff_ffff : unused (~55KB)
*/
#if 0
int platform_pci_get_irq(u_int bus, u_int slot, u_int func, u_int pin);
/* Static device mappings. */
const struct devmap_entry db88f5xxx_devmap[] = {
/*
* Map the on-board devices VA == PA so that we can access them
* with the MMU on or off.
*/
{ /* SoC integrated peripherals registers range */
MV_BASE,
MV_PHYS_BASE,
MV_SIZE,
},
{ /* PCIE I/O */
MV_PCIE_IO_BASE,
MV_PCIE_IO_PHYS_BASE,
MV_PCIE_IO_SIZE,
},
{ /* PCIE Memory */
MV_PCIE_MEM_BASE,
MV_PCIE_MEM_PHYS_BASE,
MV_PCIE_MEM_SIZE,
},
{ /* PCI I/O */
MV_PCI_IO_BASE,
MV_PCI_IO_PHYS_BASE,
MV_PCI_IO_SIZE,
},
{ /* PCI Memory */
MV_PCI_MEM_BASE,
MV_PCI_MEM_PHYS_BASE,
MV_PCI_MEM_SIZE,
},
{ /* 7-seg LED */
MV_DEV_CS0_BASE,
MV_DEV_CS0_PHYS_BASE,
MV_DEV_CS0_SIZE,
},
{ 0, 0, 0, }
};
/*
* The pci_irq_map table consists of 3 columns:
* - PCI slot number (less than zero means ANY).
* - PCI IRQ pin (less than zero means ANY).
* - PCI IRQ (less than zero marks end of table).
*
* IRQ number from the first matching entry is used to configure PCI device
*/
/* PCI IRQ Map for DB-88F5281 */
const struct obio_pci_irq_map pci_irq_map[] = {
{ 7, -1, GPIO2IRQ(12) },
{ 8, -1, GPIO2IRQ(13) },
{ 9, -1, GPIO2IRQ(13) },
{ -1, -1, -1 }
};
/* PCI IRQ Map for DB-88F5182 */
const struct obio_pci_irq_map pci_irq_map[] = {
{ 7, -1, GPIO2IRQ(0) },
{ 8, -1, GPIO2IRQ(1) },
{ 9, -1, GPIO2IRQ(1) },
{ -1, -1, -1 }
};
#endif
#if 0
/*
* mv_gpio_config row structure:
* <GPIO number>, <GPIO flags>, <GPIO mode>
*
* - GPIO pin number (less than zero marks end of table)
* - GPIO flags:
* MV_GPIO_BLINK
* MV_GPIO_POLAR_LOW
* MV_GPIO_EDGE
* MV_GPIO_LEVEL
* - GPIO mode:
* 1 - Output, set to HIGH.
* 0 - Output, set to LOW.
* -1 - Input.
*/
/* GPIO Configuration for DB-88F5281 */
const struct gpio_config mv_gpio_config[] = {
{ 12, MV_GPIO_POLAR_LOW | MV_GPIO_LEVEL, -1 },
{ 13, MV_GPIO_POLAR_LOW | MV_GPIO_LEVEL, -1 },
{ -1, -1, -1 }
};
#if 0
/* GPIO Configuration for DB-88F5182 */
const struct gpio_config mv_gpio_config[] = {
{ 0, MV_GPIO_POLAR_LOW | MV_GPIO_LEVEL, -1 },
{ 1, MV_GPIO_POLAR_LOW | MV_GPIO_LEVEL, -1 },
{ -1, -1, -1 }
};
#endif
#endif

View file

@ -1,5 +0,0 @@
# $FreeBSD$
arm/mv/ic.c standard
arm/mv/orion/orion.c standard
arm/mv/orion/db88f5xxx.c standard

View file

@ -1,5 +0,0 @@
# $FreeBSD$
arm/mv/ic.c standard
arm/mv/orion/orion.c standard

View file

@ -1,111 +0,0 @@
/*-
* SPDX-License-Identifier: BSD-3-Clause
*
* Copyright (C) 2008 MARVELL INTERNATIONAL LTD.
* All rights reserved.
*
* Developed by Semihalf.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of MARVELL nor the names of contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY 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 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 <machine/bus.h>
#include <machine/fdt.h>
#include <arm/mv/mvreg.h>
#include <arm/mv/mvvar.h>
#include <arm/mv/mvwin.h>
#if 0
extern const struct obio_pci_irq_map pci_irq_map[];
const struct obio_pci mv_pci_info[] = {
{ MV_TYPE_PCIE,
MV_PCIE_BASE, MV_PCIE_SIZE,
MV_PCIE_IO_BASE, MV_PCIE_IO_SIZE, 4, 0x51,
MV_PCIE_MEM_BASE, MV_PCIE_MEM_SIZE, 4, 0x59,
NULL, MV_INT_PEX0
},
{ MV_TYPE_PCI,
MV_PCI_BASE, MV_PCI_SIZE,
MV_PCI_IO_BASE, MV_PCI_IO_SIZE, 3, 0x51,
MV_PCI_MEM_BASE, MV_PCI_MEM_SIZE, 3, 0x59,
pci_irq_map, -1
},
{ 0, 0, 0 }
};
#endif
struct resource_spec mv_gpio_res[] = {
{ SYS_RES_MEMORY, 0, RF_ACTIVE },
{ SYS_RES_IRQ, 0, RF_ACTIVE },
{ SYS_RES_IRQ, 1, RF_ACTIVE },
{ SYS_RES_IRQ, 2, RF_ACTIVE },
{ SYS_RES_IRQ, 3, RF_ACTIVE },
{ -1, 0 }
};
const struct decode_win idma_win_tbl[] = {
{ 0 },
};
const struct decode_win *idma_wins = idma_win_tbl;
int idma_wins_no = 0;
uint32_t
get_tclk(void)
{
uint32_t sar;
/*
* On Orion TCLK is can be configured to 150 MHz or 166 MHz.
* Current setting is read from Sample At Reset register.
*/
/* XXX MPP addr should be retrieved from the DT */
sar = bus_space_read_4(fdtbus_bs_tag, MV_MPP_BASE, SAMPLE_AT_RESET);
sar = (sar & TCLK_MASK) >> TCLK_SHIFT;
switch (sar) {
case 1:
return (TCLK_150MHZ);
case 2:
return (TCLK_166MHZ);
default:
panic("Unknown TCLK settings!");
}
}
uint32_t
get_cpu_freq(void)
{
return (0);
}

View file

@ -1,7 +0,0 @@
# $FreeBSD$
include "../mv/std.mv"
files "../mv/orion/files.db88f5xxx"
makeoptions KERNVIRTADDR=0xc0900000
options KERNVIRTADDR=0xc0900000

View file

@ -1,11 +0,0 @@
# $FreeBSD$
include "../mv/std.mv"
files "../mv/orion/files.ts7800"
makeoptions KERNVIRTADDR=0xc0900000
options KERNVIRTADDR=0xc0900000
options PHYSADDR=0x00000000
options LOADERRAMADDR=0x00000000
options FLASHADDR=0x00008000

View file

@ -1,7 +0,0 @@
# $FreeBSD$
arm/ralink/rt1310_machdep.c standard
arm/ralink/rt1310_intc.c standard
arm/ralink/rt1310_gpio.c optional rt1310gpio
arm/ralink/rt1310_timer.c standard
arm/ralink/if_fv.c optional fv

File diff suppressed because it is too large Load diff

View file

@ -1,452 +0,0 @@
/*-
* Copyright (C) 2007
* Oleksandr Tymoshenko <gonzo@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 SOFTWFV 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 FV DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR OR HIS RELATIVES 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 MIND, 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 SOFTWFV, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*
* $FreeBSD$
*
*/
#ifndef __IF_FVREG_H__
#define __IF_FVREG_H__
struct fv_desc {
uint32_t fv_stat;
uint32_t fv_devcs;
uint32_t fv_addr;
uint32_t fv_link;
};
#define FV_DMASIZE(len) ((len) & ((1 << 11)-1))
#define FV_PKTSIZE(len) ((len & 0xffff0000) >> 16)
#define FV_RX_RING_CNT 128
#define FV_TX_RING_CNT 128
#define FV_TX_RING_SIZE sizeof(struct fv_desc) * FV_TX_RING_CNT
#define FV_RX_RING_SIZE sizeof(struct fv_desc) * FV_RX_RING_CNT
#define FV_RING_ALIGN sizeof(struct fv_desc)
#define FV_RX_ALIGN sizeof(uint32_t)
#define FV_MAXFRAGS 8
#define FV_TX_INTR_THRESH 8
#define FV_TX_RING_ADDR(sc, i) \
((sc)->fv_rdata.fv_tx_ring_paddr + sizeof(struct fv_desc) * (i))
#define FV_RX_RING_ADDR(sc, i) \
((sc)->fv_rdata.fv_rx_ring_paddr + sizeof(struct fv_desc) * (i))
#define FV_INC(x,y) (x) = (((x) + 1) % y)
struct fv_txdesc {
struct mbuf *tx_m;
bus_dmamap_t tx_dmamap;
};
struct fv_rxdesc {
struct mbuf *rx_m;
bus_dmamap_t rx_dmamap;
struct fv_desc *desc;
/* Use this values on error instead of allocating new mbuf */
uint32_t saved_ctl, saved_ca;
};
struct fv_chain_data {
bus_dma_tag_t fv_parent_tag;
bus_dma_tag_t fv_tx_tag;
struct fv_txdesc fv_txdesc[FV_TX_RING_CNT];
bus_dma_tag_t fv_rx_tag;
struct fv_rxdesc fv_rxdesc[FV_RX_RING_CNT];
bus_dma_tag_t fv_tx_ring_tag;
bus_dma_tag_t fv_rx_ring_tag;
bus_dmamap_t fv_tx_ring_map;
bus_dmamap_t fv_rx_ring_map;
bus_dmamap_t fv_rx_sparemap;
int fv_tx_pkts;
int fv_tx_prod;
int fv_tx_cons;
int fv_tx_cnt;
int fv_rx_cons;
bus_dma_tag_t fv_sf_tag;
bus_dmamap_t fv_sf_buff_map;
uint32_t *fv_sf_buff;
};
struct fv_ring_data {
struct fv_desc *fv_rx_ring;
struct fv_desc *fv_tx_ring;
bus_addr_t fv_rx_ring_paddr;
bus_addr_t fv_tx_ring_paddr;
bus_addr_t fv_sf_paddr;
};
struct fv_softc {
struct ifnet *fv_ifp; /* interface info */
bus_space_handle_t fv_bhandle; /* bus space handle */
bus_space_tag_t fv_btag; /* bus space tag */
device_t fv_dev;
uint8_t fv_eaddr[ETHER_ADDR_LEN];
struct resource *fv_res;
int fv_rid;
struct resource *fv_irq;
void *fv_intrhand;
u_int32_t sc_inten; /* copy of CSR_INTEN */
u_int32_t sc_rxint_mask; /* mask of Rx interrupts we want */
u_int32_t sc_txint_mask; /* mask of Tx interrupts we want */
#ifdef MII
device_t fv_miibus;
#else
struct ifmedia fv_ifmedia;
#endif
#ifdef FV_MDIO
device_t fv_miiproxy;
#endif
int fv_if_flags;
bus_dma_tag_t fv_parent_tag;
bus_dma_tag_t fv_tag;
struct mtx fv_mtx;
phandle_t fv_ofw;
struct callout fv_stat_callout;
struct task fv_link_task;
struct fv_chain_data fv_cdata;
struct fv_ring_data fv_rdata;
int fv_link_status;
int fv_detach;
};
#define FV_LOCK(_sc) mtx_lock(&(_sc)->fv_mtx)
#define FV_UNLOCK(_sc) mtx_unlock(&(_sc)->fv_mtx)
#define FV_LOCK_ASSERT(_sc) mtx_assert(&(_sc)->fv_mtx, MA_OWNED)
/*
* register space access macros
*/
#define CSR_WRITE_4(sc, reg, val) \
bus_space_write_4(sc->fv_btag, sc->fv_bhandle, reg, val)
#define CSR_READ_4(sc, reg) \
bus_space_read_4(sc->fv_btag, sc->fv_bhandle, reg)
/* $NetBSD: aereg.h,v 1.2 2008/04/28 20:23:28 martin Exp $ */
/*-
* Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
* NASA Ames Research Center.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWFV 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 FV 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 SOFTWFV, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/*
* Descriptor Status bits common to transmit and receive.
*/
#define ADSTAT_OWN 0x80000000 /* Tulip owns descriptor */
#define ADSTAT_ES 0x00008000 /* Error Summary */
/*
* Descriptor Status bits for Receive Descriptor.
*/
#define ADSTAT_Rx_FF 0x40000000 /* Filtering Fail */
#define ADSTAT_Rx_FL 0x3fff0000 /* Frame Length including CRC */
#define ADSTAT_Rx_DE 0x00004000 /* Descriptor Error */
#define ADSTAT_Rx_LE 0x00001000 /* Length Error */
#define ADSTAT_Rx_RF 0x00000800 /* Runt Frame */
#define ADSTAT_Rx_MF 0x00000400 /* Multicast Frame */
#define ADSTAT_Rx_FS 0x00000200 /* First Descriptor */
#define ADSTAT_Rx_LS 0x00000100 /* Last Descriptor */
#define ADSTAT_Rx_TL 0x00000080 /* Frame Too Long */
#define ADSTAT_Rx_CS 0x00000040 /* Collision Seen */
#define ADSTAT_Rx_RT 0x00000020 /* Frame Type */
#define ADSTAT_Rx_RW 0x00000010 /* Receive Watchdog */
#define ADSTAT_Rx_RE 0x00000008 /* Report on MII Error */
#define ADSTAT_Rx_DB 0x00000004 /* Dribbling Bit */
#define ADSTAT_Rx_CE 0x00000002 /* CRC Error */
#define ADSTAT_Rx_ZER 0x00000001 /* Zero (always 0) */
#define ADSTAT_Rx_LENGTH(x) (((x) & ADSTAT_Rx_FL) >> 16)
/*
* Descriptor Status bits for Transmit Descriptor.
*/
#define ADSTAT_Tx_ES 0x00008000 /* Error Summary */
#define ADSTAT_Tx_TO 0x00004000 /* Transmit Jabber Timeout */
#define ADSTAT_Tx_LO 0x00000800 /* Loss of Carrier */
#define ADSTAT_Tx_NC 0x00000400 /* No Carrier */
#define ADSTAT_Tx_LC 0x00000200 /* Late Collision */
#define ADSTAT_Tx_EC 0x00000100 /* Excessive Collisions */
#define ADSTAT_Tx_HF 0x00000080 /* Heartbeat Fail */
#define ADSTAT_Tx_CC 0x00000078 /* Collision Count */
#define ADSTAT_Tx_ED 0x00000004 /* Excessive Deferral */
#define ADSTAT_Tx_UF 0x00000002 /* Underflow Error */
#define ADSTAT_Tx_DE 0x00000001 /* Deferred */
#define ADSTAT_Tx_COLLISIONS(x) (((x) & ADSTAT_Tx_CC) >> 3)
/*
* Descriptor Control bits common to transmit and receive.
*/
#define ADCTL_SIZE1 0x000007ff /* Size of buffer 1 */
#define ADCTL_SIZE1_SHIFT 0
#define ADCTL_SIZE2 0x003ff800 /* Size of buffer 2 */
#define ADCTL_SIZE2_SHIFT 11
#define ADCTL_ER 0x02000000 /* End of Ring */
#define ADCTL_CH 0x01000000 /* Second Address Chained */
/*
* Descriptor Control bits for Transmit Descriptor.
*/
#define ADCTL_Tx_IC 0x80000000 /* Interrupt on Completion */
#define ADCTL_Tx_LS 0x40000000 /* Last Segment */
#define ADCTL_Tx_FS 0x20000000 /* First Segment */
#define ADCTL_Tx_SETUP 0x08000000 /* Setup frame */
#define ADCTL_Tx_AC 0x04000000 /* Add CRC Disable */
#define ADCTL_Tx_DPD 0x00800000 /* Disabled Padding */
/*
* Control registers.
*/
/* tese are registers only found on this part */
#ifdef NOTUSE
#define CSR_MACCTL 0x0000 /* mac control */
#define CSR_MACHI 0x0004
#define CSR_MACLO 0x0008
#define CSR_HTHI 0x000C /* multicast table high */
#define CSR_HTLO 0x0010 /* multicast table low */
#define CSR_MIIADDR 0x0014 /* mii address */
#define CSR_MIIDATA 0x0018 /* mii data */
#define CSR_FLOWC 0x001C /* flow control */
#define CSR_VL1 0x0020 /* vlan 1 tag */
#endif
/* these are more or less normal Tulip registers */
#define CSR_BUSMODE (0x08*0) /* bus mode */
#define CSR_TXPOLL (0x08*1) /* tx poll demand */
#define CSR_RXPOLL (0x08*2) /* rx poll demand */
#define CSR_RXLIST (0x08*3) /* rx base descriptor address */
#define CSR_TXLIST (0x08*4) /* tx base descriptor address */
#define CSR_STATUS (0x08*5) /* (interrupt) status */
#define CSR_OPMODE (0x08*6) /* operation mode */
#define CSR_INTEN (0x08*7) /* interrupt enable */
#define CSR_MISSED (0x08*8) /* missed frame counter */
#ifdef NOTUSE
#define CSR_HTBA 0x1050 /* host tx buffer address (ro) */
#define CSR_HRBA 0x1054 /* host rx buffer address (ro) */
#endif
#define CSR_MIIMNG (0x08*9) /* MII Management Register */
#define CSR_FULLDUP (0x08*11) /* Full Duplex Register */
/* 21143 like register */
#define FULLDUP_CS 0x80000000 /* Cycle Size */
#define FULLDUP_TT_SHIFT 27 /* Transmit Timer */
#define FULLDUP_NTP_SHIFT 24 /* Number of Transmit Packets */
#define FULLDUP_RT_SHIFT 20 /* Receive Timer */
#define FULLDUP_NRP_SHIFT 17 /* Number of Receive Packets */
#define FULLDUP_CON_MODE 0x00010000 /* Continuous Mode */
#define FULLDUP_TIM_SHIFT 0 /* Timer Value */
/* CSR_MACCTL - Mac Control */
#define MACCTL_RE 0x00000004 /* rx enable */
#define MACCTL_TE 0x00000008 /* tx enable */
#define MACCTL_DC 0x00000020 /* deferral check */
#define MACCTL_PSTR 0x00000100 /* automatic pad strip */
#define MACCTL_DTRY 0x00000400 /* disable retry */
#define MACCTL_DBF 0x00000800 /* disable broadcast frames */
#define MACCTL_LCC 0x00001000 /* late collision control */
#define MACCTL_HASH 0x00002000 /* hash filtering enable */
#define MACCTL_HO 0x00008000 /* disable perfect filtering */
#define MACCTL_PB 0x00010000 /* pass bad frames */
#define MACCTL_IF 0x00020000 /* inverse filtering */
#define MACCTL_PR 0x00040000 /* promiscuous mode */
#define MACCTL_PM 0x00080000 /* pass all multicast */
#define MACCTL_FDX 0x00100000 /* full duplex mode */
#define MACCTL_LOOP 0x00600000 /* loopback mask */
#define MACCTL_LOOP_INT 0x00200000 /* internal loopback */
#define MACCTL_LOOP_EXT 0x00400000 /* external loopback */
#define MACCTL_LOOP_NONE 0x00000000
#define MACCTL_DRO 0x00800000 /* disable receive own */
#define MACCTL_PS 0x08000000 /* port select, 0 = mii */
#define MACCTL_HBD 0x10000000 /* heartbeat disable */
#define MACCTL_BLE 0x40000000 /* mac big endian */
#define MACCTL_RA 0x80000000 /* receive all packets */
/* CSR_MIIADDR - MII Addess */
#define MIIADDR_BUSY 0x00000001 /* mii busy */
#define MIIADDR_WRITE 0x00000002 /* mii write */
#define MIIADDR_REG_MASK 0x000007C0 /* mii register */
#define MIIADDR_REG_SHIFT 6
#define MIIADDR_PHY_MASK 0x0000F800 /* mii phy */
#define MIIADDR_PHY_SHIFT 11
#define MIIADDR_GETREG(x) (((x) & MIIADDR_REG) >> 6)
#define MIIADDR_PUTREG(x) (((x) << 6) & MIIADR_REG)
#define MIIADDR_GETPHY(x) (((x) & MIIADDR_PHY) >> 11)
#define MIIADDR_PUTPHY(x) (((x) << 6) & MIIADR_PHY)
/* CSR_FLOWC - Flow Control */
#define FLOWC_FCB 0x00000001 /* flow control busy */
#define FLOWC_FCE 0x00000002 /* flow control enable */
#define FLOWC_PCF 0x00000004 /* pass control frames */
#define FLOWC_PT 0xffff0000 /* pause time */
/* CSR_BUSMODE - Bus Mode */
#define BUSMODE_SWR 0x00000001 /* software reset */
#define BUSMODE_BAR 0x00000002 /* bus arbitration */
#define BUSMODE_DSL 0x0000007c /* descriptor skip length */
#define BUSMODE_BLE 0x00000080 /* data buf endian */
/* programmable burst length */
#define BUSMODE_PBL_DEFAULT 0x00000000 /* default value */
#define BUSMODE_PBL_1LW 0x00000100 /* 1 longword */
#define BUSMODE_PBL_2LW 0x00000200 /* 2 longwords */
#define BUSMODE_PBL_4LW 0x00000400 /* 4 longwords */
#define BUSMODE_PBL_8LW 0x00000800 /* 8 longwords */
#define BUSMODE_PBL_16LW 0x00001000 /* 16 longwords */
#define BUSMODE_PBL_32LW 0x00002000 /* 32 longwords */
#define BUSMODE_TAP_SHIFT 17 /* Transmit Automatic Polling */
#define BUSMODE_DBO 0x00100000 /* descriptor endian */
#define BUSMODE_ALIGN_16B 0x01000000 /* force oddhw rx buf align */
/* CSR_TXPOLL - Transmit Poll Demand */
#define TXPOLL_TPD 0x00000001 /* transmit poll demand */
/* CSR_RXPOLL - Receive Poll Demand */
#define RXPOLL_RPD 0x00000001 /* receive poll demand */
/* CSR_STATUS - Status */
#define STATUS_TI 0x00000001 /* transmit interrupt */
#define STATUS_TPS 0x00000002 /* transmit process stopped */
#define STATUS_TU 0x00000004 /* transmit buffer unavail */
#define STATUS_TJT 0x00000008 /* transmit jabber timeout */
#define STATUS_UNF 0x00000020 /* transmit underflow */
#define STATUS_RI 0x00000040 /* receive interrupt */
#define STATUS_RU 0x00000080 /* receive buffer unavail */
#define STATUS_RPS 0x00000100 /* receive process stopped */
#define STATUS_ETI 0x00000400 /* early transmit interrupt */
#define STATUS_SE 0x00002000 /* system error */
#define STATUS_ER 0x00004000 /* early receive (21041) */
#define STATUS_AIS 0x00008000 /* abnormal intr summary */
#define STATUS_NIS 0x00010000 /* normal interrupt summary */
#define STATUS_RS 0x000e0000 /* receive process state */
#define STATUS_RS_STOPPED 0x00000000 /* Stopped */
#define STATUS_RS_FETCH 0x00020000 /* Running - fetch receive
descriptor */
#define STATUS_RS_CHECK 0x00040000 /* Running - check for end
of receive */
#define STATUS_RS_WAIT 0x00060000 /* Running - wait for packet */
#define STATUS_RS_SUSPENDED 0x00080000 /* Suspended */
#define STATUS_RS_CLOSE 0x000a0000 /* Running - close receive
descriptor */
#define STATUS_RS_FLUSH 0x000c0000 /* Running - flush current
frame from FIFO */
#define STATUS_RS_QUEUE 0x000e0000 /* Running - queue current
frame from FIFO into
buffer */
#define STATUS_TS 0x00700000 /* transmit process state */
#define STATUS_TS_STOPPED 0x00000000 /* Stopped */
#define STATUS_TS_FETCH 0x00100000 /* Running - fetch transmit
descriptor */
#define STATUS_TS_WAIT 0x00200000 /* Running - wait for end
of transmission */
#define STATUS_TS_READING 0x00300000 /* Running - read buffer from
memory and queue into
FIFO */
#define STATUS_TS_SUSPENDED 0x00600000 /* Suspended */
#define STATUS_TS_CLOSE 0x00700000 /* Running - close transmit
descriptor */
#define STATUS_TX_ABORT 0x00800000 /* Transmit bus abort */
#define STATUS_RX_ABORT 0x01000000 /* Transmit bus abort */
/* CSR_OPMODE - Operation Mode */
#define OPMODE_SR 0x00000002 /* start receive */
#define OPMODE_OSF 0x00000004 /* operate on second frame */
#define OPMODE_PR 0x00000040 /* promiscuous mode */
#define OPMODE_PM 0x00000080 /* pass all multicast */
#define OPMODE_FDX 0x00000200 /* full duplex mode */
#define OPMODE_ST 0x00002000 /* start transmitter */
#define OPMODE_TR 0x0000c000 /* threshold control */
#define OPMODE_TR_32 0x00000000 /* 32 words */
#define OPMODE_TR_64 0x00004000 /* 64 words */
#define OPMODE_TR_128 0x00008000 /* 128 words */
#define OPMODE_TR_256 0x0000c000 /* 256 words */
#define OPMODE_SF 0x00200000 /* store and forward mode */
#define OPMODE_SPEED 0x80000000 /* speed 100M:1 10M:0 */
/* CSR_INTEN - Interrupt Enable */
/* See bits for CSR_STATUS -- Status */
/* CSR_MISSED - Missed Frames */
#define MISSED_MFC 0xffff0000 /* missed packet count */
#define MISSED_FOC 0x0000ffff /* fifo overflow counter */
#define MISSED_GETMFC(x) ((x) & MISSED_MFC)
#define MISSED_GETFOC(x) (((x) & MISSED_FOC) >> 16)
/* setup frame code refer dc code */
#define FV_SFRAME_LEN 192
#define FV_MIN_FRAMELEN 60
/*
* MII Definitions for the 21041 and 21140/21140A/21142
* copy from if_devar.h
*/
#define MII_PREAMBLE (~0)
#define MII_TEST 0xAAAAAAAA
#define MII_RDCMD 0x06
#define MII_WRCMD 0x05
#define MII_DIN 0x00080000
#define MII_RD 0x00040000
#define MII_WR 0x00000000
#define MII_DOUT 0x00020000
#define MII_CLK 0x00010000
#define MII_CLKON MII_CLK
#define MII_CLKOFF MII_CLK
#endif /* __IF_FVREG_H__ */

View file

@ -1,480 +0,0 @@
/*-
* Copyright (c) 2011 Jakub Wojciech Klama <jceel@FreeBSD.org>
* Copyright (c) 2015 Hiroki Mori
* 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.
*
*/
/*
* GPIO on RT1310A consist of 2 ports:
* - PortA with 8 input/output pins
* - PortB with 4 input/output pins
*
* Pins are mapped to logical pin number as follows:
* [0..7] -> GPI_00..GPI_07 (port A)
* [8..11] -> GPI_08..GPI_11 (port B)
*
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/bio.h>
#include <sys/bus.h>
#include <sys/conf.h>
#include <sys/endian.h>
#include <sys/kernel.h>
#include <sys/kthread.h>
#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/module.h>
#include <sys/mutex.h>
#include <sys/queue.h>
#include <sys/resource.h>
#include <sys/rman.h>
#include <sys/time.h>
#include <sys/timetc.h>
#include <sys/watchdog.h>
#include <sys/gpio.h>
#include <machine/bus.h>
#include <machine/cpu.h>
#include <machine/cpufunc.h>
#include <machine/resource.h>
#include <machine/intr.h>
#include <machine/fdt.h>
#include <dev/gpio/gpiobusvar.h>
#include <dev/ofw/ofw_bus.h>
#include <dev/ofw/ofw_bus_subr.h>
#include <arm/ralink/rt1310reg.h>
#include <arm/ralink/rt1310var.h>
#include "gpio_if.h"
struct rt1310_gpio_softc
{
device_t lg_dev;
device_t lg_busdev;
struct resource * lg_res;
bus_space_tag_t lg_bst;
bus_space_handle_t lg_bsh;
};
struct rt1310_gpio_pinmap
{
int lp_start_idx;
int lp_pin_count;
int lp_port;
int lp_start_bit;
int lp_flags;
};
static const struct rt1310_gpio_pinmap rt1310_gpio_pins[] = {
{ 0, 8, RT_GPIO_PORTA, 0, GPIO_PIN_INPUT | GPIO_PIN_OUTPUT },
{ 8, 4, RT_GPIO_PORTB, 0, GPIO_PIN_INPUT | GPIO_PIN_OUTPUT },
{ -1, -1, -1, -1, -1 },
};
#define RT_GPIO_NPINS 12
#define RT_GPIO_PIN_IDX(_map, _idx) \
(_idx - _map->lp_start_idx)
#define RT_GPIO_PIN_BIT(_map, _idx) \
(_map->lp_start_bit + RT_GPIO_PIN_IDX(_map, _idx))
static int rt1310_gpio_probe(device_t);
static int rt1310_gpio_attach(device_t);
static int rt1310_gpio_detach(device_t);
static device_t rt1310_gpio_get_bus(device_t);
static int rt1310_gpio_pin_max(device_t, int *);
static int rt1310_gpio_pin_getcaps(device_t, uint32_t, uint32_t *);
static int rt1310_gpio_pin_getflags(device_t, uint32_t, uint32_t *);
static int rt1310_gpio_pin_setflags(device_t, uint32_t, uint32_t);
static int rt1310_gpio_pin_getname(device_t, uint32_t, char *);
static int rt1310_gpio_pin_get(device_t, uint32_t, uint32_t *);
static int rt1310_gpio_pin_set(device_t, uint32_t, uint32_t);
static int rt1310_gpio_pin_toggle(device_t, uint32_t);
static const struct rt1310_gpio_pinmap *rt1310_gpio_get_pinmap(int);
static struct rt1310_gpio_softc *rt1310_gpio_sc = NULL;
#define rt1310_gpio_read_4(_sc, _reg) \
bus_space_read_4(_sc->lg_bst, _sc->lg_bsh, _reg)
#define rt1310_gpio_write_4(_sc, _reg, _val) \
bus_space_write_4(_sc->lg_bst, _sc->lg_bsh, _reg, _val)
static int
rt1310_gpio_probe(device_t dev)
{
phandle_t node;
if (!ofw_bus_status_okay(dev))
return (ENXIO);
if (!ofw_bus_is_compatible(dev, "ralink,rt1310-gpio"))
return (ENXIO);
node = ofw_bus_get_node(dev);
if (!OF_hasprop(node, "gpio-controller"))
return (ENXIO);
device_set_desc(dev, "RT1310 GPIO");
return (BUS_PROBE_DEFAULT);
}
static int
rt1310_gpio_attach(device_t dev)
{
struct rt1310_gpio_softc *sc = device_get_softc(dev);
int rid;
sc->lg_dev = dev;
rid = 0;
sc->lg_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid,
RF_ACTIVE);
if (!sc->lg_res) {
device_printf(dev, "cannot allocate memory window\n");
return (ENXIO);
}
sc->lg_bst = rman_get_bustag(sc->lg_res);
sc->lg_bsh = rman_get_bushandle(sc->lg_res);
rt1310_gpio_sc = sc;
sc->lg_busdev = gpiobus_attach_bus(dev);
if (sc->lg_busdev == NULL) {
bus_release_resource(dev, SYS_RES_MEMORY, rid, sc->lg_res);
return (ENXIO);
}
return (0);
}
static int
rt1310_gpio_detach(device_t dev)
{
return (EBUSY);
}
static device_t
rt1310_gpio_get_bus(device_t dev)
{
struct rt1310_gpio_softc *sc;
sc = device_get_softc(dev);
return (sc->lg_busdev);
}
static int
rt1310_gpio_pin_max(device_t dev, int *npins)
{
*npins = RT_GPIO_NPINS - 1;
return (0);
}
static int
rt1310_gpio_pin_getcaps(device_t dev, uint32_t pin, uint32_t *caps)
{
const struct rt1310_gpio_pinmap *map;
if (pin > RT_GPIO_NPINS)
return (ENODEV);
map = rt1310_gpio_get_pinmap(pin);
*caps = map->lp_flags;
return (0);
}
static int
rt1310_gpio_pin_getflags(device_t dev, uint32_t pin, uint32_t *flags)
{
struct rt1310_gpio_softc *sc = device_get_softc(dev);
const struct rt1310_gpio_pinmap *map;
uint32_t state;
int dir;
if (pin > RT_GPIO_NPINS)
return (ENODEV);
map = rt1310_gpio_get_pinmap(pin);
/* Check whether it's bidirectional pin */
if ((map->lp_flags & (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT)) !=
(GPIO_PIN_INPUT | GPIO_PIN_OUTPUT)) {
*flags = map->lp_flags;
return (0);
}
switch (map->lp_port) {
case RT_GPIO_PORTA:
state = rt1310_gpio_read_4(sc, RT_GPIO_OFF_PADIR);
dir = (state & (1 << RT_GPIO_PIN_BIT(map, pin)));
break;
case RT_GPIO_PORTB:
state = rt1310_gpio_read_4(sc, RT_GPIO_OFF_PBDIR);
dir = (state & (1 << RT_GPIO_PIN_BIT(map, pin)));
break;
default:
panic("unknown GPIO port");
}
*flags = dir ? GPIO_PIN_OUTPUT : GPIO_PIN_INPUT;
return (0);
}
static int
rt1310_gpio_pin_setflags(device_t dev, uint32_t pin, uint32_t flags)
{
struct rt1310_gpio_softc *sc = device_get_softc(dev);
const struct rt1310_gpio_pinmap *map;
uint32_t dir, state;
uint32_t port;
if (pin > RT_GPIO_NPINS)
return (ENODEV);
map = rt1310_gpio_get_pinmap(pin);
/* Check whether it's bidirectional pin */
if ((map->lp_flags & (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT)) !=
(GPIO_PIN_INPUT | GPIO_PIN_OUTPUT))
return (ENOTSUP);
if (flags & GPIO_PIN_INPUT)
dir = 0;
if (flags & GPIO_PIN_OUTPUT)
dir = 1;
switch (map->lp_port) {
case RT_GPIO_PORTA:
port = RT_GPIO_OFF_PADIR;
break;
case RT_GPIO_PORTB:
port = RT_GPIO_OFF_PBDIR;
break;
}
state = rt1310_gpio_read_4(sc, port);
if (flags & GPIO_PIN_INPUT) {
state &= ~(1 << RT_GPIO_PIN_IDX(map, pin));
} else {
state |= (1 << RT_GPIO_PIN_IDX(map, pin));
}
rt1310_gpio_write_4(sc, port, state);
return (0);
}
static int
rt1310_gpio_pin_getname(device_t dev, uint32_t pin, char *name)
{
snprintf(name, GPIOMAXNAME - 1, "GPIO_%02d", pin);
return (0);
}
static int
rt1310_gpio_pin_get(device_t dev, uint32_t pin, uint32_t *value)
{
struct rt1310_gpio_softc *sc = device_get_softc(dev);
const struct rt1310_gpio_pinmap *map;
uint32_t state, flags;
int dir;
map = rt1310_gpio_get_pinmap(pin);
if (rt1310_gpio_pin_getflags(dev, pin, &flags))
return (ENXIO);
if (flags & GPIO_PIN_OUTPUT)
dir = 1;
if (flags & GPIO_PIN_INPUT)
dir = 0;
switch (map->lp_port) {
case RT_GPIO_PORTA:
state = rt1310_gpio_read_4(sc, RT_GPIO_OFF_PADR);
*value = !!(state & (1 << RT_GPIO_PIN_BIT(map, pin)));
break;
case RT_GPIO_PORTB:
state = rt1310_gpio_read_4(sc, RT_GPIO_OFF_PBDR);
*value = !!(state & (1 << RT_GPIO_PIN_BIT(map, pin)));
break;
}
return (0);
}
static int
rt1310_gpio_pin_set(device_t dev, uint32_t pin, uint32_t value)
{
struct rt1310_gpio_softc *sc = device_get_softc(dev);
const struct rt1310_gpio_pinmap *map;
uint32_t state, flags;
uint32_t port;
map = rt1310_gpio_get_pinmap(pin);
if (rt1310_gpio_pin_getflags(dev, pin, &flags))
return (ENXIO);
if ((flags & GPIO_PIN_OUTPUT) == 0)
return (EINVAL);
switch (map->lp_port) {
case RT_GPIO_PORTA:
port = RT_GPIO_OFF_PADR;
break;
case RT_GPIO_PORTB:
port = RT_GPIO_OFF_PBDR;
break;
}
state = rt1310_gpio_read_4(sc, port);
if (value == 1) {
state |= (1 << RT_GPIO_PIN_BIT(map, pin));
} else {
state &= ~(1 << RT_GPIO_PIN_BIT(map, pin));
}
rt1310_gpio_write_4(sc, port, state);
return (0);
}
static int
rt1310_gpio_pin_toggle(device_t dev, uint32_t pin)
{
const struct rt1310_gpio_pinmap *map;
uint32_t flags;
map = rt1310_gpio_get_pinmap(pin);
if (rt1310_gpio_pin_getflags(dev, pin, &flags))
return (ENXIO);
if ((flags & GPIO_PIN_OUTPUT) == 0)
return (EINVAL);
panic("not implemented yet");
return (0);
}
static const struct rt1310_gpio_pinmap *
rt1310_gpio_get_pinmap(int pin)
{
const struct rt1310_gpio_pinmap *map;
for (map = &rt1310_gpio_pins[0]; map->lp_start_idx != -1; map++) {
if (pin >= map->lp_start_idx &&
pin < map->lp_start_idx + map->lp_pin_count)
return map;
}
panic("pin number %d out of range", pin);
}
int
rt1310_gpio_set_flags(device_t dev, int pin, int flags)
{
if (rt1310_gpio_sc == NULL)
return (ENXIO);
return rt1310_gpio_pin_setflags(rt1310_gpio_sc->lg_dev, pin, flags);
}
int
rt1310_gpio_set_state(device_t dev, int pin, int state)
{
if (rt1310_gpio_sc == NULL)
return (ENXIO);
return rt1310_gpio_pin_set(rt1310_gpio_sc->lg_dev, pin, state);
}
int
rt1310_gpio_get_state(device_t dev, int pin, int *state)
{
if (rt1310_gpio_sc == NULL)
return (ENXIO);
return rt1310_gpio_pin_get(rt1310_gpio_sc->lg_dev, pin, state);
}
static phandle_t
rt1310_gpio_get_node(device_t bus, device_t dev)
{
/* We only have one child, the GPIO bus, which needs our own node. */
return (ofw_bus_get_node(bus));
}
static device_method_t rt1310_gpio_methods[] = {
/* Device interface */
DEVMETHOD(device_probe, rt1310_gpio_probe),
DEVMETHOD(device_attach, rt1310_gpio_attach),
DEVMETHOD(device_detach, rt1310_gpio_detach),
/* GPIO interface */
DEVMETHOD(gpio_get_bus, rt1310_gpio_get_bus),
DEVMETHOD(gpio_pin_max, rt1310_gpio_pin_max),
DEVMETHOD(gpio_pin_getcaps, rt1310_gpio_pin_getcaps),
DEVMETHOD(gpio_pin_getflags, rt1310_gpio_pin_getflags),
DEVMETHOD(gpio_pin_setflags, rt1310_gpio_pin_setflags),
DEVMETHOD(gpio_pin_getname, rt1310_gpio_pin_getname),
DEVMETHOD(gpio_pin_set, rt1310_gpio_pin_set),
DEVMETHOD(gpio_pin_get, rt1310_gpio_pin_get),
DEVMETHOD(gpio_pin_toggle, rt1310_gpio_pin_toggle),
/* ofw_bus interface */
DEVMETHOD(ofw_bus_get_node, rt1310_gpio_get_node),
{ 0, 0 }
};
static devclass_t rt1310_gpio_devclass;
static driver_t rt1310_gpio_driver = {
"gpio",
rt1310_gpio_methods,
sizeof(struct rt1310_gpio_softc),
};
DRIVER_MODULE(rt1310gpio, simplebus, rt1310_gpio_driver, rt1310_gpio_devclass, 0, 0);
MODULE_VERSION(rt1310gpio, 1);

View file

@ -1,336 +0,0 @@
/*-
* Copyright (c) 2010 Jakub Wojciech Klama <jceel@FreeBSD.org>
* Copyright (c) 2015 Hiroki Mori
* 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_platform.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/bus.h>
#include <sys/types.h>
#include <sys/kernel.h>
#include <sys/malloc.h>
#include <sys/module.h>
#include <sys/proc.h>
#include <sys/rman.h>
#include <vm/vm.h>
#include <vm/vm_kern.h>
#include <vm/pmap.h>
#include <vm/vm_page.h>
#include <vm/vm_extern.h>
#define _ARM32_BUS_DMA_PRIVATE
#include <machine/bus.h>
#include <machine/intr.h>
#include <dev/fdt/fdt_common.h>
#include <dev/ofw/openfirm.h>
#include <dev/ofw/ofw_bus.h>
#include <dev/ofw/ofw_bus_subr.h>
#include <arm/ralink/rt1310reg.h>
#define INTC_NIRQS 32
#include "pic_if.h"
struct rt1310_irqsrc {
struct intr_irqsrc ri_isrc;
u_int ri_irq;
};
struct rt1310_intc_softc {
device_t dev;
struct resource * ri_res;
bus_space_tag_t ri_bst;
bus_space_handle_t ri_bsh;
struct rt1310_irqsrc ri_isrcs[INTC_NIRQS];
};
static int rt1310_intc_probe(device_t);
static int rt1310_intc_attach(device_t);
static int rt1310_pic_attach(struct rt1310_intc_softc *sc);
static struct rt1310_intc_softc *intc_softc = NULL;
#define intc_read_4(_sc, _reg) \
bus_space_read_4((_sc)->ri_bst, (_sc)->ri_bsh, (_reg))
#define intc_write_4(_sc, _reg, _val) \
bus_space_write_4((_sc)->ri_bst, (_sc)->ri_bsh, (_reg), (_val))
struct rt1310_irqdef {
u_int ri_trig;
u_int ri_prio;
};
struct rt1310_irqdef irqdef[INTC_NIRQS] = {
{RT_INTC_TRIG_HIGH_LVL, 2}, /* 0 */
{RT_INTC_TRIG_HIGH_LVL, 2},
{RT_INTC_TRIG_HIGH_LVL, 2},
{RT_INTC_TRIG_HIGH_LVL, 1},
{RT_INTC_TRIG_HIGH_LVL, 2},
{RT_INTC_TRIG_HIGH_LVL, 1},
{RT_INTC_TRIG_HIGH_LVL, 1},
{RT_INTC_TRIG_HIGH_LVL, 1},
{RT_INTC_TRIG_HIGH_LVL, 1}, /* 8 */
{RT_INTC_TRIG_HIGH_LVL, 1},
{RT_INTC_TRIG_HIGH_LVL, 2},
{RT_INTC_TRIG_LOW_LVL, 2},
{RT_INTC_TRIG_LOW_LVL, 2},
{RT_INTC_TRIG_LOW_LVL, 4},
{RT_INTC_TRIG_HIGH_LVL, 2},
{RT_INTC_TRIG_HIGH_LVL, 2},
{RT_INTC_TRIG_HIGH_LVL, 2}, /* 16 */
{RT_INTC_TRIG_HIGH_LVL, 2},
{RT_INTC_TRIG_LOW_LVL, 2},
{RT_INTC_TRIG_LOW_LVL, 2},
{RT_INTC_TRIG_LOW_LVL, 2},
{RT_INTC_TRIG_LOW_LVL, 2},
{RT_INTC_TRIG_NEG_EDGE, 2},
{RT_INTC_TRIG_HIGH_LVL, 3},
{RT_INTC_TRIG_HIGH_LVL, 2}, /* 24 */
{RT_INTC_TRIG_POS_EDGE, 2},
{RT_INTC_TRIG_POS_EDGE, 2},
{RT_INTC_TRIG_HIGH_LVL, 2},
{RT_INTC_TRIG_HIGH_LVL, 2},
{RT_INTC_TRIG_POS_EDGE, 2},
{RT_INTC_TRIG_POS_EDGE, 3},
{RT_INTC_TRIG_POS_EDGE, 3},
};
static int
rt1310_intc_probe(device_t dev)
{
if (!ofw_bus_status_okay(dev))
return (ENXIO);
if (!ofw_bus_is_compatible_strict(dev, "rt,pic"))
return (ENXIO);
device_set_desc(dev, "RT1310 Interrupt Controller");
return (BUS_PROBE_DEFAULT);
}
static int
rt1310_intc_attach(device_t dev)
{
struct rt1310_intc_softc *sc = device_get_softc(dev);
int rid = 0;
int i;
if (intc_softc)
return (ENXIO);
sc->dev = dev;
sc->ri_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid,
RF_ACTIVE);
if (!sc->ri_res) {
device_printf(dev, "could not alloc resources\n");
return (ENXIO);
}
sc->ri_bst = rman_get_bustag(sc->ri_res);
sc->ri_bsh = rman_get_bushandle(sc->ri_res);
intc_softc = sc;
rt1310_pic_attach(sc);
intc_write_4(sc, RT_INTC_IECR, 0);
intc_write_4(sc, RT_INTC_ICCR, ~0);
for (i = 0; i <= INTC_NIRQS; ++i) {
intc_write_4(sc, RT_INTC_SCR0+i*4,
(irqdef[i].ri_trig << RT_INTC_TRIG_SHIF) |
irqdef[i].ri_prio);
intc_write_4(sc, RT_INTC_SVR0+i*4, i);
}
/* Clear interrupt status registers and disable all interrupts */
intc_write_4(sc, RT_INTC_ICCR, ~0);
intc_write_4(sc, RT_INTC_IMR, 0);
return (0);
}
static void
rt1310_enable_intr(device_t dev, struct intr_irqsrc *isrc)
{
u_int irq;
unsigned int value;
struct rt1310_intc_softc *sc;
sc = intc_softc;
irq = ((struct rt1310_irqsrc *)isrc)->ri_irq;
value = intc_read_4(sc, RT_INTC_IECR);
value |= (1 << irq);
intc_write_4(sc, RT_INTC_IMR, value);
intc_write_4(sc, RT_INTC_IECR, value);
}
static void
rt1310_disable_intr(device_t dev, struct intr_irqsrc *isrc)
{
u_int irq;
unsigned int value;
struct rt1310_intc_softc *sc;
sc = intc_softc;
irq = ((struct rt1310_irqsrc *)isrc)->ri_irq;
/* Clear bit in ER register */
value = intc_read_4(sc, RT_INTC_IECR);
value &= ~(1 << irq);
intc_write_4(sc, RT_INTC_IECR, value);
intc_write_4(sc, RT_INTC_IMR, value);
intc_write_4(sc, RT_INTC_ICCR, 1 << irq);
}
static int
rt1310_map_intr(device_t dev, struct intr_map_data *data,
struct intr_irqsrc **isrcp)
{
struct intr_map_data_fdt *daf;
struct rt1310_intc_softc *sc;
if (data->type != INTR_MAP_DATA_FDT)
return (ENOTSUP);
daf = (struct intr_map_data_fdt *)data;
if (daf->ncells != 1 || daf->cells[0] >= INTC_NIRQS)
return (EINVAL);
sc = device_get_softc(dev);
*isrcp = &sc->ri_isrcs[daf->cells[0]].ri_isrc;
return (0);
}
static void
rt1310_pre_ithread(device_t dev, struct intr_irqsrc *isrc)
{
arm_irq_memory_barrier(0);
rt1310_disable_intr(dev, isrc);
}
static void
rt1310_post_ithread(device_t dev, struct intr_irqsrc *isrc)
{
arm_irq_memory_barrier(0);
rt1310_enable_intr(dev, isrc);
}
static void
rt1310_post_filter(device_t dev, struct intr_irqsrc *isrc)
{
u_int irq;
struct rt1310_intc_softc *sc;
arm_irq_memory_barrier(0);
sc = intc_softc;
irq = ((struct rt1310_irqsrc *)isrc)->ri_irq;
intc_write_4(sc, RT_INTC_ICCR, 1 << irq);
}
static int
rt1310_intr(void *arg)
{
uint32_t irq;
struct rt1310_intc_softc *sc = arg;
irq = ffs(intc_read_4(sc, RT_INTC_IPR)) - 1;
if (intr_isrc_dispatch(&sc->ri_isrcs[irq].ri_isrc,
curthread->td_intr_frame) != 0) {
intc_write_4(sc, RT_INTC_ICCR, 1 << irq);
device_printf(sc->dev, "Stray irq %u disabled\n", irq);
}
arm_irq_memory_barrier(0);
return (FILTER_HANDLED);
}
static int
rt1310_pic_attach(struct rt1310_intc_softc *sc)
{
struct intr_pic *pic;
int error;
uint32_t irq;
const char *name;
intptr_t xref;
name = device_get_nameunit(sc->dev);
for (irq = 0; irq < INTC_NIRQS; irq++) {
sc->ri_isrcs[irq].ri_irq = irq;
error = intr_isrc_register(&sc->ri_isrcs[irq].ri_isrc,
sc->dev, 0, "%s,%u", name, irq);
if (error != 0)
return (error);
}
xref = OF_xref_from_node(ofw_bus_get_node(sc->dev));
pic = intr_pic_register(sc->dev, xref);
if (pic == NULL)
return (ENXIO);
return (intr_pic_claim_root(sc->dev, xref, rt1310_intr, sc, 0));
}
struct fdt_fixup_entry fdt_fixup_table[] = {
{ NULL, NULL }
};
static device_method_t rt1310_intc_methods[] = {
DEVMETHOD(device_probe, rt1310_intc_probe),
DEVMETHOD(device_attach, rt1310_intc_attach),
DEVMETHOD(pic_disable_intr, rt1310_disable_intr),
DEVMETHOD(pic_enable_intr, rt1310_enable_intr),
DEVMETHOD(pic_map_intr, rt1310_map_intr),
DEVMETHOD(pic_post_filter, rt1310_post_filter),
DEVMETHOD(pic_post_ithread, rt1310_post_ithread),
DEVMETHOD(pic_pre_ithread, rt1310_pre_ithread),
{ 0, 0 }
};
static driver_t rt1310_intc_driver = {
"pic",
rt1310_intc_methods,
sizeof(struct rt1310_intc_softc),
};
static devclass_t rt1310_intc_devclass;
EARLY_DRIVER_MODULE(pic, simplebus, rt1310_intc_driver, rt1310_intc_devclass, 0, 0, BUS_PASS_INTERRUPT);

View file

@ -1,176 +0,0 @@
/*-
* Copyright (c) 1994-1998 Mark Brinicombe.
* Copyright (c) 1994 Brini.
* All rights reserved.
*
* This code is derived from software written for Brini by Mark Brinicombe
*
* 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 Brini.
* 4. The name of the company nor the name of the author may be used to
* endorse or promote products derived from this software without specific
* prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY BRINI ``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 BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: FreeBSD: sys/arm/lpc/lpc_machdep.c
*/
#include "opt_ddb.h"
#include "opt_platform.h"
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#define _ARM32_BUS_DMA_PRIVATE
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/bus.h>
#include <sys/reboot.h>
#include <sys/devmap.h>
#include <vm/vm.h>
#include <vm/pmap.h>
#include <machine/bus.h>
#include <machine/fdt.h>
#include <machine/machdep.h>
#include <machine/platform.h>
#include <machine/cpu.h>
#include <arm/ralink/rt1310reg.h>
#include <arm/ralink/rt1310var.h>
#include <dev/fdt/fdt_common.h>
#ifdef EARLY_PRINTF
early_putc_t *early_putc;
#endif
uint32_t rt1310_master_clock;
vm_offset_t
platform_lastaddr(void)
{
return (devmap_lastaddr());
}
void
platform_probe_and_attach(void)
{
}
void
platform_gpio_init(void)
{
/*
* Set initial values of GPIO output ports
*/
}
void
platform_late_init(void)
{
bootverbose = 1;
}
/*
* Add a single static device mapping.
* The values used were taken from the ranges property of the SoC node in the
* dts file when this code was converted to arm_devmap_add_entry().
*/
int
platform_devmap_init(void)
{
devmap_add_entry(0x19C00000, 0xE0000);
devmap_add_entry(0x1e800000, 0x800000);
devmap_add_entry(0x1f000000, 0x400000);
return (0);
}
struct arm32_dma_range *
bus_dma_get_range(void)
{
return (NULL);
}
int
bus_dma_get_range_nb(void)
{
return (0);
}
void
cpu_reset(void)
{
bus_space_tag_t bst;
bus_space_handle_t bsh;
bst = fdtbus_bs_tag;
/* Enable WDT */
/* Instant assert of RESETOUT_N with pulse length 1ms */
bus_space_map(bst, 0x1e8c0000, 0x20000, 0, &bsh);
bus_space_write_4(bst, bsh, 0, 13000);
bus_space_write_4(bst, bsh, 8, (1<<3) | (1<<4) | 7);
bus_space_unmap(bst, bsh, 0x20000);
for (;;)
continue;
}
#ifdef RALINK_BOOT_DEBUG
void bootdebug1(int c);
void bootdebug1(int c)
{
/* direct put uart physical address */
uint8_t* uart_base_addr=(uint8_t*)0x1e840000;
*(uart_base_addr) = c;
}
void bootdebug2(int c);
void bootdebug2(int c)
{
#if defined(SOCDEV_PA) && defined(SOCDEV_VA)
/* direct put uart map address at locore-v4.S */
uint8_t* uart_base_addr=(uint8_t*)0xce840000;
*(uart_base_addr) = c;
#endif
}
void bootdebug3(int c);
void bootdebug3(int c)
{
bus_space_tag_t bst;
bus_space_handle_t bsh;
bst = fdtbus_bs_tag;
bus_space_map(bst, 0x1e840000, 0x20000, 0, &bsh);
bus_space_write_1(bst, bsh, 0, c);
bus_space_unmap(bst, bsh, 0x20000);
}
#endif

View file

@ -1,343 +0,0 @@
/*-
* Copyright (c) 2011 Jakub Wojciech Klama <jceel@FreeBSD.org>
* Copyright (c) 2015 Hiroki Mori
* 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/malloc.h>
#include <sys/rman.h>
#include <sys/timetc.h>
#include <sys/timeet.h>
#include <machine/bus.h>
#include <machine/cpu.h>
#include <machine/intr.h>
#include <dev/fdt/fdt_common.h>
#include <dev/ofw/ofw_bus.h>
#include <dev/ofw/ofw_bus_subr.h>
#include <arm/ralink/rt1310reg.h>
#include <arm/ralink/rt1310var.h>
struct rt1310_timer_softc {
device_t lt_dev;
struct eventtimer lt_et;
struct resource * lt_res[8];
bus_space_tag_t lt_bst0;
bus_space_handle_t lt_bsh0;
bus_space_tag_t lt_bst1;
bus_space_handle_t lt_bsh1;
bus_space_tag_t lt_bst2;
bus_space_handle_t lt_bsh2;
bus_space_tag_t lt_bst3;
bus_space_handle_t lt_bsh3;
int lt_oneshot;
uint32_t lt_period;
};
static struct resource_spec rt1310_timer_spec[] = {
{ SYS_RES_MEMORY, 0, RF_ACTIVE },
{ SYS_RES_MEMORY, 1, RF_ACTIVE },
{ SYS_RES_MEMORY, 2, RF_ACTIVE },
{ SYS_RES_MEMORY, 3, RF_ACTIVE },
{ SYS_RES_IRQ, 0, RF_ACTIVE },
{ SYS_RES_IRQ, 1, RF_ACTIVE },
{ SYS_RES_IRQ, 2, RF_ACTIVE },
{ -1, 0 }
};
static struct rt1310_timer_softc *timer_softc = NULL;
static int rt1310_timer_initialized = 0;
static int rt1310_timer_probe(device_t);
static int rt1310_timer_attach(device_t);
static int rt1310_timer_start(struct eventtimer *,
sbintime_t first, sbintime_t period);
static int rt1310_timer_stop(struct eventtimer *et);
static unsigned rt1310_get_timecount(struct timecounter *);
static int rt1310_hardclock(void *);
#define timer0_read_4(sc, reg) \
bus_space_read_4(sc->lt_bst0, sc->lt_bsh0, reg)
#define timer0_write_4(sc, reg, val) \
bus_space_write_4(sc->lt_bst0, sc->lt_bsh0, reg, val)
#define timer0_clear(sc) \
do { \
timer0_write_4(sc, RT_TIMER_LOAD, 0); \
timer0_write_4(sc, RT_TIMER_VALUE, 0); \
} while(0)
#define timer1_read_4(sc, reg) \
bus_space_read_4(sc->lt_bst1, sc->lt_bsh1, reg)
#define timer1_write_4(sc, reg, val) \
bus_space_write_4(sc->lt_bst1, sc->lt_bsh1, reg, val)
#define timer1_clear(sc) \
do { \
timer1_write_4(sc, RT_TIMER_LOAD, 0); \
timer1_write_4(sc, RT_TIMER_VALUE, 0); \
} while(0)
#define timer2_read_4(sc, reg) \
bus_space_read_4(sc->lt_bst1, sc->lt_bsh2, reg)
#define timer2_write_4(sc, reg, val) \
bus_space_write_4(sc->lt_bst2, sc->lt_bsh2, reg, val)
#define timer3_write_4(sc, reg, val) \
bus_space_write_4(sc->lt_bst3, sc->lt_bsh3, reg, val)
static struct timecounter rt1310_timecounter = {
.tc_get_timecount = rt1310_get_timecount,
.tc_name = "RT1310ATimer1",
.tc_frequency = 0, /* will be filled later */
.tc_counter_mask = ~0u,
.tc_quality = 1000,
};
static int
rt1310_timer_probe(device_t dev)
{
if (!ofw_bus_status_okay(dev))
return (ENXIO);
if (!ofw_bus_is_compatible(dev, "rt,timer"))
return (ENXIO);
device_set_desc(dev, "RT1310 timer");
return (BUS_PROBE_DEFAULT);
}
static int
rt1310_timer_attach(device_t dev)
{
void *intrcookie;
struct rt1310_timer_softc *sc = device_get_softc(dev);
phandle_t node;
uint32_t freq;
if (timer_softc)
return (ENXIO);
timer_softc = sc;
if (bus_alloc_resources(dev, rt1310_timer_spec, sc->lt_res)) {
device_printf(dev, "could not allocate resources\n");
return (ENXIO);
}
sc->lt_bst0 = rman_get_bustag(sc->lt_res[0]);
sc->lt_bsh0 = rman_get_bushandle(sc->lt_res[0]);
sc->lt_bst1 = rman_get_bustag(sc->lt_res[1]);
sc->lt_bsh1 = rman_get_bushandle(sc->lt_res[1]);
sc->lt_bst2 = rman_get_bustag(sc->lt_res[2]);
sc->lt_bsh2 = rman_get_bushandle(sc->lt_res[2]);
sc->lt_bst3 = rman_get_bustag(sc->lt_res[3]);
sc->lt_bsh3 = rman_get_bushandle(sc->lt_res[3]);
/* Timer2 interrupt */
if (bus_setup_intr(dev, sc->lt_res[6], INTR_TYPE_CLK,
rt1310_hardclock, NULL, sc, &intrcookie)) {
device_printf(dev, "could not setup interrupt handler\n");
bus_release_resources(dev, rt1310_timer_spec, sc->lt_res);
return (ENXIO);
}
/* Enable timer clock */
/*
rt1310_pwr_write(dev, LPC_CLKPWR_TIMCLK_CTRL1,
LPC_CLKPWR_TIMCLK_CTRL1_TIMER0 |
LPC_CLKPWR_TIMCLK_CTRL1_TIMER1);
*/
/* Get PERIPH_CLK encoded in parent bus 'bus-frequency' property */
node = ofw_bus_get_node(dev);
if (OF_getprop(OF_parent(node), "bus-frequency", &freq,
sizeof(pcell_t)) <= 0) {
bus_release_resources(dev, rt1310_timer_spec, sc->lt_res);
bus_teardown_intr(dev, sc->lt_res[2], intrcookie);
device_printf(dev, "could not obtain base clock frequency\n");
return (ENXIO);
}
freq = fdt32_to_cpu(freq);
/* Set desired frequency in event timer and timecounter */
sc->lt_et.et_frequency = (uint64_t)freq;
rt1310_timecounter.tc_frequency = (uint64_t)freq;
sc->lt_et.et_name = "RT1310ATimer2";
sc->lt_et.et_flags = ET_FLAGS_PERIODIC | ET_FLAGS_ONESHOT;
sc->lt_et.et_quality = 1000;
sc->lt_et.et_min_period = (0x00000002LLU << 32) / sc->lt_et.et_frequency;
sc->lt_et.et_max_period = (0xfffffffeLLU << 32) / sc->lt_et.et_frequency;
sc->lt_et.et_start = rt1310_timer_start;
sc->lt_et.et_stop = rt1310_timer_stop;
sc->lt_et.et_priv = sc;
et_register(&sc->lt_et);
tc_init(&rt1310_timecounter);
/* Reset and enable timecounter */
timer0_write_4(sc, RT_TIMER_CONTROL, 0);
timer1_write_4(sc, RT_TIMER_CONTROL, 0);
timer2_write_4(sc, RT_TIMER_CONTROL, 0);
timer3_write_4(sc, RT_TIMER_CONTROL, 0);
timer1_write_4(sc, RT_TIMER_LOAD, ~0);
timer1_write_4(sc, RT_TIMER_VALUE, ~0);
timer1_write_4(sc, RT_TIMER_CONTROL,
RT_TIMER_CTRL_ENABLE | RT_TIMER_CTRL_PERIODCAL);
/* DELAY() now can work properly */
rt1310_timer_initialized = 1;
return (0);
}
static int
rt1310_timer_start(struct eventtimer *et, sbintime_t first, sbintime_t period)
{
struct rt1310_timer_softc *sc = (struct rt1310_timer_softc *)et->et_priv;
uint32_t ticks;
if (period == 0) {
sc->lt_oneshot = 1;
sc->lt_period = 0;
} else {
sc->lt_oneshot = 0;
sc->lt_period = ((uint32_t)et->et_frequency * period) >> 32;
}
if (first == 0)
ticks = sc->lt_period;
else
ticks = ((uint32_t)et->et_frequency * first) >> 32;
/* Reset timer */
timer2_write_4(sc, RT_TIMER_CONTROL, 0);
/* Start timer */
timer2_write_4(sc, RT_TIMER_LOAD, ticks);
timer2_write_4(sc, RT_TIMER_VALUE, ticks);
timer2_write_4(sc, RT_TIMER_CONTROL,
RT_TIMER_CTRL_ENABLE | RT_TIMER_CTRL_INTCTL);
return (0);
}
static int
rt1310_timer_stop(struct eventtimer *et)
{
struct rt1310_timer_softc *sc = (struct rt1310_timer_softc *)et->et_priv;
timer2_write_4(sc, RT_TIMER_CONTROL, 0);
return (0);
}
static device_method_t rt1310_timer_methods[] = {
DEVMETHOD(device_probe, rt1310_timer_probe),
DEVMETHOD(device_attach, rt1310_timer_attach),
{ 0, 0 }
};
static driver_t rt1310_timer_driver = {
"timer",
rt1310_timer_methods,
sizeof(struct rt1310_timer_softc),
};
static devclass_t rt1310_timer_devclass;
EARLY_DRIVER_MODULE(timer, simplebus, rt1310_timer_driver, rt1310_timer_devclass, 0, 0, BUS_PASS_TIMER);
static int
rt1310_hardclock(void *arg)
{
struct rt1310_timer_softc *sc = (struct rt1310_timer_softc *)arg;
/* Reset pending interrupt */
timer2_write_4(sc, RT_TIMER_CONTROL,
timer2_read_4(sc, RT_TIMER_CONTROL) | 0x08);
timer2_write_4(sc, RT_TIMER_CONTROL,
timer2_read_4(sc, RT_TIMER_CONTROL) & 0x1fb);
/* Start timer again */
if (!sc->lt_oneshot) {
timer2_write_4(sc, RT_TIMER_LOAD, sc->lt_period);
timer2_write_4(sc, RT_TIMER_VALUE, sc->lt_period);
timer2_write_4(sc, RT_TIMER_CONTROL,
RT_TIMER_CTRL_ENABLE | RT_TIMER_CTRL_INTCTL);
}
if (sc->lt_et.et_active)
sc->lt_et.et_event_cb(&sc->lt_et, sc->lt_et.et_arg);
return (FILTER_HANDLED);
}
static unsigned
rt1310_get_timecount(struct timecounter *tc)
{
return ~timer1_read_4(timer_softc, RT_TIMER_VALUE);
}
void
DELAY(int usec)
{
uint32_t counter;
uint32_t first, last;
int val = (rt1310_timecounter.tc_frequency / 1000000 + 1) * usec;
/* Timer is not initialized yet */
if (!rt1310_timer_initialized) {
for (; usec > 0; usec--)
for (counter = 100; counter > 0; counter--)
;
return;
}
TSENTER();
first = rt1310_get_timecount(&rt1310_timecounter);
while (val > 0) {
last = rt1310_get_timecount(&rt1310_timecounter);
if (last < first) {
/* Timer rolled over */
last = first;
}
val -= (last - first);
first = last;
}
TSEXIT();
}

View file

@ -1,82 +0,0 @@
/*-
* Copyright (c) 2011 Jakub Wojciech Klama <jceel@FreeBSD.org>
* Copyright (c) 2015 Hiroki Mori
* 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 _ARM_RALINK_RT1310REG_H
#define _ARM_RALINK_RT1310REG_H
/*
* Interrupt controller
*/
#define RT_INTC_SCR0 0x00
#define RT_INTC_SVR0 0x80
#define RT_INTC_ISR 0x104
#define RT_INTC_IPR 0x108
#define RT_INTC_IMR 0x10c
#define RT_INTC_IECR 0x114
#define RT_INTC_ICCR 0x118
#define RT_INTC_TRIG_LOW_LVL (0)
#define RT_INTC_TRIG_HIGH_LVL (1)
#define RT_INTC_TRIG_NEG_EDGE (2)
#define RT_INTC_TRIG_POS_EDGE (3)
#define RT_INTC_TRIG_SHIF 6
/*
* Timer 0|1|2|3.
*/
#define RT_TIMER_LOAD 0x00
#define RT_TIMER_VALUE 0x04
#define RT_TIMER_CONTROL 0x08
#define RT_TIMER_CTRL_INTCTL (1 << 1)
#define RT_TIMER_CTRL_INTCLR (1 << 2)
#define RT_TIMER_CTRL_INTMASK (1 << 3)
#define RT_TIMER_CTRL_DIV16 (3 << 4)
#define RT_TIMER_CTRL_DIV256 (7 << 4)
#define RT_TIMER_CTRL_PERIODCAL (1 << 7)
#define RT_TIMER_CTRL_ENABLE (1 << 8)
#define RT_TIMER_INTERVAL (5000*150)
/*
* GPIO
*/
#define RT_GPIO_PORTA (0)
#define RT_GPIO_PORTB (1)
#define RT_GPIO_OFF_PADR (0x0)
#define RT_GPIO_OFF_PADIR (0x4)
#define RT_GPIO_OFF_PBDR (0x8)
#define RT_GPIO_OFF_PBDIR (0xC)
#endif /* _ARM_RALINK_RT1310REG_H */

View file

@ -1,44 +0,0 @@
/*-
* Copyright (c) 2011 Jakub Wojciech Klama <jceel@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.
*
* $FreeBSD$
*/
#ifndef _ARM_RT_RTVAR_H
#define _ARM_RT_RTVAR_H
#include <sys/types.h>
#include <sys/bus.h>
#include <machine/bus.h>
/* GPIO */
void rt1310_gpio_init(void);
int rt1310_gpio_set_flags(device_t, int, int);
int rt1310_gpio_set_state(device_t, int, int);
int rt1310_gpio_get_state(device_t, int, int *);
extern uint32_t rt1310_master_clock;
#endif /* _ARM_RT_RTVAR_H */

View file

@ -1,9 +0,0 @@
# $FreeBSD$
files "../ralink/files.ralink"
cpu CPU_ARM9E
machine arm
makeoptions CONF_CFLAGS="-march=armv5te"
options INTRNG
makeoptions KERNVIRTADDR=0xc0000000
options KERNVIRTADDR=0xc0000000

View file

@ -2358,9 +2358,6 @@ device syr827 # Silergy Corp. DC/DC regulator
# are automatically probed and attached when found.
#
# Supported devices:
# vpo Iomega Zip Drive
# Requires SCSI disk support ('scbus' and 'da'), best
# performance is achieved with ports in EPP 1.9 mode.
# lpt Parallel Printer
# plip Parallel network interface
# ppi General-purpose I/O ("Geek Port") + IEEE1284 I/O
@ -2378,7 +2375,6 @@ options DEBUG_1284 # IEEE1284 signaling protocol debug
options PERIPH_1284 # Makes your computer act as an IEEE1284
# compliant peripheral
options DONTPROBE_1284 # Avoid boot detection of PnP parallel devices
options VP0_DEBUG # ZIP/ZIP+ debug
options LPT_DEBUG # Printer driver debug
options PPC_DEBUG # Parallel chipset level debug
options PLIP_DEBUG # Parallel network IP interface debug
@ -2389,7 +2385,6 @@ device ppc
hint.ppc.0.at="isa"
hint.ppc.0.irq="7"
device ppbus
device vpo
device lpt
device plip
device ppi

View file

@ -34,6 +34,10 @@ feeder_rate_gen.h optional sound \
compile-with "${AWK} -f $S/tools/sound/feeder_rate_mkfilter.awk -- ${FEEDER_RATE_PRESETS} > feeder_rate_gen.h" \
no-obj no-implicit-rule before-depend \
clean "feeder_rate_gen.h"
font.h optional sc_dflt_font \
compile-with "uudecode < ${SRCTOP}/share/syscons/fonts/${SC_DFLT_FONT}-8x16.fnt && file2c 'static u_char dflt_font_16[16*256] = {' '};' < ${SC_DFLT_FONT}-8x16 > font.h && uudecode < ${SRCTOP}/share/syscons/fonts/${SC_DFLT_FONT}-8x14.fnt && file2c 'static u_char dflt_font_14[14*256] = {' '};' < ${SC_DFLT_FONT}-8x14 >> font.h && uudecode < ${SRCTOP}/share/syscons/fonts/${SC_DFLT_FONT}-8x8.fnt && file2c 'static u_char dflt_font_8[8*256] = {' '};' < ${SC_DFLT_FONT}-8x8 >> font.h" \
no-obj no-implicit-rule before-depend \
clean "font.h ${SC_DFLT_FONT}-8x14 ${SC_DFLT_FONT}-8x16 ${SC_DFLT_FONT}-8x8"
snd_fxdiv_gen.h optional sound \
dependency "$S/tools/sound/snd_fxdiv_gen.awk" \
compile-with "${AWK} -f $S/tools/sound/snd_fxdiv_gen.awk -- > snd_fxdiv_gen.h" \
@ -50,7 +54,7 @@ pccarddevs.h standard \
no-obj no-implicit-rule before-depend \
clean "pccarddevs.h"
kbdmuxmap.h optional kbdmux_dflt_keymap \
compile-with "kbdcontrol -P ${S:S/sys$/share/}/vt/keymaps -P ${S:S/sys$/share/}/syscons/keymaps -L ${KBDMUX_DFLT_KEYMAP} | sed -e 's/^static keymap_t.* = /static keymap_t key_map = /' -e 's/^static accentmap_t.* = /static accentmap_t accent_map = /' > kbdmuxmap.h" \
compile-with "${KEYMAP} -L ${KBDMUX_DFLT_KEYMAP} | ${KEYMAP_FIX} > ${.TARGET}" \
no-obj no-implicit-rule before-depend \
clean "kbdmuxmap.h"
teken_state.h optional sc | vt \
@ -59,7 +63,7 @@ teken_state.h optional sc | vt \
no-obj no-implicit-rule before-depend \
clean "teken_state.h"
ukbdmap.h optional ukbd_dflt_keymap \
compile-with "kbdcontrol -P ${S:S/sys$/share/}/vt/keymaps -P ${S:S/sys$/share/}/syscons/keymaps -L ${UKBD_DFLT_KEYMAP} | sed -e 's/^static keymap_t.* = /static keymap_t key_map = /' -e 's/^static accentmap_t.* = /static accentmap_t accent_map = /' > ukbdmap.h" \
compile-with "${KEYMAP} -L ${UKBD_DFLT_KEYMAP} | ${KEYMAP_FIX} > ${.TARGET}" \
no-obj no-implicit-rule before-depend \
clean "ukbdmap.h"
usbdevs.h optional usb \
@ -2672,7 +2676,6 @@ dev/pms/RefTisa/tisa/sassata/sata/host/ossasat.c optional pmspcv \
dev/pms/RefTisa/tisa/sassata/sata/host/sathw.c optional pmspcv \
compile-with "${NORMAL_C} -Wunused-variable -Woverflow -Wparentheses -w"
dev/ppbus/if_plip.c optional plip
dev/ppbus/immio.c optional vpo
dev/ppbus/lpbb.c optional lpbb
dev/ppbus/lpt.c optional lpt
dev/ppbus/pcfclock.c optional pcfclock
@ -2683,8 +2686,6 @@ dev/ppbus/ppbconf.c optional ppbus
dev/ppbus/ppbus_if.m optional ppbus
dev/ppbus/ppi.c optional ppi
dev/ppbus/pps.c optional pps
dev/ppbus/vpo.c optional vpo
dev/ppbus/vpoio.c optional vpo
dev/ppc/ppc.c optional ppc
dev/ppc/ppc_acpi.c optional ppc acpi
dev/ppc/ppc_isa.c optional ppc isa

View file

@ -72,16 +72,6 @@ ia32_assym.h standard \
no-obj no-implicit-rule before-depend \
clean "ia32_assym.h"
#
font.h optional sc_dflt_font \
compile-with "uudecode < /usr/share/syscons/fonts/${SC_DFLT_FONT}-8x16.fnt && file2c 'static u_char dflt_font_16[16*256] = {' '};' < ${SC_DFLT_FONT}-8x16 > font.h && uudecode < /usr/share/syscons/fonts/${SC_DFLT_FONT}-8x14.fnt && file2c 'static u_char dflt_font_14[14*256] = {' '};' < ${SC_DFLT_FONT}-8x14 >> font.h && uudecode < /usr/share/syscons/fonts/${SC_DFLT_FONT}-8x8.fnt && file2c 'static u_char dflt_font_8[8*256] = {' '};' < ${SC_DFLT_FONT}-8x8 >> font.h" \
no-obj no-implicit-rule before-depend \
clean "font.h ${SC_DFLT_FONT}-8x14 ${SC_DFLT_FONT}-8x16 ${SC_DFLT_FONT}-8x8"
#
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"
#
amd64/acpica/acpi_machdep.c optional acpi
acpi_wakecode.o optional acpi \
dependency "$S/amd64/acpica/acpi_wakecode.S assym.inc" \

View file

@ -9,8 +9,7 @@ arm/arm/blockio.S standard
arm/arm/bus_space_asm_generic.S standard
arm/arm/bus_space_base.c optional fdt
arm/arm/bus_space_generic.c standard
arm/arm/busdma_machdep-v4.c optional !armv7 !armv6 !ARM_USE_V6_BUSDMA
arm/arm/busdma_machdep-v6.c optional armv7 | armv6 | ARM_USE_V6_BUSDMA
arm/arm/busdma_machdep.c standard
arm/arm/copystr.S standard
arm/arm/cpufunc.c standard
arm/arm/cpufunc_asm.S standard
@ -89,11 +88,6 @@ arm/arm/unwind.c optional ddb | kdtrace_hooks | stack
arm/arm/vm_machdep.c standard
arm/arm/vfp.c standard
arm/cloudabi32/cloudabi32_sysvec.c optional compat_cloudabi32
board_id.h standard \
dependency "$S/arm/conf/genboardid.awk $S/arm/conf/mach-types" \
compile-with "${AWK} -f $S/arm/conf/genboardid.awk $S/arm/conf/mach-types > board_id.h" \
no-obj no-implicit-rule before-depend \
clean "board_id.h"
cddl/compat/opensolaris/kern/opensolaris_atomic.c optional !armv7 !armv6 zfs | !armv7 !armv6 dtrace compile-with "${CDDL_C}"
cddl/dev/dtrace/arm/dtrace_asm.S optional dtrace compile-with "${DTRACE_S}"
cddl/dev/dtrace/arm/dtrace_subr.c optional dtrace compile-with "${DTRACE_C}"
@ -118,10 +112,6 @@ dev/psci/smccc_arm.S optional psci
dev/syscons/scgfbrndr.c optional sc
dev/uart/uart_cpu_fdt.c optional uart fdt
font.h optional sc \
compile-with "uudecode < /usr/share/syscons/fonts/${SC_DFLT_FONT}-8x16.fnt && file2c 'u_char dflt_font_16[16*256] = {' '};' < ${SC_DFLT_FONT}-8x16 > font.h && uudecode < /usr/share/syscons/fonts/${SC_DFLT_FONT}-8x14.fnt && file2c 'u_char dflt_font_14[14*256] = {' '};' < ${SC_DFLT_FONT}-8x14 >> font.h && uudecode < /usr/share/syscons/fonts/${SC_DFLT_FONT}-8x8.fnt && file2c 'u_char dflt_font_8[8*256] = {' '};' < ${SC_DFLT_FONT}-8x8 >> font.h" \
no-obj no-implicit-rule before-depend \
clean "font.h ${SC_DFLT_FONT}-8x14 ${SC_DFLT_FONT}-8x16 ${SC_DFLT_FONT}-8x8"
kern/msi_if.m optional intrng
kern/pic_if.m optional intrng
kern/subr_busdma_bufalloc.c standard

View file

@ -47,16 +47,6 @@ linux_vdso.so optional compat_linux \
no-implicit-rule \
clean "linux_vdso.so"
#
font.h optional sc_dflt_font \
compile-with "uudecode < /usr/share/syscons/fonts/${SC_DFLT_FONT}-8x16.fnt && file2c 'static u_char dflt_font_16[16*256] = {' '};' < ${SC_DFLT_FONT}-8x16 > font.h && uudecode < /usr/share/syscons/fonts/${SC_DFLT_FONT}-8x14.fnt && file2c 'static u_char dflt_font_14[14*256] = {' '};' < ${SC_DFLT_FONT}-8x14 >> font.h && uudecode < /usr/share/syscons/fonts/${SC_DFLT_FONT}-8x8.fnt && file2c 'static u_char dflt_font_8[8*256] = {' '};' < ${SC_DFLT_FONT}-8x8 >> font.h" \
no-obj no-implicit-rule before-depend \
clean "font.h ${SC_DFLT_FONT}-8x14 ${SC_DFLT_FONT}-8x16 ${SC_DFLT_FONT}-8x8"
#
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"
#
cddl/contrib/opensolaris/common/atomic/i386/opensolaris_atomic.S optional zfs | dtrace compile-with "${ZFS_S}"
cddl/dev/dtrace/i386/dtrace_asm.S optional dtrace compile-with "${DTRACE_S}"
cddl/dev/dtrace/i386/dtrace_subr.c optional dtrace compile-with "${DTRACE_C}"

View file

@ -9,11 +9,6 @@
#
#
font.h optional sc \
compile-with "uudecode < /usr/share/syscons/fonts/${SC_DFLT_FONT}-8x16.fnt && file2c 'u_char dflt_font_16[16*256] = {' '};' < ${SC_DFLT_FONT}-8x16 > font.h && uudecode < /usr/share/syscons/fonts/${SC_DFLT_FONT}-8x14.fnt && file2c 'u_char dflt_font_14[14*256] = {' '};' < ${SC_DFLT_FONT}-8x14 >> font.h && uudecode < /usr/share/syscons/fonts/${SC_DFLT_FONT}-8x8.fnt && file2c 'u_char dflt_font_8[8*256] = {' '};' < ${SC_DFLT_FONT}-8x8 >> font.h" \
no-obj no-implicit-rule before-depend \
clean "font.h ${SC_DFLT_FONT}-8x14 ${SC_DFLT_FONT}-8x16 ${SC_DFLT_FONT}-8x8"
#
# There is only an asm version on ppc64.
cddl/compat/opensolaris/kern/opensolaris_atomic.c optional zfs powerpc | dtrace powerpc | zfs powerpcspe | dtrace powerpcspe compile-with "${ZFS_C}"
cddl/dev/dtrace/powerpc/dtrace_asm.S optional dtrace compile-with "${DTRACE_S}"

View file

@ -12,6 +12,11 @@
# 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 "${KEYMAP} -L ${ATKBD_DFLT_KEYMAP} | ${KEYMAP_FIX} > ${.TARGET}" \
no-obj no-implicit-rule before-depend \
clean "atkbdmap.h"
cddl/dev/fbt/x86/fbt_isa.c optional dtrace_fbt | dtraceall compile-with "${FBT_C}"
cddl/dev/dtrace/x86/dis_tables.c optional dtrace_fbt | dtraceall compile-with "${DTRACE_C}"
cddl/dev/dtrace/x86/instr_size.c optional dtrace_fbt | dtraceall compile-with "${DTRACE_C}"

View file

@ -271,6 +271,9 @@ SYSTEM_OBJS= locore.o ${MDOBJS} ${OBJS}
SYSTEM_OBJS+= ${SYSTEM_CFILES:.c=.o}
SYSTEM_OBJS+= hack.pico
KEYMAP=kbdcontrol -P ${SRCTOP}/share/vt/keymaps -P ${SRCTOP}/share/syscons/keymaps
KEYMAP_FIX=sed -e 's/^static keymap_t.* = /static keymap_t key_map = /' -e 's/^static accentmap_t.* = /static accentmap_t accent_map = /'
MD_ROOT_SIZE_CONFIGURED!= grep MD_ROOT_SIZE opt_md.h || true ; echo
.if ${MFS_IMAGE:Uno} != "no"
.if empty(MD_ROOT_SIZE_CONFIGURED)

View file

@ -13,7 +13,8 @@ clean:
.endif
.if ${TARGET} == "arm"
# LINT-V5 removed 2019-11-26. The clean rule is left here temporarily
# to avoid having stale copies left behind.
# to avoid having stale copies left behind. LINT-V7 left the tree on
# 2020-02-02.
rm -f LINT-V5 LINT-V7
.endif
.if ${TARGET} == "powerpc"
@ -55,11 +56,6 @@ LINT: ${NOTES} ${MAKELINT_SED}
echo "nodevice txp" >> ${.TARGET}-NOIP
echo "nodevice netmap" >> ${.TARGET}-NOIP
.endif
.if ${TARGET} == "arm"
cat ${NOTES} ${.CURDIR}/NOTES.armv7 | sed -E -n -f ${MAKELINT_SED} > \
${.TARGET}-V7
rm ${.TARGET}
.endif
.if ${TARGET} == "mips"
echo "machine ${TARGET} ${TARGET_ARCH}" >> ${.TARGET}
.endif

View file

@ -569,7 +569,6 @@ TI_JUMBO_HDRSPLIT opt_ti.h
# with 'make CC="cc -DDEBUG"'.
CLUSTERDEBUG opt_debug_cluster.h
DEBUG_1284 opt_ppb_1284.h
VP0_DEBUG opt_vpo.h
LPT_DEBUG opt_lpt.h
PLIP_DEBUG opt_plip.h
LOCKF_DEBUG opt_debug_lockf.h

View file

@ -5,7 +5,6 @@ ARM_CACHE_LOCK_ENABLE opt_global.h
ARM_KERN_DIRECTMAP opt_vm.h
ARM_L2_PIPT opt_global.h
ARM_MANY_BOARD opt_global.h
ARM_USE_V6_BUSDMA opt_global.h
ARM_WANT_TP_ADDRESS opt_global.h
COUNTS_PER_SEC opt_timer.h
CPSW_ETHERSWITCH opt_cpsw.h

View file

@ -1,818 +0,0 @@
/*-
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
*
* Copyright (c) 1998, 1999 Nicolas Souchu
* Copyright (c) 2001 Alcove - Nicolas Souchu
* 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$");
/*
* Iomega ZIP+ Matchmaker Parallel Port Interface driver
*
* Thanks to David Campbell work on the Linux driver and the Iomega specs
* Thanks to Thiebault Moeglin for the drive
*/
#ifdef _KERNEL
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/module.h>
#include <sys/bus.h>
#include <sys/malloc.h>
#endif /* _KERNEL */
#include "opt_vpo.h"
#include <dev/ppbus/ppbio.h>
#include <dev/ppbus/ppbconf.h>
#include <dev/ppbus/ppb_msq.h>
#include <dev/ppbus/vpoio.h>
#include <dev/ppbus/ppb_1284.h>
#include "ppbus_if.h"
#define VP0_SELTMO 5000 /* select timeout */
#define VP0_FAST_SPINTMO 500000 /* wait status timeout */
#define VP0_LOW_SPINTMO 5000000 /* wait status timeout */
#define VP0_SECTOR_SIZE 512
/*
* Microcode to execute very fast I/O sequences at the lowest bus level.
*/
#define WAIT_RET MS_PARAM(7, 2, MS_TYP_PTR)
#define WAIT_TMO MS_PARAM(1, 0, MS_TYP_INT)
#define DECLARE_WAIT_MICROSEQUENCE \
struct ppb_microseq wait_microseq[] = { \
MS_CASS(0x0c), \
MS_SET(MS_UNKNOWN), \
/* loop */ \
MS_BRSET(nBUSY, 4 /* ready */), \
MS_DBRA(-2 /* loop */), \
MS_CASS(0x04), \
MS_RET(1), /* timed out */ \
/* ready */ \
MS_CASS(0x04), \
MS_RFETCH(MS_REG_STR, 0xb8, MS_UNKNOWN ), \
MS_RET(0) /* no error */ \
}
#define SELECT_TARGET MS_PARAM(6, 1, MS_TYP_CHA)
#define DECLARE_SELECT_MICROSEQUENCE \
struct ppb_microseq select_microseq[] = { \
MS_CASS(0xc), \
/* first, check there is nothing holding onto the bus */ \
MS_SET(VP0_SELTMO), \
/* _loop: */ \
MS_BRCLEAR(0x8, 2 /* _ready */), \
MS_DBRA(-2 /* _loop */), \
MS_RET(2), /* bus busy */ \
/* _ready: */ \
MS_CASS(0x4), \
MS_DASS(MS_UNKNOWN /* 0x80 | 1 << target */), \
MS_DELAY(1), \
MS_CASS(0xc), \
MS_CASS(0xd), \
/* now, wait until the drive is ready */ \
MS_SET(VP0_SELTMO), \
/* loop: */ \
MS_BRSET(0x8, 3 /* ready */), \
MS_DBRA(-2 /* loop */), \
/* error: */ \
MS_CASS(0xc), \
MS_RET(VP0_ESELECT_TIMEOUT), \
/* ready: */ \
MS_CASS(0xc), \
MS_RET(0) \
}
static struct ppb_microseq transfer_epilog[] = {
MS_CASS(0x4),
MS_CASS(0xc),
MS_CASS(0xe),
MS_CASS(0x4),
MS_RET(0)
};
#define CPP_S1 MS_PARAM(10, 2, MS_TYP_PTR)
#define CPP_S2 MS_PARAM(13, 2, MS_TYP_PTR)
#define CPP_S3 MS_PARAM(16, 2, MS_TYP_PTR)
#define CPP_PARAM MS_PARAM(17, 1, MS_TYP_CHA)
#define DECLARE_CPP_MICROSEQ \
struct ppb_microseq cpp_microseq[] = { \
MS_CASS(0x0c), MS_DELAY(2), \
MS_DASS(0xaa), MS_DELAY(10), \
MS_DASS(0x55), MS_DELAY(10), \
MS_DASS(0x00), MS_DELAY(10), \
MS_DASS(0xff), MS_DELAY(10), \
MS_RFETCH(MS_REG_STR, 0xb8, MS_UNKNOWN /* &s1 */), \
MS_DASS(0x87), MS_DELAY(10), \
MS_RFETCH(MS_REG_STR, 0xb8, MS_UNKNOWN /* &s2 */), \
MS_DASS(0x78), MS_DELAY(10), \
MS_RFETCH(MS_REG_STR, 0x38, MS_UNKNOWN /* &s3 */), \
MS_DASS(MS_UNKNOWN /* param */), \
MS_DELAY(2), \
MS_CASS(0x0c), MS_DELAY(10), \
MS_CASS(0x0d), MS_DELAY(2), \
MS_CASS(0x0c), MS_DELAY(10), \
MS_DASS(0xff), MS_DELAY(10), \
MS_RET(0) \
}
#define NEGOCIATED_MODE MS_PARAM(2, 1, MS_TYP_CHA)
#define DECLARE_NEGOCIATE_MICROSEQ \
struct ppb_microseq negociate_microseq[] = { \
MS_CASS(0x4), \
MS_DELAY(5), \
MS_DASS(MS_UNKNOWN /* mode */), \
MS_DELAY(100), \
MS_CASS(0x6), \
MS_DELAY(5), \
MS_BRSET(0x20, 5 /* continue */), \
MS_DELAY(5), \
MS_CASS(0x7), \
MS_DELAY(5), \
MS_CASS(0x6), \
MS_RET(VP0_ENEGOCIATE), \
/* continue: */ \
MS_DELAY(5), \
MS_CASS(0x7), \
MS_DELAY(5), \
MS_CASS(0x6), \
MS_RET(0) \
}
#define INB_NIBBLE_L MS_PARAM(3, 2, MS_TYP_PTR)
#define INB_NIBBLE_H MS_PARAM(6, 2, MS_TYP_PTR)
#define INB_NIBBLE_F MS_PARAM(9, 0, MS_TYP_FUN)
#define INB_NIBBLE_P MS_PARAM(9, 1, MS_TYP_PTR)
/*
* This is the sub-microseqence for MS_GET in NIBBLE mode
* Retrieve the two nibbles and call the C function to generate the character
* and store it in the buffer (see nibble_inbyte_hook())
*/
#define DECLARE_NIBBLE_INBYTE_SUBMICROSEQ \
struct ppb_microseq nibble_inbyte_submicroseq[] = { \
MS_CASS(0x4), \
/* loop: */ \
MS_CASS(0x6), \
MS_DELAY(1), \
MS_RFETCH(MS_REG_STR, MS_FETCH_ALL, MS_UNKNOWN /* low nibble */),\
MS_CASS(0x5), \
MS_DELAY(1), \
MS_RFETCH(MS_REG_STR, MS_FETCH_ALL, MS_UNKNOWN /* high nibble */),\
MS_CASS(0x4), \
MS_DELAY(1), \
/* do a C call to format the received nibbles */ \
MS_C_CALL(MS_UNKNOWN /* C hook */, MS_UNKNOWN /* param */), \
MS_DBRA(-7 /* loop */), \
MS_RET(0) \
}
static struct ppb_microseq reset_microseq[] = {
MS_CASS(0x04),
MS_DASS(0x40),
MS_DELAY(1),
MS_CASS(0x0c),
MS_CASS(0x0d),
MS_DELAY(50),
MS_CASS(0x0c),
MS_CASS(0x04),
MS_RET(0)
};
/*
* nibble_inbyte_hook()
*
* Formats high and low nibble into a character
*/
static int
nibble_inbyte_hook (void *p, char *ptr)
{
struct vpo_nibble *s = (struct vpo_nibble *)p;
/* increment the buffer pointer */
*ptr = ((s->l >> 4) & 0x0f) + (s->h & 0xf0);
return (0);
}
/*
* This is the sub-microseqence for MS_GET in PS2 mode
*/
static struct ppb_microseq ps2_inbyte_submicroseq[] = {
MS_CASS(0x4),
/* loop: */
MS_CASS(PCD | 0x6),
MS_RFETCH_P(1, MS_REG_DTR, MS_FETCH_ALL),
MS_CASS(PCD | 0x5),
MS_DBRA(-4 /* loop */),
MS_RET(0)
};
/*
* This is the sub-microsequence for MS_PUT in both NIBBLE and PS2 modes
*/
static struct ppb_microseq spp_outbyte_submicroseq[] = {
MS_CASS(0x4),
/* loop: */
MS_RASSERT_P(1, MS_REG_DTR),
MS_CASS(0x5),
MS_DBRA(0), /* decrement counter */
MS_RASSERT_P(1, MS_REG_DTR),
MS_CASS(0x0),
MS_DBRA(-6 /* loop */),
/* return from the put call */
MS_CASS(0x4),
MS_RET(0)
};
/* EPP 1.7 microsequences, ptr and len set at runtime */
static struct ppb_microseq epp17_outstr[] = {
MS_CASS(0x4),
MS_RASSERT_P(MS_ACCUM, MS_REG_EPP_D),
MS_CASS(0xc),
MS_RET(0),
};
static struct ppb_microseq epp17_instr[] = {
MS_CASS(PCD | 0x4),
MS_RFETCH_P(MS_ACCUM, MS_REG_EPP_D, MS_FETCH_ALL),
MS_CASS(PCD | 0xc),
MS_RET(0),
};
static int
imm_disconnect(struct vpoio_data *vpo, int *connected, int release_bus)
{
DECLARE_CPP_MICROSEQ;
device_t ppbus = device_get_parent(vpo->vpo_dev);
char s1, s2, s3;
int ret;
/* all should be ok */
if (connected)
*connected = 0;
ppb_MS_init_msq(cpp_microseq, 4, CPP_S1, (void *)&s1,
CPP_S2, (void *)&s2, CPP_S3, (void *)&s3,
CPP_PARAM, 0x30);
ppb_MS_microseq(ppbus, vpo->vpo_dev, cpp_microseq, &ret);
if ((s1 != (char)0xb8 || s2 != (char)0x18 || s3 != (char)0x38)) {
if (bootverbose)
device_printf(vpo->vpo_dev,
"(disconnect) s1=0x%x s2=0x%x, s3=0x%x\n",
s1 & 0xff, s2 & 0xff, s3 & 0xff);
if (connected)
*connected = VP0_ECONNECT;
}
if (release_bus)
return (ppb_release_bus(ppbus, vpo->vpo_dev));
else
return (0);
}
/*
* how : PPB_WAIT or PPB_DONTWAIT
*/
static int
imm_connect(struct vpoio_data *vpo, int how, int *disconnected, int request_bus)
{
DECLARE_CPP_MICROSEQ;
device_t ppbus = device_get_parent(vpo->vpo_dev);
char s1, s2, s3;
int error;
int ret;
/* all should be ok */
if (disconnected)
*disconnected = 0;
if (request_bus)
if ((error = ppb_request_bus(ppbus, vpo->vpo_dev, how)))
return (error);
ppb_MS_init_msq(cpp_microseq, 3, CPP_S1, (void *)&s1,
CPP_S2, (void *)&s2, CPP_S3, (void *)&s3);
/* select device 0 in compatible mode */
ppb_MS_init_msq(cpp_microseq, 1, CPP_PARAM, 0xe0);
ppb_MS_microseq(ppbus, vpo->vpo_dev, cpp_microseq, &ret);
/* disconnect all devices */
ppb_MS_init_msq(cpp_microseq, 1, CPP_PARAM, 0x30);
ppb_MS_microseq(ppbus, vpo->vpo_dev, cpp_microseq, &ret);
if (PPB_IN_EPP_MODE(ppbus))
ppb_MS_init_msq(cpp_microseq, 1, CPP_PARAM, 0x28);
else
ppb_MS_init_msq(cpp_microseq, 1, CPP_PARAM, 0xe0);
ppb_MS_microseq(ppbus, vpo->vpo_dev, cpp_microseq, &ret);
if ((s1 != (char)0xb8 || s2 != (char)0x18 || s3 != (char)0x30)) {
if (bootverbose)
device_printf(vpo->vpo_dev,
"(connect) s1=0x%x s2=0x%x, s3=0x%x\n",
s1 & 0xff, s2 & 0xff, s3 & 0xff);
if (disconnected)
*disconnected = VP0_ECONNECT;
}
return (0);
}
/*
* imm_detect()
*
* Detect and initialise the VP0 adapter.
*/
static int
imm_detect(struct vpoio_data *vpo)
{
device_t ppbus = device_get_parent(vpo->vpo_dev);
int error;
if ((error = ppb_request_bus(ppbus, vpo->vpo_dev, PPB_DONTWAIT)))
return (error);
/* disconnect the drive, keep the bus */
imm_disconnect(vpo, NULL, 0);
vpo->vpo_mode_found = VP0_MODE_UNDEFINED;
error = 1;
/* try to enter EPP mode since vpoio failure put the bus in NIBBLE */
if (ppb_set_mode(ppbus, PPB_EPP) != -1) {
imm_connect(vpo, PPB_DONTWAIT, &error, 0);
}
/* if connection failed try PS/2 then NIBBLE modes */
if (error) {
if (ppb_set_mode(ppbus, PPB_PS2) != -1) {
imm_connect(vpo, PPB_DONTWAIT, &error, 0);
}
if (error) {
if (ppb_set_mode(ppbus, PPB_NIBBLE) != -1) {
imm_connect(vpo, PPB_DONTWAIT, &error, 0);
if (error)
goto error;
vpo->vpo_mode_found = VP0_MODE_NIBBLE;
} else {
device_printf(vpo->vpo_dev,
"NIBBLE mode unavailable!\n");
goto error;
}
} else {
vpo->vpo_mode_found = VP0_MODE_PS2;
}
} else {
vpo->vpo_mode_found = VP0_MODE_EPP;
}
/* send SCSI reset signal */
ppb_MS_microseq(ppbus, vpo->vpo_dev, reset_microseq, NULL);
/* release the bus now */
imm_disconnect(vpo, &error, 1);
/* ensure we are disconnected or daisy chained peripheral
* may cause serious problem to the disk */
if (error) {
if (bootverbose)
device_printf(vpo->vpo_dev,
"can't disconnect from the drive\n");
goto error;
}
return (0);
error:
ppb_release_bus(ppbus, vpo->vpo_dev);
return (VP0_EINITFAILED);
}
/*
* imm_outstr()
*/
static int
imm_outstr(struct vpoio_data *vpo, char *buffer, int size)
{
device_t ppbus = device_get_parent(vpo->vpo_dev);
int error = 0;
if (PPB_IN_EPP_MODE(ppbus))
ppb_reset_epp_timeout(ppbus);
ppb_MS_exec(ppbus, vpo->vpo_dev, MS_OP_PUT, (union ppb_insarg)buffer,
(union ppb_insarg)size, (union ppb_insarg)MS_UNKNOWN, &error);
return (error);
}
/*
* imm_instr()
*/
static int
imm_instr(struct vpoio_data *vpo, char *buffer, int size)
{
device_t ppbus = device_get_parent(vpo->vpo_dev);
int error = 0;
if (PPB_IN_EPP_MODE(ppbus))
ppb_reset_epp_timeout(ppbus);
ppb_MS_exec(ppbus, vpo->vpo_dev, MS_OP_GET, (union ppb_insarg)buffer,
(union ppb_insarg)size, (union ppb_insarg)MS_UNKNOWN, &error);
return (error);
}
static char
imm_select(struct vpoio_data *vpo, int initiator, int target)
{
DECLARE_SELECT_MICROSEQUENCE;
device_t ppbus = device_get_parent(vpo->vpo_dev);
int ret;
/* initialize the select microsequence */
ppb_MS_init_msq(select_microseq, 1,
SELECT_TARGET, 1 << initiator | 1 << target);
ppb_MS_microseq(ppbus, vpo->vpo_dev, select_microseq, &ret);
return (ret);
}
/*
* imm_wait()
*
* H_SELIN must be low.
*
*/
static char
imm_wait(struct vpoio_data *vpo, int tmo)
{
DECLARE_WAIT_MICROSEQUENCE;
device_t ppbus = device_get_parent(vpo->vpo_dev);
int ret, err;
/*
* Return some status information.
* Semantics : 0x88 = ZIP+ wants more data
* 0x98 = ZIP+ wants to send more data
* 0xa8 = ZIP+ wants command
* 0xb8 = end of transfer, ZIP+ is sending status
*/
ppb_MS_init_msq(wait_microseq, 2,
WAIT_RET, (void *)&ret,
WAIT_TMO, tmo);
ppb_MS_microseq(ppbus, vpo->vpo_dev, wait_microseq, &err);
if (err)
return (0); /* command timed out */
return(ret);
}
static int
imm_negociate(struct vpoio_data *vpo)
{
DECLARE_NEGOCIATE_MICROSEQ;
device_t ppbus = device_get_parent(vpo->vpo_dev);
int negociate_mode;
int ret;
if (PPB_IN_NIBBLE_MODE(ppbus))
negociate_mode = 0;
else if (PPB_IN_PS2_MODE(ppbus))
negociate_mode = 1;
else
return (0);
#if 0 /* XXX use standalone code not to depend on ppb_1284 code yet */
ret = ppb_1284_negociate(ppbus, negociate_mode);
if (ret)
return (VP0_ENEGOCIATE);
#endif
ppb_MS_init_msq(negociate_microseq, 1,
NEGOCIATED_MODE, negociate_mode);
ppb_MS_microseq(ppbus, vpo->vpo_dev, negociate_microseq, &ret);
return (ret);
}
/*
* imm_probe()
*
* Low level probe of vpo device
*
*/
int
imm_probe(device_t dev, struct vpoio_data *vpo)
{
int error;
/* ppbus dependent initialisation */
vpo->vpo_dev = dev;
/* now, try to initialise the drive */
if ((error = imm_detect(vpo))) {
return (error);
}
return (0);
}
/*
* imm_attach()
*
* Low level attachment of vpo device
*
*/
int
imm_attach(struct vpoio_data *vpo)
{
DECLARE_NIBBLE_INBYTE_SUBMICROSEQ;
device_t ppbus = device_get_parent(vpo->vpo_dev);
int error = 0;
/*
* Initialize microsequence code
*/
vpo->vpo_nibble_inbyte_msq = (struct ppb_microseq *)malloc(
sizeof(nibble_inbyte_submicroseq), M_DEVBUF, M_NOWAIT);
if (!vpo->vpo_nibble_inbyte_msq)
return (ENXIO);
bcopy((void *)nibble_inbyte_submicroseq,
(void *)vpo->vpo_nibble_inbyte_msq,
sizeof(nibble_inbyte_submicroseq));
ppb_MS_init_msq(vpo->vpo_nibble_inbyte_msq, 4,
INB_NIBBLE_H, (void *)&(vpo)->vpo_nibble.h,
INB_NIBBLE_L, (void *)&(vpo)->vpo_nibble.l,
INB_NIBBLE_F, nibble_inbyte_hook,
INB_NIBBLE_P, (void *)&(vpo)->vpo_nibble);
/*
* Initialize mode dependent in/out microsequences
*/
ppb_lock(ppbus);
if ((error = ppb_request_bus(ppbus, vpo->vpo_dev, PPB_WAIT)))
goto error;
/* ppbus automatically restore the last mode entered during detection */
switch (vpo->vpo_mode_found) {
case VP0_MODE_EPP:
ppb_MS_GET_init(ppbus, vpo->vpo_dev, epp17_instr);
ppb_MS_PUT_init(ppbus, vpo->vpo_dev, epp17_outstr);
device_printf(vpo->vpo_dev, "EPP mode\n");
break;
case VP0_MODE_PS2:
ppb_MS_GET_init(ppbus, vpo->vpo_dev, ps2_inbyte_submicroseq);
ppb_MS_PUT_init(ppbus, vpo->vpo_dev, spp_outbyte_submicroseq);
device_printf(vpo->vpo_dev, "PS2 mode\n");
break;
case VP0_MODE_NIBBLE:
ppb_MS_GET_init(ppbus, vpo->vpo_dev, vpo->vpo_nibble_inbyte_msq);
ppb_MS_PUT_init(ppbus, vpo->vpo_dev, spp_outbyte_submicroseq);
device_printf(vpo->vpo_dev, "NIBBLE mode\n");
break;
default:
panic("imm: unknown mode %d", vpo->vpo_mode_found);
}
ppb_release_bus(ppbus, vpo->vpo_dev);
error:
ppb_unlock(ppbus);
return (error);
}
/*
* imm_reset_bus()
*
*/
int
imm_reset_bus(struct vpoio_data *vpo)
{
device_t ppbus = device_get_parent(vpo->vpo_dev);
int disconnected;
/* first, connect to the drive and request the bus */
imm_connect(vpo, PPB_WAIT|PPB_INTR, &disconnected, 1);
if (!disconnected) {
/* reset the SCSI bus */
ppb_MS_microseq(ppbus, vpo->vpo_dev, reset_microseq, NULL);
/* then disconnect */
imm_disconnect(vpo, NULL, 1);
}
return (0);
}
/*
* imm_do_scsi()
*
* Send an SCSI command
*
*/
int
imm_do_scsi(struct vpoio_data *vpo, int host, int target, char *command,
int clen, char *buffer, int blen, int *result, int *count,
int *ret)
{
device_t ppbus = device_get_parent(vpo->vpo_dev);
char r;
char l, h = 0;
int len, error = 0, not_connected = 0;
int k;
int negociated = 0;
/*
* enter disk state, allocate the ppbus
*
* XXX
* Should we allow this call to be interruptible?
* The only way to report the interruption is to return
* EIO to upper SCSI code :^(
*/
if ((error = imm_connect(vpo, PPB_WAIT|PPB_INTR, &not_connected, 1)))
return (error);
if (not_connected) {
*ret = VP0_ECONNECT;
goto error;
}
/*
* Select the drive ...
*/
if ((*ret = imm_select(vpo,host,target)))
goto error;
/*
* Send the command ...
*/
for (k = 0; k < clen; k+=2) {
if (imm_wait(vpo, VP0_FAST_SPINTMO) != (char)0xa8) {
*ret = VP0_ECMD_TIMEOUT;
goto error;
}
if (imm_outstr(vpo, &command[k], 2)) {
*ret = VP0_EPPDATA_TIMEOUT;
goto error;
}
}
if (!(r = imm_wait(vpo, VP0_LOW_SPINTMO))) {
*ret = VP0_ESTATUS_TIMEOUT;
goto error;
}
if ((r & 0x30) == 0x10) {
if (imm_negociate(vpo)) {
*ret = VP0_ENEGOCIATE;
goto error;
} else
negociated = 1;
}
/*
* Complete transfer ...
*/
*count = 0;
for (;;) {
if (!(r = imm_wait(vpo, VP0_LOW_SPINTMO))) {
*ret = VP0_ESTATUS_TIMEOUT;
goto error;
}
/* stop when the ZIP+ wants to send status */
if (r == (char)0xb8)
break;
if (*count >= blen) {
*ret = VP0_EDATA_OVERFLOW;
goto error;
}
/* ZIP+ wants to send data? */
if (r == (char)0x88) {
len = (((blen - *count) >= VP0_SECTOR_SIZE)) ?
VP0_SECTOR_SIZE : 2;
error = imm_outstr(vpo, &buffer[*count], len);
} else {
if (!PPB_IN_EPP_MODE(ppbus))
len = 1;
else
len = (((blen - *count) >= VP0_SECTOR_SIZE)) ?
VP0_SECTOR_SIZE : 1;
error = imm_instr(vpo, &buffer[*count], len);
}
if (error) {
*ret = error;
goto error;
}
*count += len;
}
if ((PPB_IN_NIBBLE_MODE(ppbus) ||
PPB_IN_PS2_MODE(ppbus)) && negociated)
ppb_MS_microseq(ppbus, vpo->vpo_dev, transfer_epilog, NULL);
/*
* Retrieve status ...
*/
if (imm_negociate(vpo)) {
*ret = VP0_ENEGOCIATE;
goto error;
} else
negociated = 1;
if (imm_instr(vpo, &l, 1)) {
*ret = VP0_EOTHER;
goto error;
}
/* check if the ZIP+ wants to send more status */
if (imm_wait(vpo, VP0_FAST_SPINTMO) == (char)0xb8)
if (imm_instr(vpo, &h, 1)) {
*ret = VP0_EOTHER + 2;
goto error;
}
/* Experience showed that we should discard this */
if (h == (char) -1)
h = 0;
*result = ((int) h << 8) | ((int) l & 0xff);
error:
if ((PPB_IN_NIBBLE_MODE(ppbus) ||
PPB_IN_PS2_MODE(ppbus)) && negociated)
ppb_MS_microseq(ppbus, vpo->vpo_dev, transfer_epilog, NULL);
/* return to printer state, release the ppbus */
imm_disconnect(vpo, NULL, 1);
return (0);
}

View file

@ -1,440 +0,0 @@
/*-
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
*
* Copyright (c) 1997, 1998, 1999 Nicolas Souchu
* 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/module.h>
#include <sys/bus.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/malloc.h>
#include <cam/cam.h>
#include <cam/cam_ccb.h>
#include <cam/cam_sim.h>
#include <cam/cam_xpt_sim.h>
#include <cam/cam_debug.h>
#include <cam/cam_periph.h>
#include <cam/scsi/scsi_all.h>
#include <cam/scsi/scsi_message.h>
#include <cam/scsi/scsi_da.h>
#include <sys/kernel.h>
#include "opt_vpo.h"
#include <dev/ppbus/ppbconf.h>
#include <dev/ppbus/vpoio.h>
#include "ppbus_if.h"
struct vpo_sense {
struct scsi_sense cmd;
unsigned int stat;
unsigned int count;
};
struct vpo_data {
device_t vpo_dev;
int vpo_stat;
int vpo_count;
int vpo_error;
int vpo_isplus;
struct cam_sim *sim;
struct vpo_sense vpo_sense;
struct vpoio_data vpo_io; /* interface to low level functions */
};
#define DEVTOSOFTC(dev) \
((struct vpo_data *)device_get_softc(dev))
/* cam related functions */
static void vpo_action(struct cam_sim *sim, union ccb *ccb);
static void vpo_poll(struct cam_sim *sim);
static void
vpo_identify(driver_t *driver, device_t parent)
{
device_t dev;
dev = device_find_child(parent, "vpo", -1);
if (!dev)
BUS_ADD_CHILD(parent, 0, "vpo", -1);
}
/*
* vpo_probe()
*/
static int
vpo_probe(device_t dev)
{
device_t ppbus = device_get_parent(dev);
struct vpo_data *vpo;
int error;
vpo = DEVTOSOFTC(dev);
vpo->vpo_dev = dev;
/* check ZIP before ZIP+ or imm_probe() will send controls to
* the printer or whatelse connected to the port */
ppb_lock(ppbus);
if ((error = vpoio_probe(dev, &vpo->vpo_io)) == 0) {
vpo->vpo_isplus = 0;
device_set_desc(dev,
"Iomega VPI0 Parallel to SCSI interface");
} else if ((error = imm_probe(dev, &vpo->vpo_io)) == 0) {
vpo->vpo_isplus = 1;
device_set_desc(dev,
"Iomega Matchmaker Parallel to SCSI interface");
} else {
ppb_unlock(ppbus);
return (error);
}
ppb_unlock(ppbus);
return (0);
}
/*
* vpo_attach()
*/
static int
vpo_attach(device_t dev)
{
struct vpo_data *vpo = DEVTOSOFTC(dev);
device_t ppbus = device_get_parent(dev);
struct ppb_data *ppb = device_get_softc(ppbus); /* XXX: layering */
struct cam_devq *devq;
int error;
/* low level attachment */
if (vpo->vpo_isplus) {
if ((error = imm_attach(&vpo->vpo_io)))
return (error);
} else {
if ((error = vpoio_attach(&vpo->vpo_io)))
return (error);
}
/*
** Now tell the generic SCSI layer
** about our bus.
*/
devq = cam_simq_alloc(/*maxopenings*/1);
/* XXX What about low-level detach on error? */
if (devq == NULL)
return (ENXIO);
vpo->sim = cam_sim_alloc(vpo_action, vpo_poll, "vpo", vpo,
device_get_unit(dev), ppb->ppc_lock,
/*untagged*/1, /*tagged*/0, devq);
if (vpo->sim == NULL) {
cam_simq_free(devq);
return (ENXIO);
}
ppb_lock(ppbus);
if (xpt_bus_register(vpo->sim, dev, /*bus*/0) != CAM_SUCCESS) {
cam_sim_free(vpo->sim, /*free_devq*/TRUE);
ppb_unlock(ppbus);
return (ENXIO);
}
ppb_unlock(ppbus);
return (0);
}
/*
* vpo_intr()
*/
static void
vpo_intr(struct vpo_data *vpo, struct ccb_scsiio *csio)
{
int errno; /* error in errno.h */
#ifdef VP0_DEBUG
int i;
#endif
uint8_t *ptr;
ptr = scsiio_cdb_ptr(csio);
if (vpo->vpo_isplus) {
errno = imm_do_scsi(&vpo->vpo_io, VP0_INITIATOR,
csio->ccb_h.target_id,
ptr, csio->cdb_len,
(char *)csio->data_ptr, csio->dxfer_len,
&vpo->vpo_stat, &vpo->vpo_count, &vpo->vpo_error);
} else {
errno = vpoio_do_scsi(&vpo->vpo_io, VP0_INITIATOR,
csio->ccb_h.target_id,
ptr, csio->cdb_len,
(char *)csio->data_ptr, csio->dxfer_len,
&vpo->vpo_stat, &vpo->vpo_count, &vpo->vpo_error);
}
#ifdef VP0_DEBUG
printf("vpo_do_scsi = %d, status = 0x%x, count = %d, vpo_error = %d\n",
errno, vpo->vpo_stat, vpo->vpo_count, vpo->vpo_error);
/* dump of command */
for (i=0; i<csio->cdb_len; i++)
printf("%x ", ((char *)ptr)[i]);
printf("\n");
#endif
if (errno) {
/* connection to ppbus interrupted */
csio->ccb_h.status = CAM_CMD_TIMEOUT;
return;
}
/* if a timeout occurred, no sense */
if (vpo->vpo_error) {
if (vpo->vpo_error != VP0_ESELECT_TIMEOUT)
device_printf(vpo->vpo_dev, "VP0 error/timeout (%d)\n",
vpo->vpo_error);
csio->ccb_h.status = CAM_CMD_TIMEOUT;
return;
}
/* check scsi status */
if (vpo->vpo_stat != SCSI_STATUS_OK) {
csio->scsi_status = vpo->vpo_stat;
/* check if we have to sense the drive */
if ((vpo->vpo_stat & SCSI_STATUS_CHECK_COND) != 0) {
vpo->vpo_sense.cmd.opcode = REQUEST_SENSE;
vpo->vpo_sense.cmd.length = csio->sense_len;
vpo->vpo_sense.cmd.control = 0;
if (vpo->vpo_isplus) {
errno = imm_do_scsi(&vpo->vpo_io, VP0_INITIATOR,
csio->ccb_h.target_id,
(char *)&vpo->vpo_sense.cmd,
sizeof(vpo->vpo_sense.cmd),
(char *)&csio->sense_data, csio->sense_len,
&vpo->vpo_sense.stat, &vpo->vpo_sense.count,
&vpo->vpo_error);
} else {
errno = vpoio_do_scsi(&vpo->vpo_io, VP0_INITIATOR,
csio->ccb_h.target_id,
(char *)&vpo->vpo_sense.cmd,
sizeof(vpo->vpo_sense.cmd),
(char *)&csio->sense_data, csio->sense_len,
&vpo->vpo_sense.stat, &vpo->vpo_sense.count,
&vpo->vpo_error);
}
#ifdef VP0_DEBUG
printf("(sense) vpo_do_scsi = %d, status = 0x%x, count = %d, vpo_error = %d\n",
errno, vpo->vpo_sense.stat, vpo->vpo_sense.count, vpo->vpo_error);
#endif
/* check sense return status */
if (errno == 0 && vpo->vpo_sense.stat == SCSI_STATUS_OK) {
/* sense ok */
csio->ccb_h.status = CAM_AUTOSNS_VALID | CAM_SCSI_STATUS_ERROR;
csio->sense_resid = csio->sense_len - vpo->vpo_sense.count;
#ifdef VP0_DEBUG
/* dump of sense info */
printf("(sense) ");
for (i=0; i<vpo->vpo_sense.count; i++)
printf("%x ", ((char *)&csio->sense_data)[i]);
printf("\n");
#endif
} else {
/* sense failed */
csio->ccb_h.status = CAM_AUTOSENSE_FAIL;
}
} else {
/* no sense */
csio->ccb_h.status = CAM_SCSI_STATUS_ERROR;
}
return;
}
csio->resid = csio->dxfer_len - vpo->vpo_count;
csio->ccb_h.status = CAM_REQ_CMP;
}
static void
vpo_action(struct cam_sim *sim, union ccb *ccb)
{
struct vpo_data *vpo = (struct vpo_data *)sim->softc;
ppb_assert_locked(device_get_parent(vpo->vpo_dev));
switch (ccb->ccb_h.func_code) {
case XPT_SCSI_IO:
{
struct ccb_scsiio *csio;
csio = &ccb->csio;
if (ccb->ccb_h.flags & CAM_CDB_PHYS) {
ccb->ccb_h.status = CAM_REQ_INVALID;
xpt_done(ccb);
break;
}
#ifdef VP0_DEBUG
device_printf(vpo->vpo_dev, "XPT_SCSI_IO (0x%x) request\n",
*scsiio_cdb_ptr(csio));
#endif
vpo_intr(vpo, csio);
xpt_done(ccb);
break;
}
case XPT_CALC_GEOMETRY:
{
struct ccb_calc_geometry *ccg;
ccg = &ccb->ccg;
#ifdef VP0_DEBUG
device_printf(vpo->vpo_dev, "XPT_CALC_GEOMETRY (bs=%d,vs=%jd,c=%d,h=%d,spt=%d) request\n",
ccg->block_size,
(intmax_t)ccg->volume_size,
ccg->cylinders,
ccg->heads,
ccg->secs_per_track);
#endif
ccg->heads = 64;
ccg->secs_per_track = 32;
ccg->cylinders = ccg->volume_size /
(ccg->heads * ccg->secs_per_track);
ccb->ccb_h.status = CAM_REQ_CMP;
xpt_done(ccb);
break;
}
case XPT_RESET_BUS: /* Reset the specified SCSI bus */
{
#ifdef VP0_DEBUG
device_printf(vpo->vpo_dev, "XPT_RESET_BUS request\n");
#endif
if (vpo->vpo_isplus) {
if (imm_reset_bus(&vpo->vpo_io)) {
ccb->ccb_h.status = CAM_REQ_CMP_ERR;
xpt_done(ccb);
return;
}
} else {
if (vpoio_reset_bus(&vpo->vpo_io)) {
ccb->ccb_h.status = CAM_REQ_CMP_ERR;
xpt_done(ccb);
return;
}
}
ccb->ccb_h.status = CAM_REQ_CMP;
xpt_done(ccb);
break;
}
case XPT_PATH_INQ: /* Path routing inquiry */
{
struct ccb_pathinq *cpi = &ccb->cpi;
#ifdef VP0_DEBUG
device_printf(vpo->vpo_dev, "XPT_PATH_INQ request\n");
#endif
cpi->version_num = 1; /* XXX??? */
cpi->hba_inquiry = 0;
cpi->target_sprt = 0;
cpi->hba_misc = 0;
cpi->hba_eng_cnt = 0;
cpi->max_target = 7;
cpi->max_lun = 0;
cpi->initiator_id = VP0_INITIATOR;
cpi->bus_id = sim->bus_id;
cpi->base_transfer_speed = 93;
strlcpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
strlcpy(cpi->hba_vid, "Iomega", HBA_IDLEN);
strlcpy(cpi->dev_name, sim->sim_name, DEV_IDLEN);
cpi->unit_number = sim->unit_number;
cpi->transport = XPORT_PPB;
cpi->transport_version = 0;
cpi->ccb_h.status = CAM_REQ_CMP;
xpt_done(ccb);
break;
}
default:
ccb->ccb_h.status = CAM_REQ_INVALID;
xpt_done(ccb);
break;
}
return;
}
static void
vpo_poll(struct cam_sim *sim)
{
/* The ZIP is actually always polled throw vpo_action(). */
}
static devclass_t vpo_devclass;
static device_method_t vpo_methods[] = {
/* device interface */
DEVMETHOD(device_identify, vpo_identify),
DEVMETHOD(device_probe, vpo_probe),
DEVMETHOD(device_attach, vpo_attach),
{ 0, 0 }
};
static driver_t vpo_driver = {
"vpo",
vpo_methods,
sizeof(struct vpo_data),
};
DRIVER_MODULE(vpo, ppbus, vpo_driver, vpo_devclass, 0, 0);
MODULE_DEPEND(vpo, ppbus, 1, 1, 1);
MODULE_DEPEND(vpo, cam, 1, 1, 1);

View file

@ -1,789 +0,0 @@
/*-
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
*
* Copyright (c) 1998, 1999 Nicolas Souchu
* Copyright (c) 2000 Alcove - Nicolas Souchu
* 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$");
#ifdef _KERNEL
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/module.h>
#include <sys/bus.h>
#include <sys/malloc.h>
#endif
#include "opt_vpo.h"
#include <dev/ppbus/ppbio.h>
#include <dev/ppbus/ppbconf.h>
#include <dev/ppbus/ppb_msq.h>
#include <dev/ppbus/vpoio.h>
#include "ppbus_if.h"
/*
* The driver pools the drive. We may add a timeout queue to avoid
* active polling on nACK. I've tried this but it leads to unreliable
* transfers
*/
#define VP0_SELTMO 5000 /* select timeout */
#define VP0_FAST_SPINTMO 500000 /* wait status timeout */
#define VP0_LOW_SPINTMO 5000000 /* wait status timeout */
/*
* Actually, VP0 timings are more accurate (about few 16MHZ cycles),
* but succeeding in respecting such timings leads to architecture
* dependent considerations.
*/
#define VP0_PULSE 1
#define VP0_SECTOR_SIZE 512
#define VP0_BUFFER_SIZE 0x12000
#define n(flags) (~(flags) & (flags))
/*
* VP0 connections.
*/
#define H_AUTO n(AUTOFEED)
#define H_nAUTO AUTOFEED
#define H_STROBE n(STROBE)
#define H_nSTROBE STROBE
#define H_BSY n(nBUSY)
#define H_nBSY nBUSY
#define H_SEL SELECT
#define H_nSEL n(SELECT)
#define H_ERR PERROR
#define H_nERR n(PERROR)
#define H_ACK nACK
#define H_nACK n(nACK)
#define H_FLT nFAULT
#define H_nFLT n(nFAULT)
#define H_SELIN n(SELECTIN)
#define H_nSELIN SELECTIN
#define H_INIT nINIT
#define H_nINIT n(nINIT)
/*
* Microcode to execute very fast I/O sequences at the lowest bus level.
*/
#define WAIT_RET MS_PARAM(4, 2, MS_TYP_PTR)
#define WAIT_TMO MS_PARAM(0, 0, MS_TYP_INT)
#define DECLARE_WAIT_MICROSEQUENCE \
struct ppb_microseq wait_microseq[] = { \
MS_SET(MS_UNKNOWN), \
/* loop */ \
MS_BRSET(nBUSY, 2 /* ready */), \
MS_DBRA(-2 /* loop */), \
MS_RET(1), /* timed out */ \
/* ready */ \
MS_RFETCH(MS_REG_STR, 0xf0, MS_UNKNOWN), \
MS_RET(0) /* no error */ \
}
/* call this macro to initialize connect/disconnect microsequences */
#define INIT_TRIG_MICROSEQ { \
int i; \
for (i=1; i <= 7; i+=2) { \
disconnect_microseq[i].arg[2] = (union ppb_insarg)d_pulse; \
connect_epp_microseq[i].arg[2] = \
connect_spp_microseq[i].arg[2] = (union ppb_insarg)c_pulse; \
} \
}
#define trig_d_pulse MS_TRIG(MS_REG_CTR,5,MS_UNKNOWN /* d_pulse */)
static char d_pulse[] = {
H_AUTO | H_nSELIN | H_INIT | H_STROBE, 0,
H_nAUTO | H_nSELIN | H_INIT | H_STROBE, VP0_PULSE,
H_AUTO | H_nSELIN | H_INIT | H_STROBE, 0,
H_AUTO | H_SELIN | H_INIT | H_STROBE, VP0_PULSE,
H_AUTO | H_nSELIN | H_INIT | H_STROBE, VP0_PULSE
};
#define trig_c_pulse MS_TRIG(MS_REG_CTR,5,MS_UNKNOWN /* c_pulse */)
static char c_pulse[] = {
H_AUTO | H_nSELIN | H_INIT | H_STROBE, 0,
H_AUTO | H_SELIN | H_INIT | H_STROBE, 0,
H_nAUTO | H_SELIN | H_INIT | H_STROBE, VP0_PULSE,
H_AUTO | H_SELIN | H_INIT | H_STROBE, 0,
H_AUTO | H_nSELIN | H_INIT | H_STROBE, VP0_PULSE
};
static struct ppb_microseq disconnect_microseq[] = {
MS_DASS(0x0), trig_d_pulse, MS_DASS(0x3c), trig_d_pulse,
MS_DASS(0x20), trig_d_pulse, MS_DASS(0xf), trig_d_pulse, MS_RET(0)
};
static struct ppb_microseq connect_epp_microseq[] = {
MS_DASS(0x0), trig_c_pulse, MS_DASS(0x3c), trig_c_pulse,
MS_DASS(0x20), trig_c_pulse, MS_DASS(0xcf), trig_c_pulse, MS_RET(0)
};
static struct ppb_microseq connect_spp_microseq[] = {
MS_DASS(0x0), trig_c_pulse, MS_DASS(0x3c), trig_c_pulse,
MS_DASS(0x20), trig_c_pulse, MS_DASS(0x8f), trig_c_pulse, MS_RET(0)
};
/*
* nibble_inbyte_hook()
*
* Formats high and low nibble into a character
*/
static int
nibble_inbyte_hook (void *p, char *ptr)
{
struct vpo_nibble *s = (struct vpo_nibble *)p;
/* increment the buffer pointer */
*ptr++ = ((s->l >> 4) & 0x0f) + (s->h & 0xf0);
return (0);
}
#define INB_NIBBLE_H MS_PARAM(2, 2, MS_TYP_PTR)
#define INB_NIBBLE_L MS_PARAM(4, 2, MS_TYP_PTR)
#define INB_NIBBLE_F MS_PARAM(5, 0, MS_TYP_FUN)
#define INB_NIBBLE_P MS_PARAM(5, 1, MS_TYP_PTR)
/*
* This is the sub-microseqence for MS_GET in NIBBLE mode
* Retrieve the two nibbles and call the C function to generate the character
* and store it in the buffer (see nibble_inbyte_hook())
*/
#define DECLARE_NIBBLE_INBYTE_SUBMICROSEQ \
struct ppb_microseq nibble_inbyte_submicroseq[] = { \
/* loop: */ \
MS_CASS( H_AUTO | H_SELIN | H_INIT | H_STROBE), \
MS_DELAY(VP0_PULSE), \
MS_RFETCH(MS_REG_STR, MS_FETCH_ALL, MS_UNKNOWN /* high nibble */),\
MS_CASS(H_nAUTO | H_SELIN | H_INIT | H_STROBE), \
MS_RFETCH(MS_REG_STR, MS_FETCH_ALL, MS_UNKNOWN /* low nibble */),\
/* do a C call to format the received nibbles */ \
MS_C_CALL(MS_UNKNOWN /* C hook */, MS_UNKNOWN /* param */),\
MS_DBRA(-7 /* loop */), \
MS_CASS(H_AUTO | H_nSELIN | H_INIT | H_STROBE), \
MS_RET(0) \
}
/*
* This is the sub-microseqence for MS_GET in PS2 mode
*/
static struct ppb_microseq ps2_inbyte_submicroseq[] = {
MS_CASS(PCD | H_AUTO | H_SELIN | H_INIT | H_nSTROBE),
/* loop: */
MS_RFETCH_P(1, MS_REG_DTR, MS_FETCH_ALL),
MS_CASS(PCD | H_nAUTO | H_SELIN | H_INIT | H_nSTROBE),
MS_CASS(PCD | H_AUTO | H_SELIN | H_INIT | H_nSTROBE),
MS_DBRA(-4 /* loop */),
MS_CASS(H_AUTO | H_nSELIN | H_INIT | H_STROBE),
MS_RET(0)
};
/*
* This is the sub-microsequence for MS_PUT in both NIBBLE and PS2 modes
*/
static struct ppb_microseq spp_outbyte_submicroseq[] = {
/* loop: */
MS_RASSERT_P(1, MS_REG_DTR),
MS_CASS(H_nAUTO | H_nSELIN | H_INIT | H_STROBE),
MS_CASS( H_AUTO | H_nSELIN | H_INIT | H_STROBE),
MS_DELAY(VP0_PULSE),
MS_DBRA(-5 /* loop */),
/* return from the put call */
MS_RET(0)
};
/* EPP 1.7 microsequences, ptr and len set at runtime */
static struct ppb_microseq epp17_outstr_body[] = {
MS_CASS(H_AUTO | H_SELIN | H_INIT | H_STROBE),
/* loop: */
MS_RASSERT_P(1, MS_REG_EPP_D),
MS_BRSET(TIMEOUT, 3 /* error */), /* EPP timeout? */
MS_DBRA(-3 /* loop */),
MS_CASS(H_AUTO | H_nSELIN | H_INIT | H_STROBE),
MS_RET(0),
/* error: */
MS_CASS(H_AUTO | H_nSELIN | H_INIT | H_STROBE),
MS_RET(1)
};
static struct ppb_microseq epp17_instr_body[] = {
MS_CASS(PCD | H_AUTO | H_SELIN | H_INIT | H_STROBE),
/* loop: */
MS_RFETCH_P(1, MS_REG_EPP_D, MS_FETCH_ALL),
MS_BRSET(TIMEOUT, 3 /* error */), /* EPP timeout? */
MS_DBRA(-3 /* loop */),
MS_CASS(PCD | H_AUTO | H_nSELIN | H_INIT | H_STROBE),
MS_RET(0),
/* error: */
MS_CASS(PCD | H_AUTO | H_nSELIN | H_INIT | H_STROBE),
MS_RET(1)
};
static struct ppb_microseq in_disk_mode[] = {
MS_CASS( H_AUTO | H_nSELIN | H_INIT | H_STROBE),
MS_CASS(H_nAUTO | H_nSELIN | H_INIT | H_STROBE),
MS_BRCLEAR(H_FLT, 3 /* error */),
MS_CASS( H_AUTO | H_nSELIN | H_INIT | H_STROBE),
MS_BRSET(H_FLT, 1 /* error */),
MS_RET(1),
/* error: */
MS_RET(0)
};
static int
vpoio_disconnect(struct vpoio_data *vpo)
{
device_t ppbus = device_get_parent(vpo->vpo_dev);
int ret;
ppb_MS_microseq(ppbus, vpo->vpo_dev, disconnect_microseq, &ret);
return (ppb_release_bus(ppbus, vpo->vpo_dev));
}
/*
* how : PPB_WAIT or PPB_DONTWAIT
*/
static int
vpoio_connect(struct vpoio_data *vpo, int how)
{
device_t ppbus = device_get_parent(vpo->vpo_dev);
int error;
int ret;
if ((error = ppb_request_bus(ppbus, vpo->vpo_dev, how))) {
#ifdef VP0_DEBUG
printf("%s: can't request bus!\n", __func__);
#endif
return (error);
}
if (PPB_IN_EPP_MODE(ppbus))
ppb_MS_microseq(ppbus, vpo->vpo_dev, connect_epp_microseq, &ret);
else
ppb_MS_microseq(ppbus, vpo->vpo_dev, connect_spp_microseq, &ret);
return (0);
}
/*
* vpoio_reset()
*
* SCSI reset signal, the drive must be in disk mode
*/
static void
vpoio_reset(struct vpoio_data *vpo)
{
device_t ppbus = device_get_parent(vpo->vpo_dev);
int ret;
struct ppb_microseq reset_microseq[] = {
#define INITIATOR MS_PARAM(0, 1, MS_TYP_INT)
MS_DASS(MS_UNKNOWN),
MS_CASS(H_AUTO | H_nSELIN | H_nINIT | H_STROBE),
MS_DELAY(25),
MS_CASS(H_AUTO | H_nSELIN | H_INIT | H_STROBE),
MS_RET(0)
};
ppb_MS_init_msq(reset_microseq, 1, INITIATOR, 1 << VP0_INITIATOR);
ppb_MS_microseq(ppbus, vpo->vpo_dev, reset_microseq, &ret);
return;
}
/*
* vpoio_in_disk_mode()
*/
static int
vpoio_in_disk_mode(struct vpoio_data *vpo)
{
device_t ppbus = device_get_parent(vpo->vpo_dev);
int ret;
ppb_MS_microseq(ppbus, vpo->vpo_dev, in_disk_mode, &ret);
return (ret);
}
/*
* vpoio_detect()
*
* Detect and initialise the VP0 adapter.
*/
static int
vpoio_detect(struct vpoio_data *vpo)
{
device_t ppbus = device_get_parent(vpo->vpo_dev);
int error, ret;
/* allocate the bus, then apply microsequences */
if ((error = ppb_request_bus(ppbus, vpo->vpo_dev, PPB_DONTWAIT)))
return (error);
/* Force disconnection */
ppb_MS_microseq(ppbus, vpo->vpo_dev, disconnect_microseq, &ret);
/* Try to enter EPP mode, then connect to the drive in EPP mode */
if (ppb_set_mode(ppbus, PPB_EPP) != -1) {
/* call manually the microseq instead of using the appropriate function
* since we already requested the ppbus */
ppb_MS_microseq(ppbus, vpo->vpo_dev, connect_epp_microseq, &ret);
}
/* If EPP mode switch failed or ZIP connection in EPP mode failed,
* try to connect in NIBBLE mode */
if (!vpoio_in_disk_mode(vpo)) {
/* The interface must be at least PS/2 or NIBBLE capable.
* There is no way to know if the ZIP will work with
* PS/2 mode since PS/2 and SPP both use the same connect
* sequence. One must suppress PS/2 with boot flags if
* PS/2 mode fails (see ppc(4)).
*/
if (ppb_set_mode(ppbus, PPB_PS2) != -1) {
vpo->vpo_mode_found = VP0_MODE_PS2;
} else {
if (ppb_set_mode(ppbus, PPB_NIBBLE) == -1)
goto error;
vpo->vpo_mode_found = VP0_MODE_NIBBLE;
}
/* Can't know if the interface is capable of PS/2 yet */
ppb_MS_microseq(ppbus, vpo->vpo_dev, connect_spp_microseq, &ret);
if (!vpoio_in_disk_mode(vpo)) {
vpo->vpo_mode_found = VP0_MODE_UNDEFINED;
if (bootverbose)
device_printf(vpo->vpo_dev,
"can't connect to the drive\n");
/* disconnect and release the bus */
ppb_MS_microseq(ppbus, vpo->vpo_dev, disconnect_microseq,
&ret);
goto error;
}
} else {
vpo->vpo_mode_found = VP0_MODE_EPP;
}
/* send SCSI reset signal */
vpoio_reset(vpo);
ppb_MS_microseq(ppbus, vpo->vpo_dev, disconnect_microseq, &ret);
/* ensure we are disconnected or daisy chained peripheral
* may cause serious problem to the disk */
if (vpoio_in_disk_mode(vpo)) {
if (bootverbose)
device_printf(vpo->vpo_dev,
"can't disconnect from the drive\n");
goto error;
}
ppb_release_bus(ppbus, vpo->vpo_dev);
return (0);
error:
ppb_release_bus(ppbus, vpo->vpo_dev);
return (VP0_EINITFAILED);
}
/*
* vpoio_outstr()
*/
static int
vpoio_outstr(struct vpoio_data *vpo, char *buffer, int size)
{
device_t ppbus = device_get_parent(vpo->vpo_dev);
int error = 0;
ppb_MS_exec(ppbus, vpo->vpo_dev, MS_OP_PUT, (union ppb_insarg)buffer,
(union ppb_insarg)size, (union ppb_insarg)MS_UNKNOWN, &error);
ppb_ecp_sync(ppbus);
return (error);
}
/*
* vpoio_instr()
*/
static int
vpoio_instr(struct vpoio_data *vpo, char *buffer, int size)
{
device_t ppbus = device_get_parent(vpo->vpo_dev);
int error = 0;
ppb_MS_exec(ppbus, vpo->vpo_dev, MS_OP_GET, (union ppb_insarg)buffer,
(union ppb_insarg)size, (union ppb_insarg)MS_UNKNOWN, &error);
ppb_ecp_sync(ppbus);
return (error);
}
static char
vpoio_select(struct vpoio_data *vpo, int initiator, int target)
{
device_t ppbus = device_get_parent(vpo->vpo_dev);
int ret;
struct ppb_microseq select_microseq[] = {
/* parameter list
*/
#define SELECT_TARGET MS_PARAM(0, 1, MS_TYP_INT)
#define SELECT_INITIATOR MS_PARAM(3, 1, MS_TYP_INT)
/* send the select command to the drive */
MS_DASS(MS_UNKNOWN),
MS_CASS(H_nAUTO | H_nSELIN | H_INIT | H_STROBE),
MS_CASS( H_AUTO | H_nSELIN | H_INIT | H_STROBE),
MS_DASS(MS_UNKNOWN),
MS_CASS( H_AUTO | H_nSELIN | H_nINIT | H_STROBE),
/* now, wait until the drive is ready */
MS_SET(VP0_SELTMO),
/* loop: */ MS_BRSET(H_ACK, 2 /* ready */),
MS_DBRA(-2 /* loop */),
/* error: */ MS_RET(1),
/* ready: */ MS_RET(0)
};
/* initialize the select microsequence */
ppb_MS_init_msq(select_microseq, 2,
SELECT_TARGET, 1 << target,
SELECT_INITIATOR, 1 << initiator);
ppb_MS_microseq(ppbus, vpo->vpo_dev, select_microseq, &ret);
if (ret)
return (VP0_ESELECT_TIMEOUT);
return (0);
}
/*
* vpoio_wait()
*
* H_SELIN must be low.
*
* XXX should be ported to microseq
*/
static char
vpoio_wait(struct vpoio_data *vpo, int tmo)
{
DECLARE_WAIT_MICROSEQUENCE;
device_t ppbus = device_get_parent(vpo->vpo_dev);
int ret, err;
#if 0 /* broken */
if (ppb_poll_device(ppbus, 150, nBUSY, nBUSY, PPB_INTR))
return (0);
return (ppb_rstr(ppbus) & 0xf0);
#endif
/*
* Return some status information.
* Semantics : 0xc0 = ZIP wants more data
* 0xd0 = ZIP wants to send more data
* 0xe0 = ZIP wants command
* 0xf0 = end of transfer, ZIP is sending status
*/
ppb_MS_init_msq(wait_microseq, 2,
WAIT_RET, (void *)&ret,
WAIT_TMO, tmo);
ppb_MS_microseq(ppbus, vpo->vpo_dev, wait_microseq, &err);
if (err)
return (0); /* command timed out */
return(ret);
}
/*
* vpoio_probe()
*
* Low level probe of vpo device
*
*/
int
vpoio_probe(device_t dev, struct vpoio_data *vpo)
{
int error;
/* ppbus dependent initialisation */
vpo->vpo_dev = dev;
/*
* Initialize microsequence code
*/
INIT_TRIG_MICROSEQ;
/* now, try to initialise the drive */
if ((error = vpoio_detect(vpo))) {
return (error);
}
return (0);
}
/*
* vpoio_attach()
*
* Low level attachment of vpo device
*
*/
int
vpoio_attach(struct vpoio_data *vpo)
{
DECLARE_NIBBLE_INBYTE_SUBMICROSEQ;
device_t ppbus = device_get_parent(vpo->vpo_dev);
int error = 0;
vpo->vpo_nibble_inbyte_msq = (struct ppb_microseq *)malloc(
sizeof(nibble_inbyte_submicroseq), M_DEVBUF, M_NOWAIT);
if (!vpo->vpo_nibble_inbyte_msq)
return (ENXIO);
bcopy((void *)nibble_inbyte_submicroseq,
(void *)vpo->vpo_nibble_inbyte_msq,
sizeof(nibble_inbyte_submicroseq));
ppb_MS_init_msq(vpo->vpo_nibble_inbyte_msq, 4,
INB_NIBBLE_H, (void *)&(vpo)->vpo_nibble.h,
INB_NIBBLE_L, (void *)&(vpo)->vpo_nibble.l,
INB_NIBBLE_F, nibble_inbyte_hook,
INB_NIBBLE_P, (void *)&(vpo)->vpo_nibble);
/*
* Initialize mode dependent in/out microsequences
*/
ppb_lock(ppbus);
if ((error = ppb_request_bus(ppbus, vpo->vpo_dev, PPB_WAIT)))
goto error;
/* ppbus sets automatically the last mode entered during detection */
switch (vpo->vpo_mode_found) {
case VP0_MODE_EPP:
ppb_MS_GET_init(ppbus, vpo->vpo_dev, epp17_instr_body);
ppb_MS_PUT_init(ppbus, vpo->vpo_dev, epp17_outstr_body);
device_printf(vpo->vpo_dev, "EPP mode\n");
break;
case VP0_MODE_PS2:
ppb_MS_GET_init(ppbus, vpo->vpo_dev, ps2_inbyte_submicroseq);
ppb_MS_PUT_init(ppbus, vpo->vpo_dev, spp_outbyte_submicroseq);
device_printf(vpo->vpo_dev, "PS2 mode\n");
break;
case VP0_MODE_NIBBLE:
ppb_MS_GET_init(ppbus, vpo->vpo_dev, vpo->vpo_nibble_inbyte_msq);
ppb_MS_PUT_init(ppbus, vpo->vpo_dev, spp_outbyte_submicroseq);
device_printf(vpo->vpo_dev, "NIBBLE mode\n");
break;
default:
panic("vpo: unknown mode %d", vpo->vpo_mode_found);
}
ppb_release_bus(ppbus, vpo->vpo_dev);
error:
ppb_unlock(ppbus);
return (error);
}
/*
* vpoio_reset_bus()
*
*/
int
vpoio_reset_bus(struct vpoio_data *vpo)
{
/* first, connect to the drive */
if (vpoio_connect(vpo, PPB_WAIT|PPB_INTR) || !vpoio_in_disk_mode(vpo)) {
#ifdef VP0_DEBUG
printf("%s: not in disk mode!\n", __func__);
#endif
/* release ppbus */
vpoio_disconnect(vpo);
return (1);
}
/* reset the SCSI bus */
vpoio_reset(vpo);
/* then disconnect */
vpoio_disconnect(vpo);
return (0);
}
/*
* vpoio_do_scsi()
*
* Send an SCSI command
*
*/
int
vpoio_do_scsi(struct vpoio_data *vpo, int host, int target, char *command,
int clen, char *buffer, int blen, int *result, int *count,
int *ret)
{
device_t ppbus = device_get_parent(vpo->vpo_dev);
char r;
char l, h = 0;
int len, error = 0;
int k;
/*
* enter disk state, allocate the ppbus
*
* XXX
* Should we allow this call to be interruptible?
* The only way to report the interruption is to return
* EIO do upper SCSI code :^(
*/
if ((error = vpoio_connect(vpo, PPB_WAIT|PPB_INTR)))
return (error);
if (!vpoio_in_disk_mode(vpo)) {
*ret = VP0_ECONNECT;
goto error;
}
if ((*ret = vpoio_select(vpo,host,target)))
goto error;
/*
* Send the command ...
*
* set H_SELIN low for vpoio_wait().
*/
ppb_wctr(ppbus, H_AUTO | H_nSELIN | H_INIT | H_STROBE);
for (k = 0; k < clen; k++) {
if (vpoio_wait(vpo, VP0_FAST_SPINTMO) != (char)0xe0) {
*ret = VP0_ECMD_TIMEOUT;
goto error;
}
if (vpoio_outstr(vpo, &command[k], 1)) {
*ret = VP0_EPPDATA_TIMEOUT;
goto error;
}
}
/*
* Completion ...
*/
*count = 0;
for (;;) {
if (!(r = vpoio_wait(vpo, VP0_LOW_SPINTMO))) {
*ret = VP0_ESTATUS_TIMEOUT;
goto error;
}
/* stop when the ZIP wants to send status */
if (r == (char)0xf0)
break;
if (*count >= blen) {
*ret = VP0_EDATA_OVERFLOW;
goto error;
}
/* if in EPP mode or writing bytes, try to transfer a sector
* otherwise, just send one byte
*/
if (PPB_IN_EPP_MODE(ppbus) || r == (char)0xc0)
len = (((blen - *count) >= VP0_SECTOR_SIZE)) ?
VP0_SECTOR_SIZE : 1;
else
len = 1;
/* ZIP wants to send data? */
if (r == (char)0xc0)
error = vpoio_outstr(vpo, &buffer[*count], len);
else
error = vpoio_instr(vpo, &buffer[*count], len);
if (error) {
*ret = error;
goto error;
}
*count += len;
}
if (vpoio_instr(vpo, &l, 1)) {
*ret = VP0_EOTHER;
goto error;
}
/* check if the ZIP wants to send more status */
if (vpoio_wait(vpo, VP0_FAST_SPINTMO) == (char)0xf0)
if (vpoio_instr(vpo, &h, 1)) {
*ret = VP0_EOTHER + 2;
goto error;
}
*result = ((int) h << 8) | ((int) l & 0xff);
error:
/* return to printer state, release the ppbus */
vpoio_disconnect(vpo);
return (0);
}

View file

@ -1,99 +0,0 @@
/*-
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
*
* Copyright (c) 1998 Nicolas Souchu
* 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 __VP0IO_H
#define __VP0IO_H
/*
* The ZIP drive cannot act as an initiator.
*/
#define VP0_INITIATOR 0x7
#define VP0_ESELECT_TIMEOUT 1
#define VP0_ECMD_TIMEOUT 2
#define VP0_ECONNECT 3
#define VP0_ESTATUS_TIMEOUT 4
#define VP0_EDATA_OVERFLOW 5
#define VP0_EDISCONNECT 6
#define VP0_EPPDATA_TIMEOUT 7
#define VP0_ENEGOCIATE 8
#define VP0_ENOPORT 9
#define VP0_EINITFAILED 10
#define VP0_EINTR 12
#define VP0_EOTHER 13
#define VP0_OPENNINGS 1
/*
* Data structure used during microsequence execution
* when characters are received in nibble mode
*/
struct vpo_nibble {
char h; /* most significant nibble */
char l; /* less significant nibble */
};
/* Mode found during initialisation */
#define VP0_MODE_UNDEFINED 0x0
#define VP0_MODE_NIBBLE 0x1
#define VP0_MODE_PS2 0x2
#define VP0_MODE_EPP 0x3
struct vpoio_data {
int vpo_mode_found; /* Mode found during init */
struct vpo_nibble vpo_nibble;
/* each device must have its own nibble inbyte microsequence */
struct ppb_microseq *vpo_nibble_inbyte_msq;
device_t vpo_dev;
};
int vpoio_probe(device_t dev, struct vpoio_data *vpo);
int vpoio_attach(struct vpoio_data *vpo);
int vpoio_reset_bus(struct vpoio_data *vpo);
int vpoio_do_scsi(struct vpoio_data *vpo, int host, int target, char *command,
int clen, char *buffer, int blen, int *result, int *count,
int *ret);
int imm_probe(device_t dev, struct vpoio_data *vpo);
int imm_attach(struct vpoio_data *vpo);
int imm_reset_bus(struct vpoio_data *vpo);
int imm_do_scsi(struct vpoio_data *vpo, int host, int target, char *command,
int clen, char *buffer, int blen, int *result, int *count,
int *ret);
#endif

View file

@ -299,7 +299,7 @@ tpmcrb_cancel_cmd(struct tpm_sc *sc)
return (false);
}
WR4(sc, TPM_CRB_CTRL_CANCEL, TPM_CRB_CTRL_CANCEL_CLEAR;
WR4(sc, TPM_CRB_CTRL_CANCEL, TPM_CRB_CTRL_CANCEL_CLEAR);
return (true);
}
@ -331,7 +331,7 @@ tpmcrb_transmit(struct tpm_sc *sc, size_t length)
return (EIO);
}
/* Clear cancellation bit */
WR4(sc, TPM_CRB_CTRL_CANCEL, TPM_CRB_CTRL_CANCEL_CLEAR;
WR4(sc, TPM_CRB_CTRL_CANCEL, TPM_CRB_CTRL_CANCEL_CLEAR);
/* Switch device to idle state if necessary */
if (!(RD4(sc, TPM_CRB_CTRL_STS) & TPM_CRB_CTRL_STS_IDLE_BIT)) {

View file

@ -317,15 +317,12 @@ null_bypass(struct vop_generic_args *ap)
* We must avoid these ops.
* (This should go away when these ops are regularized.)
*/
if (descp->vdesc_flags & VDESC_VPP_WILLRELE)
goto out;
vppp = VOPARG_OFFSETTO(struct vnode***,
descp->vdesc_vpp_offset,ap);
if (*vppp)
error = null_nodeget(old_vps[0]->v_mount, **vppp, *vppp);
}
out:
return (error);
}

View file

@ -1437,7 +1437,7 @@ kern_fstat(struct thread *td, int fd, struct stat *sbp)
AUDIT_ARG_FD(fd);
error = fget(td, fd, &cap_fstat_rights, &fp);
if (error != 0)
if (__predict_false(error != 0))
return (error);
AUDIT_ARG_FILE(td->td_proc, fp);
@ -2737,8 +2737,7 @@ fget_unlocked(struct filedesc *fdp, int fd, cap_rights_t *needrightsp,
* table before this fd was closed, so it possible that
* there is a stale fp pointer in cached version.
*/
fdt = *(const struct fdescenttbl * const volatile *)
&(fdp->fd_files);
fdt = (struct fdescenttbl *)atomic_load_ptr(&fdp->fd_files);
continue;
}
if (__predict_false(count + 1 < count))
@ -2793,9 +2792,9 @@ _fget(struct thread *td, int fd, struct file **fpp, int flags,
*fpp = NULL;
fdp = td->td_proc->p_fd;
error = fget_unlocked(fdp, fd, needrightsp, &fp, seqp);
if (error != 0)
if (__predict_false(error != 0))
return (error);
if (fp->f_ops == &badfileops) {
if (__predict_false(fp->f_ops == &badfileops)) {
fdrop(fp, td);
return (EBADF);
}

View file

@ -5384,12 +5384,6 @@ vop_unlock_pre(void *ap)
ASSERT_VOP_LOCKED(a->a_vp, "VOP_UNLOCK");
}
void
vop_unlock_post(void *ap, int rc)
{
return;
}
void
vop_need_inactive_pre(void *ap)
{

View file

@ -386,7 +386,6 @@ vop_lock1 {
%! unlock pre vop_unlock_pre
%! unlock post vop_unlock_post
vop_unlock {
IN struct vnode *vp;

View file

@ -372,7 +372,6 @@ SUBDIR= \
${_vmd} \
${_vmm} \
${_vmware} \
${_vpo} \
vr \
vte \
${_wbwd} \
@ -558,7 +557,6 @@ _hwpmc_mips74k= hwpmc_mips74k
${MACHINE_CPUARCH} != "mips" && ${MACHINE_CPUARCH} != "powerpc" && \
${MACHINE_CPUARCH} != "riscv"
_syscons= syscons
_vpo= vpo
.endif
.if ${MACHINE_CPUARCH} != "mips"

View file

@ -1,10 +0,0 @@
# $FreeBSD$
.PATH: ${SRCTOP}/sys/dev/ppbus
KMOD= vpo
SRCS= bus_if.h device_if.h ppbus_if.h \
opt_cam.h opt_scsi.h opt_vpo.h \
immio.c vpo.c vpoio.c
.include <bsd.kmod.mk>

View file

@ -463,7 +463,6 @@ extern struct vattr va_null; /* predefined null vattr structure */
#define VDESC_VP1_WILLRELE 0x0002
#define VDESC_VP2_WILLRELE 0x0004
#define VDESC_VP3_WILLRELE 0x0008
#define VDESC_VPP_WILLRELE 0x0200
/*
* A generic structure.
@ -825,7 +824,6 @@ void vop_strategy_pre(void *a);
void vop_lock_pre(void *a);
void vop_lock_post(void *a, int rc);
void vop_unlock_pre(void *a);
void vop_unlock_post(void *a, int rc);
void vop_need_inactive_pre(void *a);
void vop_need_inactive_post(void *a, int rc);
#else
@ -833,7 +831,6 @@ void vop_need_inactive_post(void *a, int rc);
#define vop_lock_pre(x) do { } while (0)
#define vop_lock_post(x, y) do { } while (0)
#define vop_unlock_pre(x) do { } while (0)
#define vop_unlock_post(x, y) do { } while (0)
#define vop_need_inactive_pre(x) do { } while (0)
#define vop_need_inactive_post(x, y) do { } while (0)
#endif

View file

@ -2101,7 +2101,9 @@ zone_kva_available(uma_zone_t zone, void *unused)
if ((zone->uz_flags & UMA_ZFLAG_CACHE) != 0)
return;
KEG_GET(zone, keg);
if (keg->uk_allocf == startup_alloc)
if (keg->uk_flags & UMA_ZONE_PCPU)
keg->uk_allocf = pcpu_page_alloc;
else if (keg->uk_allocf == startup_alloc)
keg->uk_allocf = page_alloc;
}

View file

@ -370,6 +370,8 @@ dmar_gas_lowermatch(struct dmar_gas_match_args *a, struct dmar_map_entry *entry)
}
if (entry->free_down < a->size + a->offset + DMAR_PAGE_SIZE)
return (ENOMEM);
if (entry->first >= a->common->lowaddr)
return (ENOMEM);
child = RB_LEFT(entry, rb_entry);
if (child != NULL && 0 == dmar_gas_lowermatch(a, child))
return (0);
@ -390,6 +392,8 @@ dmar_gas_uppermatch(struct dmar_gas_match_args *a, struct dmar_map_entry *entry)
{
struct dmar_map_entry *child;
if (entry->free_down < a->size + a->offset + DMAR_PAGE_SIZE)
return (ENOMEM);
if (entry->last < a->common->highaddr)
return (ENOMEM);
child = RB_LEFT(entry, rb_entry);