Add a port to the NCD Explora451 ThinClient.
- Supported devices: le, com, lpt, pckbd, frame buffer. - Support missing: phy, audio, pcmcia. - Boots from network or md. Approved by: Eduardo Horvath <eeh@netbsd.org>
This commit is contained in:
parent
44b1e07ec9
commit
249e0067fe
|
@ -0,0 +1,201 @@
|
|||
# $NetBSD: EXPLORA451,v 1.1 2003/03/11 10:57:54 hannken Exp $
|
||||
#
|
||||
# GENERIC -- everything that's currently supported
|
||||
#
|
||||
|
||||
include "arch/evbppc/conf/std.explora"
|
||||
|
||||
#options INCLUDE_CONFIG_FILE # embed config file in kernel binary
|
||||
|
||||
#ident "EXPLORA451"
|
||||
|
||||
maxusers 32
|
||||
|
||||
# Options for necessary to use root memory disk
|
||||
#options MEMORY_DISK_HOOKS
|
||||
#options MEMORY_DISK_IS_ROOT
|
||||
#options MEMORY_DISK_SERVER=0
|
||||
#options MEMORY_DISK_ROOT_SIZE=4096
|
||||
|
||||
# Standard system options
|
||||
|
||||
options UCONSOLE # users can use TIOCCONS (for xconsole)
|
||||
options INSECURE # disable kernel security levels - X needs this
|
||||
|
||||
options RTC_OFFSET=0 # hardware clock is this many mins. west of GMT
|
||||
options NTP # NTP phase/frequency locked loop
|
||||
|
||||
options KTRACE # system call tracing via ktrace(1)
|
||||
options SYSTRACE # system call vetting via systrace(1)
|
||||
|
||||
options SYSVMSG # System V-like message queues
|
||||
options SYSVSEM # System V-like semaphores
|
||||
#options SEMMNI=10 # number of semaphore identifiers
|
||||
#options SEMMNS=60 # number of semaphores in system
|
||||
#options SEMUME=10 # max number of undo entries per process
|
||||
#options SEMMNU=30 # number of undo structures in system
|
||||
options SYSVSHM # System V-like memory sharing
|
||||
#options SHMMAXPGS=2048 # 2048 pages is the default
|
||||
|
||||
options LKM # loadable kernel modules
|
||||
|
||||
options USERCONF # userconf(4) support
|
||||
#options PIPE_SOCKETPAIR # smaller, but slower pipe(2)
|
||||
|
||||
# Enable experimental buffer queue strategy for better responsiveness under
|
||||
# high disk I/O load. Use it with caution - it's not proven to be stable yet.
|
||||
#options NEW_BUFQ_STRATEGY
|
||||
|
||||
# Diagnostic/debugging support options
|
||||
options DIAGNOSTIC # expensive kernel consistency checks
|
||||
options DEBUG # expensive debugging checks/support
|
||||
#options KMEMSTATS # kernel memory statistics (vmstat -m)
|
||||
options DDB # in-kernel debugger
|
||||
options DDB_HISTORY_SIZE=512 # enable history editing in DDB
|
||||
#options KGDB # remote debugger
|
||||
#options KGDB_DEVNAME="\"com\"",KGDB_DEVADDR=0x3f8,KGDB_DEVRATE=9600
|
||||
makeoptions DEBUG="-g" # compile full symbol table
|
||||
|
||||
# Compatibility options
|
||||
options COMPAT_NOMID # compatibility with 386BSD, BSDI, NetBSD 0.8,
|
||||
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_15 # NetBSD 1.5,
|
||||
options COMPAT_43 # and 4.3BSD
|
||||
#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 NTFS # Windows/NT file system (experimental)
|
||||
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 CODA # Coda File System; also needs vcoda (below)
|
||||
file-system SMBFS # experimental - CIFS; also needs nsmb (below)
|
||||
|
||||
# File system options
|
||||
options QUOTA # UFS quotas
|
||||
#options FFS_EI # FFS Endian Independent 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.
|
||||
|
||||
# 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 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 IPFILTER_DEFAULT_BLOCK # block all packets by default
|
||||
#options TCP_DEBUG # Record last TCP_NDEBUG packets with SO_DEBUG
|
||||
|
||||
# Options for wscons
|
||||
#
|
||||
# builtin terminal emulations
|
||||
#options WSEMUL_SUN # sun terminal emulation
|
||||
options WSEMUL_VT100 # VT100 / VT220 emulation
|
||||
# different kernel output - see dev/wscons/wsdisplayvar.h
|
||||
options WS_KERNEL_FG=WSCOL_GREEN
|
||||
#options WS_KERNEL_BG=WSCOL_BLACK
|
||||
# compatibility to other console drivers
|
||||
#options WSDISPLAY_COMPAT_PCVT # emulate some ioctls
|
||||
#options WSDISPLAY_COMPAT_SYSCONS # emulate some ioctls
|
||||
#options WSDISPLAY_COMPAT_USL # VT handling
|
||||
#options WSDISPLAY_COMPAT_RAWKBD # can get raw scancodes
|
||||
# see dev/pckbc/wskbdmap_mfii.c for implemented layouts
|
||||
#options PCKBD_LAYOUT="(KB_DE | KB_NODEAD)"
|
||||
# allocate a number of virtual screens at autoconfiguration time
|
||||
options WSDISPLAY_DEFAULTSCREENS=1
|
||||
|
||||
# Options for netboot
|
||||
options NFS_BOOT_BOOTPARAM
|
||||
options NFS_BOOT_DHCP
|
||||
|
||||
config netbsd root on ? type ?
|
||||
|
||||
elb0 at root
|
||||
|
||||
cpu0 at elb?
|
||||
com0 at elb?
|
||||
lpt0 at elb?
|
||||
le0 at elb?
|
||||
|
||||
fb0 at elb?
|
||||
wsdisplay* at fb?
|
||||
|
||||
pckbc0 at elb?
|
||||
pckbd* at pckbc?
|
||||
wskbd* at pckbd? console ?
|
||||
pms* at pckbc?
|
||||
wsmouse* at pms? mux 0
|
||||
|
||||
# Pseudo-Devices
|
||||
|
||||
# disk/mass storage pseudo-devices
|
||||
|
||||
pseudo-device md 1 # memory disk device (ramdisk)
|
||||
pseudo-device vnd 4 # disk-like interface to files
|
||||
|
||||
# network pseudo-devices
|
||||
pseudo-device bpfilter 8 # Berkeley packet filter
|
||||
pseudo-device ipfilter # IP filter (firewall) and NAT
|
||||
pseudo-device loop # network loopback
|
||||
pseudo-device ppp 2 # Point-to-Point Protocol
|
||||
pseudo-device pppoe # PPP over Ethernet (RFC 2516)
|
||||
pseudo-device sl 2 # Serial Line IP
|
||||
pseudo-device strip 2 # Starmode Radio IP (Metricom)
|
||||
pseudo-device irframetty # IrDA frame line discipline
|
||||
pseudo-device tun 2 # 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 bridge # simple inter-network bridging
|
||||
#options BRIDGE_IPF # bridge uses IP/IPv6 pfil hooks too
|
||||
|
||||
# miscellaneous pseudo-devices
|
||||
pseudo-device pty # pseudo-terminals
|
||||
pseudo-device tb 1 # tablet line discipline
|
||||
pseudo-device rnd # /dev/random and in-kernel generator
|
||||
#options RND_COM # use "com" randomness as well (BROKEN)
|
||||
pseudo-device clockctl # user control of clock subsystem
|
||||
|
||||
# a pseudo device needed for Coda # also needs CODA (above)
|
||||
pseudo-device vcoda 4 # coda minicache <-> venus comm.
|
||||
|
||||
# a pseudo device needed for SMBFS
|
||||
pseudo-device nsmb # experimental - SMB requester
|
||||
|
||||
# wscons pseudo-devices
|
||||
pseudo-device wsmux # mouse & keyboard multiplexor
|
||||
pseudo-device wsfont
|
|
@ -0,0 +1,11 @@
|
|||
# $NetBSD: Makefile.explora.inc,v 1.1 2003/03/11 10:57:55 hannken Exp $
|
||||
|
||||
CFLAGS+=-mcpu=403
|
||||
AFLAGS+=-mcpu=403
|
||||
|
||||
SYSTEM_FIRST_OBJ= explora_start.o
|
||||
SYSTEM_FIRST_SFILE= ${THISPPC}/explora/explora_start.S
|
||||
|
||||
SYSTEM_LD_TAIL_EXTRA+=; \
|
||||
echo objcopy --adjust-vma 0x81000000 netbsd netbsd.img ; \
|
||||
${OBJCOPY} --adjust-vma 0x81000000 netbsd netbsd.img
|
|
@ -0,0 +1,49 @@
|
|||
# $NetBSD: files.explora,v 1.1 2003/03/11 10:57:55 hannken Exp $
|
||||
|
||||
# maxpartitions must be first item in files.${ARCH}
|
||||
|
||||
maxpartitions 16
|
||||
|
||||
maxusers 2 8 64
|
||||
|
||||
defflag opt_explora.h COM_IS_CONSOLE
|
||||
defparam opt_explora.h COM_CONSOLE_SPEED
|
||||
|
||||
include "arch/powerpc/fpu/files.fpu"
|
||||
include "dev/wscons/files.wscons"
|
||||
include "dev/wsfont/files.wsfont"
|
||||
include "dev/rasops/files.rasops"
|
||||
|
||||
file arch/evbppc/explora/autoconf.c
|
||||
file arch/evbppc/explora/consinit.c
|
||||
file arch/evbppc/explora/machdep.c
|
||||
file dev/md_root.c memory_disk_hooks
|
||||
|
||||
# Explora local bus
|
||||
device elb {}
|
||||
attach elb at root
|
||||
file arch/evbppc/explora/dev/elb.c elb
|
||||
|
||||
device cpu
|
||||
attach cpu at elb
|
||||
file arch/powerpc/ibm4xx/cpu.c
|
||||
|
||||
attach com at elb with com_elb
|
||||
file arch/evbppc/explora/dev/com_elb.c com_elb
|
||||
|
||||
device lpt
|
||||
file dev/ic/lpt.c lpt needs-flag
|
||||
|
||||
attach lpt at elb with lpt_elb
|
||||
file arch/evbppc/explora/dev/lpt_elb.c lpt_elb
|
||||
|
||||
attach le at elb with le_elb: le32
|
||||
file arch/evbppc/explora/dev/le_elb.c le_elb
|
||||
|
||||
include "dev/pckbc/files.pckbc"
|
||||
attach pckbc at elb with pckbc_elb
|
||||
file arch/evbppc/explora/dev/pckbc_elb.c pckbc_elb
|
||||
|
||||
device fb: wsemuldisplaydev, rasops8
|
||||
attach fb at elb with fb_elb
|
||||
file arch/evbppc/explora/dev/fb_elb.c fb_elb
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: majors.evbppc,v 1.2 2002/12/31 22:45:25 thorpej Exp $
|
||||
# $NetBSD: majors.evbppc,v 1.3 2003/03/11 10:57:55 hannken Exp $
|
||||
#
|
||||
# Device majors for evbppc
|
||||
#
|
||||
|
@ -54,3 +54,8 @@ device-major kttcp char 61 kttcp
|
|||
device-major sysmon char 62 sysmon_envsys | sysmon_wdog
|
||||
device-major pci char 63 pci
|
||||
device-major cgd char 64 block 13 cgd
|
||||
|
||||
device-major wsdisplay char 65 wsdisplay
|
||||
device-major wskbd char 66 wskbd
|
||||
device-major wsmouse char 67 wsmouse
|
||||
device-major wsmux char 68 wsmux
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
# $NetBSD: std.explora,v 1.1 2003/03/11 10:57:55 hannken Exp $
|
||||
#
|
||||
# Standard/required options for NetBSD/explora.
|
||||
|
||||
machine evbppc powerpc
|
||||
|
||||
# standard ("mandatory") kernel options.
|
||||
options PPC_IBM4XX # IBM 40x family
|
||||
options PPC_IBM403 # IBM 403GCX
|
||||
|
||||
# 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=0x10000
|
||||
makeoptions BOARDTYPE="explora"
|
||||
makeoptions PPCDIR="ibm4xx"
|
||||
|
||||
options PPC_INTR_IMPL="<powerpc/ibm4xx/ibm4xx_intr.h>"
|
||||
|
||||
options INTSTK=8192
|
||||
options SPILLSTK=1024
|
||||
|
||||
include "arch/evbppc/conf/files.explora"
|
|
@ -0,0 +1,71 @@
|
|||
/* $NetBSD: autoconf.c,v 1.1 2003/03/11 10:57:55 hannken Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2003 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Juergen Hannken-Illjes.
|
||||
*
|
||||
* 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/conf.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/systm.h>
|
||||
|
||||
struct device *booted_device;
|
||||
int booted_partition;
|
||||
|
||||
void
|
||||
cpu_configure(void)
|
||||
{
|
||||
intr_init();
|
||||
calc_delayconst();
|
||||
|
||||
if (config_rootfound("elb", NULL) == NULL)
|
||||
panic("configure: elb 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");
|
||||
}
|
||||
|
||||
void
|
||||
cpu_rootconf(void)
|
||||
{
|
||||
setroot(booted_device, booted_partition);
|
||||
}
|
|
@ -0,0 +1,93 @@
|
|||
/* $NetBSD: consinit.c,v 1.1 2003/03/11 10:57:55 hannken Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2003 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Juergen Hannken-Illjes.
|
||||
*
|
||||
* 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 <machine/explora.h>
|
||||
#include <machine/bus.h>
|
||||
|
||||
#include "com.h"
|
||||
#if NCOM > 0
|
||||
#include <sys/termios.h>
|
||||
#include <dev/ic/comreg.h>
|
||||
#include <dev/ic/comvar.h>
|
||||
#endif
|
||||
|
||||
#include "pckbc.h"
|
||||
#if (NPCKBC > 0)
|
||||
#include <dev/isa/isareg.h>
|
||||
#include <dev/ic/i8042reg.h>
|
||||
#include <dev/ic/pckbcvar.h>
|
||||
#endif
|
||||
#include "pckbd.h"
|
||||
|
||||
#include "opt_explora.h"
|
||||
|
||||
#ifndef COM_CONSOLE_SPEED
|
||||
#define COM_CONSOLE_SPEED 9600
|
||||
#endif
|
||||
|
||||
void
|
||||
consinit(void)
|
||||
{
|
||||
bus_space_tag_t tag;
|
||||
static int done = 0;
|
||||
#ifndef COM_IS_CONSOLE
|
||||
extern void fb_cnattach(bus_space_tag_t, bus_addr_t, void *);
|
||||
#endif
|
||||
|
||||
if (done)
|
||||
return;
|
||||
|
||||
done = 1;
|
||||
|
||||
#ifdef COM_IS_CONSOLE
|
||||
tag = MAKE_BUS_TAG(BASE_COM);
|
||||
comcnattach(tag, BASE_COM, COM_CONSOLE_SPEED, COM_FREQ,
|
||||
(TTYDEF_CFLAG & ~(CSIZE | CSTOPB | PARENB)) | CS8);
|
||||
#else
|
||||
/* Clear VRam */
|
||||
memset((void *)BASE_FB, 0, SIZE_FB);
|
||||
|
||||
tag = MAKE_BUS_TAG(BASE_FB);
|
||||
fb_cnattach(tag, BASE_FB2, (void *)BASE_FB);
|
||||
tag = MAKE_BUS_TAG(BASE_PCKBC);
|
||||
pckbc_cnattach(tag, BASE_PCKBC, BASE_PCKBC2-BASE_PCKBC, PCKBC_KBD_SLOT);
|
||||
#endif
|
||||
}
|
|
@ -0,0 +1,91 @@
|
|||
/* $NetBSD: com_elb.c,v 1.1 2003/03/11 10:57:56 hannken Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2003 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Juergen Hannken-Illjes.
|
||||
*
|
||||
* 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/conf.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/tty.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
|
||||
#include <dev/ic/comreg.h>
|
||||
#include <dev/ic/comvar.h>
|
||||
|
||||
#include <evbppc/explora/dev/elbvar.h>
|
||||
|
||||
struct com_elb_softc {
|
||||
struct com_softc sc_com;
|
||||
void *sc_ih;
|
||||
};
|
||||
|
||||
static int com_elb_probe(struct device *, struct cfdata *, void *);
|
||||
static void com_elb_attach(struct device *, struct device *, void *);
|
||||
|
||||
CFATTACH_DECL(com_elb, sizeof(struct com_elb_softc),
|
||||
com_elb_probe, com_elb_attach, NULL, NULL);
|
||||
|
||||
int
|
||||
com_elb_probe(struct device *parent, struct cfdata *cf, void *aux)
|
||||
{
|
||||
struct elb_attach_args *oaa = aux;
|
||||
|
||||
if (strcmp(oaa->elb_name, cf->cf_name) != 0)
|
||||
return 0;
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
void
|
||||
com_elb_attach(struct device *parent, struct device *self, void *aux)
|
||||
{
|
||||
struct com_elb_softc *msc = (void *)self;
|
||||
struct com_softc *sc = &msc->sc_com;
|
||||
struct elb_attach_args *eaa = aux;
|
||||
|
||||
sc->sc_iot = eaa->elb_bt;
|
||||
sc->sc_iobase = eaa->elb_base;
|
||||
|
||||
bus_space_map(sc->sc_iot, eaa->elb_base, COM_NPORTS, 0, &sc->sc_ioh);
|
||||
|
||||
sc->sc_frequency = COM_FREQ;
|
||||
|
||||
com_attach_subr(sc);
|
||||
|
||||
intr_establish(eaa->elb_irq, IST_LEVEL, IPL_SERIAL, comintr, sc);
|
||||
}
|
|
@ -0,0 +1,117 @@
|
|||
/* $NetBSD: elb.c,v 1.1 2003/03/11 10:57:57 hannken Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2003 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Juergen Hannken-Illjes.
|
||||
*
|
||||
* 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/conf.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/systm.h>
|
||||
|
||||
#include <machine/explora.h>
|
||||
#define _IBM4XX_BUS_DMA_PRIVATE
|
||||
#include <machine/bus.h>
|
||||
|
||||
#include <powerpc/ibm4xx/dcr403cgx.h>
|
||||
|
||||
#include <evbppc/explora/dev/elbvar.h>
|
||||
|
||||
struct elb_dev {
|
||||
const char *elb_name;
|
||||
int elb_addr;
|
||||
int elb_addr2;
|
||||
int elb_irq;
|
||||
};
|
||||
|
||||
static int elb_match(struct device *, struct cfdata *, void *);
|
||||
static void elb_attach(struct device *, struct device *, void *);
|
||||
static int elb_print(void *, const char *);
|
||||
|
||||
static struct elb_dev elb_devs[] = {
|
||||
{ "cpu", 0, 0, -1 },
|
||||
{ "pckbc", BASE_PCKBC, BASE_PCKBC2, 31 },
|
||||
{ "com", BASE_COM, 0, 30 },
|
||||
{ "lpt", BASE_LPT, 0, -1 },
|
||||
{ "fb", BASE_FB, BASE_FB2, -1 },
|
||||
{ "le", BASE_LE, 0, 28 },
|
||||
};
|
||||
|
||||
CFATTACH_DECL(elb, sizeof(struct device),
|
||||
elb_match, elb_attach, NULL, NULL);
|
||||
|
||||
/*
|
||||
* Probe for the elb; always succeeds.
|
||||
*/
|
||||
static int
|
||||
elb_match(struct device *parent, struct cfdata *cf, void *aux)
|
||||
{
|
||||
return (1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Attach the Explora local bus.
|
||||
*/
|
||||
static void
|
||||
elb_attach(struct device *parent, struct device *self, void *aux)
|
||||
{
|
||||
struct elb_attach_args eaa;
|
||||
int i;
|
||||
|
||||
printf("\n");
|
||||
for (i = 0; i < sizeof(elb_devs)/sizeof(elb_devs[0]); i++) {
|
||||
eaa.elb_name = elb_devs[i].elb_name;
|
||||
eaa.elb_bt = MAKE_BUS_TAG(elb_devs[i].elb_addr);
|
||||
eaa.elb_dmat = &ibm4xx_default_bus_dma_tag;
|
||||
eaa.elb_base = elb_devs[i].elb_addr;
|
||||
eaa.elb_base2 = elb_devs[i].elb_addr2;
|
||||
eaa.elb_irq = elb_devs[i].elb_irq;
|
||||
|
||||
(void) config_found_sm(self, &eaa, elb_print, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
elb_print(void *aux, const char *pnp)
|
||||
{
|
||||
struct elb_attach_args *eaa = aux;
|
||||
|
||||
if (pnp)
|
||||
aprint_normal("%s at %s", eaa->elb_name, pnp);
|
||||
if (eaa->elb_irq != -1)
|
||||
aprint_normal(" irq %d", eaa->elb_irq);
|
||||
|
||||
return (UNCONF);
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
/* $NetBSD: elbvar.h,v 1.1 2003/03/11 10:57:57 hannken Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2003 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Juergen Hannken-Illjes.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
struct elb_attach_args {
|
||||
const char *elb_name;
|
||||
bus_space_tag_t elb_bt;
|
||||
bus_dma_tag_t elb_dmat;
|
||||
u_int elb_base;
|
||||
u_int elb_base2;
|
||||
int elb_irq;
|
||||
};
|
|
@ -0,0 +1,341 @@
|
|||
/* $NetBSD: fb_elb.c,v 1.1 2003/03/11 10:57:57 hannken Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2003 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Juergen Hannken-Illjes.
|
||||
*
|
||||
* 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/conf.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/systm.h>
|
||||
|
||||
#include <dev/wscons/wsconsio.h>
|
||||
#include <dev/wscons/wsdisplayvar.h>
|
||||
#include <dev/rasops/rasops.h>
|
||||
|
||||
#include <machine/explora.h>
|
||||
#include <machine/bus.h>
|
||||
|
||||
#include <evbppc/explora/dev/elbvar.h>
|
||||
|
||||
#define FB_NPORTS 65536
|
||||
|
||||
struct fb_dev {
|
||||
void *fb_vram;
|
||||
bus_space_tag_t fb_iot;
|
||||
bus_space_handle_t fb_ioh;
|
||||
struct rasops_info fb_ri;
|
||||
};
|
||||
|
||||
struct fb_elb_softc {
|
||||
struct device sc_dev;
|
||||
struct fb_dev *sc_fb;
|
||||
int sc_nscreens;
|
||||
};
|
||||
|
||||
static int fb_elb_probe(struct device *, struct cfdata *, void *);
|
||||
static void fb_elb_attach(struct device *, struct device *, void *);
|
||||
void fb_cnattach(bus_space_tag_t, bus_addr_t, void *);
|
||||
static void fb_init(struct fb_dev *, int);
|
||||
static int fb_ioctl(void *, u_long, caddr_t, int, struct proc *);
|
||||
static paddr_t fb_mmap(void *, off_t, int);
|
||||
static int fb_alloc_screen(void *, const struct wsscreen_descr *, void **,
|
||||
int *, int *, long *);
|
||||
static void fb_free_screen(void *, void *);
|
||||
static int fb_show_screen(void *, void *, int, void (*)(void *, int, int),
|
||||
void *);
|
||||
|
||||
static void s3_init(struct fb_dev *, int *, int *);
|
||||
|
||||
static struct fb_dev console_dev;
|
||||
|
||||
static struct wsdisplay_accessops accessops = {
|
||||
fb_ioctl,
|
||||
fb_mmap,
|
||||
fb_alloc_screen,
|
||||
fb_free_screen,
|
||||
fb_show_screen,
|
||||
NULL
|
||||
};
|
||||
|
||||
static struct wsscreen_descr stdscreen = {
|
||||
"std",
|
||||
0, 0,
|
||||
0,
|
||||
0, 0,
|
||||
0
|
||||
};
|
||||
|
||||
static const struct wsscreen_descr *scrlist[] = {
|
||||
&stdscreen
|
||||
};
|
||||
|
||||
static struct wsscreen_list screenlist = {
|
||||
sizeof(scrlist)/sizeof(scrlist[0]), scrlist
|
||||
};
|
||||
|
||||
CFATTACH_DECL(fb_elb, sizeof(struct fb_elb_softc),
|
||||
fb_elb_probe, fb_elb_attach, NULL, NULL);
|
||||
|
||||
static int
|
||||
fb_elb_probe(struct device *parent, struct cfdata *cf, void *aux)
|
||||
{
|
||||
struct elb_attach_args *oaa = aux;
|
||||
|
||||
if (strcmp(oaa->elb_name, cf->cf_name) != 0)
|
||||
return 0;
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
static void
|
||||
fb_elb_attach(struct device *parent, struct device *self, void *aux)
|
||||
{
|
||||
struct fb_elb_softc *sc = (void *)self;
|
||||
struct elb_attach_args *eaa = aux;
|
||||
struct wsemuldisplaydev_attach_args waa;
|
||||
struct rasops_info *ri;
|
||||
bus_space_handle_t ioh;
|
||||
int is_console;
|
||||
|
||||
is_console = ((void *)eaa->elb_base == console_dev.fb_vram);
|
||||
|
||||
if (is_console) {
|
||||
sc->sc_fb = &console_dev;
|
||||
} else {
|
||||
sc->sc_fb = malloc(sizeof(struct fb_dev), M_DEVBUF, M_WAITOK);
|
||||
memset(sc->sc_fb, 0, sizeof(struct fb_dev));
|
||||
}
|
||||
|
||||
sc->sc_fb->fb_iot = eaa->elb_bt;
|
||||
bus_space_map(sc->sc_fb->fb_iot, eaa->elb_base, SIZE_FB,
|
||||
BUS_SPACE_MAP_LINEAR, &ioh);
|
||||
sc->sc_fb->fb_vram = bus_space_vaddr(sc->sc_fb->fb_iot, ioh);
|
||||
bus_space_map(sc->sc_fb->fb_iot, eaa->elb_base2, FB_NPORTS,
|
||||
0, &sc->sc_fb->fb_ioh);
|
||||
|
||||
fb_init(sc->sc_fb, !is_console);
|
||||
|
||||
ri = &sc->sc_fb->fb_ri;
|
||||
|
||||
printf(": %d x %d\n", ri->ri_rows, ri->ri_cols);
|
||||
|
||||
waa.console = is_console;
|
||||
waa.scrdata = &screenlist;
|
||||
waa.accessops = &accessops;
|
||||
waa.accesscookie = sc;
|
||||
|
||||
config_found_sm(self, &waa, wsemuldisplaydevprint, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
fb_init(struct fb_dev *fb, int full)
|
||||
{
|
||||
struct rasops_info *ri = &fb->fb_ri;
|
||||
|
||||
if (full) {
|
||||
s3_init(fb, &ri->ri_width, &ri->ri_height);
|
||||
ri->ri_depth = 8;
|
||||
ri->ri_stride = ri->ri_width;
|
||||
ri->ri_bits = fb->fb_vram;
|
||||
ri->ri_flg = RI_CENTER;
|
||||
|
||||
rasops_init(ri, 500, 500);
|
||||
} else {
|
||||
ri->ri_origbits = fb->fb_vram; /*XXX*/
|
||||
rasops_reconfig(ri, 500, 500);
|
||||
}
|
||||
|
||||
stdscreen.nrows = ri->ri_rows;
|
||||
stdscreen.ncols = ri->ri_cols;
|
||||
stdscreen.textops = &ri->ri_ops;
|
||||
stdscreen.capabilities = ri->ri_caps;
|
||||
}
|
||||
|
||||
static int
|
||||
fb_ioctl(void *v, u_long cmd, caddr_t data, int flag, struct proc *p)
|
||||
{
|
||||
struct fb_elb_softc *sc = v;
|
||||
struct rasops_info *ri = &sc->sc_fb->fb_ri;
|
||||
struct wsdisplay_fbinfo *wdf;
|
||||
|
||||
switch (cmd) {
|
||||
case WSDISPLAYIO_GTYPE:
|
||||
*(int *)data = WSDISPLAY_TYPE_UNKNOWN; /* XXX */
|
||||
return(0);
|
||||
|
||||
case WSDISPLAYIO_GINFO:
|
||||
wdf = (void *)data;
|
||||
wdf->height = ri->ri_height;
|
||||
wdf->width = ri->ri_width;
|
||||
wdf->depth = ri->ri_depth;
|
||||
wdf->cmsize = 16; /*XXX*/
|
||||
return(0);
|
||||
|
||||
case WSDISPLAYIO_SVIDEO:
|
||||
case WSDISPLAYIO_GETCMAP:
|
||||
case WSDISPLAYIO_PUTCMAP:
|
||||
break;
|
||||
}
|
||||
|
||||
return(EPASSTHROUGH);
|
||||
}
|
||||
|
||||
static paddr_t
|
||||
fb_mmap(void *v, off_t offset, int prot)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int
|
||||
fb_alloc_screen(void *v, const struct wsscreen_descr *scrdesc, void **cookiep,
|
||||
int *ccolp, int *crowp, long *attrp)
|
||||
{
|
||||
struct fb_elb_softc *sc = v;
|
||||
struct rasops_info *ri = &sc->sc_fb->fb_ri;
|
||||
|
||||
if (sc->sc_nscreens > 0)
|
||||
return ENOMEM;
|
||||
|
||||
*cookiep = ri;
|
||||
*ccolp = *crowp = 0;
|
||||
(*ri->ri_ops.allocattr)(ri, 0, 0, 0, attrp);
|
||||
sc->sc_nscreens++;
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
static void
|
||||
fb_free_screen(void *v, void *cookie)
|
||||
{
|
||||
struct fb_elb_softc *sc = v;
|
||||
|
||||
if (sc->sc_fb == &console_dev)
|
||||
panic("fb_free_screen: freeing console");
|
||||
|
||||
sc->sc_nscreens--;
|
||||
}
|
||||
|
||||
static int
|
||||
fb_show_screen(void *v, void *cookie, int waitok, void (*cb)(void *, int, int),
|
||||
void *cbarg)
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
|
||||
void
|
||||
fb_cnattach(bus_space_tag_t iot, bus_addr_t iobase, void *vram)
|
||||
{
|
||||
struct rasops_info *ri = &console_dev.fb_ri;
|
||||
long defattr;
|
||||
|
||||
console_dev.fb_iot = iot;
|
||||
console_dev.fb_ioh = iobase;
|
||||
console_dev.fb_vram = vram;
|
||||
|
||||
fb_init(&console_dev, 1);
|
||||
|
||||
(*ri->ri_ops.allocattr)(ri, 0, 0, 0, &defattr);
|
||||
|
||||
wsdisplay_cnattach(&stdscreen, ri, 0, 0, defattr);
|
||||
}
|
||||
|
||||
/*
|
||||
* S3 support routines
|
||||
*/
|
||||
|
||||
#define S3_CRTC_INDEX 0x83d4
|
||||
#define S3_CRTC_DATA 0x83d5
|
||||
|
||||
#define S3_DAC_RD_INDEX 0x83c7
|
||||
#define S3_DAC_WR_INDEX 0x83c8
|
||||
#define S3_DAC_DATA 0x83c9
|
||||
|
||||
#define CMAP_SIZE 256
|
||||
|
||||
static u_int8_t default_cmap[] = {
|
||||
/* black */ 0, 0, 0,
|
||||
/* blue */ 0, 0, 192,
|
||||
/* green */ 0, 192, 0,
|
||||
/* cyan */ 0, 192, 192,
|
||||
/* red */ 192, 0, 0,
|
||||
/* magenta */ 192, 0, 192,
|
||||
/* brown */ 192, 192, 0,
|
||||
/* lightgrey */ 212, 208, 200,
|
||||
/* darkgrey */ 200, 192, 188,
|
||||
/* lightblue */ 0, 0, 255,
|
||||
/* lightgreen */ 0, 255, 0,
|
||||
/* lightcyan */ 0, 255, 255,
|
||||
/* lightred */ 255, 0, 0,
|
||||
/* lightmagenta */ 255, 0, 255,
|
||||
/* yellow */ 255, 255, 0,
|
||||
/* white */ 255, 255, 255,
|
||||
};
|
||||
|
||||
static void
|
||||
s3_init(struct fb_dev *fb, int *width, int *height)
|
||||
{
|
||||
int i, j, w, h;
|
||||
bus_space_tag_t iot = fb->fb_iot;
|
||||
bus_space_handle_t ioh = fb->fb_ioh;
|
||||
|
||||
/* Initialize colormap */
|
||||
|
||||
bus_space_write_1(iot, ioh, S3_DAC_WR_INDEX, 0);
|
||||
|
||||
for (i = j = 0; i < CMAP_SIZE*3; i++) {
|
||||
bus_space_write_1(iot, ioh, S3_DAC_DATA, default_cmap[j] >> 2);
|
||||
j = (j+1) % sizeof(default_cmap)/sizeof(default_cmap[0]);
|
||||
}
|
||||
|
||||
/* Retrieve frame buffer geometry */
|
||||
|
||||
bus_space_write_1(iot, ioh, S3_CRTC_INDEX, 1);
|
||||
w = bus_space_read_1(iot, ioh, S3_CRTC_DATA);
|
||||
|
||||
bus_space_write_1(iot, ioh, S3_CRTC_INDEX, 18);
|
||||
h = bus_space_read_1(iot, ioh, S3_CRTC_DATA);
|
||||
|
||||
bus_space_write_1(iot, ioh, S3_CRTC_INDEX, 7);
|
||||
i = bus_space_read_1(iot, ioh, S3_CRTC_DATA);
|
||||
|
||||
h += (i << 7) & 0x100;
|
||||
h += (i << 3) & 0x200;
|
||||
|
||||
*width = (w+1) << 3;
|
||||
*height = h+1;
|
||||
}
|
|
@ -0,0 +1,246 @@
|
|||
/* $NetBSD: le_elb.c,v 1.1 2003/03/11 10:57:57 hannken Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2003 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Juergen Hannken-Illjes.
|
||||
*
|
||||
* 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/conf.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/systm.h>
|
||||
|
||||
#include <uvm/uvm_extern.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
|
||||
#include <net/if.h>
|
||||
#include <net/if_ether.h>
|
||||
#include <net/if_media.h>
|
||||
|
||||
#include <dev/ic/lancereg.h>
|
||||
#include <dev/ic/lancevar.h>
|
||||
#include <dev/ic/am79900reg.h>
|
||||
#include <dev/ic/am79900var.h>
|
||||
|
||||
#include <evbppc/explora/dev/elbvar.h>
|
||||
|
||||
#define LE_MEMSIZE 16384
|
||||
#define LE_RDP 0x10 /* Indirect data register. */
|
||||
#define LE_RAP 0x14 /* Indirect address register. */
|
||||
#define LE_NPORTS 32
|
||||
|
||||
struct le_elb_softc {
|
||||
struct am79900_softc sc_am79900;
|
||||
bus_dma_tag_t sc_dmat;
|
||||
bus_dmamap_t sc_dmam;
|
||||
bus_space_tag_t sc_iot;
|
||||
bus_space_handle_t sc_ioh;
|
||||
void *sc_ih;
|
||||
};
|
||||
|
||||
static int le_elb_probe(struct device *, struct cfdata *, void *);
|
||||
static void le_elb_attach(struct device *, struct device *, void *);
|
||||
static u_int16_t le_rdcsr(struct lance_softc *, u_int16_t);
|
||||
static void le_wrcsr(struct lance_softc *, u_int16_t, u_int16_t);
|
||||
static void le_copytodesc(struct lance_softc *, void *, int, int);
|
||||
static void le_copyfromdesc(struct lance_softc *, void *, int, int);
|
||||
|
||||
CFATTACH_DECL(le_elb, sizeof(struct le_elb_softc),
|
||||
le_elb_probe, le_elb_attach, NULL, NULL);
|
||||
|
||||
int
|
||||
le_elb_probe(struct device *parent, struct cfdata *cf, void *aux)
|
||||
{
|
||||
struct elb_attach_args *oaa = aux;
|
||||
|
||||
if (strcmp(oaa->elb_name, cf->cf_name) != 0)
|
||||
return 0;
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
void
|
||||
le_elb_attach(struct device *parent, struct device *self, void *aux)
|
||||
{
|
||||
struct le_elb_softc *msc = (void *)self;
|
||||
struct lance_softc *sc = &msc->sc_am79900.lsc;
|
||||
struct elb_attach_args *eaa = aux;
|
||||
bus_dma_segment_t seg;
|
||||
int i, rseg;
|
||||
|
||||
printf("\n");
|
||||
|
||||
if (booted_device == NULL) /*XXX*/
|
||||
booted_device = self;
|
||||
|
||||
msc->sc_iot = eaa->elb_bt;
|
||||
msc->sc_dmat = eaa->elb_dmat;
|
||||
|
||||
bus_space_map(msc->sc_iot, eaa->elb_base, LE_NPORTS, 0, &msc->sc_ioh);
|
||||
|
||||
/*
|
||||
* Allocate a DMA area for the card.
|
||||
*/
|
||||
if (bus_dmamem_alloc(msc->sc_dmat, LE_MEMSIZE, PAGE_SIZE, 0,
|
||||
&seg, 1, &rseg, BUS_DMA_NOWAIT)) {
|
||||
printf("%s: couldn't allocate memory for card\n",
|
||||
sc->sc_dev.dv_xname);
|
||||
return;
|
||||
}
|
||||
if (bus_dmamem_map(msc->sc_dmat, &seg, rseg, LE_MEMSIZE,
|
||||
(caddr_t *)&sc->sc_mem,
|
||||
BUS_DMA_NOWAIT|BUS_DMA_COHERENT)) {
|
||||
printf("%s: couldn't map memory for card\n",
|
||||
sc->sc_dev.dv_xname);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Create and load the DMA map for the DMA area.
|
||||
*/
|
||||
if (bus_dmamap_create(msc->sc_dmat, LE_MEMSIZE, 1,
|
||||
LE_MEMSIZE, 0, BUS_DMA_NOWAIT, &msc->sc_dmam)) {
|
||||
printf("%s: couldn't create DMA map\n",
|
||||
sc->sc_dev.dv_xname);
|
||||
bus_dmamem_free(msc->sc_dmat, &seg, rseg);
|
||||
return;
|
||||
}
|
||||
if (bus_dmamap_load(msc->sc_dmat, msc->sc_dmam,
|
||||
sc->sc_mem, LE_MEMSIZE, NULL, BUS_DMA_NOWAIT)) {
|
||||
printf("%s: coundn't load DMA map\n",
|
||||
sc->sc_dev.dv_xname);
|
||||
bus_dmamem_free(msc->sc_dmat, &seg, rseg);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* This is magic -- DMA doesn't work without address
|
||||
* bit 30 set to one.
|
||||
*/
|
||||
sc->sc_addr = 0x40000000 | msc->sc_dmam->dm_segs[0].ds_addr;
|
||||
sc->sc_memsize = LE_MEMSIZE;
|
||||
|
||||
sc->sc_copytodesc = le_copytodesc;
|
||||
sc->sc_copyfromdesc = le_copyfromdesc;
|
||||
sc->sc_copytobuf = lance_copytobuf_contig;
|
||||
sc->sc_copyfrombuf = lance_copyfrombuf_contig;
|
||||
sc->sc_zerobuf = lance_zerobuf_contig;
|
||||
|
||||
sc->sc_rdcsr = le_rdcsr;
|
||||
sc->sc_wrcsr = le_wrcsr;
|
||||
|
||||
printf("%s", sc->sc_dev.dv_xname);
|
||||
|
||||
/* Save the MAC address. */
|
||||
for (i = 0; i < 3; i++) {
|
||||
sc->sc_enaddr[i*2] = le_rdcsr(sc, 12+i);
|
||||
sc->sc_enaddr[i*2+1] = le_rdcsr(sc, 12+i) >> 8;
|
||||
}
|
||||
|
||||
am79900_config(&msc->sc_am79900);
|
||||
|
||||
/* Chip is stopped. Set "software style" to 32-bit. */
|
||||
le_wrcsr(sc, LE_CSR58, 2);
|
||||
|
||||
intr_establish(eaa->elb_irq, IST_LEVEL, IPL_NET, am79900_intr, sc);
|
||||
}
|
||||
|
||||
/*
|
||||
* Read from an indirect CSR.
|
||||
*/
|
||||
static u_int16_t
|
||||
le_rdcsr(struct lance_softc *sc, u_int16_t reg)
|
||||
{
|
||||
struct le_elb_softc *lesc = (struct le_elb_softc *)sc;
|
||||
bus_space_tag_t iot = lesc->sc_iot;
|
||||
bus_space_handle_t ioh = lesc->sc_ioh;
|
||||
u_int16_t val;
|
||||
|
||||
bus_space_write_4(iot, ioh, LE_RAP, reg);
|
||||
val = bus_space_read_4(iot, ioh, LE_RDP);
|
||||
|
||||
return(val);
|
||||
}
|
||||
|
||||
/*
|
||||
* Write to an indirect CSR.
|
||||
*/
|
||||
static void
|
||||
le_wrcsr(struct lance_softc *sc, u_int16_t reg, u_int16_t val)
|
||||
{
|
||||
struct le_elb_softc *lesc = (struct le_elb_softc *)sc;
|
||||
bus_space_tag_t iot = lesc->sc_iot;
|
||||
bus_space_handle_t ioh = lesc->sc_ioh;
|
||||
|
||||
bus_space_write_4(iot, ioh, LE_RAP, reg);
|
||||
bus_space_write_4(iot, ioh, LE_RDP, val);
|
||||
}
|
||||
|
||||
/*
|
||||
* Copy data to memory and swap bytes.
|
||||
*/
|
||||
static void
|
||||
le_copytodesc(struct lance_softc *sc, void *from, int boff, int len)
|
||||
{
|
||||
volatile u_int32_t *src = from;
|
||||
volatile u_int32_t *dst = (u_int32_t *)((u_char *)sc->sc_mem+boff);
|
||||
|
||||
/* XXX lance_setladrf should be modified to use u_int32_t instead.
|
||||
* The init block contains u_int16_t values that require
|
||||
* special swapping.
|
||||
*/
|
||||
if (boff == LE_INITADDR(sc) && len == sizeof(struct leinit)) {
|
||||
src[3] = (src[3] >> 16) | (src[3] << 16);
|
||||
src[4] = (src[4] >> 16) | (src[4] << 16);
|
||||
}
|
||||
|
||||
len /= sizeof(u_int32_t);
|
||||
while (len-- > 0)
|
||||
*dst++ = bswap32(*src++);
|
||||
}
|
||||
|
||||
/*
|
||||
* Copy data from memory and swap bytes.
|
||||
*/
|
||||
static void
|
||||
le_copyfromdesc(struct lance_softc *sc, void *to, int boff, int len)
|
||||
{
|
||||
volatile u_int32_t *src = (u_int32_t *)((u_char *)sc->sc_mem+boff);
|
||||
volatile u_int32_t *dst = to;
|
||||
|
||||
len /= sizeof(u_int32_t);
|
||||
while (len-- > 0)
|
||||
*dst++ = bswap32(*src++);
|
||||
}
|
|
@ -0,0 +1,81 @@
|
|||
/* $NetBSD: lpt_elb.c,v 1.1 2003/03/11 10:57:57 hannken Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2003 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Juergen Hannken-Illjes.
|
||||
*
|
||||
* 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/conf.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/tty.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
|
||||
#include <dev/ic/lptreg.h>
|
||||
#include <dev/ic/lptvar.h>
|
||||
|
||||
#include <evbppc/explora/dev/elbvar.h>
|
||||
|
||||
static int lpt_elb_probe(struct device *, struct cfdata *, void *);
|
||||
static void lpt_elb_attach(struct device *, struct device *, void *);
|
||||
|
||||
CFATTACH_DECL(lpt_elb, sizeof(struct lpt_softc),
|
||||
lpt_elb_probe, lpt_elb_attach, NULL, NULL);
|
||||
|
||||
int
|
||||
lpt_elb_probe(struct device *parent, struct cfdata *cf, void *aux)
|
||||
{
|
||||
struct elb_attach_args *oaa = aux;
|
||||
|
||||
if (strcmp(oaa->elb_name, cf->cf_name) != 0)
|
||||
return 0;
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
void
|
||||
lpt_elb_attach(struct device *parent, struct device *self, void *aux)
|
||||
{
|
||||
struct lpt_softc *sc = (struct lpt_softc *)self;
|
||||
struct elb_attach_args *eaa = aux;
|
||||
|
||||
sc->sc_iot = eaa->elb_bt;
|
||||
bus_space_map(sc->sc_iot, eaa->elb_base, LPT_NPORTS, 0, &sc->sc_ioh);
|
||||
|
||||
printf("\n");
|
||||
|
||||
lpt_attach_subr(sc);
|
||||
}
|
|
@ -0,0 +1,123 @@
|
|||
/* $NetBSD: pckbc_elb.c,v 1.1 2003/03/11 10:57:57 hannken Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2003 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Juergen Hannken-Illjes.
|
||||
*
|
||||
* 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/conf.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/malloc.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
|
||||
#include <dev/ic/i8042reg.h>
|
||||
#include <dev/ic/pckbcvar.h>
|
||||
|
||||
#include <evbppc/explora/dev/elbvar.h>
|
||||
|
||||
struct pckbc_elb_softc {
|
||||
struct pckbc_softc sc_pckbc;
|
||||
int sc_irq;
|
||||
};
|
||||
|
||||
static int pckbc_elb_probe(struct device *, struct cfdata *, void *);
|
||||
static void pckbc_elb_attach(struct device *, struct device *, void *);
|
||||
static void pckbc_elb_intr_establish(struct pckbc_softc *, pckbc_slot_t);
|
||||
|
||||
CFATTACH_DECL(pckbc_elb, sizeof(struct pckbc_elb_softc),
|
||||
pckbc_elb_probe, pckbc_elb_attach, NULL, NULL);
|
||||
|
||||
int
|
||||
pckbc_elb_probe(struct device *parent, struct cfdata *cf, void *aux)
|
||||
{
|
||||
struct elb_attach_args *oaa = aux;
|
||||
|
||||
if (strcmp(oaa->elb_name, cf->cf_name) != 0)
|
||||
return 0;
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
void
|
||||
pckbc_elb_attach(struct device *parent, struct device *self, void *aux)
|
||||
{
|
||||
struct pckbc_elb_softc *msc = (void *)self;
|
||||
struct pckbc_softc *sc = &msc->sc_pckbc;
|
||||
struct elb_attach_args *eaa = aux;
|
||||
struct pckbc_internal *t;
|
||||
|
||||
/*
|
||||
* Setup interrupt data.
|
||||
*/
|
||||
msc->sc_irq = eaa->elb_irq;
|
||||
sc->intr_establish = pckbc_elb_intr_establish;
|
||||
|
||||
if (pckbc_is_console(eaa->elb_bt, eaa->elb_base)) {
|
||||
t = &pckbc_consdata;
|
||||
pckbc_console_attached = 1;
|
||||
} else {
|
||||
t = malloc(sizeof(struct pckbc_internal), M_DEVBUF, M_WAITOK);
|
||||
memset(t, 0, sizeof(struct pckbc_internal));
|
||||
}
|
||||
|
||||
t->t_iot = eaa->elb_bt;
|
||||
bus_space_map(eaa->elb_bt, eaa->elb_base, 1, 0, &t->t_ioh_d);
|
||||
bus_space_map(eaa->elb_bt, eaa->elb_base2, 1, 0, &t->t_ioh_c);
|
||||
t->t_addr = eaa->elb_base;
|
||||
t->t_sc = sc;
|
||||
sc->id = t;
|
||||
|
||||
printf("\n");
|
||||
|
||||
pckbc_attach(sc);
|
||||
}
|
||||
|
||||
static void
|
||||
pckbc_elb_intr_establish(struct pckbc_softc *sc, pckbc_slot_t slot)
|
||||
{
|
||||
struct pckbc_elb_softc *msc = (void *)sc;
|
||||
int irq = msc->sc_irq;
|
||||
|
||||
/*
|
||||
* We ignore slot since all slots use the same interrupt.
|
||||
*/
|
||||
|
||||
if (irq >= 0)
|
||||
intr_establish(irq, IST_LEVEL, IPL_SERIAL, pckbcintr, sc);
|
||||
|
||||
irq = -1;
|
||||
}
|
|
@ -0,0 +1,226 @@
|
|||
/* $NetBSD: explora_start.S,v 1.1 2003/03/11 10:57:56 hannken Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2003 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Juergen Hannken-Illjes.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Initial state:
|
||||
*
|
||||
* iccr = 0x00008001 0x80000000-0x87ffffff 0xf80000000-0xffffffff
|
||||
* dccr = 0x00008001 0x80000000-0x87ffffff 0xf80000000-0xffffffff
|
||||
* dcwr = 0x00000000
|
||||
* msr = 0x00001000 ME=machine check enable
|
||||
*
|
||||
*/
|
||||
|
||||
#include "assym.h"
|
||||
|
||||
#include <machine/param.h>
|
||||
#include <machine/psl.h>
|
||||
#include <machine/trap.h>
|
||||
#include <machine/asm.h>
|
||||
|
||||
#include <powerpc/spr.h>
|
||||
#include <powerpc/ibm4xx/dcr403cgx.h>
|
||||
#include <powerpc/ibm4xx/pmap.h>
|
||||
|
||||
#include "opt_ddb.h"
|
||||
#include "opt_ppcparam.h"
|
||||
|
||||
GLOBAL(proc0paddr)
|
||||
.long 0 /* proc0 p_addr */
|
||||
|
||||
GLOBAL(intrnames)
|
||||
.asciz "irq0", "irq1", "irq2", "irq3"
|
||||
.asciz "irq4", "irq5", "irq6", "irq7"
|
||||
.asciz "irq8", "irq9", "irq10", "irq11"
|
||||
.asciz "irq12", "irq13", "irq14", "irq15"
|
||||
.asciz "irq16", "irq17", "irq18", "softnet"
|
||||
.asciz "softclock", "softserial", "clock", "statclock"
|
||||
.asciz "irq24", "irq25", "irq26", "irq27"
|
||||
.asciz "irq28", "irq29", "irq30", "irq31"
|
||||
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
|
||||
GLOBAL(eintrcnt)
|
||||
|
||||
/*
|
||||
* Initially the dram starts at 0x01000000. This is way too high.
|
||||
* We relocate dram to 0x00000000. We use the video ram at 0xf0000000
|
||||
* as a temporary staging area.
|
||||
*/
|
||||
|
||||
#define STAGE1_BASE 0xf0000000
|
||||
|
||||
.text
|
||||
.globl __start
|
||||
__start:
|
||||
b 1f
|
||||
nop
|
||||
nop
|
||||
.long 0
|
||||
.ascii "XncdPPC\0"
|
||||
.long 0
|
||||
.long 0
|
||||
|
||||
1:
|
||||
/* Disable exceptions, caches, invalidate all TLB's. */
|
||||
|
||||
li 0,0
|
||||
mtmsr 0
|
||||
mttcr 0
|
||||
mtdccr 0
|
||||
mticcr 0
|
||||
sync
|
||||
isync
|
||||
|
||||
/* Clear caches and invalidate tlbs */
|
||||
li 7,256
|
||||
mtctr 7
|
||||
li 6,0
|
||||
1:
|
||||
dccci 0,6
|
||||
addi 6,6,16
|
||||
bdnz 1b
|
||||
|
||||
li 7,512
|
||||
mtctr 7
|
||||
li 6,0
|
||||
1:
|
||||
iccci 0,6
|
||||
addi 6,6,16
|
||||
bdnz 1b
|
||||
|
||||
tlbia
|
||||
sync
|
||||
isync
|
||||
|
||||
/* Get current address -- NOT the same as . */
|
||||
|
||||
bl _next
|
||||
_next:
|
||||
mflr 3
|
||||
subi 3,3,_next-__start
|
||||
lis 4,STAGE1_BASE@h
|
||||
ori 4,4,STAGE1_BASE@l
|
||||
li 5,stage1size
|
||||
|
||||
1:
|
||||
lbz 1,0(3)
|
||||
mr 0,5
|
||||
cmpwi 0,0
|
||||
stb 1,0(4)
|
||||
addi 3,3,1
|
||||
addi 4,4,1
|
||||
addi 5,5,-1
|
||||
bgt 1b
|
||||
|
||||
/* Jump into the staging area so we can remap the dram. */
|
||||
|
||||
lis 0,stage1reloc@h
|
||||
ori 0,0,stage1reloc@l
|
||||
mtlr 0
|
||||
blr
|
||||
|
||||
stage1reloc = .-__start+STAGE1_BASE
|
||||
|
||||
/* Remap the dram from 0x01000000 to 0x00000000. */
|
||||
|
||||
#define REMAP(r, tmp1, tmp2) \
|
||||
mfbr##r tmp1 ; \
|
||||
lis tmp2,0xff ; \
|
||||
ori tmp2,tmp2,0xffff ; \
|
||||
cmplw tmp1,tmp2 ; \
|
||||
ble 1f ; \
|
||||
addis tmp1,tmp1,0xf000 ; \
|
||||
mtbr##r tmp1 ; \
|
||||
1:
|
||||
|
||||
REMAP(4, 1, 2)
|
||||
REMAP(5, 1, 2)
|
||||
REMAP(6, 1, 2)
|
||||
REMAP(7, 1, 2)
|
||||
|
||||
#undef REMAP
|
||||
|
||||
/* Initial setup. */
|
||||
|
||||
ba stage2
|
||||
|
||||
stage2:
|
||||
|
||||
#ifdef PPC_4XX_NOCACHE
|
||||
li 0,0
|
||||
#else
|
||||
lis 0,0xfffc
|
||||
#endif
|
||||
mtdccr 0
|
||||
mticcr 0
|
||||
sync
|
||||
isync
|
||||
|
||||
/* get start of bss */
|
||||
lis 7,_C_LABEL(edata)-4@h
|
||||
ori 7,7,_C_LABEL(edata)-4@l
|
||||
/* get end of kernel */
|
||||
lis 4,_C_LABEL(end)@h
|
||||
ori 4,4,_C_LABEL(end)@l
|
||||
/* clear bss */
|
||||
li 3,0
|
||||
1:
|
||||
stwu 3,4(7)
|
||||
cmpw 7,4
|
||||
bne+ 1b
|
||||
|
||||
INIT_CPUINFO(4,1,9,0)
|
||||
|
||||
lis 3,__start@h
|
||||
ori 3,3,__start@l
|
||||
|
||||
/* Run the remaining setup in C. */
|
||||
bl _C_LABEL(bootstrap)
|
||||
|
||||
bl _C_LABEL(main)
|
||||
|
||||
/* NOTREACHED */
|
||||
2: nop
|
||||
b 2b
|
||||
|
||||
stage1size = .-__start
|
||||
|
||||
#include <powerpc/ibm4xx/4xx_locore.S>
|
|
@ -0,0 +1,509 @@
|
|||
/* $NetBSD: machdep.c,v 1.1 2003/03/11 10:57:56 hannken Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2003 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Juergen Hannken-Illjes.
|
||||
*
|
||||
* 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/buf.h>
|
||||
#include <sys/msgbuf.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/mount.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/user.h>
|
||||
#include <sys/reboot.h>
|
||||
#include <sys/properties.h>
|
||||
|
||||
#include <uvm/uvm_extern.h>
|
||||
|
||||
#include <net/netisr.h>
|
||||
|
||||
#include <machine/explora.h>
|
||||
#include <machine/bus.h>
|
||||
#include <machine/powerpc.h>
|
||||
#include <machine/trap.h>
|
||||
|
||||
#include <powerpc/spr.h>
|
||||
#include <powerpc/ibm4xx/dcr403cgx.h>
|
||||
|
||||
#ifdef DDB
|
||||
#include <machine/db_machdep.h>
|
||||
#include <ddb/db_extern.h>
|
||||
#endif
|
||||
|
||||
#define MEMREGIONS 2
|
||||
#define TLB_PG_SIZE (16*1024*1024)
|
||||
|
||||
char cpu_model[80];
|
||||
char machine[] = MACHINE; /* from <machine/param.h> */
|
||||
char machine_arch[] = MACHINE_ARCH; /* from <machine/param.h> */
|
||||
|
||||
extern struct user *proc0paddr;
|
||||
|
||||
struct propdb *board_info = NULL;
|
||||
struct vm_map *phys_map = NULL;
|
||||
struct vm_map *mb_map = NULL;
|
||||
struct vm_map *exec_map = NULL;
|
||||
char msgbuf[MSGBUFSIZE];
|
||||
paddr_t msgbuf_paddr;
|
||||
static unsigned cpuspeed = 66000000;
|
||||
static unsigned memsize;
|
||||
|
||||
static struct mem_region phys_mem[MEMREGIONS];
|
||||
static struct mem_region avail_mem[MEMREGIONS];
|
||||
|
||||
void bootstrap(u_int, u_int);
|
||||
static void install_extint(void (*)(void));
|
||||
int lcsplx(int);
|
||||
|
||||
/*
|
||||
* Trap vectors
|
||||
*/
|
||||
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
|
||||
static struct {
|
||||
int vector;
|
||||
void *addr;
|
||||
void *size;
|
||||
} trap_table[] = {
|
||||
{ EXC_SC, &sctrap, &scsize },
|
||||
{ EXC_ALI, &alitrap, &alisize },
|
||||
{ EXC_DSI, &dsitrap, &dsisize },
|
||||
{ EXC_ISI, &isitrap, &isisize },
|
||||
{ EXC_MCHK, &mchktrap, &mchksize },
|
||||
{ EXC_ITMISS, &tlbimiss4xx, &tlbim4size },
|
||||
{ EXC_DTMISS, &tlbdmiss4xx, &tlbdm4size },
|
||||
{ EXC_PIT, &pitfitwdog, &pitfitwdogsize },
|
||||
{ EXC_DEBUG, &debugtrap, &debugsize },
|
||||
{ (EXC_DTMISS|EXC_ALI), &errata51handler, &errata51size },
|
||||
#if defined(DDB)
|
||||
{ EXC_PGM, &ddblow, &ddbsize },
|
||||
#endif /* DDB */
|
||||
};
|
||||
|
||||
static void
|
||||
set_tlb(int idx, u_int addr, u_int flags)
|
||||
{
|
||||
u_int lo, hi;
|
||||
|
||||
addr &= ~(TLB_PG_SIZE-1);
|
||||
|
||||
lo = addr | TLB_EX | TLB_WR | flags;
|
||||
#ifdef PPC_4XX_NOCACHE
|
||||
lo |= TLB_I;
|
||||
#endif
|
||||
hi = addr | TLB_VALID | TLB_PG_16M;
|
||||
|
||||
asm volatile(
|
||||
" tlbwe %1,%0,1 \n"
|
||||
" tlbwe %2,%0,0 \n"
|
||||
" sync \n"
|
||||
: : "r" (idx), "r" (lo), "r" (hi) );
|
||||
}
|
||||
|
||||
void
|
||||
bootstrap(u_int startkernel, u_int endkernel)
|
||||
{
|
||||
u_int i, j, t, br[4];
|
||||
u_int maddr, msize, size;
|
||||
struct cpu_info * const ci = &cpu_info[0];
|
||||
|
||||
consinit();
|
||||
|
||||
br[0] = mfdcr(DCR_BR4);
|
||||
br[1] = mfdcr(DCR_BR5);
|
||||
br[2] = mfdcr(DCR_BR6);
|
||||
br[3] = mfdcr(DCR_BR7);
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
for (j = i+1; j < 4; j++)
|
||||
if (br[j] < br[i])
|
||||
t = br[j], br[j] = br[i], br[i] = t;
|
||||
|
||||
for (i = 0, size = 0; i < 4; i++) {
|
||||
if (((br[i] >> 19) & 3) != 3)
|
||||
continue;
|
||||
maddr = ((br[i] >> 24) & 0xff) << 20;
|
||||
msize = 1 << (20 + ((br[i] >> 21) & 7));
|
||||
if (maddr+msize > size)
|
||||
size = maddr+msize;
|
||||
}
|
||||
|
||||
phys_mem[0].start = 0;
|
||||
phys_mem[0].size = size & ~PGOFSET;
|
||||
avail_mem[0].start = startkernel;
|
||||
avail_mem[0].size = size-startkernel;
|
||||
|
||||
asm volatile(
|
||||
" mtpid %0 \n"
|
||||
" sync \n"
|
||||
: : "r" (1) );
|
||||
|
||||
/*
|
||||
* Setup initial tlbs.
|
||||
* Physical memory is mapped into the first (reserved) tlbs.
|
||||
* Memory of potential console devices is mapped into the
|
||||
* last tlbs. They are only needed until the devices are configured.
|
||||
*/
|
||||
|
||||
t = 0;
|
||||
for (maddr = 0; maddr < phys_mem[0].size; maddr += TLB_PG_SIZE)
|
||||
set_tlb(t++, maddr, 0);
|
||||
|
||||
t = NTLB-1;
|
||||
set_tlb(t--, BASE_FB, TLB_I | TLB_G);
|
||||
set_tlb(t--, BASE_FB2, TLB_I | TLB_G);
|
||||
set_tlb(t--, BASE_COM, TLB_I | TLB_G);
|
||||
|
||||
/* Disable all external interrupts */
|
||||
mtdcr(DCR_EXIER, 0);
|
||||
|
||||
/* Disable all timer interrupts */
|
||||
mtspr(SPR_TCR, 0);
|
||||
|
||||
/* Initialize cache info for memcpy, etc. */
|
||||
cpu_probe_cache();
|
||||
|
||||
/*
|
||||
* Initialize lwp0 and current pcb and pmap pointers.
|
||||
*/
|
||||
lwp0.l_cpu = ci;
|
||||
lwp0.l_addr = proc0paddr;
|
||||
memset(lwp0.l_addr, 0, sizeof *lwp0.l_addr);
|
||||
|
||||
curpcb = &proc0paddr->u_pcb;
|
||||
curpm = curpcb->pcb_pmreal = curpcb->pcb_pm = pmap_kernel();
|
||||
|
||||
/*
|
||||
* Install trap vectors.
|
||||
*/
|
||||
|
||||
for (i = EXC_RSVD; i <= EXC_LAST; i += 0x100)
|
||||
memcpy((void *)i, &defaulttrap, (size_t)&defaultsize);
|
||||
|
||||
for (i = 0; i < sizeof(trap_table)/sizeof(trap_table[0]); i++) {
|
||||
memcpy((void *)trap_table[i].vector, trap_table[i].addr,
|
||||
(size_t)trap_table[i].size);
|
||||
}
|
||||
|
||||
__syncicache((void *)EXC_RST, EXC_LAST - EXC_RST + 0x100);
|
||||
|
||||
/*
|
||||
* Set Exception vector base.
|
||||
* Handle trap instruction as PGM exception.
|
||||
*/
|
||||
|
||||
mtspr(SPR_EVPR, 0);
|
||||
|
||||
t = mfspr(SPR_DBCR0);
|
||||
t &= ~DBCR0_TDE;
|
||||
mtspr(SPR_DBCR0, t);
|
||||
|
||||
/*
|
||||
* External interrupt handler install.
|
||||
*/
|
||||
|
||||
install_extint(ext_intr);
|
||||
|
||||
/*
|
||||
* Now enable translation (and machine checks/recoverable interrupts).
|
||||
*/
|
||||
asm volatile (
|
||||
" mfmsr %0 \n"
|
||||
" ori %0,%0,%1 \n"
|
||||
" mtmsr %0 \n"
|
||||
" sync \n"
|
||||
: : "r" (0), "K" (PSL_IR|PSL_DR|PSL_ME) );
|
||||
|
||||
uvm_setpagesize();
|
||||
|
||||
/*
|
||||
* Initialize pmap module.
|
||||
*/
|
||||
pmap_bootstrap(startkernel, endkernel);
|
||||
|
||||
#ifdef DDB
|
||||
ddb_init(0, NULL, NULL);
|
||||
#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 \n"
|
||||
" andi. %1,%0,%2 \n"
|
||||
" mtmsr %1 \n"
|
||||
: "=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 \n"
|
||||
: : "r" (omsr) );
|
||||
}
|
||||
|
||||
void
|
||||
cpu_startup(void)
|
||||
{
|
||||
caddr_t v;
|
||||
vaddr_t minaddr, maxaddr;
|
||||
u_int sz, i, base, residual;
|
||||
char pbuf[9];
|
||||
|
||||
/*
|
||||
* Initialize error message buffer (before start of kernel)
|
||||
*/
|
||||
initmsgbuf((caddr_t)msgbuf, round_page(MSGBUFSIZE));
|
||||
|
||||
printf("%s", version);
|
||||
printf("NCD Explora451\n");
|
||||
|
||||
memsize = ctob(physmem);
|
||||
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("processor-frequency", &cpuspeed,
|
||||
sizeof(&cpuspeed), PROP_CONST, 0))
|
||||
panic("setting processor-frequency");
|
||||
if (board_info_set("mem-size", &memsize,
|
||||
sizeof(&memsize), PROP_CONST, 0))
|
||||
panic("setting mem-size");
|
||||
}
|
||||
|
||||
int
|
||||
lcsplx(int ipl)
|
||||
{
|
||||
return spllower(ipl); /*XXX*/
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
#include "com.h"
|
||||
void
|
||||
softserial(void)
|
||||
{
|
||||
#if NCOM > 0
|
||||
void comsoft(void); /* XXX from dev/ic/com.c */
|
||||
|
||||
comsoft();
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
cpu_reboot(int howto, char *what)
|
||||
{
|
||||
static int syncing = 0;
|
||||
|
||||
boothowto = howto;
|
||||
if (!cold && !(howto & RB_NOSYNC) && !syncing) {
|
||||
syncing = 1;
|
||||
vfs_shutdown();
|
||||
resettodr();
|
||||
}
|
||||
|
||||
splhigh();
|
||||
|
||||
if (!cold && (howto & RB_DUMP))
|
||||
/*XXX dumpsys()*/;
|
||||
|
||||
doshutdownhooks();
|
||||
|
||||
if (howto & RB_HALT) {
|
||||
printf("halted\n\n");
|
||||
|
||||
while (1)
|
||||
;
|
||||
}
|
||||
|
||||
printf("rebooting\n\n");
|
||||
|
||||
/* flush cache for msgbuf */
|
||||
__syncicache((void *)msgbuf_paddr, round_page(MSGBUFSIZE));
|
||||
|
||||
ppc4xx_reset();
|
||||
|
||||
#ifdef DDB
|
||||
while (1)
|
||||
Debugger();
|
||||
#else
|
||||
while (1)
|
||||
;
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
inittodr(time_t base)
|
||||
{
|
||||
if (base > 365*24*60*60 && time.tv_sec < 365*24*60*60)
|
||||
time.tv_sec = base;
|
||||
}
|
||||
|
||||
void
|
||||
resettodr(void)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
mem_regions(struct mem_region **mem, struct mem_region **avail)
|
||||
{
|
||||
*mem = phys_mem;
|
||||
*avail = avail_mem;
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
|
||||
#ifndef _EVBPPC_EXPLORA_H_
|
||||
#define _EVBPPC_EXPLORA_H_
|
||||
|
||||
/*
|
||||
* Base addresses of external peripherals
|
||||
*/
|
||||
#define BASE_PCKBC 0x740000c0
|
||||
#define BASE_PCKBC2 0x740000c8
|
||||
#define BASE_COM 0x740005f0
|
||||
#define BASE_LPT 0x740006f0
|
||||
#define BASE_FB 0x70000000
|
||||
#define BASE_FB2 0x71000000
|
||||
#define BASE_LE 0x70800000
|
||||
|
||||
#define SIZE_FB (2*1024*1024)
|
||||
|
||||
#define MAKE_BUS_TAG(a) ibm4xx_make_bus_space_tag(0, \
|
||||
((a)&0xff000000) == 0x74000000 ? 1 : 0)
|
||||
|
||||
void consinit(void);
|
||||
|
||||
#endif /* _EVBPPC_EXPLORA_H_ */
|
Loading…
Reference in New Issue