The walnut port has been subsumed by the new evbppc port.
This commit is contained in:
parent
599e82b578
commit
c7eafb778a
@ -1,4 +1,4 @@
|
||||
$NetBSD: README,v 1.27 2002/12/09 12:29:17 scw Exp $
|
||||
$NetBSD: README,v 1.28 2002/12/09 14:57:47 scw Exp $
|
||||
|
||||
acorn26: Acorn ARM2- and ARM3-based machines (arm, 20000509)
|
||||
acorn32: Acorn computers Ltd. ARM 6/7/SA based machines (arm, 20011118)
|
||||
@ -55,7 +55,6 @@ sparc64: Sun Microsystems UltraSPARC 64 bit machines (sparc64/sparc, 19980620)
|
||||
sun2: Sun m68010 based machines (m68k, 20010328)
|
||||
sun3: Sun m680[23]0 based machines (m68k, 19930625)
|
||||
vax: Digital Equipment Corp. VAX machines (vax, 19940802)
|
||||
walnut: IBM's PowerPC 405GP Reference Board (powerpc, 20010613)
|
||||
x68k: Sharp X68000, X68030 (m68k, 19960505)
|
||||
x86_64: AMD's x86 64 bit architecture on the simics simulator (x86_64, 20010619)
|
||||
|
||||
|
@ -1,32 +0,0 @@
|
||||
# $NetBSD: Makefile,v 1.1 2001/06/13 06:01:50 simonb Exp $
|
||||
|
||||
ETAGS?= etags
|
||||
|
||||
SUBDIR= include
|
||||
|
||||
SWALNUT= walnut/*.[ch] include/*.h dev/*.[ch] pci/*.[ch]
|
||||
AWALNUT= walnut/*.[sS]
|
||||
|
||||
SPPC= ../powerpc/ibm4xx/*.[ch] ../powerpc/powerpc/*.[ch] \
|
||||
../powerpc/include/*.h ../powerpc/include/ibm4xx/*.h \
|
||||
../powerpc/fpu/*.[ch]
|
||||
APPC= ../powerpc/ibm4xx/*.[sS] ../powerpc/powerpc/*.[sS]
|
||||
LPPC= ../../lib/libkern/arch/powerpc/*.[chsS] \
|
||||
../../lib/libkern/*.[ch] \
|
||||
../../lib/libsa/*.[ch]
|
||||
|
||||
SYSDIR= ../..
|
||||
.include "../../kern/Make.tags.inc"
|
||||
|
||||
.ifmake TAGS
|
||||
COMM!= find ${SYSDIR} -name "arch" -prune -o -name "*.[ch]" -print
|
||||
.endif
|
||||
|
||||
TAGS: ${SWALNUT} ${COMM} ${SPPC} ${COMM} ${ASPARC64}
|
||||
@echo Making TAGS...
|
||||
@${ETAGS} ${SWALNUT} ${COMM} ${SPPC} ${COMM} "--regex=/^GLOBAL(\(.*\))/\1/" \
|
||||
"--regex=/^_C_LABEL(\(.*\)):/\1/" "--regex=/^\(.*\):/\1/" \
|
||||
"--regex=/^ENTRY(\(.*\)):/\1/" "--regex=/^ASENTRY(\(.*\)):/\1/" \
|
||||
${APPC} ${AWALNUT}
|
||||
|
||||
.include <bsd.subdir.mk>
|
@ -1,35 +0,0 @@
|
||||
#!/bin/sh
|
||||
# $NetBSD: mkimg.sh,v 1.2 2001/09/17 15:57:00 reinoud Exp $
|
||||
|
||||
# Convert a kernel to an tftp image loadable by the walnut IBM openbios.
|
||||
|
||||
if [ $# -ne 2 ] ; then
|
||||
echo usage: $0 kernel image 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
kernel=$1; shift
|
||||
output=$1; shift
|
||||
|
||||
: ${OBJDUMP=objdump}
|
||||
: ${OBJCOPY=objcopy}
|
||||
|
||||
start=`${OBJDUMP} -f ${kernel} | awk '/start address/ { print $NF }'`
|
||||
start=`printf "%d" $start`
|
||||
${OBJCOPY} -O binary ${kernel} ${kernel}.bin.$$
|
||||
size=`/bin/ls -l ${kernel}.bin.$$ | awk '{ printf "%d", ( $5 + 511 ) / 512 }'`
|
||||
|
||||
printf "%d\n%d\n0\n%d\n0\n0\n0\n" $start $size $start |
|
||||
awk 'BEGIN { printf "\x00\x52\x50\x4f" }
|
||||
{
|
||||
printf "%c", $0 / 256 / 256 / 256 ;
|
||||
printf "%c", $0 / 256 / 256 ;
|
||||
printf "%c", $0 / 256 ;
|
||||
printf "%c", $0 ;
|
||||
}
|
||||
' > ${output}
|
||||
|
||||
cat ${kernel}.bin.$$ >> ${output}
|
||||
|
||||
rm -f ${kernel}.bin.$$
|
||||
exit
|
@ -1,24 +0,0 @@
|
||||
# $NetBSD: INSTALL,v 1.4 2002/10/15 21:54:24 jdolecek Exp $
|
||||
|
||||
include "arch/walnut/conf/WALNUT"
|
||||
|
||||
#ident "INSTALL-$Revision: 1.4 $"
|
||||
|
||||
# DEBUG options turned on:
|
||||
|
||||
#options LOCKDEBUG
|
||||
options DIAGNOSTIC
|
||||
#makeoptions DEBUG="-g"
|
||||
options DEBUG
|
||||
#options SYSCALL_DEBUG
|
||||
options PIPE_SOCKETPAIR # smaller, but slower pipe(2)
|
||||
options MALLOC_NOINLINE # Not inlining MALLOC saves memory
|
||||
options VNODE_OP_NOINLINE # Not inlining vnode op calls saves mem
|
||||
|
||||
# Enable the hooks used for initializing the root memory-disk.
|
||||
options MEMORY_DISK_HOOKS
|
||||
options MEMORY_DISK_IS_ROOT # force root on memory disk
|
||||
options MEMORY_DISK_SERVER=0 # no userspace memory disk support
|
||||
## The ramdisk size must be kept in sync manually with the size of
|
||||
## the `ramdisk' image (which is built in distrib/walnut/ramdisk/ramdisk).
|
||||
options MEMORY_DISK_ROOT_SIZE=16384 # size of memory disk, in blocks
|
@ -1,14 +0,0 @@
|
||||
# $NetBSD: Makefile.walnut.inc,v 1.6 2002/11/25 02:56:20 thorpej Exp $
|
||||
|
||||
MKIMG?= ${THISPPC}/compile/mkimg.sh
|
||||
CFLAGS+=-mcpu=403
|
||||
AFLAGS+=-mcpu=403
|
||||
TEXTADDR?= 25000
|
||||
.ifdef DBSYM
|
||||
SYSTEM_LD_TAIL_EXTRA+=; echo ${DBSYM} $@; ${DBSYM} $@
|
||||
.endif
|
||||
|
||||
SYSTEM_LD_TAIL_EXTRA+=; \
|
||||
echo ${MKIMG} netbsd netbsd.img ; \
|
||||
OBJDUMP=${OBJDUMP}; OBJCOPY=${OBJCOPY}; export OBJDUMP OBJCOPY; \
|
||||
${MKIMG} $@ $@.img
|
@ -1,257 +0,0 @@
|
||||
# $NetBSD: WALNUT,v 1.27 2002/10/14 18:39:41 elric Exp $
|
||||
#
|
||||
# GENERIC -- everything that's currently supported
|
||||
#
|
||||
|
||||
include "arch/walnut/conf/std.walnut"
|
||||
|
||||
#options INCLUDE_CONFIG_FILE # embed config file in kernel binary
|
||||
|
||||
#ident "WALNUT"
|
||||
|
||||
maxusers 32
|
||||
|
||||
#options UVMHIST
|
||||
#options UVMHIST_PRINT
|
||||
|
||||
# Options for necessary to use MD
|
||||
#options MEMORY_DISK_HOOKS
|
||||
#options MEMORY_DISK_IS_ROOT # force root on memory disk
|
||||
#options MEMORY_DISK_SERVER=0 # no userspace memory disk support
|
||||
#options MEMORY_DISK_ROOT_SIZE=16384 # size of memory disk, in blocks
|
||||
|
||||
|
||||
#options UCONSOLE # users can use TIOCCONS (for xconsole)
|
||||
#options INSECURE # disable kernel security levels
|
||||
#options NTP # NTP phase/frequency locked loop
|
||||
options KTRACE # system call tracing via ktrace(1)
|
||||
|
||||
options SYSVMSG # System V message queues
|
||||
options SYSVSEM # System V semaphores
|
||||
options SYSVSHM # System V shared memory
|
||||
#options SHMMAXPGS=1024 # 1024 pages is the default
|
||||
|
||||
#options LKM # loadable kernel modules
|
||||
|
||||
options USERCONF # userconf(4) support
|
||||
#options PIPE_SOCKETPAIR # smaller, but slower pipe(2)
|
||||
|
||||
# Diagnostic/debugging support options
|
||||
#options DIAGNOSTIC # cheap kernel consistency checks
|
||||
#options DEBUG # expensive debugging checks/support
|
||||
options DDB # in-kernel debugger
|
||||
options DDB_HISTORY_SIZE=512 # enable history editing in DDB
|
||||
options TRAP_PANICWAIT
|
||||
options SYMTAB_SPACE=300000 # size for embedded symbol table
|
||||
|
||||
makeoptions DEBUG="-g" # compile full symbol table
|
||||
|
||||
# Compatibility options
|
||||
#options COMPAT_09 # NetBSD 0.9,
|
||||
#options COMPAT_10 # NetBSD 1.0,
|
||||
#options COMPAT_11 # NetBSD 1.1,
|
||||
#options COMPAT_12 # NetBSD 1.2,
|
||||
options COMPAT_13 # NetBSD 1.3,
|
||||
options COMPAT_14 # NetBSD 1.4,
|
||||
options COMPAT_43 # and 4.3BSD
|
||||
#options COMPAT_386BSD_MBRPART # recognize old partition ID
|
||||
#options TCP_COMPAT_42 # 4.2BSD TCP/IP bug compat. Not recommended.
|
||||
|
||||
# File systems
|
||||
file-system FFS # UFS
|
||||
file-system EXT2FS # second extended file system (linux)
|
||||
file-system LFS # log-structured file system
|
||||
file-system MFS # memory file system
|
||||
file-system NFS # Network File System client
|
||||
file-system CD9660 # ISO 9660 + Rock Ridge file system
|
||||
file-system MSDOSFS # MS-DOS file system
|
||||
file-system FDESC # /dev/fd
|
||||
file-system KERNFS # /kern
|
||||
file-system NULLFS # loopback file system
|
||||
file-system OVERLAY # overlay file system
|
||||
file-system PORTAL # portal filesystem (still experimental)
|
||||
file-system PROCFS # /proc
|
||||
file-system UMAPFS # NULLFS + uid and gid remapping
|
||||
file-system UNION # union file system
|
||||
|
||||
# File system options
|
||||
options QUOTA # UFS quotas
|
||||
#options FFS_EI # FFS Endian Independant support
|
||||
options SOFTDEP # FFS soft updates support.
|
||||
options NFSSERVER # Network File System server
|
||||
options EXT2FS_SYSTEM_FLAGS # makes ext2fs file flags (append and
|
||||
# immutable) behave as system flags.
|
||||
|
||||
options NFS_BOOT_DHCP # Support DHCP NFS root
|
||||
|
||||
# Networking options
|
||||
#options GATEWAY # packet forwarding
|
||||
options INET # IP + ICMP + TCP + UDP
|
||||
options INET6 # IPV6
|
||||
#options IPSEC # IP security
|
||||
#options IPSEC_ESP # IP security (encryption part; define w/IPSEC)
|
||||
#options IPSEC_DEBUG # debug for IP security
|
||||
#options MROUTING # IP multicast routing
|
||||
#options DIRECTED_BROADCAST # allow broadcasts through routers
|
||||
#options NS # XNS
|
||||
#options NSIP # XNS tunneling over IP
|
||||
options ISO,TPIP # OSI
|
||||
#options EON # OSI tunneling over IP
|
||||
#options CCITT,LLC,HDLC # X.25
|
||||
#options NETATALK # AppleTalk networking protocols
|
||||
options PPP_BSDCOMP # BSD-Compress compression support for PPP
|
||||
options PPP_DEFLATE # Deflate compression support for PPP
|
||||
options PPP_FILTER # Active filter support for PPP (requires bpf)
|
||||
options PFIL_HOOKS # pfil(9) packet filter hooks
|
||||
options IPFILTER_LOG # ipmon(8) log support
|
||||
#options TCP_DEBUG # Record last TCP_NDEBUG packets with SO_DEBUG
|
||||
options NMBCLUSTERS=1024
|
||||
|
||||
# These options enable verbose messages for several subsystems.
|
||||
# Warning, these may compile large string tables into the kernel!
|
||||
options PCIVERBOSE # verbose PCI device autoconfig messages
|
||||
options MIIVERBOSE # verbose PHY autoconfig messages
|
||||
#options PCI_CONFIG_DUMP # verbosely dump PCI config space
|
||||
options SCSIVERBOSE # human readable SCSI error messages
|
||||
options PCI_NETBSD_CONFIGURE # Do not rely on BIOS/whatever to configure PCI devices
|
||||
#options PCI_CONFIGURE_VERBOSE # Show PCI config information
|
||||
|
||||
# wscons options
|
||||
#options WSEMUL_SUN # sun terminal emulation
|
||||
#options WSEMUL_VT100 # VT100 / VT220 emulation
|
||||
|
||||
# Kernel root file system and dump configuration.
|
||||
config netbsd root on ? type ?
|
||||
|
||||
#
|
||||
# Device configuration
|
||||
#
|
||||
|
||||
plb0 at root # Processor Local Bus
|
||||
|
||||
cpu0 at plb?
|
||||
|
||||
ecc0 at plb? irq 16 # On-chip ECC controller
|
||||
|
||||
opb* at plb? # On-chip Peripheral Bus
|
||||
|
||||
wdog* at opb? # Watchdog timer
|
||||
|
||||
com* at opb? addr ? irq ? # UARTs
|
||||
|
||||
emac0 at opb? addr ? irq ? # Ethernet Media Access Controller
|
||||
options EMAC_EVENT_COUNTERS
|
||||
|
||||
pchb0 at plb? # PCI-Host bridges
|
||||
|
||||
pci* at pchb?
|
||||
ppb* at pci? dev ? function ? # PCI-PCI bridges
|
||||
|
||||
fpa* at pci? dev ? function ? # DEC PCI FDDI (DEFPA) Controller
|
||||
ep* at pci? dev ? function ? # 3Com 3c59x
|
||||
epic* at pci? dev ? function ? # SMC EPIC/100 Ethernet
|
||||
ex* at pci? dev ? function ? # 3Com 90x[B]
|
||||
fxp* at pci? dev ? function ? # Intel EtherExpress PRO 10+/100B
|
||||
ne* at pci? dev ? function ? # NE2000-compatible Ethernet
|
||||
rtk* at pci? dev ? function ? # Realtek 8129/8139
|
||||
sip* at pci? dev ? function ? # SiS 900/7016 Ethernet
|
||||
tlp* at pci? dev ? function ? # DECchip 21x4x and clones
|
||||
adv* at pci? dev ? function ? # AdvanSys 1200[A,B], 9xx[U,UA] SCSI
|
||||
adw* at pci? dev ? function ? # AdvanSys 9x0UW[D], 3940U[2,3]W SCSI
|
||||
ahc* at pci? dev ? function ? # Adaptec 294x, aic78x0 SCSI
|
||||
bha* at pci? dev ? function ? # BusLogic 9xx SCSI
|
||||
isp* at pci? dev ? function ? # Qlogic ISP 10x0/2xx0 SCSI/Fibre Chan
|
||||
siop* at pci? dev ? function ? # NCR 53c8xx SCSI
|
||||
pcscp* at pci? dev ? function ? # AMD Am53c974 PCscsi-PCI SCSI
|
||||
pciide* at pci? dev ? function ?
|
||||
#cbb* at pci? dev ? function ? # PCI-CardBus bridge
|
||||
|
||||
exphy* at mii? phy ? # 3Com internal PHYs
|
||||
icsphy* at mii? phy ? # Integrated Circuit Systems ICS189x
|
||||
inphy* at mii? phy ? # Intel 82555 PHYs
|
||||
iophy* at mii? phy ? # Intel 82553 PHYs
|
||||
lxtphy* at mii? phy ? # Level One LXT-970 PHYs
|
||||
nsphy* at mii? phy ? # NS83840 PHYs
|
||||
nsphyter* at mii? phy ? # NS83843 PHYs
|
||||
qsphy* at mii? phy ? # Quality Semiconductor QS6612 PHYs
|
||||
sqphy* at mii? phy ? # Seeq 80220/80221/80223 PHYs
|
||||
tlphy* at mii? phy ? # ThunderLAN PHYs
|
||||
tqphy* at mii? phy ? # TDK Semiconductor PHYs
|
||||
ukphy* at mii? phy ? # generic unknown PHYs
|
||||
|
||||
# PCI serial interfaces
|
||||
#cy* at pci? dev ? function ? # Cyclades Cyclom-Y serial boards
|
||||
#cz* at pci? dev ? function ? # Cyclades-Z multi-port serial boards
|
||||
|
||||
#cardslot* at cbb?
|
||||
#cardbus* at cardslot?
|
||||
#pcmcia* at cardslot?
|
||||
|
||||
#com* at pcmcia? function ? # Modems and serial cards
|
||||
#wdc* at pcmcia? function ? # PCMCIA IDE controllers
|
||||
#ep* at pcmcia? function ? # 3Com 3c589 and 3c562 Ethernet
|
||||
#mbe* at pcmcia? function ? # MB8696x based Ethernet
|
||||
#ne* at pcmcia? function ? # NE2000-compatible Ethernet
|
||||
#ex* at cardbus? dev ? function ? # 3Com 3C575TX
|
||||
#tlp* at cardbus? dev ? function ? # DECchip 21143
|
||||
#rtk* at cardbus? dev ? function ? # Realtek 8129/8139
|
||||
|
||||
scsibus* at adv?
|
||||
scsibus* at adw?
|
||||
scsibus* at ahc?
|
||||
scsibus* at bha?
|
||||
scsibus* at isp?
|
||||
scsibus* at pcscp?
|
||||
scsibus* at siop?
|
||||
|
||||
sd* at scsibus? target ? lun ? # SCSI disks
|
||||
st* at scsibus? target ? lun ? # SCSI tape drives
|
||||
cd* at scsibus? target ? lun ? # SCSI CD-ROM drives
|
||||
ch* at scsibus? target ? lun ? # SCSI autochangers
|
||||
ss* at scsibus? target ? lun ? # SCSI scanners
|
||||
uk* at scsibus? target ? lun ? # SCSI unknown
|
||||
|
||||
wd* at pciide? channel ? drive ?
|
||||
|
||||
atapibus* at pciide? channel ?
|
||||
|
||||
cd* at atapibus? drive ? flags 0x0000 # ATAPI CD-ROM drives
|
||||
sd* at atapibus? drive ? flags 0x0000 # ATAPI disk drives
|
||||
uk* at atapibus? drive ? flags 0x0000 # ATAPI unknown
|
||||
|
||||
pbus* at plb? # off-chip Peripheral BUS
|
||||
|
||||
dsrtc0 at pbus? addr ? # RTC
|
||||
todclock0 at dsrtc? # time-of-day device via rtc device
|
||||
|
||||
#pckbc0 at pbus?
|
||||
#pckbd* at pckbc?
|
||||
#wskbd* at pckbd? console ?
|
||||
#pms* at pckbc?
|
||||
#wsmouse* at pms? mux 0
|
||||
|
||||
#vga* at pci? dev ? function ?
|
||||
#wsdisplay* at vga? console ?
|
||||
|
||||
pseudo-device vnd 4 # disk-like interface to files
|
||||
pseudo-device ccd 4 # concatenated/striped disk devices
|
||||
#pseudo-device cgd 4 # cryptographic disk devices
|
||||
pseudo-device raid 4 # RAIDframe disk driver
|
||||
options RAID_AUTOCONFIG # auto-configuration of RAID components
|
||||
pseudo-device md 1 # memory disk device
|
||||
pseudo-device loop # network loopback
|
||||
pseudo-device bpfilter 8 # packet filter
|
||||
pseudo-device ipfilter # IP filter (firewall) and NAT
|
||||
pseudo-device ppp 2 # Point-to-Point Protocol
|
||||
pseudo-device sl 2 # Serial Line IP
|
||||
pseudo-device tun 4 # network tunneling over tty
|
||||
#pseudo-device gre 2 # generic L3 over IP tunnel
|
||||
pseudo-device gif 4 # IPv[46] over IPv[46] tunnel (RFC1933)
|
||||
#pseudo-device faith 1 # IPv[46] tcp relay translation i/f
|
||||
#pseudo-device stf 1 # 6to4 IPv6 over IPv4 encapsulation
|
||||
pseudo-device vlan # IEEE 802.1q encapsulation
|
||||
pseudo-device pty # pseudo-terminals
|
||||
pseudo-device rnd # /dev/random and in-kernel generator
|
||||
#pseudo-device wsmux # ick
|
||||
pseudo-device clockctl # user control of clock subsystem
|
||||
pseudo-device kttcp # kernel ttcp
|
@ -1,81 +0,0 @@
|
||||
# $NetBSD: files.walnut,v 1.11 2002/10/26 13:50:49 jdolecek Exp $
|
||||
#
|
||||
# walnut-specific configuration info
|
||||
|
||||
# maxpartitions must be first item in files.${ARCH}.newconf
|
||||
maxpartitions 16
|
||||
|
||||
maxusers 2 8 64
|
||||
|
||||
include "arch/powerpc/conf/files.ibm4xx"
|
||||
|
||||
file arch/walnut/walnut/autoconf.c
|
||||
file arch/walnut/walnut/bus_dma.c
|
||||
file arch/walnut/walnut/consinit.c
|
||||
file arch/walnut/walnut/disksubr.c disk
|
||||
file arch/walnut/walnut/machdep.c
|
||||
file arch/walnut/dev/ibm405gp.c
|
||||
file arch/walnut/walnut/procfs_machdep.c procfs
|
||||
file dev/cons.c
|
||||
|
||||
# Memory Disk for install kernel
|
||||
file dev/md_root.c memory_disk_hooks
|
||||
|
||||
# Machine-independent I2O drivers.
|
||||
include "dev/i2o/files.i2o"
|
||||
|
||||
# Machine-independent SCSI drivers
|
||||
include "dev/scsipi/files.scsipi"
|
||||
|
||||
# Machine-independent ATA drivers
|
||||
include "dev/ata/files.ata"
|
||||
|
||||
# Workstation Console
|
||||
include "dev/wscons/files.wscons"
|
||||
|
||||
# Raster operations
|
||||
include "dev/rasops/files.rasops"
|
||||
include "dev/wsfont/files.wsfont"
|
||||
|
||||
# PCI bus support
|
||||
include "dev/pci/files.pci"
|
||||
|
||||
# On-chip PCI bridge
|
||||
device pchb : pcibus
|
||||
attach pchb at plb
|
||||
file arch/walnut/pci/pchb.c pchb
|
||||
|
||||
file arch/walnut/pci/pci_machdep.c pci
|
||||
|
||||
# Off-chip peripheral bus
|
||||
device pbus {[addr=-1], [irq=-1]}
|
||||
attach pbus at plb
|
||||
file arch/walnut/dev/pbus.c pbus
|
||||
|
||||
define todservice {}
|
||||
|
||||
device todclock
|
||||
attach todclock at todservice
|
||||
file arch/walnut/dev/todclock.c todclock needs-count
|
||||
|
||||
device dsrtc: todservice
|
||||
attach dsrtc at pbus
|
||||
file arch/walnut/dev/ds1743.c dsrtc
|
||||
|
||||
include "dev/pckbc/files.pckbc"
|
||||
attach pckbc at pbus with pckbc_pbus
|
||||
file arch/walnut/dev/pckbc_pbus.c pckbc_pbus
|
||||
|
||||
#
|
||||
# Machine-independent CardBus drivers
|
||||
#
|
||||
|
||||
# XXX dev/pcmcia needs fdc
|
||||
device fdc {drive = -1}
|
||||
|
||||
include "dev/cardbus/files.cardbus"
|
||||
include "dev/pcmcia/files.pcmcia"
|
||||
|
||||
file arch/macppc/macppc/rbus_machdep.c cardbus
|
||||
|
||||
include "arch/walnut/conf/majors.walnut"
|
@ -1,56 +0,0 @@
|
||||
# $NetBSD: majors.walnut,v 1.3 2002/10/04 18:28:36 elric Exp $
|
||||
#
|
||||
# Device majors for walnut
|
||||
#
|
||||
|
||||
device-major cons char 0
|
||||
device-major ctty char 1
|
||||
device-major mem char 2
|
||||
device-major pts char 3 pty
|
||||
device-major ptc char 4 pty
|
||||
device-major log char 5
|
||||
device-major swap char 6 block 1
|
||||
|
||||
device-major bpf char 10 bpfilter
|
||||
device-major tun char 11 tun
|
||||
|
||||
device-major sd char 13 block 4 sd
|
||||
device-major st char 14 block 5 st
|
||||
device-major cd char 15 block 6 cd
|
||||
device-major ch char 16 ch
|
||||
device-major ss char 17 ss
|
||||
device-major uk char 18 uk
|
||||
|
||||
device-major ipl char 21 ipfilter
|
||||
|
||||
device-major rnd char 24 rnd
|
||||
device-major vnd char 25 block 2 vnd
|
||||
device-major ccd char 26 block 3 ccd
|
||||
device-major md char 27 block 9 md
|
||||
|
||||
device-major wd char 30 block 10 wd
|
||||
device-major lkm char 31 lkm
|
||||
device-major filedesc char 32
|
||||
|
||||
device-major scsibus char 34 scsibus
|
||||
|
||||
device-major raid char 38 block 12 raid
|
||||
|
||||
device-major com char 45 com
|
||||
device-major cz char 46 cz
|
||||
device-major cy char 47 cy
|
||||
device-major audio char 48 audio
|
||||
device-major midi char 49 midi
|
||||
device-major sequencer char 50 sequencer
|
||||
|
||||
device-major isdn char 54 isdn
|
||||
device-major isdnctl char 55 isdnctl
|
||||
device-major isdnbchan char 56 isdnbchan
|
||||
device-major isdntrc char 57 isdntrc
|
||||
device-major isdntel char 58 isdntel
|
||||
device-major clockctl char 59 clockctl
|
||||
device-major systrace char 60 systrace
|
||||
device-major kttcp char 61 kttcp
|
||||
device-major sysmon char 62 sysmon
|
||||
device-major pci char 63 pci
|
||||
device-major cgd char 64 block 13 cgd
|
@ -1,15 +0,0 @@
|
||||
# $NetBSD: std.walnut,v 1.2 2001/08/26 11:00:07 simonb Exp $
|
||||
#
|
||||
# Standard/required options for NetBSD/walnut.
|
||||
|
||||
machine walnut powerpc
|
||||
|
||||
# standard ("mandatory") kernel options.
|
||||
options PPC_IBM4XX # IBM 40x family
|
||||
|
||||
# Executable support:
|
||||
options EXEC_ELF32 # (native) ELF32 binary support
|
||||
options EXEC_AOUT # (native) a.out binary support (deprecated)
|
||||
options EXEC_SCRIPT # shell script support
|
||||
|
||||
makeoptions TEXTADDR=0x25000
|
@ -1,269 +0,0 @@
|
||||
/* $NetBSD: ds1743.c,v 1.7 2002/10/02 16:02:38 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001-2002 Wasabi Sysetms, Inc.
|
||||
* Copyright (c) 1998 Mark Brinicombe.
|
||||
* Copyright (c) 1998 Causality Limited.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Written by Mark Brinicombe, Causality Limited
|
||||
*
|
||||
* 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 Mark Brinicombe
|
||||
* for the NetBSD Project.
|
||||
* 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 CAUASLITY LIMITED ``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 CAUSALITY LIMITED 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/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/device.h>
|
||||
|
||||
#include <machine/rtc.h>
|
||||
#include <machine/bus.h>
|
||||
|
||||
#include <walnut/dev/ds1743reg.h>
|
||||
#include <walnut/dev/todclockvar.h>
|
||||
#include <walnut/dev/pbusvar.h>
|
||||
|
||||
struct dsrtc_softc {
|
||||
struct device sc_dev;
|
||||
bus_space_tag_t sc_iot;
|
||||
bus_space_handle_t sc_ioh;
|
||||
};
|
||||
|
||||
static void dsrtcattach(struct device *, struct device *, void *);
|
||||
static int dsrtcmatch(struct device *, struct cfdata *, void *);
|
||||
#if 0 /* Nothing uses these yet */
|
||||
static int ds1743_ram_read(struct dsrtc_softc *, int);
|
||||
static void ds1743_ram_write(struct dsrtc_softc *, int, int);
|
||||
#endif
|
||||
|
||||
static int dsrtc_read(void *, rtc_t *);
|
||||
static int dsrtc_write(void *, rtc_t *);
|
||||
static inline u_char ds1743_read(struct dsrtc_softc *, int);
|
||||
static inline void ds1743_write(struct dsrtc_softc *, int, u_char);
|
||||
static u_char ds1743_lock(struct dsrtc_softc *, u_char);
|
||||
static void ds1743_unlock(struct dsrtc_softc *, u_char);
|
||||
|
||||
/* device and attach structures */
|
||||
CFATTACH_DECL(dsrtc, sizeof(struct dsrtc_softc),
|
||||
dsrtcmatch, dsrtcattach, NULL, NULL);
|
||||
|
||||
/*
|
||||
* dsrtcmatch()
|
||||
*
|
||||
* Validate the IIC address to make sure its an RTC we understand
|
||||
*/
|
||||
int ds1743found = 0;
|
||||
|
||||
#define DS_SCRATCH_ADDR 0x1FF7
|
||||
|
||||
static int
|
||||
dsrtcmatch(struct device *parent, struct cfdata *cf, void *aux)
|
||||
{
|
||||
struct pbus_attach_args *paa = aux;
|
||||
int retval = !ds1743found;
|
||||
bus_space_handle_t h;
|
||||
u_int8_t x;
|
||||
|
||||
/* match only RTC devices */
|
||||
if (strcmp(paa->pb_name, cf->cf_name) != 0)
|
||||
return 0;
|
||||
|
||||
if (bus_space_map(0, paa->pb_addr, DS_SIZE, 0, &h)) {
|
||||
printf("%s: can't map i/o space\n", paa->pb_name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Read one byte of what's supposed to be NVRAM */
|
||||
x = bus_space_read_1(0, h, DS_SCRATCH_ADDR);
|
||||
bus_space_write_1(0, h, DS_SCRATCH_ADDR, 0xAA);
|
||||
if (bus_space_read_1(0, h, DS_SCRATCH_ADDR) != 0xAA) {
|
||||
retval = 0;
|
||||
goto done;
|
||||
}
|
||||
|
||||
bus_space_write_1(0, h, DS_SCRATCH_ADDR, 0x55);
|
||||
if (bus_space_read_1(0, h, DS_SCRATCH_ADDR) != 0x55) {
|
||||
retval = 0;
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Restore scratch byte value */
|
||||
bus_space_write_1(0, h, DS_SCRATCH_ADDR, x);
|
||||
done:
|
||||
bus_space_unmap(0, h, DS_SIZE);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
/*
|
||||
* dsrtcattach()
|
||||
*
|
||||
* Attach the rtc device
|
||||
*/
|
||||
|
||||
static void
|
||||
dsrtcattach(struct device *parent, struct device *self, void *aux)
|
||||
{
|
||||
struct dsrtc_softc *sc = (struct dsrtc_softc *)self;
|
||||
struct pbus_attach_args *paa = aux;
|
||||
struct todclock_attach_args ta;
|
||||
|
||||
ds1743found = 1;
|
||||
|
||||
sc->sc_iot = 0;
|
||||
sc->sc_ioh = paa->pb_addr;
|
||||
if (bus_space_map(sc->sc_iot, paa->pb_addr, DS_SIZE, 0, &sc->sc_ioh)) {
|
||||
printf(": can't map i/o space\n");
|
||||
return;
|
||||
}
|
||||
|
||||
ds1743_unlock(sc,0); /* Make sure the clock is running */
|
||||
if ((ds1743_read(sc, DS_DAY) & DS_CTL_BF) == 0)
|
||||
printf(": lithium cell is dead, RTC unreliable");
|
||||
printf("\n");
|
||||
|
||||
#ifdef DEBUG
|
||||
{
|
||||
rtc_t rtc;
|
||||
dsrtc_read(sc,&rtc);
|
||||
printf("RTC: %d/%d/%02d%02d %d:%02d:%02d\n",
|
||||
rtc.rtc_mon, rtc.rtc_day, rtc.rtc_cen, rtc.rtc_year,
|
||||
rtc.rtc_hour, rtc.rtc_min, rtc.rtc_sec);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
ta.ta_name = "todclock";
|
||||
ta.ta_rtc_arg = sc;
|
||||
ta.ta_rtc_write = dsrtc_write;
|
||||
ta.ta_rtc_read = dsrtc_read;
|
||||
ta.ta_flags = 0;
|
||||
config_found(self, &ta, NULL);
|
||||
}
|
||||
|
||||
static inline u_char
|
||||
ds1743_read(struct dsrtc_softc *sc, int addr)
|
||||
{
|
||||
|
||||
return(bus_space_read_1(sc->sc_iot, sc->sc_ioh, addr));
|
||||
}
|
||||
|
||||
static inline void
|
||||
ds1743_write(struct dsrtc_softc *sc, int addr, u_char data)
|
||||
{
|
||||
|
||||
bus_space_write_1(sc->sc_iot, sc->sc_ioh, addr, data);
|
||||
}
|
||||
|
||||
|
||||
#if 0 /* Nothing uses these yet */
|
||||
static u_char
|
||||
ds1743_ram_read(struct dsrtc_softc *sc, int addr)
|
||||
{
|
||||
|
||||
if (addr >= DS_RAM_SIZE)
|
||||
return(-1);
|
||||
return(ds1743_read(sc, addr));
|
||||
}
|
||||
|
||||
static void
|
||||
ds1743_ram_write(struct dsrtc_softc *sc, int addr, u_char val)
|
||||
{
|
||||
|
||||
if (addr >= DS_RAM_SIZE)
|
||||
return (-1);
|
||||
ds1743_write(sc,addr,val);
|
||||
}
|
||||
#endif
|
||||
|
||||
#define BCD(x) ((((x)/10)<<4)|(x%10))
|
||||
#define unBCD(v,x) v=x; v = ((v>>4) & 0xf)*10+(v & 0xf)
|
||||
|
||||
static u_char
|
||||
ds1743_lock(struct dsrtc_softc *sc, u_char mode)
|
||||
{
|
||||
u_char octl,ctl;
|
||||
|
||||
octl = ds1743_read(sc,DS_CENTURY);
|
||||
ctl = octl | (mode & DS_CTL_RW);
|
||||
ds1743_write(sc,DS_CENTURY, ctl); /* Lock RTC for both reading and writing */
|
||||
return octl;
|
||||
}
|
||||
|
||||
static void
|
||||
ds1743_unlock(struct dsrtc_softc *sc, u_char key)
|
||||
{
|
||||
int ctl;
|
||||
|
||||
ctl = ds1743_read(sc,DS_CENTURY);
|
||||
ctl = (ctl & 0x3f) | (key & DS_CTL_RW);
|
||||
ds1743_write(sc,DS_CENTURY, ctl); /* Enable updates */
|
||||
}
|
||||
|
||||
static int
|
||||
dsrtc_write(void * arg, rtc_t * rtc)
|
||||
{
|
||||
struct dsrtc_softc *sc = arg;
|
||||
u_char key;
|
||||
|
||||
key = ds1743_lock(sc,DS_CTL_W);
|
||||
|
||||
ds1743_write(sc, DS_SECONDS, BCD(rtc->rtc_sec) & 0x7f);
|
||||
ds1743_write(sc, DS_MINUTES, BCD(rtc->rtc_min) & 0x7f);
|
||||
ds1743_write(sc, DS_HOURS, BCD(rtc->rtc_hour) & 0x3f);
|
||||
ds1743_write(sc, DS_DATE, BCD(rtc->rtc_day) & 0x3f);
|
||||
ds1743_write(sc, DS_MONTH, BCD(rtc->rtc_mon) & 0x1f);
|
||||
ds1743_write(sc, DS_YEAR, BCD(rtc->rtc_year));
|
||||
ds1743_write(sc, DS_CENTURY, ((ds1743_read(sc,DS_CENTURY) & DS_CTL_RW)
|
||||
| BCD(rtc->rtc_cen)));
|
||||
|
||||
ds1743_unlock(sc,key);
|
||||
dsrtc_read(arg,rtc);
|
||||
return(1);
|
||||
}
|
||||
|
||||
static int
|
||||
dsrtc_read(void *arg, rtc_t *rtc)
|
||||
{
|
||||
struct dsrtc_softc *sc = arg;
|
||||
u_char key;
|
||||
|
||||
key = ds1743_lock(sc,DS_CTL_R);
|
||||
rtc->rtc_micro = 0;
|
||||
rtc->rtc_centi = 0;
|
||||
unBCD(rtc->rtc_sec,ds1743_read(sc, DS_SECONDS) & 0x7f);
|
||||
unBCD(rtc->rtc_min,ds1743_read(sc, DS_MINUTES) & 0x7f);
|
||||
unBCD(rtc->rtc_hour, ds1743_read(sc, DS_HOURS) & 0x3f);
|
||||
unBCD(rtc->rtc_day, ds1743_read(sc, DS_DATE) & 0x3f);
|
||||
unBCD(rtc->rtc_mon,ds1743_read(sc, DS_MONTH) & 0x1f);
|
||||
unBCD(rtc->rtc_year, ds1743_read(sc, DS_YEAR));
|
||||
unBCD(rtc->rtc_cen, ds1743_read(sc, DS_CENTURY) & ~DS_CTL_RW);
|
||||
|
||||
ds1743_unlock(sc,key);
|
||||
return(1);
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
/* $NetBSD: ds1743reg.h,v 1.2 2002/03/13 19:17:41 eeh Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 2001-2002 Wasabi Systems, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Written by Simon Burge and Eduardo Horvath for Wasabi Systems, Inc.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed for the NetBSD Project by
|
||||
* Wasabi Systems, Inc.
|
||||
* 4. The name of Wasabi Systems, Inc. may not be used to endorse
|
||||
* or promote products derived from this software without specific prior
|
||||
* written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef __DS1501_H__
|
||||
#define __DS1501_H__
|
||||
|
||||
/* Dallas Semiconductor DS1501/DS1511 Watchdog RTC */
|
||||
|
||||
#define DS_SECONDS 0x1ff9
|
||||
#define DS_MINUTES 0x1ffa
|
||||
#define DS_HOURS 0x1ffb
|
||||
#define DS_DAY 0x1ffc
|
||||
#define DS_DATE 0x1ffd
|
||||
#define DS_MONTH 0x1ffe
|
||||
#define DS_YEAR 0x1fff
|
||||
#define DS_CENTURY 0x1ff8
|
||||
|
||||
|
||||
#define DS_CTL_R 0x40 /* R bit in the century register */
|
||||
#define DS_CTL_W 0x80 /* W bit in the century register */
|
||||
#define DS_CTL_RW (DS_CTL_R|DS_CTL_W)
|
||||
|
||||
#define DS_CTL_OSC 0x80 /* ~OSC BIT in the seconds register */
|
||||
|
||||
#define DS_CTL_BF 0x80 /* BF(battery failure) bit in the day register */
|
||||
#define DS_CTL_FT 0x40 /* FT(frequency test) bit in the day register */
|
||||
|
||||
#define DS_RAM_SIZE 0x1ff8
|
||||
|
||||
#define DS_SIZE 0x2000
|
||||
|
||||
#endif /* __DS1501_H__ */
|
@ -1,139 +0,0 @@
|
||||
/* $NetBSD: ibm405gp.c,v 1.7 2002/09/27 15:37:00 provos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 2001 Wasabi Systems, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Written by Eduardo Horvath and Simon Burge for Wasabi Systems, Inc.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed for the NetBSD Project by
|
||||
* Wasabi Systems, Inc.
|
||||
* 4. The name of Wasabi Systems, Inc. may not be used to endorse
|
||||
* or promote products derived from this software without specific prior
|
||||
* written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/systm.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
#include <dev/pci/pcivar.h>
|
||||
|
||||
#include <powerpc/ibm4xx/ibm405gp.h>
|
||||
#include <powerpc/ibm4xx/dev/pcicreg.h>
|
||||
|
||||
static bus_space_tag_t pcicfg_iot = ibm4xx_make_bus_space_tag(0, 0);
|
||||
static bus_space_handle_t pcicfg_ioh = 0;
|
||||
|
||||
#define PCI0_MEM_BASE 0x80000000
|
||||
|
||||
static void setup_pcicfg_window(void)
|
||||
{
|
||||
if (pcicfg_ioh)
|
||||
return;
|
||||
if (bus_space_map(pcicfg_iot, IBM405GP_PCIL0_BASE, 0x40 , 0, &pcicfg_ioh))
|
||||
panic("Cannot map PCI configuration registers");
|
||||
}
|
||||
|
||||
/*
|
||||
* Setup proper Local<->PCI mapping
|
||||
* PCI memory window: 256M @ PCI0MEMBASE with direct memory translation
|
||||
*/
|
||||
void ibm4xx_setup_pci(void)
|
||||
{
|
||||
pcitag_t tag;
|
||||
|
||||
setup_pcicfg_window();
|
||||
|
||||
/* Disable all three memory mappers */
|
||||
bus_space_write_4(pcicfg_iot, pcicfg_ioh, PCIL_PMM0MA, 0x00000000); /* disabled */
|
||||
bus_space_write_4(pcicfg_iot, pcicfg_ioh, PCIL_PMM1MA, 0x00000000); /* disabled */
|
||||
bus_space_write_4(pcicfg_iot, pcicfg_ioh, PCIL_PMM2MA, 0x00000000); /* disabled */
|
||||
bus_space_write_4(pcicfg_iot, pcicfg_ioh, PCIL_PTM1MS, 0x00000000); /* Can't really disable PTM1. */
|
||||
bus_space_write_4(pcicfg_iot, pcicfg_ioh, PCIL_PTM2MS, 0x00000000); /* disabled */
|
||||
|
||||
|
||||
/* Setup memory map #0 */
|
||||
bus_space_write_4(pcicfg_iot, pcicfg_ioh, PCIL_PMM0MA, 0xF0000001); /* 256M non-prefetchable, enabled */
|
||||
|
||||
bus_space_write_4(pcicfg_iot, pcicfg_ioh, PCIL_PMM0LA, PCI0_MEM_BASE);
|
||||
bus_space_write_4(pcicfg_iot, pcicfg_ioh, PCIL_PMM0PCILA, PCI0_MEM_BASE);
|
||||
bus_space_write_4(pcicfg_iot, pcicfg_ioh, PCIL_PMM0PCIHA, 0);
|
||||
|
||||
/* Configure PCI bridge */
|
||||
tag = pci_make_tag(0, 0, 0, 0);
|
||||
// x = pci_conf_read(0, tag, PCI0_CMD); /* Read PCI command register */
|
||||
// pci_conf_write(0, tag, PCI0_CMD, x | MA | ME); /* enable bus mastering and memory space */
|
||||
|
||||
bus_space_write_4(pcicfg_iot, pcicfg_ioh, PCIL_PTM1MS, 0xF0000001); /* Enable PTM1 */
|
||||
bus_space_write_4(pcicfg_iot, pcicfg_ioh, PCIL_PTM1LA, 0);
|
||||
pci_conf_write(0, tag, PCIC_PTM1BAR, 0); /* Set up proper PCI->Local address base. Always enabled */
|
||||
pci_conf_write(0, tag, PCIC_PTM2BAR, 0);
|
||||
}
|
||||
|
||||
void ibm4xx_show_pci_map(void)
|
||||
{
|
||||
paddr_t la, lm, pl, ph;
|
||||
pcitag_t tag;
|
||||
|
||||
setup_pcicfg_window();
|
||||
|
||||
printf("Local -> PCI map\n");
|
||||
la = bus_space_read_4(pcicfg_iot, pcicfg_ioh, PCIL_PMM0LA);
|
||||
lm = bus_space_read_4(pcicfg_iot, pcicfg_ioh, PCIL_PMM0MA);
|
||||
pl = bus_space_read_4(pcicfg_iot, pcicfg_ioh, PCIL_PMM0PCILA);
|
||||
ph = bus_space_read_4(pcicfg_iot, pcicfg_ioh, PCIL_PMM0PCIHA);
|
||||
printf("0: %08lx,%08lx -> %08lx%08lx %sprefetchable, %s\n", la, lm, ph, pl,
|
||||
(lm & 2) ? "":"not ",
|
||||
(lm & 1) ? "enabled":"disabled");
|
||||
la = bus_space_read_4(pcicfg_iot, pcicfg_ioh, PCIL_PMM1LA);
|
||||
lm = bus_space_read_4(pcicfg_iot, pcicfg_ioh, PCIL_PMM1MA);
|
||||
pl = bus_space_read_4(pcicfg_iot, pcicfg_ioh, PCIL_PMM1PCILA);
|
||||
ph = bus_space_read_4(pcicfg_iot, pcicfg_ioh, PCIL_PMM1PCIHA);
|
||||
printf("1: %08lx,%08lx -> %08lx%08lx %sprefetchable, %s\n", la, lm, ph, pl,
|
||||
(lm & 2) ? "":"not ",
|
||||
(lm & 1) ? "enabled":"disabled");
|
||||
la = bus_space_read_4(pcicfg_iot, pcicfg_ioh, PCIL_PMM2LA);
|
||||
lm = bus_space_read_4(pcicfg_iot, pcicfg_ioh, PCIL_PMM2MA);
|
||||
pl = bus_space_read_4(pcicfg_iot, pcicfg_ioh, PCIL_PMM2PCILA);
|
||||
ph = bus_space_read_4(pcicfg_iot, pcicfg_ioh, PCIL_PMM2PCIHA);
|
||||
printf("2: %08lx,%08lx -> %08lx%08lx %sprefetchable, %s\n", la, lm, ph, pl,
|
||||
(lm & 2) ? "":"not ",
|
||||
(lm & 1) ? "enabled":"disabled");
|
||||
printf("PCI -> Local map\n");
|
||||
|
||||
tag = pci_make_tag(0, 0, 0, 0);
|
||||
pl = pci_conf_read(0, tag, PCIC_PTM1BAR);
|
||||
la = bus_space_read_4(pcicfg_iot, pcicfg_ioh, PCIL_PTM1LA);
|
||||
lm = bus_space_read_4(pcicfg_iot, pcicfg_ioh, PCIL_PTM1MS);
|
||||
printf("1: %08lx -> %08lx,%08lx %s\n", pl, la, lm,
|
||||
(lm & 1)?"enabled":"disabled");
|
||||
pl = pci_conf_read(0, tag, PCIC_PTM2BAR);
|
||||
la = bus_space_read_4(pcicfg_iot, pcicfg_ioh, PCIL_PTM2LA);
|
||||
lm = bus_space_read_4(pcicfg_iot, pcicfg_ioh, PCIL_PTM2MS);
|
||||
printf("2: %08lx -> %08lx,%08lx %s\n", pl, la, lm,
|
||||
(lm & 1)?"enabled":"disabled");
|
||||
}
|
@ -1,204 +0,0 @@
|
||||
/* $NetBSD: pbus.c,v 1.8 2002/10/02 16:02:38 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 2001 Wasabi Systems, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Written by Eduardo Horvath and Simon Burge for Wasabi Systems, Inc.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed for the NetBSD Project by
|
||||
* Wasabi Systems, Inc.
|
||||
* 4. The name of Wasabi Systems, Inc. may not be used to endorse
|
||||
* or promote products derived from this software without specific prior
|
||||
* written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Christopher G. Demetriou
|
||||
* for the NetBSD Project.
|
||||
* 4. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "locators.h"
|
||||
#include "pckbc.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/device.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
#include <machine/walnut.h>
|
||||
|
||||
#include <arch/walnut/dev/pbusvar.h>
|
||||
|
||||
#include <powerpc/ibm4xx/ibm405gp.h>
|
||||
#include <powerpc/ibm4xx/dev/plbvar.h>
|
||||
|
||||
/*
|
||||
* The devices built in to the 405GP cpu.
|
||||
*/
|
||||
const struct pbus_dev {
|
||||
const char *name;
|
||||
bus_addr_t addr;
|
||||
int irq;
|
||||
} pbus_devs [] = {
|
||||
{ "dsrtc", NVRAM_BASE, -1 },
|
||||
{ "pckbc", KEY_MOUSE_BASE, 25 }, /* XXX: really irq x..x+1 */
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
static int pbus_match(struct device *, struct cfdata *, void *);
|
||||
static void pbus_attach(struct device *, struct device *, void *);
|
||||
static int pbus_submatch(struct device *, struct cfdata *, void *);
|
||||
static int pbus_print(void *, const char *);
|
||||
|
||||
CFATTACH_DECL(pbus, sizeof(struct device),
|
||||
pbus_match, pbus_attach, NULL, NULL);
|
||||
|
||||
/*
|
||||
* Probe for the peripheral bus.
|
||||
*/
|
||||
static int
|
||||
pbus_match(struct device *parent, struct cfdata *cf, void *aux)
|
||||
{
|
||||
struct pbus_attach_args *pba = aux;
|
||||
|
||||
/* match only pbus devices */
|
||||
if (strcmp(pba->pb_name, cf->cf_name) != 0)
|
||||
return (0);
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
static int
|
||||
pbus_submatch(struct device *parent, struct cfdata *cf, void *aux)
|
||||
{
|
||||
struct pbus_attach_args *pba = aux;
|
||||
|
||||
if (cf->cf_loc[PBUSCF_ADDR] != PBUSCF_ADDR_DEFAULT &&
|
||||
cf->cf_loc[PBUSCF_ADDR] != pba->pb_addr)
|
||||
return (0);
|
||||
|
||||
return (config_match(parent, cf, aux));
|
||||
}
|
||||
|
||||
/*
|
||||
* Attach the peripheral bus.
|
||||
*/
|
||||
static void
|
||||
pbus_attach(struct device *parent, struct device *self, void *aux)
|
||||
{
|
||||
struct plb_attach_args *paa = aux;
|
||||
struct pbus_attach_args pba;
|
||||
int i;
|
||||
#if NPCKBC > 0
|
||||
bus_space_handle_t ioh_fpga;
|
||||
bus_space_tag_t iot_fpga = paa->plb_bt;
|
||||
uint8_t fpga_reg;
|
||||
#endif
|
||||
|
||||
printf("\n");
|
||||
|
||||
for (i = 0; pbus_devs[i].name != NULL; i++) {
|
||||
pba.pb_name = pbus_devs[i].name;
|
||||
pba.pb_addr = pbus_devs[i].addr;
|
||||
pba.pb_irq = pbus_devs[i].irq;
|
||||
pba.pb_bt = paa->plb_bt;
|
||||
pba.pb_dmat = paa->plb_dmat;
|
||||
|
||||
(void) config_found_sm(self, &pba, pbus_print, pbus_submatch);
|
||||
}
|
||||
|
||||
#if NPCKBC > 0
|
||||
/* Configure FPGA */
|
||||
if (bus_space_map(iot_fpga, FPGA_BASE, FPGA_SIZE, 0, &ioh_fpga)) {
|
||||
printf("pbus_attach: can't map FPGA\n");
|
||||
/* XXX - disable keyboard probe? */
|
||||
} else {
|
||||
/* Use separate interrupts for keyboard and mouse */
|
||||
fpga_reg = bus_space_read_1(iot_fpga, ioh_fpga, FPGA_BRDC);
|
||||
fpga_reg |= FPGA_BRDC_INT;
|
||||
bus_space_write_1(iot_fpga, ioh_fpga, FPGA_BRDC, fpga_reg);
|
||||
|
||||
/* Set interrupts to active high */
|
||||
fpga_reg = bus_space_read_1(iot_fpga, ioh_fpga, FPGA_INT_POL);
|
||||
fpga_reg |= (FPGA_IRQ_KYBD | FPGA_IRQ_MOUSE);
|
||||
bus_space_write_1(iot_fpga, ioh_fpga, FPGA_INT_POL, fpga_reg);
|
||||
|
||||
/* Set interrupts to level triggered */
|
||||
fpga_reg = bus_space_read_1(iot_fpga, ioh_fpga, FPGA_INT_TRIG);
|
||||
fpga_reg |= (FPGA_IRQ_KYBD | FPGA_IRQ_MOUSE);
|
||||
bus_space_write_1(iot_fpga, ioh_fpga, FPGA_INT_TRIG, fpga_reg);
|
||||
|
||||
/* Enable interrupts */
|
||||
fpga_reg = bus_space_read_1(iot_fpga, ioh_fpga, FPGA_INT_ENABLE);
|
||||
fpga_reg |= (FPGA_IRQ_KYBD | FPGA_IRQ_MOUSE);
|
||||
bus_space_write_1(iot_fpga, ioh_fpga, FPGA_INT_ENABLE, fpga_reg);
|
||||
|
||||
bus_space_unmap(&iot_fpga, ioh_fpga, 2);
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
static int
|
||||
pbus_print(void *aux, const char *pnp)
|
||||
{
|
||||
struct pbus_attach_args *pba = aux;
|
||||
|
||||
if (pnp)
|
||||
printf("%s at %s", pba->pb_name, pnp);
|
||||
|
||||
if (pba->pb_addr != PBUSCF_ADDR_DEFAULT)
|
||||
printf(" addr 0x%08lx", pba->pb_addr);
|
||||
if (pba->pb_irq != PBUSCF_IRQ_DEFAULT)
|
||||
printf(" irq %d", pba->pb_irq);
|
||||
|
||||
return (UNCONF);
|
||||
}
|
@ -1,46 +0,0 @@
|
||||
/* $NetBSD: pbusvar.h,v 1.1 2002/08/12 02:06:22 simonb Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 2002 Wasabi Systems, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Written by Simon Burge for Wasabi Systems, Inc.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed for the NetBSD Project by
|
||||
* Wasabi Systems, Inc.
|
||||
* 4. The name of Wasabi Systems, Inc. may not be used to endorse
|
||||
* or promote products derived from this software without specific prior
|
||||
* written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <machine/bus.h>
|
||||
|
||||
struct pbus_attach_args {
|
||||
const char *pb_name;
|
||||
u_long pb_addr;
|
||||
int pb_irq;
|
||||
bus_space_tag_t pb_bt; /* Bus space tag */
|
||||
bus_dma_tag_t pb_dmat; /* DMA tag */
|
||||
};
|
@ -1,151 +0,0 @@
|
||||
/* $NetBSD: pckbc_pbus.c,v 1.7 2002/10/02 16:02:38 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 2001 Wasabi Systems, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Written by Simon Burge and Eduardo Horvath for Wasabi Systems, Inc.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed for the NetBSD Project by
|
||||
* Wasabi Systems, Inc.
|
||||
* 4. The name of Wasabi Systems, Inc. may not be used to endorse
|
||||
* or promote products derived from this software without specific prior
|
||||
* written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/malloc.h>
|
||||
|
||||
#include <machine/intr.h>
|
||||
#include <machine/walnut.h>
|
||||
|
||||
#include <arch/walnut/dev/pbusvar.h>
|
||||
#include <powerpc/ibm4xx/dev/plbvar.h>
|
||||
|
||||
#include <dev/ic/i8042reg.h>
|
||||
#include <dev/ic/pckbcvar.h>
|
||||
|
||||
struct pckbc_pbus_softc {
|
||||
struct pckbc_softc sc_pckbc;
|
||||
|
||||
// XXX void *sc_ih[PCKBC_NSLOTS];
|
||||
int sc_irq[PCKBC_NSLOTS];
|
||||
|
||||
};
|
||||
|
||||
|
||||
static int pckbc_pbus_probe(struct device *, struct cfdata *, void *);
|
||||
static void pckbc_pbus_attach(struct device *, struct device *, void *);
|
||||
static void pckbc_pbus_intr_establish(struct pckbc_softc *, pckbc_slot_t);
|
||||
|
||||
CFATTACH_DECL(pckbc_pbus, sizeof(struct pckbc_pbus_softc),
|
||||
pckbc_pbus_probe, pckbc_pbus_attach, NULL, NULL);
|
||||
|
||||
int pckbcfound = 0;
|
||||
|
||||
int
|
||||
pckbc_pbus_probe(struct device *parent, struct cfdata *cf, void *aux)
|
||||
{
|
||||
struct pbus_attach_args *paa = aux;
|
||||
|
||||
/* match only pckbc devices */
|
||||
if (strcmp(paa->pb_name, cf->cf_name) != 0)
|
||||
return 0;
|
||||
|
||||
return (pckbcfound < 1);
|
||||
}
|
||||
|
||||
struct pckbc_softc *pckbc0; /* XXX */
|
||||
|
||||
void
|
||||
pckbc_pbus_attach(struct device *parent, struct device *self, void *aux)
|
||||
{
|
||||
struct pckbc_pbus_softc *msc = (void *)self;
|
||||
struct pckbc_softc *sc = &msc->sc_pckbc;
|
||||
struct pbus_attach_args *paa = aux;
|
||||
struct pckbc_internal *t;
|
||||
bus_space_handle_t ioh_d, ioh_c;
|
||||
bus_space_tag_t iot = paa->pb_bt;
|
||||
u_long addr = paa->pb_addr;
|
||||
|
||||
/*
|
||||
* Set up IRQs
|
||||
*/
|
||||
msc->sc_irq[PCKBC_KBD_SLOT] = paa->pb_irq;
|
||||
msc->sc_irq[PCKBC_AUX_SLOT] = paa->pb_irq + 1; /* XXX */
|
||||
|
||||
sc->intr_establish = pckbc_pbus_intr_establish;
|
||||
|
||||
if (pckbc_is_console(iot, addr)) {
|
||||
t = &pckbc_consdata;
|
||||
pckbc_console_attached = 1;
|
||||
/* t->t_cmdbyte was initialized by cnattach */
|
||||
} else {
|
||||
if (bus_space_map(iot, addr + KEY_MOUSE_DATA, 1, 0, &ioh_d) ||
|
||||
bus_space_map(iot, addr + KEY_MOUSE_CMD, 1, 0, &ioh_c))
|
||||
panic("pckbc_attach: couldn't map");
|
||||
|
||||
t = malloc(sizeof(struct pckbc_internal), M_DEVBUF, M_WAITOK);
|
||||
memset(t, 0, sizeof(struct pckbc_internal));
|
||||
t->t_iot = iot;
|
||||
t->t_ioh_d = ioh_d;
|
||||
t->t_ioh_c = ioh_c;
|
||||
t->t_addr = addr;
|
||||
t->t_cmdbyte = KC8_CPU; /* Enable ports */
|
||||
}
|
||||
|
||||
t->t_sc = sc;
|
||||
sc->id = t;
|
||||
|
||||
printf("\n");
|
||||
|
||||
/* Finish off the attach. */
|
||||
pckbc_attach(sc);
|
||||
|
||||
pckbcfound++;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static void
|
||||
pckbc_pbus_intr_establish(struct pckbc_softc *sc, pckbc_slot_t slot)
|
||||
{
|
||||
struct pckbc_pbus_softc *msc = (void *)sc;
|
||||
int irq = msc->sc_irq[slot];
|
||||
|
||||
if (slot > PCKBC_NSLOTS) {
|
||||
printf("pckbc_pbus_intr_establish: attempt to establish "
|
||||
"interrupt at slot %d\n", slot);
|
||||
return;
|
||||
}
|
||||
|
||||
intr_establish(irq, IST_LEVEL, IPL_SERIAL, pckbcintr, sc);
|
||||
printf("%s: %s slot interrupting at irq %d\n", sc->sc_dv.dv_xname,
|
||||
pckbc_slot_names[slot], irq);
|
||||
|
||||
}
|
@ -1,324 +0,0 @@
|
||||
/* $NetBSD: todclock.c,v 1.6 2002/10/10 13:37:21 jdolecek Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994-1997 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 Mark Brinicombe.
|
||||
* 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 THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* RiscBSD kernel project
|
||||
*
|
||||
* clock.c
|
||||
*
|
||||
* Timer related machine specific code
|
||||
*
|
||||
* Created : 29/09/94
|
||||
*/
|
||||
|
||||
/* Include header files */
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/device.h>
|
||||
|
||||
#include <machine/rtc.h>
|
||||
#include <walnut/dev/todclockvar.h>
|
||||
|
||||
#include "todclock.h"
|
||||
|
||||
#if NTODCLOCK > 1
|
||||
#error "Can only had 1 todclock device"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* softc structure for the todclock device
|
||||
*/
|
||||
|
||||
struct todclock_softc {
|
||||
struct device sc_dev; /* device node */
|
||||
void *sc_rtc_arg; /* arg to read/write */
|
||||
int (*sc_rtc_write)(void *, rtc_t *); /* rtc write function */
|
||||
int (*sc_rtc_read)(void *, rtc_t *); /* rtc read function */
|
||||
};
|
||||
|
||||
/* prototypes for functions */
|
||||
|
||||
static void todclockattach(struct device *parent, struct device *self,
|
||||
void *aux);
|
||||
static int todclockmatch(struct device *parent, struct cfdata *cf, void *aux);
|
||||
static inline int yeartoday(int);
|
||||
|
||||
/*
|
||||
* We need to remember our softc for functions like inittodr()
|
||||
* and resettodr()
|
||||
* since we only ever have one time-of-day device we can just store
|
||||
* the direct pointer to softc.
|
||||
*/
|
||||
|
||||
static struct todclock_softc *todclock_sc = NULL;
|
||||
|
||||
/* driver and attach structures */
|
||||
|
||||
CFATTACH_DECL(todclock, sizeof(struct todclock_softc),
|
||||
todclockmatch, todclockattach, NULL, NULL);
|
||||
|
||||
/*
|
||||
* int todclockmatch(struct device *parent, struct cfdata *cf, void *aux)
|
||||
*
|
||||
* todclock device probe function.
|
||||
* just validate the attach args
|
||||
*/
|
||||
|
||||
int
|
||||
todclockmatch(struct device *parent, struct cfdata *cf, void *aux)
|
||||
{
|
||||
struct todclock_attach_args *ta = aux;
|
||||
|
||||
if (todclock_sc != NULL)
|
||||
return(0);
|
||||
if (strcmp(ta->ta_name, "todclock") != 0)
|
||||
return(0);
|
||||
|
||||
if (ta->ta_flags & TODCLOCK_FLAG_FAKE)
|
||||
return(1);
|
||||
return(2);
|
||||
}
|
||||
|
||||
/*
|
||||
* void todclockattach(struct device *parent, struct device *self, void *aux)
|
||||
*
|
||||
* todclock device attach function.
|
||||
* Initialise the softc structure and do a search for children
|
||||
*/
|
||||
|
||||
void
|
||||
todclockattach(struct device *parent, struct device *self, void *aux)
|
||||
{
|
||||
struct todclock_softc *sc = (void *)self;
|
||||
struct todclock_attach_args *ta = aux;
|
||||
|
||||
/* set up our softc */
|
||||
todclock_sc = sc;
|
||||
todclock_sc->sc_rtc_arg = ta->ta_rtc_arg;
|
||||
todclock_sc->sc_rtc_write = ta->ta_rtc_write;
|
||||
todclock_sc->sc_rtc_read = ta->ta_rtc_read;
|
||||
|
||||
printf("\n");
|
||||
|
||||
/*
|
||||
* Initialise the time of day register.
|
||||
* This is normally left to the filing system to do but not all
|
||||
* filing systems call it e.g. cd9660
|
||||
*/
|
||||
|
||||
inittodr(0);
|
||||
}
|
||||
|
||||
static inline int
|
||||
yeartoday(int year)
|
||||
{
|
||||
return((year % 4) ? 365 : 366);
|
||||
}
|
||||
|
||||
|
||||
static int month[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
|
||||
static int timeset = 0;
|
||||
|
||||
#define SECPERDAY (24*60*60)
|
||||
#define SECPERNYEAR (365*SECPERDAY)
|
||||
#define SECPER4YEARS (4*SECPERNYEAR+SECPERDAY)
|
||||
#define EPOCHYEAR 1970
|
||||
|
||||
/*
|
||||
* Globally visable functions
|
||||
*
|
||||
* These functions are used from other parts of the kernel.
|
||||
* These functions use the functions defined in the tod_sc
|
||||
* to actually read and write the rtc.
|
||||
*
|
||||
* The first todclock to be attached will be used for handling
|
||||
* the time of day.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Write back the time of day to the rtc
|
||||
*/
|
||||
|
||||
void
|
||||
resettodr(void)
|
||||
{
|
||||
int s;
|
||||
time_t year, mon, day, hour, min, sec;
|
||||
rtc_t rtc;
|
||||
|
||||
/* Have we set the system time in inittodr() */
|
||||
if (!timeset)
|
||||
return;
|
||||
|
||||
/* We need a todclock device and should always have one */
|
||||
if (!todclock_sc)
|
||||
panic("resettodr: No todclock device attached");
|
||||
|
||||
/* Abort early if there is not actually an RTC write routine */
|
||||
if (todclock_sc->sc_rtc_write == NULL)
|
||||
return;
|
||||
|
||||
sec = time.tv_sec;
|
||||
sec -= rtc_offset * 60;
|
||||
year = (sec / SECPER4YEARS) * 4;
|
||||
sec %= SECPER4YEARS;
|
||||
|
||||
/* year now hold the number of years rounded down 4 */
|
||||
|
||||
while (sec > (yeartoday(EPOCHYEAR+year) * SECPERDAY)) {
|
||||
sec -= yeartoday(EPOCHYEAR+year)*SECPERDAY;
|
||||
year++;
|
||||
}
|
||||
|
||||
/* year is now a correct offset from the EPOCHYEAR */
|
||||
|
||||
year+=EPOCHYEAR;
|
||||
mon=0;
|
||||
if (yeartoday(year) == 366)
|
||||
month[1]=29;
|
||||
else
|
||||
month[1]=28;
|
||||
while (sec >= month[mon]*SECPERDAY) {
|
||||
sec -= month[mon]*SECPERDAY;
|
||||
mon++;
|
||||
}
|
||||
|
||||
day = sec / SECPERDAY;
|
||||
sec %= SECPERDAY;
|
||||
hour = sec / 3600;
|
||||
sec %= 3600;
|
||||
min = sec / 60;
|
||||
sec %= 60;
|
||||
rtc.rtc_cen = year / 100;
|
||||
rtc.rtc_year = year % 100;
|
||||
rtc.rtc_mon = mon+1;
|
||||
rtc.rtc_day = day+1;
|
||||
rtc.rtc_hour = hour;
|
||||
rtc.rtc_min = min;
|
||||
rtc.rtc_sec = sec;
|
||||
rtc.rtc_centi =
|
||||
rtc.rtc_micro = 0;
|
||||
|
||||
printf("resettod: %02d/%02d/%02d%02d %02d:%02d:%02d\n", rtc.rtc_day,
|
||||
rtc.rtc_mon, rtc.rtc_cen, rtc.rtc_year, rtc.rtc_hour,
|
||||
rtc.rtc_min, rtc.rtc_sec);
|
||||
|
||||
s = splclock();
|
||||
todclock_sc->sc_rtc_write(todclock_sc->sc_rtc_arg, &rtc);
|
||||
(void)splx(s);
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialise the time of day register, based on the time base which is, e.g.
|
||||
* from a filesystem.
|
||||
*/
|
||||
|
||||
void
|
||||
inittodr(time_t base)
|
||||
{
|
||||
time_t n;
|
||||
int i, days = 0;
|
||||
int s;
|
||||
int year;
|
||||
rtc_t rtc;
|
||||
|
||||
/*
|
||||
* Default to the suggested time but replace that we one from an
|
||||
* RTC is we can.
|
||||
*/
|
||||
|
||||
/* We expect a todclock device */
|
||||
if (!todclock_sc)
|
||||
panic("inittodr: No todclock device attached");
|
||||
|
||||
/* Use the suggested time as a fall back */
|
||||
time.tv_sec = base;
|
||||
time.tv_usec = 0;
|
||||
|
||||
/* Can we read an RTC ? */
|
||||
if (todclock_sc->sc_rtc_read) {
|
||||
s = splclock();
|
||||
if (todclock_sc->sc_rtc_read(todclock_sc->sc_rtc_arg, &rtc) == 0) {
|
||||
(void)splx(s);
|
||||
return;
|
||||
}
|
||||
(void)splx(s);
|
||||
} else
|
||||
return;
|
||||
|
||||
/* Convert the rtc time into seconds */
|
||||
|
||||
n = rtc.rtc_sec + 60 * rtc.rtc_min + 3600 * rtc.rtc_hour;
|
||||
n += (rtc.rtc_day - 1) * 3600 * 24;
|
||||
year = (rtc.rtc_year + rtc.rtc_cen * 100) - 1900;
|
||||
|
||||
if (yeartoday(year) == 366)
|
||||
month[1] = 29;
|
||||
for (i = rtc.rtc_mon - 2; i >= 0; i--)
|
||||
days += month[i];
|
||||
month[1] = 28;
|
||||
|
||||
for (i = 70; i < year; i++)
|
||||
days += yeartoday(i);
|
||||
|
||||
n += days * 3600 * 24;
|
||||
|
||||
n += rtc_offset * 60;
|
||||
|
||||
time.tv_sec = n;
|
||||
time.tv_usec = 0;
|
||||
|
||||
/* timeset is used to ensure the time is valid before a resettodr() */
|
||||
|
||||
timeset = 1;
|
||||
|
||||
/* If the base was 0 then keep quiet */
|
||||
|
||||
if (base) {
|
||||
printf("inittodr: %02d:%02d:%02d.%02d%02d %02d/%02d/%02d%02d\n",
|
||||
rtc.rtc_hour, rtc.rtc_min, rtc.rtc_sec, rtc.rtc_centi,
|
||||
rtc.rtc_micro, rtc.rtc_day, rtc.rtc_mon, rtc.rtc_cen,
|
||||
rtc.rtc_year);
|
||||
|
||||
if (n > base + 60) {
|
||||
days = (n - base) / SECPERDAY;
|
||||
printf("Clock has gained %d day%c %ld hours %ld minutes %ld secs\n",
|
||||
days, ((days == 1) ? 0 : 's'), ((n - base) / 3600) % 24,
|
||||
((n - base) / 60) % 60, (n - base) % 60);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,55 +0,0 @@
|
||||
/* $NetBSD: todclockvar.h,v 1.1 2001/06/13 06:01:53 simonb Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997 Mark Brinicombe.
|
||||
* Copyright (c) 1997 Causality Limited
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Mark Brinicombe
|
||||
* 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 THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* todclockvar.h
|
||||
*
|
||||
* structures and variables for the todclock device
|
||||
*
|
||||
* Created : 12/02/97
|
||||
*/
|
||||
|
||||
/*
|
||||
* Attach args for todclock device
|
||||
*/
|
||||
|
||||
struct todclock_attach_args {
|
||||
const char *ta_name; /* device name */
|
||||
void *ta_rtc_arg; /* arg to read/write */
|
||||
int (*ta_rtc_write)(void *, rtc_t *); /* function to write rtc */
|
||||
int (*ta_rtc_read)(void *, rtc_t *); /* function to read rtc */
|
||||
int ta_flags; /* flags */
|
||||
#define TODCLOCK_FLAG_FAKE 0x01 /* tod service is faked */
|
||||
};
|
||||
|
||||
/* End of todclockvar.h */
|
@ -1,24 +0,0 @@
|
||||
# $NetBSD: Makefile,v 1.5 2002/11/26 23:30:29 lukem Exp $
|
||||
|
||||
INCSDIR= /usr/include/walnut
|
||||
|
||||
INCS= ansi.h aout_machdep.h asm.h \
|
||||
bswap.h bus.h \
|
||||
cdefs.h cpu.h \
|
||||
db_machdep.h disklabel.h \
|
||||
elf_machdep.h endian.h endian_machdep.h \
|
||||
float.h fpu.h frame.h \
|
||||
ieee.h ieeefp.h int_const.h int_fmtio.h int_limits.h int_mwgwtypes.h \
|
||||
int_types.h intr.h ipkdb.h \
|
||||
kcore.h \
|
||||
limits.h lock.h \
|
||||
math.h \
|
||||
param.h pcb.h pio.h pmap.h pmc.h powerpc.h \
|
||||
proc.h profile.h psl.h pte.h \
|
||||
ptrace.h \
|
||||
reg.h reloc.h \
|
||||
setjmp.h signal.h stdarg.h \
|
||||
tlb.h trap.h types.h \
|
||||
varargs.h vmparam.h
|
||||
|
||||
.include <bsd.kinc.mk>
|
@ -1,3 +0,0 @@
|
||||
/* $NetBSD: ansi.h,v 1.1 2001/06/13 06:01:53 simonb Exp $ */
|
||||
|
||||
#include <powerpc/ansi.h>
|
@ -1,3 +0,0 @@
|
||||
/* $NetBSD: aout_machdep.h,v 1.1 2001/06/13 06:01:54 simonb Exp $ */
|
||||
|
||||
#include <powerpc/aout_machdep.h>
|
@ -1,3 +0,0 @@
|
||||
/* $NetBSD: asm.h,v 1.1 2001/06/13 06:01:54 simonb Exp $ */
|
||||
|
||||
#include <powerpc/asm.h>
|
@ -1,4 +0,0 @@
|
||||
/* $NetBSD: bswap.h,v 1.1 2001/06/13 06:01:55 simonb Exp $ */
|
||||
|
||||
#include <powerpc/bswap.h>
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,3 +0,0 @@
|
||||
/* $NetBSD: cdefs.h,v 1.1 2001/06/13 06:01:55 simonb Exp $ */
|
||||
|
||||
#include <powerpc/cdefs.h>
|
@ -1,43 +0,0 @@
|
||||
/* $NetBSD: cpu.h,v 1.3 2002/03/13 23:07:47 eeh Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 2002 Wasabi Systems, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Written by Eduardo Horvath for Wasabi Systems, Inc.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed for the NetBSD Project by
|
||||
* Wasabi Systems, Inc.
|
||||
* 4. The name of Wasabi Systems, Inc. may not be used to endorse
|
||||
* or promote products derived from this software without specific prior
|
||||
* written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _MACHINE_CPU_H_
|
||||
#define _MACHINE_CPU_H_
|
||||
|
||||
#include <powerpc/ibm4xx/cpu.h>
|
||||
|
||||
#endif /* _MACHINE_CPU_H_ */
|
@ -1,3 +0,0 @@
|
||||
/* $NetBSD: darwin_machdep.h,v 1.1 2002/12/08 21:53:16 manu Exp $ */
|
||||
|
||||
#include <powerpc/darwin_machdep.h>
|
@ -1,3 +0,0 @@
|
||||
/* $NetBSD: db_machdep.h,v 1.1 2001/06/13 06:01:55 simonb Exp $ */
|
||||
|
||||
#include <powerpc/db_machdep.h>
|
@ -1,43 +0,0 @@
|
||||
/* $NetBSD: dcr.h,v 1.2 2002/03/13 23:10:36 eeh Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 2002 Wasabi Systems, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Written by Eduardo Horvath for Wasabi Systems, Inc.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed for the NetBSD Project by
|
||||
* Wasabi Systems, Inc.
|
||||
* 4. The name of Wasabi Systems, Inc. may not be used to endorse
|
||||
* or promote products derived from this software without specific prior
|
||||
* written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _MACHINE_DCR_H_
|
||||
#define _MACHINE_DCR_H_
|
||||
|
||||
#include <powerpc/ibm4xx/dcr405gp.h>
|
||||
|
||||
#endif /* _MACHINE_DCR_H_ */
|
@ -1,52 +0,0 @@
|
||||
/* $NetBSD: disklabel.h,v 1.1 2001/06/13 06:01:55 simonb Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994 Christopher G. Demetriou
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Christopher G. Demetriou.
|
||||
* 4. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _MACHINE_DISKLABEL_H_
|
||||
#define _MACHINE_DISKLABEL_H_
|
||||
|
||||
#define LABELSECTOR 0 /* sector containing label */
|
||||
#define LABELOFFSET 64 /* offset of label in sector */
|
||||
#define MAXPARTITIONS 16 /* number of partitions */
|
||||
#define RAW_PART 2 /* raw partition: XX?c */
|
||||
|
||||
#include <sys/dkbad.h>
|
||||
|
||||
struct cpu_disklabel {
|
||||
struct dkbad bad; /* bad-sector information */
|
||||
};
|
||||
|
||||
#ifdef _KERNEL
|
||||
struct disklabel;
|
||||
int bounds_check_with_label(struct buf *bp, struct disklabel *lp, int wlabel);
|
||||
#endif
|
||||
|
||||
#endif /* _MACHINE_DISKLABEL_H_ */
|
@ -1,3 +0,0 @@
|
||||
/* $NetBSD: elf_machdep.h,v 1.1 2001/06/13 06:01:55 simonb Exp $ */
|
||||
|
||||
#include <powerpc/elf_machdep.h>
|
@ -1,3 +0,0 @@
|
||||
/* $NetBSD: endian.h,v 1.1 2001/06/13 06:01:55 simonb Exp $ */
|
||||
|
||||
#include <sys/endian.h>
|
@ -1,3 +0,0 @@
|
||||
/* $NetBSD: endian_machdep.h,v 1.1 2001/06/13 06:01:55 simonb Exp $ */
|
||||
|
||||
#include <powerpc/endian_machdep.h>
|
@ -1,3 +0,0 @@
|
||||
/* $NetBSD: float.h,v 1.1 2001/06/13 06:01:56 simonb Exp $ */
|
||||
|
||||
#include <powerpc/float.h>
|
@ -1,3 +0,0 @@
|
||||
/* $NetBSD: fpu.h,v 1.1 2001/06/13 06:01:56 simonb Exp $ */
|
||||
|
||||
#include <powerpc/fpu.h>
|
@ -1,94 +0,0 @@
|
||||
/* $NetBSD: frame.h,v 1.1 2001/06/13 06:01:56 simonb Exp $ */
|
||||
/* $NetBSD: frame.h,v 1.1 2001/06/13 06:01:56 simonb Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
|
||||
* Copyright (C) 1995, 1996 TooLs GmbH.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by TooLs GmbH.
|
||||
* 4. The name of TooLs GmbH may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``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 TOOLS GMBH 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.
|
||||
*/
|
||||
#ifndef _MACHINE_FRAME_H_
|
||||
#define _MACHINE_FRAME_H_
|
||||
|
||||
#include <machine/types.h>
|
||||
|
||||
/*
|
||||
* We have to save all registers on every trap, because
|
||||
* 1. user could attach this process every time
|
||||
* 2. we must be able to restore all user registers in case of fork
|
||||
* Actually, we do not save the fp registers on trap, since
|
||||
* these are not used by the kernel. They are saved only when switching
|
||||
* between processes using the FPU.
|
||||
*
|
||||
* Change ordering to cluster together these register_t's. XXX
|
||||
*/
|
||||
struct trapframe {
|
||||
register_t fixreg[32];
|
||||
register_t lr;
|
||||
int cr;
|
||||
int xer;
|
||||
register_t ctr;
|
||||
register_t srr0;
|
||||
register_t srr1;
|
||||
register_t dear; /* dar & dsisr are only filled on a DSI trap */
|
||||
int esr;
|
||||
int exc;
|
||||
int pid;
|
||||
};
|
||||
/*
|
||||
* This is to ensure alignment of the stackpointer
|
||||
*/
|
||||
#define FRAMELEN roundup(sizeof(struct trapframe) + 8, 16)
|
||||
#define trapframe(p) ((struct trapframe *)((char *)(p)->p_addr + USPACE - FRAMELEN + 8))
|
||||
|
||||
struct switchframe {
|
||||
register_t sp;
|
||||
int fill;
|
||||
int user_vsid;
|
||||
int cr;
|
||||
register_t fixreg2;
|
||||
register_t fixreg[19]; /* R13-R31 */
|
||||
};
|
||||
|
||||
struct clockframe {
|
||||
register_t srr1;
|
||||
register_t srr0;
|
||||
int pri;
|
||||
int depth;
|
||||
};
|
||||
|
||||
/*
|
||||
* Call frame for PowerPC used during fork.
|
||||
*/
|
||||
struct callframe {
|
||||
register_t sp;
|
||||
register_t lr;
|
||||
register_t r30;
|
||||
register_t r31;
|
||||
};
|
||||
|
||||
#endif /* _MACHINE_FRAME_H_ */
|
@ -1,3 +0,0 @@
|
||||
/* $NetBSD: ieee.h,v 1.1 2001/06/13 06:01:56 simonb Exp $ */
|
||||
|
||||
#include <powerpc/ieee.h>
|
@ -1,3 +0,0 @@
|
||||
/* $NetBSD: ieeefp.h,v 1.1 2001/06/13 06:01:56 simonb Exp $ */
|
||||
|
||||
#include <powerpc/ieeefp.h>
|
@ -1,3 +0,0 @@
|
||||
/* $NetBSD: int_const.h,v 1.1 2001/06/13 06:01:56 simonb Exp $ */
|
||||
|
||||
#include <powerpc/int_const.h>
|
@ -1,3 +0,0 @@
|
||||
/* $NetBSD: int_fmtio.h,v 1.1 2001/06/13 06:01:57 simonb Exp $ */
|
||||
|
||||
#include <powerpc/int_fmtio.h>
|
@ -1,3 +0,0 @@
|
||||
/* $NetBSD: int_limits.h,v 1.1 2001/06/13 06:01:57 simonb Exp $ */
|
||||
|
||||
#include <powerpc/int_limits.h>
|
@ -1,3 +0,0 @@
|
||||
/* $NetBSD: int_mwgwtypes.h,v 1.1 2001/06/13 06:01:57 simonb Exp $ */
|
||||
|
||||
#include <powerpc/int_mwgwtypes.h>
|
@ -1,3 +0,0 @@
|
||||
/* $NetBSD: int_types.h,v 1.1 2001/06/13 06:01:57 simonb Exp $ */
|
||||
|
||||
#include <powerpc/int_types.h>
|
@ -1,208 +0,0 @@
|
||||
/* $NetBSD: intr.h,v 1.8 2002/08/13 05:43:26 simonb Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Charles M. Hannum.
|
||||
*
|
||||
* 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 the NetBSD
|
||||
* Foundation, Inc. and its contributors.
|
||||
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _WALNUT_INTR_H_
|
||||
#define _WALNUT_INTR_H_
|
||||
|
||||
/* Interrupt priority `levels'. */
|
||||
#define IPL_NONE 9 /* nothing */
|
||||
#define IPL_SOFTCLOCK 8 /* software clock interrupt */
|
||||
#define IPL_SOFTNET 7 /* software network interrupt */
|
||||
#define IPL_BIO 6 /* block I/O */
|
||||
#define IPL_NET 5 /* network */
|
||||
#define IPL_SOFTSERIAL 4 /* software serial interrupt */
|
||||
#define IPL_TTY 3 /* terminal */
|
||||
#define IPL_IMP 3 /* memory allocation */
|
||||
#define IPL_AUDIO 2 /* audio */
|
||||
#define IPL_CLOCK 1 /* clock */
|
||||
#define IPL_HIGH 1 /* everything */
|
||||
#define IPL_SERIAL 0 /* serial */
|
||||
#define NIPL 10
|
||||
|
||||
/* Interrupt sharing types. */
|
||||
#define IST_NONE 0 /* none */
|
||||
#define IST_PULSE 1 /* pulsed */
|
||||
#define IST_EDGE 2 /* edge-triggered */
|
||||
#define IST_LEVEL 3 /* level-triggered */
|
||||
|
||||
#ifndef _LOCORE
|
||||
|
||||
/*
|
||||
* Interrupt handler chains. intr_establish() inserts a handler into
|
||||
* the list. The handler is called with its (single) argument.
|
||||
*/
|
||||
struct intrhand {
|
||||
int (*ih_fun)(void *);
|
||||
void *ih_arg;
|
||||
u_long ih_count;
|
||||
struct intrhand *ih_next;
|
||||
int ih_level;
|
||||
int ih_irq;
|
||||
};
|
||||
|
||||
void setsoftclock(void);
|
||||
int splsoftclock(void);
|
||||
void setsoftnet(void);
|
||||
int splsoftnet(void);
|
||||
|
||||
void do_pending_int(void);
|
||||
void ext_intr(void);
|
||||
void *intr_establish(int, int, int, int (*)(void *), void *);
|
||||
void intr_disestablish(void *);
|
||||
void intr_init(void);
|
||||
|
||||
static __inline int splraise(int);
|
||||
static __inline int spllower(int);
|
||||
static __inline void splx(int);
|
||||
static __inline void set_sint(int);
|
||||
|
||||
extern volatile int cpl, ipending, astpending;
|
||||
extern u_long imask[];
|
||||
extern u_long intrcnt[];
|
||||
|
||||
/*
|
||||
* Reorder protection in the following inline functions is
|
||||
* achived with the "eieio" instruction which the assembler
|
||||
* seems to detect and then doesn't move instructions past....
|
||||
*/
|
||||
static __inline int
|
||||
splraise(newcpl)
|
||||
int newcpl;
|
||||
{
|
||||
int oldcpl;
|
||||
|
||||
__asm__ volatile("sync; eieio\n"); /* don't reorder.... */
|
||||
oldcpl = cpl;
|
||||
cpl = oldcpl | newcpl;
|
||||
__asm__ volatile("sync; eieio\n"); /* reorder protect */
|
||||
return(oldcpl);
|
||||
}
|
||||
|
||||
static __inline void
|
||||
splx(newcpl)
|
||||
int newcpl;
|
||||
{
|
||||
__asm__ volatile("sync; eieio\n"); /* reorder protect */
|
||||
cpl = newcpl;
|
||||
if(ipending & ~newcpl)
|
||||
do_pending_int();
|
||||
__asm__ volatile("sync; eieio\n"); /* reorder protect */
|
||||
}
|
||||
|
||||
static __inline int
|
||||
spllower(newcpl)
|
||||
int newcpl;
|
||||
{
|
||||
int oldcpl;
|
||||
|
||||
__asm__ volatile("sync; eieio\n"); /* reorder protect */
|
||||
oldcpl = cpl;
|
||||
cpl = newcpl;
|
||||
if(ipending & ~newcpl)
|
||||
do_pending_int();
|
||||
__asm__ volatile("sync; eieio\n"); /* reorder protect */
|
||||
return(oldcpl);
|
||||
}
|
||||
|
||||
/* Following code should be implemented with lwarx/stwcx to avoid
|
||||
* the disable/enable. i need to read the manual once more.... */
|
||||
static __inline void
|
||||
set_sint(pending)
|
||||
int pending;
|
||||
{
|
||||
int msrsave;
|
||||
|
||||
__asm__ ("mfmsr %0" : "=r"(msrsave));
|
||||
__asm__ volatile ("mtmsr %0" :: "r"(msrsave & ~PSL_EE));
|
||||
ipending |= pending;
|
||||
__asm__ volatile ("mtmsr %0" :: "r"(msrsave));
|
||||
}
|
||||
|
||||
#define ICU_LEN 32
|
||||
#define LEGAL_IRQ(x) ((x) >= 0 && (x) < ICU_LEN)
|
||||
#define IRQ_TO_MASK(x) (0x80000000UL >> (x))
|
||||
|
||||
/*
|
||||
* Interrupt bits 0-18 and 25-31 are used by hardware. This
|
||||
* leaves us bits 19-24 for stoftware.
|
||||
*/
|
||||
#define HWINT_MASK ~0x1fc0
|
||||
|
||||
/* Assign these to unused (reserved) interrupt bits: */
|
||||
#define CNT_SINT_NET 19
|
||||
#define CNT_SINT_CLOCK 20
|
||||
#define CNT_SINT_SERIAL 21
|
||||
#define CNT_CLOCK 22
|
||||
#define CNT_STATCLOCK 23
|
||||
|
||||
#define SINT_NET IRQ_TO_MASK(CNT_SINT_NET)
|
||||
#define SINT_CLOCK IRQ_TO_MASK(CNT_SINT_CLOCK)
|
||||
#define SINT_SERIAL IRQ_TO_MASK(CNT_SINT_SERIAL)
|
||||
#define SPL_CLOCK IRQ_TO_MASK(CNT_CLOCK)
|
||||
#define SINT_MASK (SINT_CLOCK|SINT_NET|SINT_SERIAL)
|
||||
|
||||
#define splbio() splraise(imask[IPL_BIO])
|
||||
#define splnet() splraise(imask[IPL_NET])
|
||||
#define spltty() splraise(imask[IPL_TTY])
|
||||
#define splclock() splraise(imask[IPL_CLOCK])
|
||||
#define splimp() splraise(imask[IPL_IMP])
|
||||
#define splvm() splraise(imask[IPL_IMP])
|
||||
#define splserial() splraise(imask[IPL_SERIAL])
|
||||
#define splstatclock() splclock()
|
||||
#define spllowersoftclock() spllower(imask[IPL_SOFTCLOCK])
|
||||
#define splsoftclock() splraise(imask[IPL_SOFTCLOCK])
|
||||
#define splsoftnet() splraise(imask[IPL_SOFTNET])
|
||||
#define splsoftserial() splraise(imask[IPL_SOFTSERIAL])
|
||||
|
||||
#define spllpt() spltty()
|
||||
|
||||
#define setsoftclock() set_sint(SINT_CLOCK);
|
||||
#define setsoftnet() set_sint(SINT_NET);
|
||||
#define setsoftserial() set_sint(SINT_SERIAL);
|
||||
|
||||
#define splhigh() splraise(imask[IPL_HIGH])
|
||||
#define spl0() spllower(0)
|
||||
|
||||
#define splsched() splhigh()
|
||||
#define spllock() splhigh()
|
||||
|
||||
void softnet(void);
|
||||
void softserial(void);
|
||||
|
||||
#endif /* !_LOCORE */
|
||||
#endif /* !_WALNUT_INTR_H_ */
|
@ -1,3 +0,0 @@
|
||||
/* $NetBSD: ipkdb.h,v 1.1 2001/06/13 06:01:57 simonb Exp $ */
|
||||
|
||||
#include <powerpc/ipkdb.h>
|
@ -1,3 +0,0 @@
|
||||
/* $NetBSD: kcore.h,v 1.1 2001/06/13 06:01:57 simonb Exp $ */
|
||||
|
||||
#include <powerpc/kcore.h>
|
@ -1,3 +0,0 @@
|
||||
/* $NetBSD: limits.h,v 1.1 2001/06/13 06:01:57 simonb Exp $ */
|
||||
|
||||
#include <powerpc/limits.h>
|
@ -1,56 +0,0 @@
|
||||
/* $NetBSD: loadfile_machdep.h,v 1.2 2001/10/31 17:20:50 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Christos Zoulas.
|
||||
*
|
||||
* 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 the NetBSD
|
||||
* Foundation, Inc. and its contributors.
|
||||
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#define BOOT_AOUT
|
||||
#define BOOT_ELF32
|
||||
|
||||
#define LOAD_KERNEL (LOAD_ALL & ~LOAD_TEXTA)
|
||||
#define COUNT_KERNEL (COUNT_ALL & ~COUNT_TEXTA)
|
||||
|
||||
#define LOADADDR(a) (((u_long)(a)) + offset)
|
||||
#define ALIGNENTRY(a) ((u_long)(a))
|
||||
#define READ(f, b, c) read((f), (void *)LOADADDR(b), (c))
|
||||
#define BCOPY(s, d, c) memcpy((void *)LOADADDR(d), (void *)(s), (c))
|
||||
#define BZERO(d, c) memset((void *)LOADADDR(d), 0, (c))
|
||||
#define WARN(a) (void)(printf a, \
|
||||
printf((errno ? ": %s\n" : "\n"), \
|
||||
strerror(errno)))
|
||||
#define PROGRESS(a) (void) printf a
|
||||
#define ALLOC(a) alloc(a)
|
||||
#define FREE(a, b) free(a, b)
|
||||
#define OKMAGIC(a) ((a) == OMAGIC)
|
@ -1,3 +0,0 @@
|
||||
/* $NetBSD: lock.h,v 1.1 2001/06/13 06:01:57 simonb Exp $ */
|
||||
|
||||
#include <powerpc/lock.h>
|
@ -1,3 +0,0 @@
|
||||
/* $NetBSD: macho_machdep.h,v 1.1 2002/10/30 18:31:41 matt Exp $ */
|
||||
|
||||
#include <powerpc/macho_machdep.h>
|
@ -1,3 +0,0 @@
|
||||
/* $NetBSD: math.h,v 1.1 2001/06/13 06:01:57 simonb Exp $ */
|
||||
|
||||
#include <powerpc/math.h>
|
@ -1,137 +0,0 @@
|
||||
/* $NetBSD: param.h,v 1.1 2001/06/13 06:01:57 simonb Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
|
||||
* Copyright (C) 1995, 1996 TooLs GmbH.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by TooLs GmbH.
|
||||
* 4. The name of TooLs GmbH may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``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 TOOLS GMBH 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.
|
||||
*/
|
||||
|
||||
#ifdef _KERNEL
|
||||
#ifndef _LOCORE
|
||||
#include <machine/cpu.h>
|
||||
#endif /* _LOCORE */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Machine dependent constants for PowerPC (32-bit only currently)
|
||||
*/
|
||||
#define MACHINE "walnut"
|
||||
#define MACHINE_ARCH "powerpc"
|
||||
#define MID_MACHINE MID_POWERPC
|
||||
|
||||
#define ALIGNBYTES (sizeof(double) - 1)
|
||||
#define ALIGN(p) (((u_int)(p) + ALIGNBYTES) & ~ALIGNBYTES)
|
||||
#define ALIGNED_POINTER(p,t) ((((u_long)(p)) & (sizeof(t)-1)) == 0)
|
||||
|
||||
#define PGSHIFT 14 /* 16K pages to reduce number of TLB misses */
|
||||
#define NBPG (1 << PGSHIFT) /* Page size */
|
||||
#define PGOFSET (NBPG - 1)
|
||||
|
||||
#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */
|
||||
#define DEV_BSIZE (1 << DEV_BSHIFT)
|
||||
#define BLKDEV_IOSIZE NBPG
|
||||
#define MAXPHYS (64 * 1024) /* max raw I/O transfer size */
|
||||
|
||||
#define UPAGES 1
|
||||
#define USPACE (UPAGES * NBPG)
|
||||
|
||||
#ifndef MSGBUFSIZE
|
||||
#define MSGBUFSIZE NBPG /* default message buffer size */
|
||||
#endif
|
||||
|
||||
#define KERNBASE 0x25000
|
||||
|
||||
/*
|
||||
* Constants related to network buffer management.
|
||||
* MCLBYTES must be no larger than NBPG (the software page size), and,
|
||||
* on machines that exchange pages of input or output buffers with mbuf
|
||||
* clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple
|
||||
* of the hardware page size.
|
||||
*/
|
||||
#define MSIZE 256 /* size of an mbuf */
|
||||
#define MCLSHIFT 11 /* convert bytes to m_buf clusters */
|
||||
#define MCLBYTES (1 << MCLSHIFT) /* size of a m_buf cluster */
|
||||
|
||||
#ifndef NMBCLUSTERS
|
||||
|
||||
#if defined(_KERNEL) && !defined(_LKM)
|
||||
#include "opt_gateway.h"
|
||||
#endif /* _KERNEL && ! _LKM */
|
||||
|
||||
#ifdef GATEWAY
|
||||
#define NMBCLUSTERS 512 /* map size, max cluster allocation */
|
||||
#else
|
||||
#define NMBCLUSTERS 256 /* map size, max cluster allocation */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Minimum and maximum sizes of the kernel malloc arena in PAGE_SIZE-sized
|
||||
* logical pages.
|
||||
*/
|
||||
#define NKMEMPAGES_MIN_DEFAULT ((8 * 1024 * 1024) >> PAGE_SHIFT)
|
||||
#define NKMEMPAGES_MAX_DEFAULT ((48 * 1024 * 1024) >> PAGE_SHIFT)
|
||||
|
||||
/*
|
||||
* pages ("clicks") to disk blocks
|
||||
*/
|
||||
#define ctod(x) ((x) << (PGSHIFT - DEV_BSHIFT))
|
||||
#define dtoc(x) ((x) >> (PGSHIFT - DEV_BSHIFT))
|
||||
/*
|
||||
* bytes to pages
|
||||
*/
|
||||
#define ctob(x) ((x) << PGSHIFT)
|
||||
#define btoc(x) (((x) + PGOFSET) >> PGSHIFT)
|
||||
|
||||
/*
|
||||
* bytes to disk blocks
|
||||
*/
|
||||
#define dbtob(x) ((x) << DEV_BSHIFT)
|
||||
#define btodb(x) ((x) >> DEV_BSHIFT)
|
||||
|
||||
/*
|
||||
* Segment handling stuff
|
||||
*/
|
||||
#define SEGMENT_LENGTH 0x10000000
|
||||
#define SEGMENT_MASK 0xf0000000
|
||||
|
||||
/*
|
||||
* Fixed segments
|
||||
*/
|
||||
#define USER_SR 12
|
||||
#define KERNEL_SR 13
|
||||
#define KERNEL_SEGMENT (0xf00000 + KERNEL_SR)
|
||||
#define EMPTY_SEGMENT 0xfffff0
|
||||
#define USER_ADDR ((void *)(USER_SR << ADDR_SR_SHFT))
|
||||
|
||||
/*
|
||||
* Some system constants
|
||||
*/
|
||||
#ifndef NPMAPS
|
||||
#define NPMAPS 32768 /* Number of pmaps in system */
|
||||
#endif
|
@ -1,3 +0,0 @@
|
||||
/* $NetBSD: pcb.h,v 1.1 2001/06/13 06:01:57 simonb Exp $ */
|
||||
|
||||
#include <powerpc/pcb.h>
|
@ -1,89 +0,0 @@
|
||||
/* $NetBSD: pci_machdep.h,v 1.4 2002/05/15 19:23:56 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
|
||||
* Copyright (c) 1994 Charles M. Hannum. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Charles M. Hannum.
|
||||
* 4. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Machine-specific definitions for PCI autoconfiguration.
|
||||
*/
|
||||
|
||||
#define __HAVE_PCI_CONF_HOOK
|
||||
|
||||
/*
|
||||
* Forward declarations.
|
||||
*/
|
||||
struct pci_attach_args;
|
||||
|
||||
/*
|
||||
* macppc-specific PCI structure and type definitions.
|
||||
* NOT TO BE USED DIRECTLY BY MACHINE INDEPENDENT CODE.
|
||||
*
|
||||
* Configuration tag; created from a {bus,device,function} triplet by
|
||||
* pci_make_tag(), and passed to pci_conf_read() and pci_conf_write().
|
||||
* We could instead always pass the {bus,device,function} triplet to
|
||||
* the read and write routines, but this would cause extra overhead.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Types provided to machine-independent PCI code
|
||||
*/
|
||||
typedef void *pci_chipset_tag_t;
|
||||
typedef int pcitag_t;
|
||||
typedef int pci_intr_handle_t;
|
||||
|
||||
/*
|
||||
* Functions provided to machine-independent PCI code.
|
||||
*/
|
||||
void pci_attach_hook(struct device *, struct device *,
|
||||
struct pcibus_attach_args *);
|
||||
int pci_bus_maxdevs(pci_chipset_tag_t, int);
|
||||
pcitag_t pci_make_tag(pci_chipset_tag_t, int, int, int);
|
||||
void pci_decompose_tag(pci_chipset_tag_t, pcitag_t,
|
||||
int *, int *, int *);
|
||||
pcireg_t pci_conf_read(pci_chipset_tag_t, pcitag_t, int);
|
||||
void pci_conf_write(pci_chipset_tag_t, pcitag_t, int,
|
||||
pcireg_t);
|
||||
int pci_intr_map(struct pci_attach_args *, pci_intr_handle_t *);
|
||||
const char *pci_intr_string(pci_chipset_tag_t, pci_intr_handle_t);
|
||||
const struct evcnt *pci_intr_evcnt(pci_chipset_tag_t, pci_intr_handle_t);
|
||||
void *pci_intr_establish(pci_chipset_tag_t, pci_intr_handle_t,
|
||||
int, int (*)(void *), void *);
|
||||
void pci_intr_disestablish(pci_chipset_tag_t, void *);
|
||||
int pci_conf_hook(pci_chipset_tag_t, int, int, int, pcireg_t);
|
||||
|
||||
void pci_machdep_init(void);
|
||||
|
||||
#define pci_enumerate_bus(sc, m, p) \
|
||||
pci_enumerate_bus_generic((sc), (m), (p))
|
||||
|
||||
/*
|
||||
* Internal functions.
|
||||
*/
|
||||
void pci_init(int);
|
@ -1,3 +0,0 @@
|
||||
/* $NetBSD: pio.h,v 1.1 2001/06/13 06:01:57 simonb Exp $ */
|
||||
|
||||
#include <powerpc/pio.h>
|
@ -1,3 +0,0 @@
|
||||
/* $NetBSD: pmap.h,v 1.1 2001/06/13 06:01:58 simonb Exp $ */
|
||||
|
||||
#include <powerpc/ibm4xx/pmap.h>
|
@ -1,3 +0,0 @@
|
||||
/* $NetBSD: pmc.h,v 1.1 2002/08/07 05:16:18 briggs Exp $ */
|
||||
|
||||
#include <powerpc/pmc.h>
|
@ -1,43 +0,0 @@
|
||||
/* $NetBSD: powerpc.h,v 1.1 2001/06/13 06:01:58 simonb Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1996 Wolfgang Solfrank.
|
||||
* Copyright (C) 1996 TooLs GmbH.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by TooLs GmbH.
|
||||
* 4. The name of TooLs GmbH may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``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 TOOLS GMBH 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.
|
||||
*/
|
||||
#ifndef _MACHINE_POWERPC_H_
|
||||
#define _MACHINE_POWERPC_H_
|
||||
|
||||
struct mem_region {
|
||||
paddr_t start;
|
||||
psize_t size;
|
||||
};
|
||||
|
||||
void mem_regions(struct mem_region **, struct mem_region **);
|
||||
|
||||
#endif /* _MACHINE_POWERPC_H_ */
|
@ -1,3 +0,0 @@
|
||||
/* $NetBSD: proc.h,v 1.1 2001/06/13 06:01:58 simonb Exp $ */
|
||||
|
||||
#include <powerpc/proc.h>
|
@ -1,3 +0,0 @@
|
||||
/* $NetBSD: profile.h,v 1.1 2001/06/13 06:01:58 simonb Exp $ */
|
||||
|
||||
#include <powerpc/profile.h>
|
@ -1,17 +0,0 @@
|
||||
/* $NetBSD: psl.h,v 1.1 2001/06/13 06:01:58 simonb Exp $ */
|
||||
|
||||
#include <powerpc/psl.h>
|
||||
|
||||
/* Apparently we get unexplained machine checks, so disable them. */
|
||||
#undef PSL_USERSET
|
||||
#define PSL_USERSET (PSL_EE | PSL_PR | PSL_IR | PSL_DR | PSL_RI)
|
||||
|
||||
/*
|
||||
* We also need to override the PSL_SE bit. 4xx have completely
|
||||
* different debug register support.
|
||||
*
|
||||
* The SE bit is actually the DWE bit. We want to set the DE bit
|
||||
* to enable the debug regs instead of the DWE bit.
|
||||
*/
|
||||
#undef PSL_SE
|
||||
#define PSL_SE 0x00000200
|
@ -1,3 +0,0 @@
|
||||
/* $NetBSD: pte.h,v 1.1 2001/06/13 06:01:58 simonb Exp $ */
|
||||
|
||||
#include <powerpc/ibm4xx/pte.h>
|
@ -1,3 +0,0 @@
|
||||
/* $NetBSD: ptrace.h,v 1.1 2001/06/13 06:01:58 simonb Exp $ */
|
||||
|
||||
#include <powerpc/ptrace.h>
|
@ -1,3 +0,0 @@
|
||||
/* $NetBSD: reg.h,v 1.1 2001/06/13 06:01:58 simonb Exp $ */
|
||||
|
||||
#include <powerpc/reg.h>
|
@ -1,3 +0,0 @@
|
||||
/* $NetBSD: reloc.h,v 1.1 2001/06/13 06:01:58 simonb Exp $ */
|
||||
|
||||
#include <powerpc/reloc.h>
|
@ -1,3 +0,0 @@
|
||||
/* $NetBSD: rnd.h,v 1.1 2001/06/13 06:01:58 simonb Exp $ */
|
||||
|
||||
#include <powerpc/rnd.h>
|
@ -1,61 +0,0 @@
|
||||
/* $NetBSD: rtc.h,v 1.1 2001/06/13 06:01:58 simonb Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994 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.
|
||||
*
|
||||
* RiscBSD kernel project
|
||||
*
|
||||
* rtc.h
|
||||
*
|
||||
* Header file for RTC / CMOS stuff
|
||||
*
|
||||
* Created : 13/10/94
|
||||
* Updated : 15/07/2000
|
||||
*
|
||||
* Based of kate/display/iiccontrol.c
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
u_char rtc_micro;
|
||||
u_char rtc_centi;
|
||||
u_char rtc_sec;
|
||||
u_char rtc_min;
|
||||
u_char rtc_hour;
|
||||
u_char rtc_day;
|
||||
u_char rtc_mon;
|
||||
u_char rtc_year;
|
||||
u_char rtc_cen;
|
||||
} rtc_t;
|
||||
|
||||
/* End of rtc.h */
|
@ -1,3 +0,0 @@
|
||||
/* $NetBSD: setjmp.h,v 1.1 2001/06/13 06:01:58 simonb Exp $ */
|
||||
|
||||
#include <powerpc/setjmp.h>
|
@ -1,3 +0,0 @@
|
||||
/* $NetBSD: signal.h,v 1.1 2001/06/13 06:01:58 simonb Exp $ */
|
||||
|
||||
#include <powerpc/signal.h>
|
@ -1,3 +0,0 @@
|
||||
/* $NetBSD: stdarg.h,v 1.1 2001/06/13 06:01:58 simonb Exp $ */
|
||||
|
||||
#include <powerpc/stdarg.h>
|
@ -1,6 +0,0 @@
|
||||
/* $NetBSD: tlb.h,v 1.2 2002/03/13 19:26:07 eeh Exp $ */
|
||||
|
||||
#include <powerpc/ibm4xx/tlb.h>
|
||||
|
||||
#define ppc4xx_tlbflags(va, pa) (0)
|
||||
|
@ -1,3 +0,0 @@
|
||||
/* $NetBSD: trap.h,v 1.1 2001/06/13 06:01:59 simonb Exp $ */
|
||||
|
||||
#include <powerpc/trap.h>
|
@ -1,5 +0,0 @@
|
||||
/* $NetBSD: types.h,v 1.2 2002/02/28 03:17:36 simonb Exp $ */
|
||||
|
||||
#include <powerpc/types.h>
|
||||
|
||||
#define __HAVE_NWSCONS
|
@ -1,3 +0,0 @@
|
||||
/* $NetBSD: varargs.h,v 1.1 2001/06/13 06:01:59 simonb Exp $ */
|
||||
|
||||
#include <powerpc/varargs.h>
|
@ -1,119 +0,0 @@
|
||||
/* $NetBSD: vmparam.h,v 1.2 2001/11/15 18:06:18 soren Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
|
||||
* Copyright (C) 1995, 1996 TooLs GmbH.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by TooLs GmbH.
|
||||
* 4. The name of TooLs GmbH may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``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 TOOLS GMBH 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.
|
||||
*/
|
||||
|
||||
#ifndef _MACHINE_VMPARAM_H_
|
||||
#define _MACHINE_VMPARAM_H_
|
||||
|
||||
#define USRTEXT NBPG
|
||||
#define USRSTACK VM_MAXUSER_ADDRESS
|
||||
|
||||
#ifndef MAXTSIZ
|
||||
#define MAXTSIZ (64*1024*1024) /* max text size */
|
||||
#endif
|
||||
|
||||
#ifndef DFLDSIZ
|
||||
#define DFLDSIZ (128*1024*1024) /* default data size */
|
||||
#endif
|
||||
|
||||
#ifndef MAXDSIZ
|
||||
#define MAXDSIZ (1*1024*1024*1024) /* max data size */
|
||||
#endif
|
||||
|
||||
#ifndef DFLSSIZ
|
||||
#define DFLSSIZ (2*1024*1024) /* default stack size */
|
||||
#endif
|
||||
|
||||
#ifndef MAXSSIZ
|
||||
#define MAXSSIZ (32*1024*1024) /* max stack size */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Size of shared memory map
|
||||
*/
|
||||
#ifndef SHMMAXPGS
|
||||
#define SHMMAXPGS 1024
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Size of User Raw I/O map
|
||||
*/
|
||||
#define USRIOSIZE 1024
|
||||
|
||||
#if 1
|
||||
/*
|
||||
* These definitions give you a 2GB kernel VA space. The other set matches
|
||||
* the way other PPC ports lay out their 256MB kernel address space.
|
||||
*/
|
||||
#define VM_MIN_ADDRESS ((vaddr_t)0)
|
||||
#define VM_MAXUSER_ADDRESS ((vaddr_t)0xffff0000-NBPG)
|
||||
#define VM_MAX_ADDRESS VM_MAXUSER_ADDRESS
|
||||
#define VM_MIN_KERNEL_ADDRESS ((vaddr_t)0x80000000)
|
||||
#define VM_MAX_KERNEL_ADDRESS ((vaddr_t)0xff000000)
|
||||
#else
|
||||
/*
|
||||
* Would like to have MAX addresses = 0, but this doesn't (currently) work
|
||||
*/
|
||||
#define VM_MIN_ADDRESS ((vaddr_t)0)
|
||||
#define VM_MAXUSER_ADDRESS ((vaddr_t)0x80000000-NBPG)
|
||||
#define VM_MAX_ADDRESS VM_MAXUSER_ADDRESS
|
||||
#define VM_MIN_KERNEL_ADDRESS ((vaddr_t)(KERNEL_SR << ADDR_SR_SHFT))
|
||||
#define VM_MAX_KERNEL_ADDRESS (VM_MIN_KERNEL_ADDRESS + SEGMENT_LENGTH - 1)
|
||||
#endif
|
||||
|
||||
/* XXX max. amount of KVM to be used by buffers. */
|
||||
#ifndef VM_MAX_KERNEL_BUF
|
||||
#define VM_MAX_KERNEL_BUF (SEGMENT_LENGTH * 7 / 10)
|
||||
|
||||
/*
|
||||
* Override the default pager_map size, there's not enough KVA.
|
||||
*/
|
||||
#define PAGER_MAP_SIZE (4 * 1024 * 1024)
|
||||
#endif
|
||||
|
||||
#define VM_PHYS_SIZE (USRIOSIZE * NBPG)
|
||||
|
||||
#define __HAVE_PMAP_PHYSSEG
|
||||
|
||||
struct pmap_physseg {
|
||||
struct pv_entry *pvent;
|
||||
char *attrs;
|
||||
};
|
||||
|
||||
#define VM_PHYSSEG_MAX 16 /* 1? */
|
||||
#define VM_PHYSSEG_STRAT VM_PSTRAT_BSEARCH
|
||||
#define VM_PHYSSEG_NOADD /* can't add RAM after vm_mem_init */
|
||||
|
||||
#define VM_NFREELIST 1
|
||||
#define VM_FREELIST_DEFAULT 0
|
||||
|
||||
#endif /* _MACHINE_VMPARAM_H_ */
|
@ -1,154 +0,0 @@
|
||||
/* $NetBSD: walnut.h,v 1.4 2002/03/13 19:27:02 eeh Exp $ */
|
||||
|
||||
/* include/eval.h, openbios_walnut, walnut_bios 8/10/00 14:35:05 */
|
||||
/*-----------------------------------------------------------------------------+
|
||||
|
|
||||
| This source code has been made available to you by IBM on an AS-IS
|
||||
| basis. Anyone receiving this source is licensed under IBM
|
||||
| copyrights to use it in any way he or she deems fit, including
|
||||
| copying it, modifying it, compiling it, and redistributing it either
|
||||
| with or without modifications. No license under IBM patents or
|
||||
| patent applications is to be implied by the copyright license.
|
||||
|
|
||||
| Any user of this software should understand that IBM cannot provide
|
||||
| technical support for this software and will not be responsible for
|
||||
| any consequences resulting from the use of this software.
|
||||
|
|
||||
| Any person who transfers this source code or any derivative work
|
||||
| must include the IBM copyright notice, this paragraph, and the
|
||||
| preceding two paragraphs in the transferred software.
|
||||
|
|
||||
| COPYRIGHT I B M CORPORATION 1995
|
||||
| LICENSED MATERIAL - PROGRAM PROPERTY OF I B M
|
||||
+-----------------------------------------------------------------------------*/
|
||||
/*-----------------------------------------------------------------------------+
|
||||
|
|
||||
| File Name: eval.h
|
||||
|
|
||||
| Function: Openbios board specific defines. Should contain no
|
||||
| prototypes since this file gets included in assembly files.
|
||||
|
|
||||
| Author: James Burke
|
||||
|
|
||||
| Change Activity-
|
||||
|
|
||||
| Date Description of Change BY
|
||||
| --------- --------------------- ---
|
||||
| 11-May-99 Created for Walnut JWB
|
||||
| 01-Jul-99 Made ROM/SRAM non-cacheable in D_CACHEABLE_REGIONS JWB
|
||||
| 08-Aug-00 Added memory regions and MMIO regions for ROM Monitor debug JWB
|
||||
| 10-Aug-00 Modified PCI memory regions JWB
|
||||
|
|
||||
+-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef _WALNUT_H_
|
||||
#define _WALNUT_H_
|
||||
|
||||
/*----------------------------------------------------------------------------+
|
||||
| 405GP PCI core memory map defines.
|
||||
+----------------------------------------------------------------------------*/
|
||||
#define MIN_PCI_MEMADDR_NOPREFETCH 0x80000000
|
||||
#define MIN_PCI_MEMADDR_PREFETCH 0xc0000000
|
||||
#define MIN_PCI_MEMADDR_VGA 0x00000000
|
||||
#define MIN_PLB_PCI_IOADDR 0xe8000000 /* PLB side of PCI I/O address space */
|
||||
#define MIN_PCI_PCI_IOADDR 0x00000000 /* PCI side of PCI I/O address space */
|
||||
#define MAX_PCI_DEVICES 5
|
||||
|
||||
#define SRAM_START_ADDR 0xfff00000 /* SRAM starting addr */
|
||||
#define SRAM_SIZE 0x80000 /* SRAM size - 512K */
|
||||
|
||||
/*----------------------------------------------------------------------------+
|
||||
| Universal Interrupt Controller (UIC) events for the Walnut board.
|
||||
+----------------------------------------------------------------------------*/
|
||||
/* Walnut board external IRQs */
|
||||
#define EXT_IRQ_FPGA UIC_E0IS /* IRQ 25 */
|
||||
#define EXT_IRQ_SMI UIC_E1IS /* IRQ 26 */
|
||||
#define EXT_IRQ_UNUSED UIC_E2IS /* IRQ 27 */
|
||||
#define EXT_IRQ_PCI_SLOT3 UIC_E3IS /* IRQ 28 */
|
||||
#define EXT_IRQ_PCI_SLOT2 UIC_E4IS /* IRQ 29 */
|
||||
#define EXT_IRQ_PCI_SLOT1 UIC_E5IS /* IRQ 30 */
|
||||
#define EXT_IRQ_PCI_SLOT0 UIC_E6IS /* IRQ 31 */
|
||||
|
||||
#define EXT_IRQ_CASCADE EXT_IRQ_FPGA
|
||||
#define EXT_IRQ_EXPANSION EXT_IRQ_FPGA
|
||||
#define EXT_IRQ_IR EXT_IRQ_FPGA
|
||||
#define EXT_IRQ_KEYBOARD EXT_IRQ_FPGA
|
||||
#define EXT_IRQ_MOUSE EXT_IRQ_FPGA
|
||||
|
||||
/*-----------------------------------------------------------------------------+
|
||||
| Defines for the RTC/NVRAM.
|
||||
+-----------------------------------------------------------------------------*/
|
||||
#define NVRAM_BASE 0xf0000000
|
||||
#if 0
|
||||
#define RTC_CONTROL 0x1ff8
|
||||
#define RTC_SECONDS 0x1ff9
|
||||
#define RTC_MINUTES 0x1ffa
|
||||
#define RTC_HOURS 0x1ffb
|
||||
#define RTC_DAY 0x1ffc
|
||||
#define RTC_DATE 0x1ffd
|
||||
#define RTC_MONTH 0x1ffe
|
||||
#define RTC_YEAR 0x1fff
|
||||
#endif
|
||||
|
||||
/*-----------------------------------------------------------------------------+
|
||||
| Defines for the Keyboard/Mouse controller.
|
||||
+-----------------------------------------------------------------------------*/
|
||||
#define KEY_MOUSE_BASE 0xf0100000
|
||||
#define KEY_MOUSE_DATA 0x0
|
||||
#define KEY_MOUSE_CMD 0x1 /* write only */
|
||||
#define KEY_MOUSE_STAT 0x1 /* read only */
|
||||
|
||||
/*-----------------------------------------------------------------------------+
|
||||
| Defines for FPGA regs.
|
||||
+-----------------------------------------------------------------------------*/
|
||||
#define FPGA_BASE 0xf0300000
|
||||
#define FPGA_INT_STATUS 0x00 /* Int status - read only */
|
||||
#define FPGA_SW_SMI 0x10 /* SW_SMI_N present */
|
||||
#define FPGA_EXT_IRQ 0x08 /* EXT_IRQ present */
|
||||
#define FPGA_IRQ_IRDA 0x04 /* IRQ_IRDA present */
|
||||
#define FPGA_IRQ_KYBD 0x02 /* IRQ_KYBD present */
|
||||
#define FPGA_IRQ_MOUSE 0x01 /* IRQ_MOUSE present */
|
||||
#define FPGA_INT_ENABLE 0x01 /* Int enable */
|
||||
/* FPGA_SW_SMI */ /* enable SW_SMI_N */
|
||||
/* FPGA_EXT_IRQ */ /* enable FPGA_EXT_IRQ */
|
||||
/* FPGA_IRQ_IRDA */ /* enable FPGA_IRQ_IRDA */
|
||||
/* FPGA_IRQ_KYBD */ /* enable FPGA_IRQ_KYBD */
|
||||
/* FPGA_IRQ_MOUSE */ /* enable FPGA_IRQ_MOUSE */
|
||||
#define FPGA_INT_POL 0x02 /* Int polarity */
|
||||
/* FPGA_SW_SMI */ /* SW_SMI_N active high/rising */
|
||||
/* FPGA_EXT_IRQ */ /* FPGA_EXT_IRQ active high/rising */
|
||||
/* FPGA_IRQ_IRDA */ /* FPGA_IRQ_IRDA active high/rising */
|
||||
/* FPGA_IRQ_KYBD */ /* FPGA_IRQ_KYBD active high/rising */
|
||||
/* FPGA_IRQ_MOUSE */ /* FPGA_IRQ_MOUSE active high/rising */
|
||||
#define FPGA_INT_TRIG 0x03 /* Int type */
|
||||
/* FPGA_SW_SMI */ /* SW_SMI_N level */
|
||||
/* FPGA_EXT_IRQ */ /* FPGA_EXT_IRQ level */
|
||||
/* FPGA_IRQ_IRDA */ /* FPGA_IRQ_IRDA level */
|
||||
/* FPGA_IRQ_KYBD */ /* FPGA_IRQ_KYBD level */
|
||||
/* FPGA_IRQ_MOUSE */ /* FPGA_IRQ_MOUSE level */
|
||||
#define FPGA_BRDC 0x04 /* Board controls */
|
||||
#define FPGA_BRDC_INT 0x80 /* IRQ_MOUSE is separate */
|
||||
#define FPGA_BRDC_TC3 0x10 /* DMA_EOT/TC3 is set to TC */
|
||||
#define FPGA_BRDC_TC2 0x08 /* DMA_EOT/TC2 is set to TC */
|
||||
#define FPGA_BRDC_DIS_EI 0x04 /* disable expansion interface */
|
||||
#define FPGA_BRDC_EN_INV 0x02 /* enable invalid address checking */
|
||||
#define FPGA_BRDC_UART_CR 0x01 /* UART1 is set to CTS/RTS */
|
||||
#define FPGA_BRDS1 0x05 /* Board status - read only */
|
||||
#define FPGA_BRDS1_CLK 0x04 /* 405 SDRAM CLK disabled, MPC972 used */
|
||||
#define FPGA_BRDS1_FLASH_EN 0x02 /* On board FLASH disabled */
|
||||
#define FPGA_BRDS1_FLASH_SEL 0x01 /* FLASH at low addr */
|
||||
#define FPGA_BRDS2 0x06 /* Board status - read only */
|
||||
#define SW_CLK_SRC1 0x40 /* if async pci, ext or int clk */
|
||||
#define SW_SEL1 0x20 /* use test clock for master clock */
|
||||
#define SW_SEL0 0x10 /* use 405GP arbiter */
|
||||
#define FSEL_B 0x0c /* use for mask */
|
||||
#define FSEL_SDRAM100 0x01 /* select 100Mhz SDRAM */
|
||||
#define FSEL_SDRAM66 0x03 /* select 66Mhz SDRAM */
|
||||
#define FSEL_A 0x03 /* use for mask */
|
||||
#define FSEL_PCI_66 0x01 /* select 66Mhz async int PCI */
|
||||
#define FSEL_PCI_33 0x03 /* select 33Mhz async int PCI */
|
||||
#define FPGA_SPARE1 0x0e /* Spare inputs - read only */
|
||||
#define FPGA_SPARE2 0x0f /* Spare outputs */
|
||||
#define FPGA_SIZE FPGA_SPARE2
|
||||
|
||||
#endif /* _WALNUT_H_ */
|
@ -1,204 +0,0 @@
|
||||
/* $NetBSD: pchb.c,v 1.13 2002/11/01 09:16:28 simonb Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Jason R. Thorpe.
|
||||
*
|
||||
* 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 the NetBSD
|
||||
* Foundation, Inc. and its contributors.
|
||||
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#include "pci.h"
|
||||
#include "opt_pci.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/extent.h>
|
||||
#include <sys/malloc.h>
|
||||
|
||||
#define _IBM4XX_BUS_DMA_PRIVATE
|
||||
#include <machine/walnut.h>
|
||||
|
||||
#include <powerpc/ibm4xx/ibm405gp.h>
|
||||
#include <powerpc/ibm4xx/dev/plbvar.h>
|
||||
|
||||
#include <dev/pci/pcivar.h>
|
||||
#include <dev/pci/pcireg.h>
|
||||
#include <dev/pci/pcidevs.h>
|
||||
#include <dev/pci/pciconf.h>
|
||||
|
||||
static int pchbmatch(struct device *, struct cfdata *, void *);
|
||||
static void pchbattach(struct device *, struct device *, void *);
|
||||
static int pchbprint(void *, const char *);
|
||||
|
||||
CFATTACH_DECL(pchb, sizeof(struct device),
|
||||
pchbmatch, pchbattach, NULL, NULL);
|
||||
|
||||
static int pcifound = 0;
|
||||
|
||||
static int
|
||||
pchbmatch(struct device *parent, struct cfdata *cf, void *aux)
|
||||
{
|
||||
struct plb_attach_args *paa = aux;
|
||||
/* XXX chipset tag unused by walnut, so just pass 0 */
|
||||
pci_chipset_tag_t pc = 0;
|
||||
pcitag_t tag;
|
||||
int class, id;
|
||||
|
||||
/* match only pchb devices */
|
||||
if (strcmp(paa->plb_name, cf->cf_name) != 0)
|
||||
return 0;
|
||||
|
||||
pci_machdep_init();
|
||||
tag = pci_make_tag(pc, 0, 0, 0);
|
||||
|
||||
class = pci_conf_read(pc, tag, PCI_CLASS_REG);
|
||||
id = pci_conf_read(pc, tag, PCI_ID_REG);
|
||||
|
||||
/*
|
||||
* Match all known PCI host chipsets.
|
||||
*/
|
||||
if (PCI_CLASS(class) == PCI_CLASS_BRIDGE &&
|
||||
PCI_SUBCLASS(class) == PCI_SUBCLASS_BRIDGE_HOST) {
|
||||
switch (PCI_VENDOR(id)) {
|
||||
case PCI_VENDOR_IBM:
|
||||
switch (PCI_PRODUCT(id)) {
|
||||
case PCI_PRODUCT_IBM_405GP:
|
||||
return (!pcifound);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
static void
|
||||
pchbattach(struct device *parent, struct device *self, void *aux)
|
||||
{
|
||||
struct pcibus_attach_args pba;
|
||||
char devinfo[256];
|
||||
#ifdef PCI_NETBSD_CONFIGURE
|
||||
struct extent *ioext, *memext;
|
||||
#ifdef PCI_CONFIGURE_VERBOSE
|
||||
extern int pci_conf_debug;
|
||||
|
||||
pci_conf_debug = 1;
|
||||
#endif
|
||||
#endif
|
||||
pci_chipset_tag_t pc = 0;
|
||||
pcitag_t tag;
|
||||
int class, id;
|
||||
|
||||
pci_machdep_init();
|
||||
tag = pci_make_tag(pc, 0, 0, 0);
|
||||
|
||||
class = pci_conf_read(pc, tag, PCI_CLASS_REG);
|
||||
id = pci_conf_read(pc, tag, PCI_ID_REG);
|
||||
|
||||
printf("\n");
|
||||
pcifound++;
|
||||
/*
|
||||
* All we do is print out a description. Eventually, we
|
||||
* might want to add code that does something that's
|
||||
* possibly chipset-specific.
|
||||
*/
|
||||
|
||||
pci_devinfo(id, class, 0, devinfo);
|
||||
printf("%s: %s (rev. 0x%02x)\n", self->dv_xname, devinfo,
|
||||
PCI_REVISION(class));
|
||||
|
||||
pci_machdep_init(); /* Redundant... */
|
||||
ibm4xx_setup_pci();
|
||||
#ifdef PCI_CONFIGURE_VERBOSE
|
||||
ibm4xx_show_pci_map();
|
||||
#endif
|
||||
|
||||
#ifdef PCI_NETBSD_CONFIGURE
|
||||
memext = extent_create("pcimem", MIN_PCI_MEMADDR_NOPREFETCH,
|
||||
MIN_PCI_MEMADDR_NOPREFETCH + 0x1fffffff, M_DEVBUF, NULL, 0,
|
||||
EX_NOWAIT);
|
||||
ioext = extent_create("pciio", MIN_PCI_PCI_IOADDR,
|
||||
MIN_PCI_PCI_IOADDR + 0xffff, M_DEVBUF, NULL, 0, EX_NOWAIT);
|
||||
pci_configure_bus(0, ioext, memext, NULL, 0, 32);
|
||||
extent_destroy(memext);
|
||||
extent_destroy(ioext);
|
||||
#endif /* PCI_NETBSD_CONFIGURE */
|
||||
|
||||
#ifdef PCI_CONFIGURE_VERBOSE
|
||||
printf("running config_found PCI\n");
|
||||
#endif
|
||||
pba.pba_busname = "pci";
|
||||
/* IO window located @ e8000000 and maps to 0-0xffff */
|
||||
pba.pba_iot = ibm4xx_make_bus_space_tag(MIN_PLB_PCI_IOADDR, 0);
|
||||
/* PCI memory window is directly mapped */
|
||||
pba.pba_memt = ibm4xx_make_bus_space_tag(0, 0);
|
||||
pba.pba_dmat = &ibm4xx_default_bus_dma_tag;
|
||||
pba.pba_bus = 0;
|
||||
pba.pba_bridgetag = NULL;
|
||||
pba.pba_flags = PCI_FLAGS_MEM_ENABLED | PCI_FLAGS_IO_ENABLED;
|
||||
config_found(self, &pba, pchbprint);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
pchbprint(void *aux, const char *p)
|
||||
{
|
||||
|
||||
if (p == NULL)
|
||||
return (UNCONF);
|
||||
return (QUIET);
|
||||
}
|
||||
|
||||
#if 0
|
||||
static void
|
||||
scan_pci_bus(void)
|
||||
{
|
||||
pcitag_t tag;
|
||||
int i, x;
|
||||
|
||||
for (i=0;i<32;i++){
|
||||
tag = pci_make_tag(0, 0, i, 0);
|
||||
x = pci_conf_read(0, tag, 0);
|
||||
printf("%d tag=%08x : %08x\n", i, tag, x);
|
||||
#if 0
|
||||
if (PCI_VENDOR(x) == PCI_VENDOR_INTEL
|
||||
&& PCI_PRODUCT(x) == PCI_PRODUCT_INTEL_80960_RP) {
|
||||
/* Do not configure PCI bus analyzer */
|
||||
continue;
|
||||
}
|
||||
x = pci_conf_read(0, tag, PCI_COMMAND_STATUS_REG);
|
||||
x |= PCI_COMMAND_IO_ENABLE | PCI_COMMAND_MEM_ENABLE | PCI_COMMAND_MASTER_ENABLE;
|
||||
pci_conf_write(0, tag, PCI_COMMAND_STATUS_REG, x);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif
|
@ -1,261 +0,0 @@
|
||||
/* $NetBSD: pci_machdep.c,v 1.11 2002/09/27 15:37:01 provos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
|
||||
* Copyright (c) 1994 Charles M. Hannum. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Charles M. Hannum.
|
||||
* 4. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Machine-specific functions for PCI autoconfiguration.
|
||||
*
|
||||
* On PCs, there are two methods of generating PCI configuration cycles.
|
||||
* We try to detect the appropriate mechanism for this machine and set
|
||||
* up a few function pointers to access the correct method directly.
|
||||
*
|
||||
* The configuration method can be hard-coded in the config file by
|
||||
* using `options PCI_CONF_MODE=N', where `N' is the configuration mode
|
||||
* as defined section 3.6.4.1, `Generating Configuration Cycles'.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/errno.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/extent.h>
|
||||
|
||||
#include <uvm/uvm_extern.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
#include <machine/intr.h>
|
||||
|
||||
#include <dev/pci/pcivar.h>
|
||||
#include <dev/pci/pcireg.h>
|
||||
#include <dev/pci/pcidevs.h>
|
||||
#include <dev/pci/pciconf.h>
|
||||
|
||||
#include <powerpc/ibm4xx/ibm405gp.h>
|
||||
#include <powerpc/ibm4xx/dev/pcicreg.h>
|
||||
|
||||
static bus_space_tag_t pci_iot;
|
||||
static bus_space_handle_t pci_ioh;
|
||||
|
||||
void pci_machdep_init(void)
|
||||
{
|
||||
|
||||
if (pci_ioh == 0) {
|
||||
pci_iot = 0;
|
||||
if (bus_space_map(pci_iot, IBM405GP_PCIC0_BASE, 8, 0, &pci_ioh)){
|
||||
panic("Cannot map PCI registers");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
pci_attach_hook(struct device *parent, struct device *self,
|
||||
struct pcibus_attach_args *pba)
|
||||
{
|
||||
|
||||
#ifdef PCI_CONFIGURE_VERBOSE
|
||||
printf("pci_attach_hook\n");
|
||||
ibm4xx_show_pci_map();
|
||||
#endif
|
||||
ibm4xx_setup_pci();
|
||||
#ifdef PCI_CONFIGURE_VERBOSE
|
||||
ibm4xx_show_pci_map();
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
pci_bus_maxdevs(pci_chipset_tag_t pc, int busno)
|
||||
{
|
||||
|
||||
/*
|
||||
* Bus number is irrelevant. Configuration Mechanism 1 is in
|
||||
* use, can have devices 0-32 (i.e. the `normal' range).
|
||||
*/
|
||||
return 5;
|
||||
}
|
||||
|
||||
pcitag_t
|
||||
pci_make_tag(pci_chipset_tag_t pc, int bus, int device, int function)
|
||||
{
|
||||
pcitag_t tag;
|
||||
|
||||
if (bus >= 256 || device >= 32 || function >= 8)
|
||||
panic("pci_make_tag: bad request");
|
||||
|
||||
/* XXX magic number */
|
||||
tag = 0x80000000 | (bus << 16) | (device << 11) | (function << 8);
|
||||
|
||||
return tag;
|
||||
}
|
||||
|
||||
void
|
||||
pci_decompose_tag(pci_chipset_tag_t pc, pcitag_t tag, int *bp, int *dp, int *fp)
|
||||
{
|
||||
|
||||
if (bp != NULL)
|
||||
*bp = (tag >> 16) & 0xff;
|
||||
if (dp != NULL)
|
||||
*dp = (tag >> 11) & 0x1f;
|
||||
if (fp != NULL)
|
||||
*fp = (tag >> 8) & 0x07;
|
||||
}
|
||||
|
||||
pcireg_t
|
||||
pci_conf_read(pci_chipset_tag_t pc, pcitag_t tag, int reg)
|
||||
{
|
||||
pcireg_t data;
|
||||
|
||||
/* 405GT BIOS disables interrupts here. Should we? --Art */
|
||||
bus_space_write_4(pci_iot, pci_ioh, PCIC_CFGADDR, tag | reg);
|
||||
data = bus_space_read_4(pci_iot, pci_ioh, PCIC_CFGDATA);
|
||||
bus_space_write_4(pci_iot, pci_ioh, PCIC_CFGADDR, 0); /* 405GP pass2 errata #6 */
|
||||
return data;
|
||||
}
|
||||
|
||||
void
|
||||
pci_conf_write(pci_chipset_tag_t pc, pcitag_t tag, int reg, pcireg_t data)
|
||||
{
|
||||
|
||||
bus_space_write_4(pci_iot, pci_ioh, PCIC_CFGADDR, tag | reg);
|
||||
bus_space_write_4(pci_iot, pci_ioh, PCIC_CFGDATA, data);
|
||||
bus_space_write_4(pci_iot, pci_ioh, PCIC_CFGADDR, 0); /* 405GP pass2 errata #6 */
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
pci_intr_map(struct pci_attach_args *pa, pci_intr_handle_t *ihp)
|
||||
{
|
||||
int pin = pa->pa_intrpin;
|
||||
int dev = pa->pa_device;
|
||||
|
||||
if (pin == 0) {
|
||||
/* No IRQ used. */
|
||||
goto bad;
|
||||
}
|
||||
|
||||
if (pin > 4) {
|
||||
printf("pci_intr_map: bad interrupt pin %d\n", pin);
|
||||
goto bad;
|
||||
}
|
||||
|
||||
/*
|
||||
* We need to map the interrupt pin to the interrupt bit in the UIC
|
||||
* associated with it. This is highly machine-dependent.
|
||||
*/
|
||||
switch(dev) {
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
*ihp = 27 + dev;
|
||||
break;
|
||||
default:
|
||||
printf("Hmm.. PCI device %d should not exist on this board\n",
|
||||
dev);
|
||||
goto bad;
|
||||
}
|
||||
return 0;
|
||||
|
||||
bad:
|
||||
*ihp = -1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
const char *
|
||||
pci_intr_string(pci_chipset_tag_t pc, pci_intr_handle_t ih)
|
||||
{
|
||||
static char irqstr[8]; /* 4 + 2 + NUL + sanity */
|
||||
|
||||
if (ih == 0 || ih >= ICU_LEN)
|
||||
panic("pci_intr_string: bogus handle 0x%x", ih);
|
||||
|
||||
sprintf(irqstr, "irq %d", ih);
|
||||
return (irqstr);
|
||||
|
||||
}
|
||||
|
||||
const struct evcnt *
|
||||
pci_intr_evcnt(pci_chipset_tag_t pc, pci_intr_handle_t ih)
|
||||
{
|
||||
|
||||
/* XXX for now, no evcnt parent reported */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void *
|
||||
pci_intr_establish(pci_chipset_tag_t pc, pci_intr_handle_t ih, int level,
|
||||
int (*func)(void *), void *arg)
|
||||
{
|
||||
|
||||
if (ih == 0 || ih >= ICU_LEN)
|
||||
panic("pci_intr_establish: bogus handle 0x%x", ih);
|
||||
|
||||
return intr_establish(ih, IST_LEVEL, level, func, arg);
|
||||
}
|
||||
|
||||
void
|
||||
pci_intr_disestablish(pci_chipset_tag_t pc, void *cookie)
|
||||
{
|
||||
|
||||
intr_disestablish(cookie);
|
||||
}
|
||||
|
||||
void
|
||||
pci_conf_interrupt(pci_chipset_tag_t pc, int bus, int dev, int pin,
|
||||
int swiz, int *iline)
|
||||
{
|
||||
|
||||
if (bus == 0) {
|
||||
switch(dev) {
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
*iline = 31 - dev;
|
||||
}
|
||||
} else {
|
||||
*iline = 20 + ((swiz + dev + 1) & 3);
|
||||
}
|
||||
}
|
||||
|
||||
/* Avoid overconfiguration */
|
||||
int
|
||||
pci_conf_hook(pci_chipset_tag_t pc, int bus, int dev, int func, pcireg_t id)
|
||||
{
|
||||
|
||||
if ((PCI_VENDOR(id) == PCI_VENDOR_IBM && PCI_PRODUCT(id) == PCI_PRODUCT_IBM_405GP) ||
|
||||
(PCI_VENDOR(id) == PCI_VENDOR_INTEL && PCI_PRODUCT(id) == PCI_PRODUCT_INTEL_80960_RP)) {
|
||||
/* Don't configure the bridge and PCI probe. */
|
||||
return 0;
|
||||
}
|
||||
return PCI_CONF_ALL & ~PCI_CONF_MAP_ROM;
|
||||
}
|
@ -1,90 +0,0 @@
|
||||
/* $NetBSD: autoconf.c,v 1.5 2002/08/23 11:40:08 scw Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
|
||||
* Copyright (C) 1995, 1996 TooLs GmbH.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by TooLs GmbH.
|
||||
* 4. The name of TooLs GmbH may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``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 TOOLS GMBH 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/param.h>
|
||||
#include <sys/conf.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/systm.h>
|
||||
|
||||
#include <powerpc/ibm4xx/dev/plbvar.h>
|
||||
|
||||
#include <machine/dcr.h>
|
||||
|
||||
struct device *booted_device;
|
||||
int booted_partition;
|
||||
|
||||
/*
|
||||
* List of port-specific devices to attach to the processor local bus.
|
||||
*/
|
||||
static const struct plb_dev local_plb_devs [] = {
|
||||
{ "pbus", },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
/*
|
||||
* Determine device configuration for a machine.
|
||||
*/
|
||||
void
|
||||
cpu_configure(void)
|
||||
{
|
||||
|
||||
intr_init();
|
||||
calc_delayconst();
|
||||
|
||||
/* Make sure that timers run at CPU frequency */
|
||||
mtdcr(DCR_CPC0_CR1, mfdcr(DCR_CPC0_CR1) & ~CPC0_CR1_CETE);
|
||||
|
||||
if (config_rootfound("plb", &local_plb_devs) == NULL)
|
||||
panic("configure: plb not configured");
|
||||
|
||||
printf("biomask %x netmask %x ttymask %x\n", (u_short)imask[IPL_BIO],
|
||||
(u_short)imask[IPL_NET], (u_short)imask[IPL_TTY]);
|
||||
|
||||
(void)spl0();
|
||||
|
||||
/*
|
||||
* Now allow hardware interrupts.
|
||||
*/
|
||||
asm volatile ("wrteei 1");
|
||||
}
|
||||
|
||||
/*
|
||||
* Setup root device.
|
||||
* Configure swap area.
|
||||
*/
|
||||
void
|
||||
cpu_rootconf(void)
|
||||
{
|
||||
|
||||
setroot(booted_device, booted_partition);
|
||||
}
|
@ -1,651 +0,0 @@
|
||||
/* $NetBSD: bus_dma.c,v 1.7 2002/11/25 05:12:06 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997, 1998 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.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the NetBSD
|
||||
* Foundation, Inc. and its contributors.
|
||||
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/mbuf.h>
|
||||
|
||||
#include <uvm/uvm_extern.h>
|
||||
|
||||
#define _IBM4XX_BUS_DMA_PRIVATE
|
||||
#include <machine/bus.h>
|
||||
#include <machine/intr.h>
|
||||
|
||||
int _bus_dmamap_load_buffer(bus_dma_tag_t, bus_dmamap_t, void *,
|
||||
bus_size_t, struct proc *, int, paddr_t *, int *, int);
|
||||
|
||||
/*
|
||||
* Common function for DMA map creation. May be called by bus-specific
|
||||
* DMA map creation functions.
|
||||
*/
|
||||
int
|
||||
_bus_dmamap_create(bus_dma_tag_t t, bus_size_t size, int nsegments,
|
||||
bus_size_t maxsegsz, bus_size_t boundary, int flags,
|
||||
bus_dmamap_t *dmamp)
|
||||
{
|
||||
struct ibm4xx_bus_dmamap *map;
|
||||
void *mapstore;
|
||||
size_t mapsize;
|
||||
|
||||
/*
|
||||
* Allocate and initialize the DMA map. The end of the map
|
||||
* is a variable-sized array of segments, so we allocate enough
|
||||
* room for them in one shot.
|
||||
*
|
||||
* Note we don't preserve the WAITOK or NOWAIT flags. Preservation
|
||||
* of ALLOCNOW notifies others that we've reserved these resources,
|
||||
* and they are not to be freed.
|
||||
*
|
||||
* The bus_dmamap_t includes one bus_dma_segment_t, hence
|
||||
* the (nsegments - 1).
|
||||
*/
|
||||
mapsize = sizeof(struct ibm4xx_bus_dmamap) +
|
||||
(sizeof(bus_dma_segment_t) * (nsegments - 1));
|
||||
if ((mapstore = malloc(mapsize, M_DMAMAP,
|
||||
(flags & BUS_DMA_NOWAIT) ? M_NOWAIT : M_WAITOK)) == NULL)
|
||||
return (ENOMEM);
|
||||
|
||||
memset(mapstore, 0, mapsize);
|
||||
map = (struct ibm4xx_bus_dmamap *)mapstore;
|
||||
map->_dm_size = size;
|
||||
map->_dm_segcnt = nsegments;
|
||||
map->_dm_maxsegsz = maxsegsz;
|
||||
map->_dm_boundary = boundary;
|
||||
map->_dm_bounce_thresh = t->_bounce_thresh;
|
||||
map->_dm_flags = flags & ~(BUS_DMA_WAITOK|BUS_DMA_NOWAIT);
|
||||
map->dm_mapsize = 0; /* no valid mappings */
|
||||
map->dm_nsegs = 0;
|
||||
|
||||
*dmamp = map;
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Common function for DMA map destruction. May be called by bus-specific
|
||||
* DMA map destruction functions.
|
||||
*/
|
||||
void
|
||||
_bus_dmamap_destroy(bus_dma_tag_t t, bus_dmamap_t map)
|
||||
{
|
||||
|
||||
free(map, M_DMAMAP);
|
||||
}
|
||||
|
||||
/*
|
||||
* Utility function to load a linear buffer. lastaddrp holds state
|
||||
* between invocations (for multiple-buffer loads). segp contains
|
||||
* the starting segment on entrance, and the ending segment on exit.
|
||||
* first indicates if this is the first invocation of this function.
|
||||
*/
|
||||
int
|
||||
_bus_dmamap_load_buffer(bus_dma_tag_t t, bus_dmamap_t map, void *buf,
|
||||
bus_size_t buflen, struct proc *p, int flags,
|
||||
paddr_t *lastaddrp, int *segp, int first)
|
||||
{
|
||||
bus_size_t sgsize;
|
||||
bus_addr_t curaddr, lastaddr, baddr, bmask;
|
||||
vaddr_t vaddr = (vaddr_t)buf;
|
||||
int seg;
|
||||
|
||||
lastaddr = *lastaddrp;
|
||||
bmask = ~(map->_dm_boundary - 1);
|
||||
|
||||
for (seg = *segp; buflen > 0 ; ) {
|
||||
/*
|
||||
* Get the physical address for this segment.
|
||||
*/
|
||||
if (p != NULL)
|
||||
(void) pmap_extract(p->p_vmspace->vm_map.pmap,
|
||||
vaddr, (void *)&curaddr);
|
||||
else
|
||||
curaddr = vtophys(vaddr);
|
||||
|
||||
/*
|
||||
* If we're beyond the bounce threshold, notify
|
||||
* the caller.
|
||||
*/
|
||||
if (map->_dm_bounce_thresh != 0 &&
|
||||
curaddr >= map->_dm_bounce_thresh)
|
||||
return (EINVAL);
|
||||
|
||||
/*
|
||||
* Compute the segment size, and adjust counts.
|
||||
*/
|
||||
sgsize = NBPG - ((u_long)vaddr & PGOFSET);
|
||||
if (buflen < sgsize)
|
||||
sgsize = buflen;
|
||||
|
||||
/*
|
||||
* Make sure we don't cross any boundaries.
|
||||
*/
|
||||
if (map->_dm_boundary > 0) {
|
||||
baddr = (curaddr + map->_dm_boundary) & bmask;
|
||||
if (sgsize > (baddr - curaddr))
|
||||
sgsize = (baddr - curaddr);
|
||||
}
|
||||
|
||||
/*
|
||||
* Insert chunk into a segment, coalescing with
|
||||
* the previous segment if possible.
|
||||
*/
|
||||
if (first) {
|
||||
map->dm_segs[seg].ds_addr = curaddr;
|
||||
map->dm_segs[seg].ds_len = sgsize;
|
||||
first = 0;
|
||||
} else {
|
||||
if (curaddr == lastaddr &&
|
||||
(map->dm_segs[seg].ds_len + sgsize) <=
|
||||
map->_dm_maxsegsz &&
|
||||
(map->_dm_boundary == 0 ||
|
||||
(map->dm_segs[seg].ds_addr & bmask) ==
|
||||
(curaddr & bmask)))
|
||||
map->dm_segs[seg].ds_len += sgsize;
|
||||
else {
|
||||
if (++seg >= map->_dm_segcnt)
|
||||
break;
|
||||
map->dm_segs[seg].ds_addr = curaddr;
|
||||
map->dm_segs[seg].ds_len = sgsize;
|
||||
}
|
||||
}
|
||||
|
||||
lastaddr = curaddr + sgsize;
|
||||
vaddr += sgsize;
|
||||
buflen -= sgsize;
|
||||
}
|
||||
|
||||
*segp = seg;
|
||||
*lastaddrp = lastaddr;
|
||||
|
||||
/*
|
||||
* Did we fit?
|
||||
*/
|
||||
if (buflen != 0)
|
||||
return (EFBIG); /* XXX better return value here? */
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Common function for loading a DMA map with a linear buffer. May
|
||||
* be called by bus-specific DMA map load functions.
|
||||
*/
|
||||
int
|
||||
_bus_dmamap_load(bus_dma_tag_t t, bus_dmamap_t map, void *buf,
|
||||
bus_size_t buflen, struct proc *p, int flags)
|
||||
{
|
||||
paddr_t lastaddr;
|
||||
int seg, error;
|
||||
|
||||
/*
|
||||
* Make sure that on error condition we return "no valid mappings".
|
||||
*/
|
||||
map->dm_mapsize = 0;
|
||||
map->dm_nsegs = 0;
|
||||
|
||||
if (buflen > map->_dm_size)
|
||||
return (EINVAL);
|
||||
|
||||
seg = 0;
|
||||
error = _bus_dmamap_load_buffer(t, map, buf, buflen, p, flags,
|
||||
&lastaddr, &seg, 1);
|
||||
if (error == 0) {
|
||||
map->dm_mapsize = buflen;
|
||||
map->dm_nsegs = seg + 1;
|
||||
}
|
||||
return (error);
|
||||
}
|
||||
|
||||
/*
|
||||
* Like _bus_dmamap_load(), but for mbufs.
|
||||
*/
|
||||
int
|
||||
_bus_dmamap_load_mbuf(bus_dma_tag_t t, bus_dmamap_t map, struct mbuf *m0,
|
||||
int flags)
|
||||
{
|
||||
paddr_t lastaddr;
|
||||
int seg, error, first;
|
||||
struct mbuf *m;
|
||||
|
||||
/*
|
||||
* Make sure that on error condition we return "no valid mappings."
|
||||
*/
|
||||
map->dm_mapsize = 0;
|
||||
map->dm_nsegs = 0;
|
||||
|
||||
#ifdef DIAGNOSTIC
|
||||
if ((m0->m_flags & M_PKTHDR) == 0)
|
||||
panic("_bus_dmamap_load_mbuf: no packet header");
|
||||
#endif
|
||||
|
||||
if (m0->m_pkthdr.len > map->_dm_size)
|
||||
return (EINVAL);
|
||||
|
||||
first = 1;
|
||||
seg = 0;
|
||||
error = 0;
|
||||
for (m = m0; m != NULL && error == 0; m = m->m_next) {
|
||||
error = _bus_dmamap_load_buffer(t, map, m->m_data, m->m_len,
|
||||
NULL, flags, &lastaddr, &seg, first);
|
||||
first = 0;
|
||||
}
|
||||
if (error == 0) {
|
||||
map->dm_mapsize = m0->m_pkthdr.len;
|
||||
map->dm_nsegs = seg + 1;
|
||||
}
|
||||
return (error);
|
||||
}
|
||||
|
||||
/*
|
||||
* Like _bus_dmamap_load(), but for uios.
|
||||
*/
|
||||
int
|
||||
_bus_dmamap_load_uio(bus_dma_tag_t t, bus_dmamap_t map, struct uio *uio,
|
||||
int flags)
|
||||
{
|
||||
paddr_t lastaddr;
|
||||
int seg, i, error, first;
|
||||
bus_size_t minlen, resid;
|
||||
struct proc *p = NULL;
|
||||
struct iovec *iov;
|
||||
caddr_t addr;
|
||||
|
||||
/*
|
||||
* Make sure that on error condition we return "no valid mappings."
|
||||
*/
|
||||
map->dm_mapsize = 0;
|
||||
map->dm_nsegs = 0;
|
||||
|
||||
resid = uio->uio_resid;
|
||||
iov = uio->uio_iov;
|
||||
|
||||
if (uio->uio_segflg == UIO_USERSPACE) {
|
||||
p = uio->uio_procp;
|
||||
#ifdef DIAGNOSTIC
|
||||
if (p == NULL)
|
||||
panic("_bus_dmamap_load_uio: USERSPACE but no proc");
|
||||
#endif
|
||||
}
|
||||
|
||||
first = 1;
|
||||
seg = 0;
|
||||
error = 0;
|
||||
for (i = 0; i < uio->uio_iovcnt && resid != 0 && error == 0; i++) {
|
||||
/*
|
||||
* Now at the first iovec to load. Load each iovec
|
||||
* until we have exhausted the residual count.
|
||||
*/
|
||||
minlen = resid < iov[i].iov_len ? resid : iov[i].iov_len;
|
||||
addr = (caddr_t)iov[i].iov_base;
|
||||
|
||||
error = _bus_dmamap_load_buffer(t, map, addr, minlen,
|
||||
p, flags, &lastaddr, &seg, first);
|
||||
first = 0;
|
||||
|
||||
resid -= minlen;
|
||||
}
|
||||
if (error == 0) {
|
||||
map->dm_mapsize = uio->uio_resid;
|
||||
map->dm_nsegs = seg + 1;
|
||||
}
|
||||
return (error);
|
||||
}
|
||||
|
||||
/*
|
||||
* Like _bus_dmamap_load(), but for raw memory.
|
||||
*/
|
||||
int
|
||||
_bus_dmamap_load_raw(bus_dma_tag_t t, bus_dmamap_t map, bus_dma_segment_t *segs,
|
||||
int nsegs, bus_size_t size, int flags)
|
||||
{
|
||||
|
||||
panic("_bus_dmamap_load_raw: not implemented");
|
||||
}
|
||||
|
||||
/*
|
||||
* Common function for unloading a DMA map. May be called by
|
||||
* chipset-specific DMA map unload functions.
|
||||
*/
|
||||
void
|
||||
_bus_dmamap_unload(bus_dma_tag_t t, bus_dmamap_t map)
|
||||
{
|
||||
|
||||
/*
|
||||
* No resources to free; just mark the mappings as
|
||||
* invalid.
|
||||
*/
|
||||
map->dm_mapsize = 0;
|
||||
map->dm_nsegs = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Common function for DMA map synchronization. May be called
|
||||
* by chipset-specific DMA map synchronization functions.
|
||||
*/
|
||||
void
|
||||
_bus_dmamap_sync(bus_dma_tag_t t, bus_dmamap_t map, bus_addr_t offset,
|
||||
bus_size_t len, int ops)
|
||||
{
|
||||
bus_addr_t addr, startline, endline, cachemask;
|
||||
bus_size_t cachestride;
|
||||
int i, minlen;
|
||||
|
||||
/*
|
||||
* Mixing PRE and POST operations is not allowed.
|
||||
*/
|
||||
if ((ops & (BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE)) != 0 &&
|
||||
(ops & (BUS_DMASYNC_POSTREAD|BUS_DMASYNC_POSTWRITE)) != 0)
|
||||
panic("_bus_dmamap_sync: mix PRE and POST");
|
||||
|
||||
#if 0
|
||||
/* We only care about PREREAD and PREWRITE */
|
||||
if ((ops & (BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE)) == 0)
|
||||
return;
|
||||
#endif
|
||||
cachestride = curcpu()->ci_ci.dcache_line_size;
|
||||
#ifdef DIAGNOSTIC
|
||||
if (cachestride<4)
|
||||
printf("_bus_dmamap_sync: WARNING line size %x\n", cachestride);
|
||||
#endif
|
||||
if (cachestride < 4) cachestride = 4;
|
||||
cachemask = ~(cachestride - 1);
|
||||
|
||||
for (i = 0; i < map->dm_nsegs && len != 0; i++) {
|
||||
/* Find the beginning segment. */
|
||||
if (offset >= map->dm_segs[i].ds_len) {
|
||||
offset -= map->dm_segs[i].ds_len;
|
||||
continue;
|
||||
}
|
||||
|
||||
/*
|
||||
* Now at the first segment to sync; nail
|
||||
* each segment until we have exhausted the
|
||||
* length.
|
||||
*/
|
||||
minlen = len < map->dm_segs[i].ds_len - offset ? len :
|
||||
map->dm_segs[i].ds_len - offset;
|
||||
|
||||
addr = map->dm_segs[i].ds_addr;
|
||||
|
||||
#if 0
|
||||
printf("bus_dmamap_sync: %s segment %d (%p + %x) \n",
|
||||
(ops & BUS_DMASYNC_PREREAD) ? "invalidate": "flush",
|
||||
i, addr + offset, minlen);
|
||||
#endif
|
||||
/* XXX does not deal with address wrap */
|
||||
|
||||
/* Cache line first byte belongs to */
|
||||
startline = (addr + offset) & cachemask;
|
||||
/* Cache line last byte belongs to */
|
||||
endline = ( addr + offset + minlen - 1) & cachemask;
|
||||
|
||||
if (ops & BUS_DMASYNC_PREREAD) {
|
||||
/*
|
||||
* Flush & Invalidate cache, so we'll re-read whatever's
|
||||
* in memory now.
|
||||
*/
|
||||
for (addr = startline; addr <= endline;
|
||||
addr += cachestride)
|
||||
asm volatile("dcbf 0,%0"::"r"(addr));
|
||||
} else if (ops & BUS_DMASYNC_PREWRITE) {
|
||||
/*
|
||||
* Flush cache so memory contains correct data.
|
||||
*/
|
||||
for (addr = startline; addr <= endline;
|
||||
addr += cachestride)
|
||||
asm volatile("dcbst 0,%0"::"r"(addr));
|
||||
} else if (ops & BUS_DMASYNC_POSTREAD){
|
||||
/*
|
||||
* Invalidate cache w/o flush, so we'll read whatever's
|
||||
* in memory.
|
||||
*/
|
||||
for (addr = startline; addr <= endline;
|
||||
addr += cachestride)
|
||||
asm volatile("dcbi 0,%0"::"r"(addr));
|
||||
}
|
||||
|
||||
offset = 0;
|
||||
len -= minlen;
|
||||
}
|
||||
asm volatile("eieio; sync; isync");
|
||||
}
|
||||
|
||||
/*
|
||||
* Common function for DMA-safe memory allocation. May be called
|
||||
* by bus-specific DMA memory allocation functions.
|
||||
*/
|
||||
int
|
||||
_bus_dmamem_alloc(bus_dma_tag_t t, bus_size_t size, bus_size_t alignment,
|
||||
bus_size_t boundary, bus_dma_segment_t *segs, int nsegs,
|
||||
int *rsegs, int flags)
|
||||
{
|
||||
paddr_t avail_start, avail_end;
|
||||
paddr_t curaddr, lastaddr, high;
|
||||
struct vm_page *m;
|
||||
struct pglist mlist;
|
||||
int curseg, error;
|
||||
|
||||
avail_start = vm_physmem[0].avail_start << PGSHIFT;
|
||||
avail_end = vm_physmem[vm_nphysseg - 1].avail_end << PGSHIFT;
|
||||
|
||||
/* Always round the size. */
|
||||
size = round_page(size);
|
||||
|
||||
high = avail_end - PAGE_SIZE;
|
||||
|
||||
/*
|
||||
* Allocate pages from the VM system.
|
||||
*/
|
||||
error = uvm_pglistalloc(size, avail_start, high, alignment, boundary,
|
||||
&mlist, nsegs, (flags & BUS_DMA_NOWAIT) == 0);
|
||||
if (error)
|
||||
return (error);
|
||||
|
||||
/*
|
||||
* Compute the location, size, and number of segments actually
|
||||
* returned by the VM code.
|
||||
*/
|
||||
m = mlist.tqh_first;
|
||||
curseg = 0;
|
||||
lastaddr = segs[curseg].ds_addr = VM_PAGE_TO_PHYS(m);
|
||||
segs[curseg].ds_len = PAGE_SIZE;
|
||||
m = m->pageq.tqe_next;
|
||||
|
||||
for (; m != NULL; m = m->pageq.tqe_next) {
|
||||
curaddr = VM_PAGE_TO_PHYS(m);
|
||||
#ifdef DIAGNOSTIC
|
||||
if (curaddr < avail_start || curaddr >= high) {
|
||||
printf("vm_page_alloc_memory returned non-sensical"
|
||||
" address 0x%lx\n", curaddr);
|
||||
panic("_bus_dmamem_alloc");
|
||||
}
|
||||
#endif
|
||||
if (curaddr == (lastaddr + PAGE_SIZE))
|
||||
segs[curseg].ds_len += PAGE_SIZE;
|
||||
else {
|
||||
curseg++;
|
||||
segs[curseg].ds_addr = curaddr;
|
||||
segs[curseg].ds_len = PAGE_SIZE;
|
||||
}
|
||||
lastaddr = curaddr;
|
||||
}
|
||||
|
||||
*rsegs = curseg + 1;
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Common function for freeing DMA-safe memory. May be called by
|
||||
* bus-specific DMA memory free functions.
|
||||
*/
|
||||
void
|
||||
_bus_dmamem_free(bus_dma_tag_t t, bus_dma_segment_t *segs, int nsegs)
|
||||
{
|
||||
struct vm_page *m;
|
||||
bus_addr_t addr;
|
||||
struct pglist mlist;
|
||||
int curseg;
|
||||
|
||||
/*
|
||||
* Build a list of pages to free back to the VM system.
|
||||
*/
|
||||
TAILQ_INIT(&mlist);
|
||||
for (curseg = 0; curseg < nsegs; curseg++) {
|
||||
for (addr = segs[curseg].ds_addr;
|
||||
addr < (segs[curseg].ds_addr + segs[curseg].ds_len);
|
||||
addr += PAGE_SIZE) {
|
||||
m = PHYS_TO_VM_PAGE(addr);
|
||||
TAILQ_INSERT_TAIL(&mlist, m, pageq);
|
||||
}
|
||||
}
|
||||
|
||||
uvm_pglistfree(&mlist);
|
||||
}
|
||||
|
||||
/*
|
||||
* Common function for mapping DMA-safe memory. May be called by
|
||||
* bus-specific DMA memory map functions.
|
||||
*/
|
||||
int
|
||||
_bus_dmamem_map(bus_dma_tag_t t, bus_dma_segment_t *segs, int nsegs,
|
||||
size_t size, caddr_t *kvap, int flags)
|
||||
{
|
||||
vaddr_t va;
|
||||
bus_addr_t addr;
|
||||
int curseg;
|
||||
|
||||
size = round_page(size);
|
||||
|
||||
va = uvm_km_valloc(kernel_map, size);
|
||||
|
||||
if (va == 0)
|
||||
return (ENOMEM);
|
||||
|
||||
*kvap = (caddr_t)va;
|
||||
|
||||
for (curseg = 0; curseg < nsegs; curseg++) {
|
||||
for (addr = segs[curseg].ds_addr;
|
||||
addr < (segs[curseg].ds_addr + segs[curseg].ds_len);
|
||||
addr += NBPG, va += NBPG, size -= NBPG) {
|
||||
if (size == 0)
|
||||
panic("_bus_dmamem_map: size botch");
|
||||
pmap_enter(pmap_kernel(), va, addr,
|
||||
VM_PROT_READ | VM_PROT_WRITE,
|
||||
VM_PROT_READ | VM_PROT_WRITE | PMAP_WIRED |
|
||||
PME_NOCACHE);
|
||||
}
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Common function for unmapping DMA-safe memory. May be called by
|
||||
* bus-specific DMA memory unmapping functions.
|
||||
*/
|
||||
void
|
||||
_bus_dmamem_unmap(bus_dma_tag_t t, caddr_t kva, size_t size)
|
||||
{
|
||||
|
||||
#ifdef DIAGNOSTIC
|
||||
if ((u_long)kva & PGOFSET)
|
||||
panic("_bus_dmamem_unmap");
|
||||
#endif
|
||||
|
||||
size = round_page(size);
|
||||
|
||||
uvm_km_free(kernel_map, (vaddr_t)kva, size);
|
||||
}
|
||||
|
||||
/*
|
||||
* Common functin for mmap(2)'ing DMA-safe memory. May be called by
|
||||
* bus-specific DMA mmap(2)'ing functions.
|
||||
*/
|
||||
paddr_t
|
||||
_bus_dmamem_mmap(bus_dma_tag_t t, bus_dma_segment_t *segs, int nsegs, off_t off,
|
||||
int prot, int flags)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < nsegs; i++) {
|
||||
#ifdef DIAGNOSTIC
|
||||
if (off & PGOFSET)
|
||||
panic("_bus_dmamem_mmap: offset unaligned");
|
||||
if (segs[i].ds_addr & PGOFSET)
|
||||
panic("_bus_dmamem_mmap: segment unaligned");
|
||||
if (segs[i].ds_len & PGOFSET)
|
||||
panic("_bus_dmamem_mmap: segment size not multiple"
|
||||
" of page size");
|
||||
#endif
|
||||
if (off >= segs[i].ds_len) {
|
||||
off -= segs[i].ds_len;
|
||||
continue;
|
||||
}
|
||||
|
||||
return (segs[i].ds_addr + off);
|
||||
}
|
||||
|
||||
/* Page not found. */
|
||||
return (-1);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* "generic" DMA struct, nothing special.
|
||||
*/
|
||||
struct ibm4xx_bus_dma_tag ibm4xx_default_bus_dma_tag = {
|
||||
0, /* _bounce_thresh */
|
||||
_bus_dmamap_create,
|
||||
_bus_dmamap_destroy,
|
||||
_bus_dmamap_load,
|
||||
_bus_dmamap_load_mbuf,
|
||||
_bus_dmamap_load_uio,
|
||||
_bus_dmamap_load_raw,
|
||||
_bus_dmamap_unload,
|
||||
_bus_dmamap_sync,
|
||||
_bus_dmamem_alloc,
|
||||
_bus_dmamem_free,
|
||||
_bus_dmamem_map,
|
||||
_bus_dmamem_unmap,
|
||||
_bus_dmamem_mmap,
|
||||
};
|
@ -1,134 +0,0 @@
|
||||
/* $NetBSD: consinit.c,v 1.5 2002/08/13 05:43:26 simonb Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998
|
||||
* Matthias Drochner. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "opt_kgdb.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/device.h>
|
||||
#include <machine/bus.h>
|
||||
|
||||
#include <powerpc/ibm4xx/ibm405gp.h>
|
||||
|
||||
#include "com.h"
|
||||
#if (NCOM > 0)
|
||||
#include <sys/termios.h>
|
||||
#include <dev/ic/comreg.h>
|
||||
#include <dev/ic/comvar.h>
|
||||
#endif
|
||||
|
||||
#include <dev/cons.h>
|
||||
|
||||
#ifndef CONSDEVNAME
|
||||
#define CONSDEVNAME "com"
|
||||
#endif
|
||||
|
||||
#if (NCOM > 0)
|
||||
#ifndef CONADDR
|
||||
#define CONADDR IBM405GP_UART0_BASE
|
||||
#endif
|
||||
#ifndef CONSPEED
|
||||
#define CONSPEED B9600 /* */
|
||||
// #define CONSPEED B115200 /* 9600 is too slow for my taste */
|
||||
#endif
|
||||
#ifndef CONMODE
|
||||
#define CONMODE ((TTYDEF_CFLAG & ~(CSIZE | CSTOPB | PARENB)) | CS8) /* 8N1 */
|
||||
#endif
|
||||
int comcnmode = CONMODE;
|
||||
#endif /* NCOM */
|
||||
|
||||
#ifdef KGDB
|
||||
#ifndef KGDB_DEVNAME
|
||||
#define KGDB_DEVNAME "com"
|
||||
#endif
|
||||
char kgdb_devname[] = KGDB_DEVNAME;
|
||||
|
||||
#if (NCOM > 1)
|
||||
#ifndef KGDB_DEVADDR
|
||||
#define KGDB_DEVADDR UART1_BASE
|
||||
#endif
|
||||
int comkgdbaddr = KGDB_DEVADDR;
|
||||
|
||||
#ifndef KGDB_DEVRATE
|
||||
#define KGDB_DEVRATE CONSPEED
|
||||
#endif
|
||||
int comkgdbrate = KGDB_DEVRATE;
|
||||
|
||||
#ifndef KGDB_DEVMODE
|
||||
#define KGDB_DEVMODE ((TTYDEF_CFLAG & ~(CSIZE | CSTOPB | PARENB)) | CS8) /* 8N1 */
|
||||
#endif
|
||||
int comkgdbmode = KGDB_DEVMODE;
|
||||
|
||||
#endif /* NCOM */
|
||||
|
||||
#endif /* KGDB */
|
||||
|
||||
/*
|
||||
* consinit:
|
||||
* initialize the system console.
|
||||
* XXX - shouldn't deal with this initted thing, but then,
|
||||
* it shouldn't be called from initppc either.
|
||||
*/
|
||||
void
|
||||
consinit(void)
|
||||
{
|
||||
static int initted = 0;
|
||||
#if (NCOM > 0)
|
||||
bus_space_tag_t tag;
|
||||
#endif
|
||||
|
||||
if (initted)
|
||||
return;
|
||||
initted = 1;
|
||||
|
||||
#if (NCOM > 0)
|
||||
tag = ibm4xx_make_bus_space_tag(0, 0);
|
||||
|
||||
if (comcnattach(tag, CONADDR, CONSPEED, COM_FREQ*6,
|
||||
comcnmode))
|
||||
panic("can't init serial console @%x", CONADDR);
|
||||
else
|
||||
return;
|
||||
#endif
|
||||
panic("console device missing -- serial console not in kernel");
|
||||
/* Of course, this is moot if there is no console... */
|
||||
}
|
||||
|
||||
#ifdef KGDB
|
||||
void
|
||||
kgdb_port_init(void)
|
||||
{
|
||||
#if (NCOM > 0)
|
||||
if(!strcmp(kgdb_devname, "com")) {
|
||||
bus_space_tag_t tag = ibm4xx_make_bus_space_tag(0, 2);
|
||||
com_kgdb_attach(tag, comkgdbaddr, comkgdbrate, COM_FREQ * 6,
|
||||
comkgdbmode);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
@ -1,311 +0,0 @@
|
||||
/* $NetBSD: disksubr.c,v 1.2 2002/02/19 17:09:50 wiz Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1988 Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)ufs_disksubr.c 7.16 (Berkeley) 5/4/91
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/buf.h>
|
||||
#include <sys/disklabel.h>
|
||||
#include <sys/syslog.h>
|
||||
|
||||
/*
|
||||
* Attempt to read a disk label from a device
|
||||
* using the indicated strategy routine.
|
||||
* The label must be partly set up before this:
|
||||
* secpercyl, secsize and anything required for a block i/o read
|
||||
* operation in the driver's strategy/start routines
|
||||
* must be filled in before calling us.
|
||||
*
|
||||
* If dos partition table requested, attempt to load it and
|
||||
* find disklabel inside a DOS partition. Also, if bad block
|
||||
* table needed, attempt to extract it as well. Return buffer
|
||||
* for use in signalling errors if requested.
|
||||
*
|
||||
* Returns null on success and an error string on failure.
|
||||
*/
|
||||
char *
|
||||
readdisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp,
|
||||
struct cpu_disklabel *osdep)
|
||||
{
|
||||
struct buf *bp;
|
||||
struct disklabel *dlp;
|
||||
struct dkbad *bdp;
|
||||
char *msg = NULL;
|
||||
int i;
|
||||
|
||||
/* minimal requirements for archtypal disk label */
|
||||
if (lp->d_secsize == 0)
|
||||
lp->d_secsize = DEV_BSIZE;
|
||||
if (lp->d_secperunit == 0)
|
||||
lp->d_secperunit = 0x1fffffff;
|
||||
lp->d_npartitions = RAW_PART + 1;
|
||||
if (lp->d_partitions[RAW_PART].p_size == 0)
|
||||
lp->d_partitions[RAW_PART].p_size =
|
||||
lp->d_secperunit * (lp->d_secsize / DEV_BSIZE);
|
||||
lp->d_partitions[RAW_PART].p_offset = 0;
|
||||
|
||||
/* get a buffer and initialize it */
|
||||
bp = geteblk((int)lp->d_secsize);
|
||||
|
||||
/* next, dig out disk label */
|
||||
bp->b_dev = dev;
|
||||
bp->b_blkno = LABELSECTOR;
|
||||
bp->b_cylinder = 0;
|
||||
bp->b_bcount = lp->d_secsize;
|
||||
bp->b_flags |= B_READ;
|
||||
(*strat)(bp);
|
||||
|
||||
/* if successful, locate disk label within block and validate */
|
||||
if (biowait(bp)) {
|
||||
msg = "disk label I/O error";
|
||||
goto done;
|
||||
}
|
||||
|
||||
for (dlp = (struct disklabel *)bp->b_data;
|
||||
dlp <= (struct disklabel *)(bp->b_data + lp->d_secsize - sizeof(*dlp));
|
||||
dlp = (struct disklabel *)((char *)dlp + sizeof(long))) {
|
||||
if (dlp->d_magic != DISKMAGIC || dlp->d_magic2 != DISKMAGIC) {
|
||||
if (msg == NULL)
|
||||
msg = "no disk label";
|
||||
} else if (dlp->d_npartitions > MAXPARTITIONS ||
|
||||
dkcksum(dlp) != 0)
|
||||
msg = "disk label corrupted";
|
||||
else {
|
||||
*lp = *dlp;
|
||||
msg = NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (msg)
|
||||
goto done;
|
||||
|
||||
/* obtain bad sector table if requested and present */
|
||||
if (osdep && (lp->d_flags & D_BADSECT)) {
|
||||
struct dkbad *db;
|
||||
|
||||
bdp = &osdep->bad;
|
||||
i = 0;
|
||||
do {
|
||||
/* read a bad sector table */
|
||||
bp->b_flags &= ~(B_DONE);
|
||||
bp->b_flags |= B_READ;
|
||||
bp->b_blkno = lp->d_secperunit - lp->d_nsectors + i;
|
||||
if (lp->d_secsize > DEV_BSIZE)
|
||||
bp->b_blkno *= lp->d_secsize / DEV_BSIZE;
|
||||
else
|
||||
bp->b_blkno /= DEV_BSIZE / lp->d_secsize;
|
||||
bp->b_bcount = lp->d_secsize;
|
||||
bp->b_cylinder = lp->d_ncylinders - 1;
|
||||
(*strat)(bp);
|
||||
|
||||
/* if successful, validate, otherwise try another */
|
||||
if (biowait(bp)) {
|
||||
msg = "bad sector table I/O error";
|
||||
} else {
|
||||
db = (struct dkbad *)(bp->b_data);
|
||||
#define DKBAD_MAGIC 0x4321
|
||||
if (db->bt_mbz == 0
|
||||
&& db->bt_flag == DKBAD_MAGIC) {
|
||||
msg = NULL;
|
||||
*bdp = *db;
|
||||
break;
|
||||
} else
|
||||
msg = "bad sector table corrupted";
|
||||
}
|
||||
} while ((bp->b_flags & B_ERROR) && (i += 2) < 10 &&
|
||||
i < lp->d_nsectors);
|
||||
}
|
||||
|
||||
done:
|
||||
bp->b_flags |= B_INVAL;
|
||||
brelse(bp);
|
||||
return (msg);
|
||||
}
|
||||
|
||||
/*
|
||||
* Check new disk label for sensibility before setting it.
|
||||
*/
|
||||
int
|
||||
setdisklabel(struct disklabel *olp, struct disklabel *nlp, u_long openmask,
|
||||
struct cpu_disklabel *osdep)
|
||||
{
|
||||
int i;
|
||||
struct partition *opp, *npp;
|
||||
|
||||
/* sanity clause */
|
||||
if (nlp->d_secpercyl == 0 || nlp->d_secsize == 0 ||
|
||||
(nlp->d_secsize % DEV_BSIZE) != 0)
|
||||
return(EINVAL);
|
||||
|
||||
/* special case to allow disklabel to be invalidated */
|
||||
if (nlp->d_magic == 0xffffffff) {
|
||||
*olp = *nlp;
|
||||
return (0);
|
||||
}
|
||||
|
||||
if (nlp->d_magic != DISKMAGIC || nlp->d_magic2 != DISKMAGIC ||
|
||||
dkcksum(nlp) != 0)
|
||||
return (EINVAL);
|
||||
|
||||
while (openmask != 0) {
|
||||
i = ffs(openmask) - 1;
|
||||
openmask &= ~(1 << i);
|
||||
if (nlp->d_npartitions <= i)
|
||||
return (EBUSY);
|
||||
opp = &olp->d_partitions[i];
|
||||
npp = &nlp->d_partitions[i];
|
||||
if (npp->p_offset != opp->p_offset || npp->p_size < opp->p_size)
|
||||
return (EBUSY);
|
||||
/*
|
||||
* Copy internally-set partition information
|
||||
* if new label doesn't include it. XXX
|
||||
*/
|
||||
if (npp->p_fstype == FS_UNUSED && opp->p_fstype != FS_UNUSED) {
|
||||
npp->p_fstype = opp->p_fstype;
|
||||
npp->p_fsize = opp->p_fsize;
|
||||
npp->p_frag = opp->p_frag;
|
||||
npp->p_cpg = opp->p_cpg;
|
||||
}
|
||||
}
|
||||
nlp->d_checksum = 0;
|
||||
nlp->d_checksum = dkcksum(nlp);
|
||||
*olp = *nlp;
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Write disk label back to device after modification.
|
||||
*/
|
||||
int
|
||||
writedisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp,
|
||||
struct cpu_disklabel *osdep)
|
||||
{
|
||||
struct buf *bp;
|
||||
struct disklabel *dlp;
|
||||
int error;
|
||||
|
||||
#ifdef maybe
|
||||
/* disklabel in appropriate location? */
|
||||
if (lp->d_partitions[2].p_offset != 0
|
||||
&& lp->d_partitions[2].p_offset != dospartoff) {
|
||||
error = EXDEV;
|
||||
goto done;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* get a buffer and initialize it */
|
||||
bp = geteblk((int)lp->d_secsize);
|
||||
bp->b_dev = dev;
|
||||
bp->b_blkno = LABELSECTOR;
|
||||
bp->b_cylinder = 0;
|
||||
bp->b_bcount = lp->d_secsize;
|
||||
bp->b_flags |= B_READ;
|
||||
(*strat)(bp);
|
||||
|
||||
/* if successful, locate disk label within block and validate */
|
||||
if ((error = biowait(bp)) != 0)
|
||||
goto done;
|
||||
for (dlp = (struct disklabel *)bp->b_data;
|
||||
dlp <= (struct disklabel *)(bp->b_data + lp->d_secsize - sizeof(*dlp));
|
||||
dlp = (struct disklabel *)((char *)dlp + sizeof(long))) {
|
||||
if (dlp->d_magic == DISKMAGIC && dlp->d_magic2 == DISKMAGIC &&
|
||||
dkcksum(dlp) == 0) {
|
||||
*dlp = *lp;
|
||||
bp->b_flags = B_BUSY | B_WRITE;
|
||||
(*strat)(bp);
|
||||
error = biowait(bp);
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
error = ESRCH;
|
||||
|
||||
done:
|
||||
brelse(bp);
|
||||
return (error);
|
||||
}
|
||||
|
||||
/*
|
||||
* Determine the size of the transfer, and make sure it is
|
||||
* within the boundaries of the partition. Adjust transfer
|
||||
* if needed, and signal errors or early completion.
|
||||
*/
|
||||
int
|
||||
bounds_check_with_label(struct buf *bp, struct disklabel *lp, int wlabel)
|
||||
{
|
||||
struct partition *p = lp->d_partitions + DISKPART(bp->b_dev);
|
||||
int labelsector = lp->d_partitions[RAW_PART].p_offset + LABELSECTOR;
|
||||
int sz;
|
||||
|
||||
sz = howmany(bp->b_bcount, lp->d_secsize);
|
||||
|
||||
if (bp->b_blkno + sz > p->p_size) {
|
||||
sz = p->p_size - bp->b_blkno;
|
||||
if (sz == 0) {
|
||||
/* If exactly at end of disk, return EOF. */
|
||||
bp->b_resid = bp->b_bcount;
|
||||
goto done;
|
||||
}
|
||||
if (sz < 0) {
|
||||
/* If past end of disk, return EINVAL. */
|
||||
bp->b_error = EINVAL;
|
||||
goto bad;
|
||||
}
|
||||
/* Otherwise, truncate request. */
|
||||
bp->b_bcount = sz << DEV_BSHIFT;
|
||||
}
|
||||
|
||||
/* Overwriting disk label? */
|
||||
if (bp->b_blkno + p->p_offset <= labelsector &&
|
||||
#if LABELSECTOR != 0
|
||||
bp->b_blkno + p->p_offset + sz > labelsector &&
|
||||
#endif
|
||||
(bp->b_flags & B_READ) == 0 && !wlabel) {
|
||||
bp->b_error = EROFS;
|
||||
goto bad;
|
||||
}
|
||||
|
||||
/* calculate cylinder for disksort to order transfers with */
|
||||
bp->b_cylinder = (bp->b_blkno + p->p_offset) /
|
||||
(lp->d_secsize / DEV_BSIZE) / lp->d_secpercyl;
|
||||
return (1);
|
||||
|
||||
bad:
|
||||
bp->b_flags |= B_ERROR;
|
||||
done:
|
||||
return (0);
|
||||
}
|
@ -1,78 +0,0 @@
|
||||
# $NetBSD: genassym.cf,v 1.4 2002/08/02 03:46:46 chs Exp $
|
||||
|
||||
#
|
||||
# Copyright (C) 1995, 1996 Wolfgang Solfrank.
|
||||
# Copyright (C) 1995, 1996 TooLs GmbH.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# 3. All advertising materials mentioning features or use of this software
|
||||
# must display the following acknowledgement:
|
||||
# This product includes software developed by TooLs GmbH.
|
||||
# 4. The name of TooLs GmbH may not be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``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 TOOLS GMBH 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/param.h>
|
||||
include <sys/time.h>
|
||||
include <sys/proc.h>
|
||||
|
||||
include <uvm/uvm_extern.h>
|
||||
|
||||
include <machine/pcb.h>
|
||||
include <machine/pmap.h>
|
||||
|
||||
define FRAMELEN FRAMELEN
|
||||
define FRAME_0 offsetof(struct trapframe, fixreg[0])
|
||||
define FRAME_1 offsetof(struct trapframe, fixreg[1])
|
||||
define FRAME_2 offsetof(struct trapframe, fixreg[2])
|
||||
define FRAME_3 offsetof(struct trapframe, fixreg[3])
|
||||
define FRAME_LR offsetof(struct trapframe, lr)
|
||||
define FRAME_CR offsetof(struct trapframe, cr)
|
||||
define FRAME_CTR offsetof(struct trapframe, ctr)
|
||||
define FRAME_XER offsetof(struct trapframe, xer)
|
||||
define FRAME_SRR0 offsetof(struct trapframe, srr0)
|
||||
define FRAME_SRR1 offsetof(struct trapframe, srr1)
|
||||
define FRAME_DEAR offsetof(struct trapframe, dear)
|
||||
define FRAME_ESR offsetof(struct trapframe, esr)
|
||||
define FRAME_EXC offsetof(struct trapframe, exc)
|
||||
define FRAME_PID offsetof(struct trapframe, pid)
|
||||
|
||||
define SFRAMELEN roundup(sizeof(struct switchframe), 16)
|
||||
|
||||
define PCB_PMR offsetof(struct pcb, pcb_pmreal)
|
||||
define PCB_SP offsetof(struct pcb, pcb_sp)
|
||||
define PCB_SPL offsetof(struct pcb, pcb_spl)
|
||||
define PCB_FAULT offsetof(struct pcb, pcb_onfault)
|
||||
|
||||
define PM_CTX offsetof(struct pmap, pm_ctx)
|
||||
|
||||
define P_FORW offsetof(struct proc, p_forw)
|
||||
define P_BACK offsetof(struct proc, p_back)
|
||||
define P_ADDR offsetof(struct proc, p_addr)
|
||||
define P_STAT offsetof(struct proc, p_stat)
|
||||
define P_CPU offsetof(struct proc, p_cpu)
|
||||
|
||||
define P_MD_SYSCALL offsetof(struct proc, p_md.md_syscall)
|
||||
|
||||
define SONPROC SONPROC
|
||||
|
||||
define CPU_CI offsetof(struct cpu_info, ci_ci)
|
@ -1,282 +0,0 @@
|
||||
/* $NetBSD: locore.S,v 1.9 2002/08/23 11:37:53 scw Exp $ */
|
||||
/* $OpenBSD: locore.S,v 1.4 1997/01/26 09:06:38 rahnds Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 2001 Wasabi Systems, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Written by Eduardo Horvath and Simon Burge for Wasabi Systems, Inc.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed for the NetBSD Project by
|
||||
* Wasabi Systems, Inc.
|
||||
* 4. The name of Wasabi Systems, Inc. may not be used to endorse
|
||||
* or promote products derived from this software without specific prior
|
||||
* written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
|
||||
* Copyright (C) 1995, 1996 TooLs GmbH.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by TooLs GmbH.
|
||||
* 4. The name of TooLs GmbH may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``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 TOOLS GMBH 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.
|
||||
*/
|
||||
|
||||
#undef PPC_4XX_NOCACHE
|
||||
|
||||
#include "opt_ddb.h"
|
||||
#include "fs_kernfs.h"
|
||||
#include "opt_ipkdb.h"
|
||||
#include "opt_lockdebug.h"
|
||||
#include "opt_multiprocessor.h"
|
||||
#include "opt_ppcarch.h"
|
||||
#include "assym.h"
|
||||
|
||||
#include <sys/syscall.h>
|
||||
|
||||
#include <machine/param.h>
|
||||
#include <machine/psl.h>
|
||||
#include <machine/trap.h>
|
||||
#include <machine/asm.h>
|
||||
#include <machine/dcr.h>
|
||||
|
||||
#include <powerpc/spr.h>
|
||||
#include <powerpc/ibm4xx/pmap.h>
|
||||
|
||||
/*
|
||||
* Some instructions gas doesn't understand (yet?)
|
||||
*/
|
||||
#define bdneq bdnzf 2,
|
||||
|
||||
#define INTSTK (8*1024) /* 8K interrupt stack */
|
||||
#define SPILLSTK 1024 /* 1K spill stack */
|
||||
|
||||
/*
|
||||
* Globals
|
||||
*/
|
||||
GLOBAL(proc0paddr)
|
||||
.long 0 /* proc0 p_addr */
|
||||
|
||||
GLOBAL(intrnames)
|
||||
.asciz "clock", "irq1", "irq2", "irq3"
|
||||
.asciz "irq4", "irq5", "irq6", "irq7"
|
||||
.asciz "irq8", "irq9", "irq10", "irq11"
|
||||
.asciz "irq12", "irq13", "irq14", "irq15"
|
||||
.asciz "irq16", "irq17", "irq18", "irq19"
|
||||
.asciz "irq20", "irq21", "irq22", "irq23"
|
||||
.asciz "irq24", "irq25", "irq26", "irq27"
|
||||
.asciz "irq28", "softnet", "softclock", "softserial"
|
||||
.asciz "statclock"
|
||||
GLOBAL(eintrnames)
|
||||
.align 4
|
||||
GLOBAL(intrcnt)
|
||||
.long 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
.long 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
.long 0
|
||||
GLOBAL(eintrcnt)
|
||||
|
||||
GLOBAL(powersave)
|
||||
.long 0
|
||||
|
||||
/*
|
||||
* File-scope for locore.S
|
||||
*/
|
||||
.data
|
||||
idle_u:
|
||||
.long 0 /* fake uarea during idle after exit */
|
||||
|
||||
/*
|
||||
* This symbol is here for the benefit of kvm_mkdb, and is supposed to
|
||||
* mark the start of kernel text.
|
||||
*/
|
||||
.text
|
||||
.globl _C_LABEL(kernel_text)
|
||||
_C_LABEL(kernel_text):
|
||||
|
||||
/*
|
||||
* Startup entry. Note, this must be the first thing in the text
|
||||
* segment!
|
||||
*/
|
||||
.text
|
||||
.globl __start
|
||||
__start:
|
||||
b 1f
|
||||
/* Reserve some space for info_block required for IBM eval board bootloader */
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
|
||||
1:
|
||||
mr 31,3 /* Save address of PROM info_block */
|
||||
li 0,0
|
||||
mtmsr 0 /* Disable FPU/MMU/exceptions */
|
||||
isync
|
||||
|
||||
/* PPC405GP errata, item #58.
|
||||
* Load string instructions may write incorrect data into the last GPR
|
||||
* targeted in the operation.
|
||||
* Workaround: set OCM0_DSCNTL[DSEN]=0 and OCM0_DSCNTL[DOF]=0 */
|
||||
mtdcr DCR_OCM0_DSCNTL, 0 /* Disable Data access to OCM */
|
||||
mtdcr DCR_OCM0_ISCNTL, 0 /* Disable Instruction access to OCM. Just in case */
|
||||
/*
|
||||
* Cpu detect.
|
||||
*
|
||||
*/
|
||||
__start_cpu0:
|
||||
#ifdef PPC_4XX_NOCACHE
|
||||
/* Disable all caches for physical addresses */
|
||||
li 0,0
|
||||
#else
|
||||
/* Allow cacheing for only the first 2GB of RAM */
|
||||
lis 0,0xffff
|
||||
#endif
|
||||
mtdccr 0
|
||||
mticcr 0
|
||||
|
||||
/* Invalidate all TLB entries */
|
||||
tlbia
|
||||
sync
|
||||
isync
|
||||
|
||||
/* compute end of kernel memory */
|
||||
lis 8,_C_LABEL(end)@ha
|
||||
addi 8,8,_C_LABEL(end)@l
|
||||
#if defined(DDB) || defined(KERNFS)
|
||||
/* If we had symbol table location we'd store it here and would've adjusted r8 here */
|
||||
lis 7,_C_LABEL(startsym)@ha
|
||||
addi 7,7,_C_LABEL(startsym)@l
|
||||
stw 8,0(7)
|
||||
lis 7,_C_LABEL(endsym)@ha
|
||||
addi 7,7,_C_LABEL(endsym)@l
|
||||
stw 8,0(7)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Set up TLB entry to cover kernel addresses.
|
||||
*
|
||||
* XXX: Skip TLB 0 for now, due to unresolved TLB 0 replacement
|
||||
* and hard hangs
|
||||
*/
|
||||
li 0,1
|
||||
mtpid 0
|
||||
sync
|
||||
|
||||
li 0,0
|
||||
#ifdef PPC_4XX_NOCACHE
|
||||
li 4,TLB_EX|TLB_WR|TLB_I /* |TLB_W */
|
||||
#else
|
||||
li 4,TLB_EX|TLB_WR /* |TLB_W */
|
||||
#endif
|
||||
li 3,TLB_VALID|TLB_PG_16M
|
||||
tlbwe 4,0,1 /* Load the data(Low) portion of the entry */
|
||||
tlbwe 3,0,0 /* Load the tag(High) portion of the entry */
|
||||
|
||||
#if 1
|
||||
/* Damn. Have to be able to access all real memory.... Hardcode for 32M for now. */
|
||||
li 0,1
|
||||
lis 4,0x01000000@h
|
||||
ori 3,4,0
|
||||
#ifdef PPC_4XX_NOCACHE
|
||||
addi 4,4,TLB_EX|TLB_WR|TLB_I /* |TLB_W */
|
||||
#else
|
||||
addi 4,4,TLB_EX|TLB_WR /* |TLB_W */
|
||||
#endif
|
||||
addi 3,3,TLB_VALID|TLB_PG_16M
|
||||
tlbwe 4,0,1 /* Load the data(Low) portion of the entry */
|
||||
tlbwe 3,0,0 /* Load the tag(High) portion of the entry */
|
||||
#endif
|
||||
|
||||
/* set up a TLB mapping to cover uart0 */
|
||||
lis 3,0xef000000@h /* Load the virtual address */
|
||||
ori 4,3,0 /* Load the physical address */
|
||||
|
||||
clrrwi 4,4,10 /* Mask off the real page number */
|
||||
/* write, execute, cache inhibit, guarded */
|
||||
ori 4,4,(TLB_WR|TLB_EX|TLB_I|TLB_G)
|
||||
|
||||
clrrwi 3,3,10 /* Mask off the effective page number */
|
||||
ori 3,3,(TLB_VALID|TLB_PG_16M)
|
||||
|
||||
li 0,2
|
||||
|
||||
tlbwe 4,0,1 /* Load the data portion of the entry */
|
||||
tlbwe 3,0,0 /* Load the tag portion of the entry */
|
||||
|
||||
/* END of TLB setup */
|
||||
|
||||
li 9,PGOFSET
|
||||
add 8,8,9
|
||||
andc 8,8,9
|
||||
addi 8,8,NBPG
|
||||
lis 9,idle_u@ha
|
||||
stw 8,idle_u@l(9)
|
||||
addi 8,8,USPACE /* space for idle_u */
|
||||
lis 9,_C_LABEL(proc0paddr)@ha
|
||||
stw 8,_C_LABEL(proc0paddr)@l(9)
|
||||
addi 1,8,USPACE-FRAMELEN /* stackpointer for proc0 */
|
||||
mr 4,1 /* end of mem reserved for kernel */
|
||||
xor 0,0,0
|
||||
stwu 0,-16(1) /* end of stack chain */
|
||||
|
||||
lis 3,__start@ha
|
||||
addi 3,3,__start@l
|
||||
|
||||
mr 6,31 /* info_block address */
|
||||
bl _C_LABEL(initppc)
|
||||
bl _C_LABEL(main)
|
||||
|
||||
loop: b loop /* XXX not reached */
|
||||
|
||||
#include <powerpc/ibm4xx/4xx_locore.S>
|
@ -1,672 +0,0 @@
|
||||
/* $NetBSD: machdep.c,v 1.16 2002/11/25 05:13:41 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 2001, 2002 Wasabi Systems, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Written by Eduardo Horvath and Simon Burge for Wasabi Systems, Inc.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed for the NetBSD Project by
|
||||
* Wasabi Systems, Inc.
|
||||
* 4. The name of Wasabi Systems, Inc. may not be used to endorse
|
||||
* or promote products derived from this software without specific prior
|
||||
* written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
|
||||
* Copyright (C) 1995, 1996 TooLs GmbH.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by TooLs GmbH.
|
||||
* 4. The name of TooLs GmbH may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``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 TOOLS GMBH 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 "opt_compat_netbsd.h"
|
||||
#include "opt_ddb.h"
|
||||
#include "opt_ipkdb.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/buf.h>
|
||||
#include <sys/exec.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/mbuf.h>
|
||||
#include <sys/mount.h>
|
||||
#include <sys/msgbuf.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/reboot.h>
|
||||
#include <sys/syscallargs.h>
|
||||
#include <sys/syslog.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/user.h>
|
||||
#include <sys/boot_flag.h>
|
||||
#include <sys/properties.h>
|
||||
|
||||
#include <uvm/uvm_extern.h>
|
||||
|
||||
#include <net/netisr.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
#include <machine/powerpc.h>
|
||||
#include <machine/trap.h>
|
||||
#include <machine/walnut.h>
|
||||
#include <machine/dcr.h>
|
||||
|
||||
#include <powerpc/spr.h>
|
||||
|
||||
#include <dev/cons.h>
|
||||
|
||||
#ifdef DDB
|
||||
#include <machine/db_machdep.h>
|
||||
#include <ddb/db_extern.h>
|
||||
#endif
|
||||
|
||||
#include "com.h"
|
||||
#if NCOM > 0
|
||||
#include <dev/ic/comreg.h> /* For COM_FREQ */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Global variables used here and there
|
||||
*/
|
||||
struct vm_map *exec_map = NULL;
|
||||
struct vm_map *mb_map = NULL;
|
||||
struct vm_map *phys_map = NULL;
|
||||
|
||||
/*
|
||||
* This should probably be in autoconf! XXX
|
||||
*/
|
||||
char cpu_model[80];
|
||||
char machine[] = MACHINE; /* from <machine/param.h> */
|
||||
char machine_arch[] = MACHINE_ARCH; /* from <machine/param.h> */
|
||||
|
||||
struct pcb *curpcb;
|
||||
struct pmap *curpm;
|
||||
struct proc *fpuproc; /* XXX - shouldn't need this on fpu-less CPUs */
|
||||
|
||||
extern struct user *proc0paddr;
|
||||
|
||||
char bootpath[256];
|
||||
paddr_t msgbuf_paddr;
|
||||
vaddr_t msgbuf_vaddr;
|
||||
|
||||
#ifdef DDB
|
||||
void *startsym, *endsym;
|
||||
#endif
|
||||
|
||||
int lcsplx(int);
|
||||
void initppc(u_int, u_int, char *, void *);
|
||||
|
||||
static void dumpsys(void);
|
||||
static void install_extint(void (*)(void));
|
||||
|
||||
#define MEMREGIONS 8
|
||||
struct mem_region physmemr[MEMREGIONS]; /* Hard code memory */
|
||||
struct mem_region availmemr[MEMREGIONS]; /* Who's supposed to set these up? */
|
||||
|
||||
int fake_mapiodev = 1;
|
||||
struct board_cfg_data board_data;
|
||||
struct propdb *board_info = NULL;
|
||||
|
||||
void
|
||||
initppc(u_int startkernel, u_int endkernel, char *args, void *info_block)
|
||||
{
|
||||
extern int defaulttrap, defaultsize;
|
||||
extern int sctrap, scsize;
|
||||
extern int alitrap, alisize;
|
||||
extern int dsitrap, dsisize;
|
||||
extern int isitrap, isisize;
|
||||
extern int mchktrap, mchksize;
|
||||
extern int tlbimiss4xx, tlbim4size;
|
||||
extern int tlbdmiss4xx, tlbdm4size;
|
||||
extern int pitfitwdog, pitfitwdogsize;
|
||||
extern int debugtrap, debugsize;
|
||||
extern int errata51handler, errata51size;
|
||||
#ifdef DDB
|
||||
extern int ddblow, ddbsize;
|
||||
#endif
|
||||
#ifdef IPKDB
|
||||
extern int ipkdblow, ipkdbsize;
|
||||
#endif
|
||||
int exc;
|
||||
extern char _edata, _end;
|
||||
|
||||
/* Disable all external interrupts */
|
||||
mtdcr(DCR_UIC0_ER, 0);
|
||||
|
||||
/* Initialize cache info for memcpy, etc. */
|
||||
cpu_probe_cache();
|
||||
|
||||
memset(&_edata, 0, &_end-&_edata); /* Clear BSS area */
|
||||
|
||||
/* Save info block */
|
||||
if (info_block == NULL)
|
||||
/* XXX why isn't r3 set correctly?!?!? */
|
||||
info_block = (void *)0x8e10;
|
||||
memcpy(&board_data, info_block, sizeof(board_data));
|
||||
|
||||
memset(physmemr, 0, sizeof physmemr);
|
||||
memset(availmemr, 0, sizeof availmemr);
|
||||
physmemr[0].start = 0;
|
||||
physmemr[0].size = board_data.mem_size & ~PGOFSET;
|
||||
/* Lower memory reserved by eval board BIOS */
|
||||
availmemr[0].start = startkernel;
|
||||
availmemr[0].size = board_data.mem_size - availmemr[0].start;
|
||||
|
||||
proc0.p_addr = proc0paddr;
|
||||
memset(proc0.p_addr, 0, sizeof *proc0.p_addr);
|
||||
|
||||
curpcb = &proc0paddr->u_pcb;
|
||||
|
||||
curpm = curpcb->pcb_pmreal = curpcb->pcb_pm = pmap_kernel();
|
||||
|
||||
/*
|
||||
* Set up trap vectors
|
||||
*/
|
||||
for (exc = EXC_RSVD; exc <= EXC_LAST; exc += 0x100)
|
||||
switch (exc) {
|
||||
default:
|
||||
memcpy((void *)exc, &defaulttrap, (size_t)&defaultsize);
|
||||
break;
|
||||
case EXC_EXI:
|
||||
/*
|
||||
* This one is (potentially) installed during autoconf
|
||||
*/
|
||||
break;
|
||||
case EXC_SC:
|
||||
memcpy((void *)EXC_SC, &sctrap, (size_t)&scsize);
|
||||
break;
|
||||
case EXC_ALI:
|
||||
memcpy((void *)EXC_ALI, &alitrap, (size_t)&alisize);
|
||||
break;
|
||||
case EXC_DSI:
|
||||
memcpy((void *)EXC_DSI, &dsitrap, (size_t)&dsisize);
|
||||
break;
|
||||
case EXC_ISI:
|
||||
memcpy((void *)EXC_ISI, &isitrap, (size_t)&isisize);
|
||||
break;
|
||||
case EXC_MCHK:
|
||||
memcpy((void *)EXC_MCHK, &mchktrap, (size_t)&mchksize);
|
||||
break;
|
||||
case EXC_ITMISS:
|
||||
memcpy((void *)EXC_ITMISS, &tlbimiss4xx,
|
||||
(size_t)&tlbim4size);
|
||||
break;
|
||||
case EXC_DTMISS:
|
||||
memcpy((void *)EXC_DTMISS, &tlbdmiss4xx,
|
||||
(size_t)&tlbdm4size);
|
||||
break;
|
||||
/*
|
||||
* EXC_PIT, EXC_FIT, EXC_WDOG handlers
|
||||
* are spaced by 0x10 bytes only..
|
||||
*/
|
||||
case EXC_PIT:
|
||||
memcpy((void *)EXC_PIT, &pitfitwdog,
|
||||
(size_t)&pitfitwdogsize);
|
||||
break;
|
||||
case EXC_DEBUG:
|
||||
memcpy((void *)EXC_DEBUG, &debugtrap,
|
||||
(size_t)&debugsize);
|
||||
break;
|
||||
case EXC_DTMISS|EXC_ALI:
|
||||
/* PPC405GP Rev D errata item 51 */
|
||||
memcpy((void *)(EXC_DTMISS|EXC_ALI), &errata51handler,
|
||||
(size_t)&errata51size);
|
||||
break;
|
||||
case EXC_PGM:
|
||||
#if defined(DDB)
|
||||
memcpy((void *)exc, &ddblow, (size_t)&ddbsize);
|
||||
#elif defined(IPKDB)
|
||||
memcpy((void *)exc, &ipkdblow, (size_t)&ipkdbsize);
|
||||
#else
|
||||
memcpy((void *)exc, &pgmtrap, (size_t)&pgmsize);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
__syncicache((void *)EXC_RST, EXC_LAST - EXC_RST + 0x100);
|
||||
mtspr(SPR_EVPR, 0); /* Set Exception vector base */
|
||||
consinit();
|
||||
|
||||
/* Handle trap instruction as PGM exception */
|
||||
{
|
||||
int dbcr0;
|
||||
asm volatile("mfspr %0,%1":"=r"(dbcr0):"K"(SPR_DBCR0));
|
||||
asm volatile("mtspr %0,%1"::"K"(SPR_DBCR0),"r"(dbcr0 & ~DBCR0_TDE));
|
||||
}
|
||||
|
||||
/*
|
||||
* external interrupt handler install
|
||||
*/
|
||||
install_extint(ext_intr);
|
||||
|
||||
/*
|
||||
* Now enable translation (and machine checks/recoverable interrupts).
|
||||
*/
|
||||
asm volatile ("mfmsr %0; ori %0,%0,%1; mtmsr %0; isync"
|
||||
: : "r"(0), "K"(PSL_IR|PSL_DR));
|
||||
/* XXXX PSL_ME - With ME set kernel gets stuck... */
|
||||
|
||||
uvm_setpagesize();
|
||||
|
||||
/*
|
||||
* Initialize pmap module.
|
||||
*/
|
||||
pmap_bootstrap(startkernel, endkernel);
|
||||
|
||||
consinit();
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("Board config data:\n");
|
||||
printf(" usr_config_ver = %s\n", board_data.usr_config_ver);
|
||||
printf(" rom_sw_ver = %s\n", board_data.rom_sw_ver);
|
||||
printf(" mem_size = %u\n", board_data.mem_size);
|
||||
printf(" mac_address_local = %02x:%02x:%02x:%02x:%02x:%02x\n",
|
||||
board_data.mac_address_local[0], board_data.mac_address_local[1],
|
||||
board_data.mac_address_local[2], board_data.mac_address_local[3],
|
||||
board_data.mac_address_local[4], board_data.mac_address_local[5]);
|
||||
printf(" mac_address_pci = %02x:%02x:%02x:%02x:%02x:%02x\n",
|
||||
board_data.mac_address_pci[0], board_data.mac_address_pci[1],
|
||||
board_data.mac_address_pci[2], board_data.mac_address_pci[3],
|
||||
board_data.mac_address_pci[4], board_data.mac_address_pci[5]);
|
||||
printf(" processor_speed = %u\n", board_data.processor_speed);
|
||||
printf(" plb_speed = %u\n", board_data.plb_speed);
|
||||
printf(" pci_speed = %u\n", board_data.pci_speed);
|
||||
#endif
|
||||
|
||||
#ifdef DDB
|
||||
ddb_init((int)((u_int)endsym - (u_int)startsym), startsym, endsym);
|
||||
if (boothowto & RB_KDB)
|
||||
Debugger();
|
||||
#endif
|
||||
#ifdef IPKDB
|
||||
/*
|
||||
* Now trap to IPKDB
|
||||
*/
|
||||
ipkdb_init();
|
||||
if (boothowto & RB_KDB)
|
||||
ipkdb_connect(0);
|
||||
#endif
|
||||
fake_mapiodev = 0;
|
||||
}
|
||||
|
||||
static void
|
||||
install_extint(void (*handler)(void))
|
||||
{
|
||||
extern int extint, extsize;
|
||||
extern u_long extint_call;
|
||||
u_long offset = (u_long)handler - (u_long)&extint_call;
|
||||
int omsr, msr;
|
||||
|
||||
#ifdef DIAGNOSTIC
|
||||
if (offset > 0x1ffffff)
|
||||
panic("install_extint: too far away");
|
||||
#endif
|
||||
asm volatile ("mfmsr %0; andi. %1,%0,%2; mtmsr %1"
|
||||
: "=r"(omsr), "=r"(msr) : "K"((u_short)~PSL_EE));
|
||||
extint_call = (extint_call & 0xfc000003) | offset;
|
||||
memcpy((void *)EXC_EXI, &extint, (size_t)&extsize);
|
||||
__syncicache((void *)&extint_call, sizeof extint_call);
|
||||
__syncicache((void *)EXC_EXI, (int)&extsize);
|
||||
asm volatile ("mtmsr %0" :: "r"(omsr));
|
||||
}
|
||||
|
||||
/*
|
||||
* Machine dependent startup code.
|
||||
*/
|
||||
|
||||
char msgbuf[MSGBUFSIZE];
|
||||
|
||||
void
|
||||
cpu_startup(void)
|
||||
{
|
||||
caddr_t v;
|
||||
vaddr_t minaddr, maxaddr;
|
||||
u_int sz, i, base, residual;
|
||||
char pbuf[9];
|
||||
|
||||
proc0.p_addr = proc0paddr;
|
||||
v = (caddr_t)proc0paddr + USPACE;
|
||||
|
||||
/*
|
||||
* Initialize error message buffer (at end of core).
|
||||
*/
|
||||
#if 0 /* For some reason this fails... --Artem
|
||||
* Besides, do we really have to put it at the end of core?
|
||||
* Let's use static buffer for now
|
||||
*/
|
||||
if (!(msgbuf_vaddr = uvm_km_alloc(kernel_map, round_page(MSGBUFSIZE))))
|
||||
panic("startup: no room for message buffer");
|
||||
for (i = 0; i < btoc(MSGBUFSIZE); i++)
|
||||
pmap_kenter_pa(msgbuf_vaddr + i * NBPG,
|
||||
msgbuf_paddr + i * NBPG, VM_PROT_READ|VM_PROT_WRITE);
|
||||
initmsgbuf((caddr_t)msgbuf_vaddr, round_page(MSGBUFSIZE));
|
||||
#else
|
||||
initmsgbuf((caddr_t)msgbuf, round_page(MSGBUFSIZE));
|
||||
#endif
|
||||
|
||||
|
||||
printf("%s", version);
|
||||
printf("Walnut PowerPC 405GP Evaluation Board\n");
|
||||
|
||||
format_bytes(pbuf, sizeof(pbuf), ctob(physmem));
|
||||
printf("total memory = %s\n", pbuf);
|
||||
|
||||
/*
|
||||
* Find out how much space we need, allocate it,
|
||||
* and then give everything true virtual addresses.
|
||||
*/
|
||||
sz = (u_int)allocsys(NULL, NULL);
|
||||
if ((v = (caddr_t)uvm_km_zalloc(kernel_map, round_page(sz))) == 0)
|
||||
panic("startup: no room for tables");
|
||||
if (allocsys(v, NULL) - v != sz)
|
||||
panic("startup: table size inconsistency");
|
||||
|
||||
/*
|
||||
* Now allocate buffers proper. They are different than the above
|
||||
* in that they usually occupy more virtual memory than physical.
|
||||
*/
|
||||
sz = MAXBSIZE * nbuf;
|
||||
minaddr = 0;
|
||||
if (uvm_map(kernel_map, (vaddr_t *)&minaddr, round_page(sz),
|
||||
NULL, UVM_UNKNOWN_OFFSET, 0,
|
||||
UVM_MAPFLAG(UVM_PROT_NONE, UVM_PROT_NONE, UVM_INH_NONE,
|
||||
UVM_ADV_NORMAL, 0)) != 0)
|
||||
panic("startup: cannot allocate VM for buffers");
|
||||
buffers = (char *)minaddr;
|
||||
base = bufpages / nbuf;
|
||||
residual = bufpages % nbuf;
|
||||
if (base >= MAXBSIZE) {
|
||||
/* Don't want to alloc more physical mem than ever needed */
|
||||
base = MAXBSIZE;
|
||||
residual = 0;
|
||||
}
|
||||
for (i = 0; i < nbuf; i++) {
|
||||
vsize_t curbufsize;
|
||||
vaddr_t curbuf;
|
||||
struct vm_page *pg;
|
||||
|
||||
curbuf = (vaddr_t)buffers + i * MAXBSIZE;
|
||||
curbufsize = NBPG * (i < residual ? base + 1 : base);
|
||||
|
||||
while (curbufsize) {
|
||||
pg = uvm_pagealloc(NULL, 0, NULL, 0);
|
||||
if (pg == NULL)
|
||||
panic("cpu_startup: not enough memory for "
|
||||
"buffer cache");
|
||||
pmap_kenter_pa(curbuf, VM_PAGE_TO_PHYS(pg),
|
||||
VM_PROT_READ | VM_PROT_WRITE);
|
||||
curbuf += PAGE_SIZE;
|
||||
curbufsize -= PAGE_SIZE;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Allocate a submap for exec arguments. This map effectively
|
||||
* limits the number of processes exec'ing at any time.
|
||||
*/
|
||||
exec_map = uvm_km_suballoc(kernel_map, &minaddr, &maxaddr,
|
||||
16*NCARGS, VM_MAP_PAGEABLE, FALSE, NULL);
|
||||
|
||||
/*
|
||||
* Allocate a submap for physio
|
||||
*/
|
||||
phys_map = uvm_km_suballoc(kernel_map, &minaddr, &maxaddr,
|
||||
VM_PHYS_SIZE, 0, FALSE, NULL);
|
||||
|
||||
/*
|
||||
* No need to allocate an mbuf cluster submap. Mbuf clusters
|
||||
* are allocated via the pool allocator, and we use direct-mapped
|
||||
* pool pages.
|
||||
*/
|
||||
|
||||
format_bytes(pbuf, sizeof(pbuf), ptoa(uvmexp.free));
|
||||
printf("avail memory = %s\n", pbuf);
|
||||
format_bytes(pbuf, sizeof(pbuf), bufpages * NBPG);
|
||||
printf("using %u buffers containing %s of memory\n", nbuf, pbuf);
|
||||
|
||||
/*
|
||||
* Set up the buffers.
|
||||
*/
|
||||
bufinit();
|
||||
|
||||
/*
|
||||
* Set up the board properties database.
|
||||
*/
|
||||
if (!(board_info = propdb_create("board info")))
|
||||
panic("Cannot create board info database");
|
||||
|
||||
if (board_info_set("mem-size", &board_data.mem_size,
|
||||
sizeof(&board_data.mem_size), PROP_CONST, 0))
|
||||
panic("setting mem-size");
|
||||
if (board_info_set("emac-mac-addr", &board_data.mac_address_local,
|
||||
sizeof(&board_data.mac_address_local), PROP_CONST, 0))
|
||||
panic("setting emac-mac-addr");
|
||||
if (board_info_set("sip0-mac-addr", &board_data.mac_address_pci,
|
||||
sizeof(&board_data.mac_address_pci), PROP_CONST, 0))
|
||||
panic("setting sip0-mac-addr");
|
||||
if (board_info_set("processor-frequency", &board_data.processor_speed,
|
||||
sizeof(&board_data.processor_speed), PROP_CONST, 0))
|
||||
panic("setting processor-frequency");
|
||||
#if NCOM > 0
|
||||
{
|
||||
unsigned int comfreq = COM_FREQ * 6;
|
||||
if (board_info_set("com-opb-frequency", &comfreq,
|
||||
sizeof(&comfreq), 0, 0))
|
||||
panic("setting com-opb-frequency");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
dumpsys(void)
|
||||
{
|
||||
|
||||
printf("dumpsys: TBD\n");
|
||||
}
|
||||
|
||||
/*
|
||||
* Soft networking interrupts.
|
||||
*/
|
||||
void
|
||||
softnet(void)
|
||||
{
|
||||
int isr;
|
||||
|
||||
isr = netisr;
|
||||
netisr = 0;
|
||||
|
||||
#define DONETISR(bit, fn) do { \
|
||||
if (isr & (1 << bit)) \
|
||||
fn(); \
|
||||
} while (0)
|
||||
|
||||
#include <net/netisr_dispatch.h>
|
||||
|
||||
#undef DONETISR
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Soft tty interrupts.
|
||||
*/
|
||||
void
|
||||
softserial(void)
|
||||
{
|
||||
#if NCOM > 0
|
||||
void comsoft(void); /* XXX from dev/ic/com.c */
|
||||
|
||||
comsoft();
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* Halt or reboot the machine after syncing/dumping according to howto.
|
||||
*/
|
||||
void
|
||||
cpu_reboot(int howto, char *what)
|
||||
{
|
||||
static int syncing;
|
||||
static char str[256];
|
||||
char *ap = str, *ap1 = ap;
|
||||
|
||||
boothowto = howto;
|
||||
if (!cold && !(howto & RB_NOSYNC) && !syncing) {
|
||||
syncing = 1;
|
||||
vfs_shutdown(); /* sync */
|
||||
resettodr(); /* set wall clock */
|
||||
}
|
||||
|
||||
splhigh();
|
||||
|
||||
if (!cold && (howto & RB_DUMP))
|
||||
dumpsys();
|
||||
|
||||
doshutdownhooks();
|
||||
|
||||
if ((howto & RB_POWERDOWN) == RB_POWERDOWN) {
|
||||
/* Power off here if we know how...*/
|
||||
}
|
||||
|
||||
if (howto & RB_HALT) {
|
||||
printf("halted\n\n");
|
||||
|
||||
goto reboot; /* XXX for now... */
|
||||
|
||||
#ifdef DDB
|
||||
printf("dropping to debugger\n");
|
||||
while(1)
|
||||
Debugger();
|
||||
#endif
|
||||
}
|
||||
|
||||
printf("rebooting\n\n");
|
||||
if (what && *what) {
|
||||
if (strlen(what) > sizeof str - 5)
|
||||
printf("boot string too large, ignored\n");
|
||||
else {
|
||||
strcpy(str, what);
|
||||
ap1 = ap = str + strlen(str);
|
||||
*ap++ = ' ';
|
||||
}
|
||||
}
|
||||
*ap++ = '-';
|
||||
if (howto & RB_SINGLE)
|
||||
*ap++ = 's';
|
||||
if (howto & RB_KDB)
|
||||
*ap++ = 'd';
|
||||
*ap++ = 0;
|
||||
if (ap[-2] == '-')
|
||||
*ap1 = 0;
|
||||
|
||||
/* flush cache for msgbuf */
|
||||
__syncicache((void *)msgbuf_paddr, round_page(MSGBUFSIZE));
|
||||
|
||||
reboot:
|
||||
ppc4xx_reset();
|
||||
|
||||
printf("ppc4xx_reset() failed!\n");
|
||||
#ifdef DDB
|
||||
while(1)
|
||||
Debugger();
|
||||
#else
|
||||
while (1)
|
||||
/* nothing */;
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
lcsplx(int ipl)
|
||||
{
|
||||
|
||||
return spllower(ipl); /* XXX */
|
||||
}
|
||||
|
||||
/*
|
||||
* Allocate vm space and mapin the I/O address
|
||||
*/
|
||||
void *
|
||||
mapiodev(paddr_t pa, psize_t len)
|
||||
{
|
||||
paddr_t faddr;
|
||||
vaddr_t taddr, va;
|
||||
int off;
|
||||
|
||||
/*
|
||||
* Initially we cannot use uvm_ functions, but we still have to map
|
||||
* console..
|
||||
*/
|
||||
if (fake_mapiodev)
|
||||
return (void *)pa;
|
||||
|
||||
faddr = trunc_page(pa);
|
||||
off = pa - faddr;
|
||||
len = round_page(off + len);
|
||||
va = taddr = uvm_km_valloc(kernel_map, len);
|
||||
|
||||
if (va == 0)
|
||||
return NULL;
|
||||
|
||||
for (; len > 0; len -= NBPG) {
|
||||
pmap_kenter_pa(taddr, faddr,
|
||||
VM_PROT_READ|VM_PROT_WRITE|PME_NOCACHE);
|
||||
faddr += NBPG;
|
||||
taddr += NBPG;
|
||||
}
|
||||
|
||||
return (void *)(va + off);
|
||||
}
|
||||
|
||||
void
|
||||
mem_regions(struct mem_region **mem, struct mem_region **avail)
|
||||
{
|
||||
|
||||
*mem = physmemr;
|
||||
*avail = availmemr;
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
/* $NetBSD: procfs_machdep.c,v 1.1 2001/06/13 06:02:01 simonb Exp $ */
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/mount.h>
|
||||
#include <sys/vnode.h>
|
||||
#include <miscfs/procfs/procfs.h>
|
||||
|
||||
|
||||
/*
|
||||
* Linux-style /proc/cpuinfo.
|
||||
* Only used when procfs is mounted with -o linux.
|
||||
*/
|
||||
int
|
||||
procfs_getcpuinfstr(char *buf, int *len)
|
||||
{
|
||||
|
||||
*len = 0;
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user