Support Plathome's OpenBlockS600.
This commit is contained in:
parent
b105a1867e
commit
325b8e821a
@ -1,9 +1,28 @@
|
||||
# $NetBSD: Makefile.obs405.inc,v 1.4 2009/05/18 05:17:28 mrg Exp $
|
||||
|
||||
MKIMG?= ${HOST_SH} ${THISPPC}/compile/walnut-mkimg.sh
|
||||
# $NetBSD: Makefile.obs405.inc,v 1.5 2010/03/18 14:15:38 kiyohara Exp $
|
||||
|
||||
CFLAGS+=-mcpu=405
|
||||
AFLAGS+=-mcpu=405
|
||||
|
||||
|
||||
.if ${PRDCTTYPE} == "obs200"
|
||||
|
||||
MKIMG?= ${HOST_SH} ${THISPPC}/compile/walnut-mkimg.sh
|
||||
|
||||
TEXTADDR?= 450000
|
||||
|
||||
SYSTEM_FIRST_OBJ= obs200_locore.o
|
||||
SYSTEM_FIRST_SFILE= ${THISPPC}/obs405/obs200_locore.S
|
||||
|
||||
SYSTEM_LD_TAIL_EXTRA+=; \
|
||||
echo ${MKIMG} netbsd netbsd.img ; \
|
||||
OBJDUMP=${OBJDUMP}; OBJCOPY=${OBJCOPY}; export OBJDUMP OBJCOPY; \
|
||||
${MKIMG} $@ $@.img
|
||||
|
||||
|
||||
.elif ${PRDCTTYPE} == "obs266"
|
||||
|
||||
MKIMG?= ${HOST_SH} ${THISPPC}/compile/walnut-mkimg.sh
|
||||
|
||||
TEXTADDR?= 25000
|
||||
|
||||
SYSTEM_FIRST_OBJ= locore.o
|
||||
@ -13,3 +32,17 @@ SYSTEM_LD_TAIL_EXTRA+=; \
|
||||
echo ${MKIMG} netbsd netbsd.img ; \
|
||||
OBJDUMP=${OBJDUMP}; OBJCOPY=${OBJCOPY}; export OBJDUMP OBJCOPY; \
|
||||
${MKIMG} $@ $@.img
|
||||
|
||||
|
||||
.elif ${PRDCTTYPE} == "obs600"
|
||||
|
||||
TEXTADDR?= 25000
|
||||
|
||||
SYSTEM_FIRST_OBJ= obs600_locore.o
|
||||
SYSTEM_FIRST_SFILE= ${THISPPC}/obs405/obs600_locore.S
|
||||
|
||||
SYSTEM_LD_TAIL_EXTRA+=; \
|
||||
echo ${OBJCOPY} -S -O binary $@ $@.bin; \
|
||||
${OBJCOPY} -S -O binary $@ $@.bin;
|
||||
|
||||
.endif
|
||||
|
@ -1,13 +1,13 @@
|
||||
# $NetBSD: OPENBLOCKS266,v 1.47 2010/03/10 17:25:21 kiyohara Exp $
|
||||
# $NetBSD: OPENBLOCKS266,v 1.48 2010/03/18 14:15:38 kiyohara Exp $
|
||||
#
|
||||
# GENERIC -- everything that's currently supported
|
||||
#
|
||||
|
||||
include "arch/evbppc/conf/std.obs405"
|
||||
include "arch/evbppc/conf/std.obs266"
|
||||
|
||||
#options INCLUDE_CONFIG_FILE # embed config file in kernel binary
|
||||
|
||||
#ident "OPENBLOCKS266-$Revision: 1.47 $"
|
||||
#ident "OPENBLOCKS266-$Revision: 1.48 $"
|
||||
|
||||
maxusers 32
|
||||
|
||||
|
212
sys/arch/evbppc/conf/OPENBLOCKS600
Normal file
212
sys/arch/evbppc/conf/OPENBLOCKS600
Normal file
@ -0,0 +1,212 @@
|
||||
# $NetBSD: OPENBLOCKS600,v 1.1 2010/03/18 14:15:38 kiyohara Exp $
|
||||
#
|
||||
# GENERIC -- everything that's currently supported
|
||||
#
|
||||
|
||||
include "arch/evbppc/conf/std.obs600"
|
||||
|
||||
#options INCLUDE_CONFIG_FILE # embed config file in kernel binary
|
||||
|
||||
#ident "OPENBLOCKS600-$Revision: 1.1 $"
|
||||
|
||||
maxusers 32
|
||||
|
||||
|
||||
#
|
||||
# Standard system options
|
||||
#
|
||||
|
||||
#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 P1003_1B_SEMAPHORE # p1003.1b semaphore support
|
||||
|
||||
|
||||
#options USERCONF # userconf(4) support
|
||||
#options PIPE_SOCKETPAIR # smaller, but slower pipe(2)
|
||||
#options SYSCTL_INCLUDE_DESCR # Include sysctl descriptions in kernel
|
||||
|
||||
#options UVMHIST
|
||||
#options UVMHIST_PRINT
|
||||
|
||||
|
||||
#
|
||||
# Diagnostic/debugging support options
|
||||
#
|
||||
|
||||
#options DIAGNOSTIC # cheap 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 TRAP_PANICWAIT
|
||||
options SYMTAB_SPACE=410000 # 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_15 # NetBSD 1.5,
|
||||
options COMPAT_16 # NetBSD 1.6,
|
||||
options COMPAT_20 # NetBSD 2.0,
|
||||
options COMPAT_30 # NetBSD 3.0,
|
||||
options COMPAT_40 # NetBSD 4.0,
|
||||
options COMPAT_50 # NetBSD 5.0 compatibility.
|
||||
options COMPAT_43 # and 4.3BSD
|
||||
#options COMPAT_386BSD_MBRPART # recognize old partition ID
|
||||
options COMPAT_BSDPTY # /dev/[pt]ty?? ptys.
|
||||
|
||||
|
||||
#
|
||||
# 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 PUFFS # Userspace file systems (e.g. ntfs-3g & sshfs)
|
||||
file-system PROCFS # /proc
|
||||
file-system UMAPFS # NULLFS + uid and gid remapping
|
||||
file-system UNION # union file system
|
||||
file-system PTYFS # /dev/pts/N support
|
||||
file-system TMPFS # Efficient memory file-system
|
||||
#file-system NTFS # Windows NT file system (experimental)
|
||||
|
||||
|
||||
#
|
||||
# File system options
|
||||
#
|
||||
|
||||
options QUOTA # UFS quotas
|
||||
options FFS_EI # FFS Endian Independant support
|
||||
options WAPBL # File system journaling support - Experimental
|
||||
options NFSSERVER # Network File System server
|
||||
#options FFS_NO_SNAPSHOT # No FFS snapshot support
|
||||
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_NAT_T # IPsec NAT traversal (NAT-T)
|
||||
#options IPSEC_DEBUG # debug for IP security
|
||||
#options MROUTING # IP multicast routing
|
||||
#options PIM # Protocol Independent Multicast
|
||||
#options DIRECTED_BROADCAST # allow broadcasts through routers
|
||||
options ISO,TPIP # OSI
|
||||
#options EON # OSI tunneling over IP
|
||||
#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_LOOKUP # ippool(8) support
|
||||
#options TCP_COMPAT_42 # 4.2BSD TCP/IP bug compat. Not recommended.
|
||||
#options TCP_DEBUG # Record last TCP_NDEBUG packets with SO_DEBUG
|
||||
|
||||
|
||||
#
|
||||
# Kernel root file system and dump configuration.
|
||||
#
|
||||
|
||||
config netbsd root on ? type ?
|
||||
|
||||
|
||||
#
|
||||
# Device configuration
|
||||
#
|
||||
|
||||
plb0 at root # Processor Local Bus
|
||||
cpu0 at plb? # CPU
|
||||
ecc0 at plb? irq 17 # On-chip ECC controller
|
||||
|
||||
# On-chip Peripheral Bus support
|
||||
opb* at plb? # On-chip Peripheral Bus
|
||||
wdog* at opb? # Watchdog timer
|
||||
com* at opb? addr ? irq ? # UARTs
|
||||
emac* at opb? addr ? irq ? # Ethernet Media Access Controller
|
||||
options EMAC_EVENT_COUNTERS
|
||||
options EMAC_RGMII_PHY
|
||||
gpiic* at opb? addr ? irq ? # On-chip IIC controller
|
||||
iic* at gpiic? # I2C bus
|
||||
m41trtc0 at iic? addr 0x68 # Dallas DS1340C Real Time Clock
|
||||
opbgpio0 at opb? addr ? irq ? # On-chip GPIO controller
|
||||
gpio* at opbgpio? # GPIO framework
|
||||
|
||||
# MII/PHY support
|
||||
brgphy* at mii? phy ? # Broadcom BCM5400-family PHYs
|
||||
options MIIVERBOSE # verbose PHY autoconfig messages
|
||||
|
||||
|
||||
#
|
||||
# Pseudo devices
|
||||
#
|
||||
|
||||
# disk/mass storage pseudo-devices
|
||||
#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 fss 4 # file system snapshot device
|
||||
#pseudo-device md 1 # memory disk device
|
||||
#pseudo-device vnd # disk-like interface to files
|
||||
|
||||
# network pseudo-devices
|
||||
pseudo-device loop # network loopback
|
||||
pseudo-device bpfilter # packet filter
|
||||
pseudo-device ipfilter # IP filter (firewall) and NAT
|
||||
pseudo-device ppp # Point-to-Point Protocol
|
||||
pseudo-device pppoe # PPP over Ethernet (RFC 2516)
|
||||
#options PPPOE_SERVER # Enable PPPoE server via link0
|
||||
pseudo-device sl # Serial Line IP
|
||||
pseudo-device strip # Starmode Radio IP (Metricom)
|
||||
#pseudo-device irframetty # IrDA frame line discipline
|
||||
pseudo-device tap # virtual ethernet
|
||||
pseudo-device tun # network tunneling over tty
|
||||
pseudo-device gre # generic L3 over IP tunnel
|
||||
pseudo-device gif # IPv[46] over IPv[46] tunnel (RFC 1933)
|
||||
#pseudo-device faith # IPv[46] TCP relay translation i/f
|
||||
pseudo-device stf # 6to4 IPv6 over IPv4 encapsulation
|
||||
pseudo-device vlan # IEEE 802.1q encapsulation
|
||||
pseudo-device bridge # simple inter-network bridging
|
||||
#options BRIDGE_IPF # bridge uses IPv[46] pfil hooks too
|
||||
pseudo-device agr # IEEE 802.3ad link aggregation
|
||||
#pseudo-device pf # PF packet filter
|
||||
#pseudo-device pflog # PF log if
|
||||
|
||||
# miscellaneous pseudo-devices
|
||||
pseudo-device pty # pseudo-terminals
|
||||
pseudo-device rnd # /dev/random and in-kernel generator
|
||||
pseudo-device clockctl # user control of clock subsystem
|
||||
pseudo-device ksyms # /dev/ksyms
|
||||
pseudo-device putter # for puffs and pud
|
21
sys/arch/evbppc/conf/files.obs266
Normal file
21
sys/arch/evbppc/conf/files.obs266
Normal file
@ -0,0 +1,21 @@
|
||||
# $NetBSD: files.obs266,v 1.1 2010/03/18 14:15:38 kiyohara Exp $
|
||||
#
|
||||
# obs266-specific configuration info
|
||||
|
||||
file arch/powerpc/ibm4xx/openbios/openbios.c
|
||||
file arch/evbppc/obs405/obs266_autoconf.c
|
||||
file arch/evbppc/obs405/obs266_machdep.c
|
||||
|
||||
#
|
||||
# Machine-independent CardBus drivers
|
||||
#
|
||||
include "dev/cardbus/files.cardbus"
|
||||
include "dev/pcmcia/files.pcmcia"
|
||||
|
||||
file arch/evbppc/obs405/rbus_machdep.c cardbus
|
||||
|
||||
include "dev/usb/files.usb"
|
||||
|
||||
include "dev/ieee1394/files.ieee1394"
|
||||
|
||||
include "dev/bluetooth/files.bluetooth"
|
10
sys/arch/evbppc/conf/files.obs600
Normal file
10
sys/arch/evbppc/conf/files.obs600
Normal file
@ -0,0 +1,10 @@
|
||||
# $NetBSD: files.obs600,v 1.1 2010/03/18 14:15:38 kiyohara Exp $
|
||||
#
|
||||
# obs600-specific configuration info
|
||||
|
||||
file arch/evbppc/obs405/obs600_autoconf.c
|
||||
file arch/evbppc/obs405/obs600_machdep.c
|
||||
|
||||
include "dev/usb/files.usb"
|
||||
|
||||
include "dev/bluetooth/files.bluetooth"
|
@ -1,29 +1,11 @@
|
||||
# $NetBSD: std.obs200,v 1.3 2005/12/11 12:17:11 christos Exp $
|
||||
# $NetBSD: std.obs200,v 1.4 2010/03/18 14:15:38 kiyohara Exp $
|
||||
#
|
||||
# Standard/required options for NetBSD/obs200
|
||||
# Standard/required options for obs200
|
||||
|
||||
machine evbppc powerpc
|
||||
include "conf/std" # MI standard options
|
||||
|
||||
# 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
|
||||
include "arch/evbppc/conf/std.obs405"
|
||||
|
||||
makeoptions PRDCTTYPE="obs200"
|
||||
makeoptions TEXTADDR=0x450000
|
||||
makeoptions BOARDTYPE="obs200"
|
||||
makeoptions PPCDIR="ibm4xx"
|
||||
|
||||
options PPC_INTR_IMPL="<powerpc/ibm4xx/ibm4xx_intr.h>"
|
||||
options PPC_PCI_MACHDEP_IMPL="<powerpc/ibm4xx/pci_machdep.h>"
|
||||
options KERNBASE=0x450000
|
||||
|
||||
options INTSTK=16384
|
||||
options SPILLSTK=1024
|
||||
|
||||
include "arch/powerpc/conf/files.ibm4xx"
|
||||
include "arch/powerpc/conf/files.ibm405gp"
|
||||
include "arch/evbppc/conf/files.obs200"
|
||||
|
11
sys/arch/evbppc/conf/std.obs266
Normal file
11
sys/arch/evbppc/conf/std.obs266
Normal file
@ -0,0 +1,11 @@
|
||||
# $NetBSD: std.obs266,v 1.1 2010/03/18 14:15:38 kiyohara Exp $
|
||||
#
|
||||
# Standard/required options for obs266.
|
||||
|
||||
include "arch/evbppc/conf/std.obs405"
|
||||
|
||||
makeoptions PRDCTTYPE="obs266"
|
||||
makeoptions TEXTADDR=0x25000
|
||||
options KERNBASE=0x25000
|
||||
|
||||
include "arch/evbppc/conf/files.obs266"
|
@ -1,4 +1,4 @@
|
||||
# $NetBSD: std.obs405,v 1.3 2005/12/11 12:17:11 christos Exp $
|
||||
# $NetBSD: std.obs405,v 1.4 2010/03/18 14:15:38 kiyohara Exp $
|
||||
#
|
||||
# Standard/required options for NetBSD/obs405.
|
||||
|
||||
@ -13,17 +13,14 @@ 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
|
||||
makeoptions BOARDTYPE="obs405"
|
||||
makeoptions PPCDIR="ibm4xx"
|
||||
|
||||
options PPC_INTR_IMPL="<powerpc/ibm4xx/ibm4xx_intr.h>"
|
||||
options PPC_PCI_MACHDEP_IMPL="<powerpc/ibm4xx/pci_machdep.h>"
|
||||
options KERNBASE=0x25000
|
||||
|
||||
options INTSTK=16384
|
||||
options SPILLSTK=1024
|
||||
|
||||
include "arch/powerpc/conf/files.ibm4xx"
|
||||
include "arch/powerpc/conf/files.ibm405gp"
|
||||
include "arch/evbppc/conf/files.obs405"
|
||||
|
12
sys/arch/evbppc/conf/std.obs600
Normal file
12
sys/arch/evbppc/conf/std.obs600
Normal file
@ -0,0 +1,12 @@
|
||||
# $NetBSD: std.obs600,v 1.1 2010/03/18 14:15:38 kiyohara Exp $
|
||||
#
|
||||
# Standard/required options for obs600.
|
||||
|
||||
include "arch/evbppc/conf/std.obs405"
|
||||
options MULTIUIC
|
||||
|
||||
makeoptions PRDCTTYPE="obs600"
|
||||
makeoptions TEXTADDR=0x25000
|
||||
options KERNBASE=0x25000
|
||||
|
||||
include "arch/evbppc/conf/files.obs600"
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: obs405.h,v 1.6 2005/12/11 12:17:12 christos Exp $ */
|
||||
/* $NetBSD: obs405.h,v 1.7 2010/03/18 14:15:38 kiyohara Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 2004 Shigeyuki Fukushima.
|
||||
@ -36,39 +36,9 @@
|
||||
#ifndef _EVBPPC_OBS405_H_
|
||||
#define _EVBPPC_OBS405_H_
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/device.h>
|
||||
|
||||
#include <powerpc/ibm4xx/ibm405gp.h>
|
||||
|
||||
#include "com.h"
|
||||
#if (NCOM > 0)
|
||||
|
||||
#include <sys/termios.h>
|
||||
|
||||
# ifndef CONADDR
|
||||
# define CONADDR IBM405GP_UART0_BASE
|
||||
# endif
|
||||
# ifndef CONSPEED
|
||||
# define CONSPEED B9600
|
||||
# endif
|
||||
# ifndef CONMODE
|
||||
/* 8N1 */
|
||||
# define CONMODE ((TTYDEF_CFLAG & ~(CSIZE | CSTOPB | PARENB)) | CS8)
|
||||
# endif
|
||||
|
||||
#define OBS405_CONADDR (CONADDR)
|
||||
#define OBS405_CONSPEED (CONSPEED)
|
||||
#define OBS405_CONMODE (CONMODE)
|
||||
|
||||
#endif /* NCOM */
|
||||
|
||||
#include <dev/ic/comreg.h>
|
||||
|
||||
/*
|
||||
* extern variables and functions
|
||||
*/
|
||||
extern void obs405_consinit(int com_freq);
|
||||
extern void obs405_device_register(struct device *dev, void *aux, int com_freq);
|
||||
|
||||
#endif /* _EVBPPC_OBS405_H_ */
|
||||
|
44
sys/arch/evbppc/include/obs600.h
Normal file
44
sys/arch/evbppc/include/obs600.h
Normal file
@ -0,0 +1,44 @@
|
||||
/* $NetBSD: obs600.h,v 1.1 2010/03/18 14:15:38 kiyohara Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2009 KIYOHARA Takashi
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _EVBPPC_OBS600_H_
|
||||
#define _EVBPPC_OBS600_H_
|
||||
|
||||
/*
|
||||
* Device Properties for OpenBlockS600 (AMCC 405EX 600MHz)
|
||||
*/
|
||||
|
||||
/* UART Clock */
|
||||
#define OBS600_COM_FREQ (COM_FREQ * 4) /* UART CLK 7.3728 MHz */
|
||||
|
||||
/*
|
||||
* extern variables and functions
|
||||
*/
|
||||
|
||||
#include <machine/obs405.h>
|
||||
|
||||
#endif /* _EVBPPC_OBS600_H_ */
|
@ -1,51 +0,0 @@
|
||||
/* $NetBSD: consinit.c,v 1.5 2005/12/11 12:17:12 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2004 Shigeyuki Fukushima.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote
|
||||
* products derived from this software without specific prior
|
||||
* written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
||||
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: consinit.c,v 1.5 2005/12/11 12:17:12 christos Exp $");
|
||||
|
||||
#include <machine/obs405.h>
|
||||
#include <powerpc/ibm4xx/dev/comopbvar.h>
|
||||
|
||||
/*
|
||||
* obs405_consinit:
|
||||
* Initialize the system console.
|
||||
*/
|
||||
void
|
||||
obs405_consinit(int com_freq)
|
||||
{
|
||||
|
||||
#if (NCOM > 0)
|
||||
com_opb_cnattach(com_freq,
|
||||
OBS405_CONADDR, OBS405_CONSPEED, OBS405_CONMODE);
|
||||
#endif /* NCOM */
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: obs200_machdep.c,v 1.11 2010/03/18 13:47:04 kiyohara Exp $ */
|
||||
/* $NetBSD: obs200_machdep.c,v 1.12 2010/03/18 14:15:38 kiyohara Exp $ */
|
||||
/* Original: machdep.c,v 1.3 2005/01/17 17:24:09 shige Exp */
|
||||
|
||||
/*
|
||||
@ -68,7 +68,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: obs200_machdep.c,v 1.11 2010/03/18 13:47:04 kiyohara Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: obs200_machdep.c,v 1.12 2010/03/18 14:15:38 kiyohara Exp $");
|
||||
|
||||
#include "opt_compat_netbsd.h"
|
||||
#include "opt_ddb.h"
|
||||
@ -96,11 +96,27 @@ __KERNEL_RCSID(0, "$NetBSD: obs200_machdep.c,v 1.11 2010/03/18 13:47:04 kiyohara
|
||||
#include <powerpc/ibm4xx/ibm405gp.h>
|
||||
#include <powerpc/ibm4xx/dev/comopbvar.h>
|
||||
|
||||
#include <dev/ic/comreg.h>
|
||||
#include <dev/pci/pcivar.h>
|
||||
#include <dev/pci/pciconf.h>
|
||||
|
||||
#include "ksyms.h"
|
||||
|
||||
#include "com.h"
|
||||
#if (NCOM > 0)
|
||||
#include <sys/termios.h>
|
||||
|
||||
#ifndef CONADDR
|
||||
#define CONADDR IBM405GP_UART0_BASE
|
||||
#endif
|
||||
#ifndef CONSPEED
|
||||
#define CONSPEED B9600
|
||||
#endif
|
||||
#ifndef CONMODE
|
||||
/* 8N1 */
|
||||
#define CONMODE ((TTYDEF_CFLAG & ~(CSIZE | CSTOPB | PARENB)) | CS8)
|
||||
#endif
|
||||
#endif /* NCOM */
|
||||
|
||||
#define TLB_PG_SIZE (16*1024*1024)
|
||||
|
||||
@ -141,8 +157,8 @@ initppc(u_int startkernel, u_int endkernel, char *args, void *info_block)
|
||||
ppc4xx_tlb_reserve(va, va, TLB_PG_SIZE, TLB_EX);
|
||||
|
||||
/* Map console after physmem (see pmap_tlbmiss()). */
|
||||
ppc4xx_tlb_reserve(OBS405_CONADDR, roundup(memsize, TLB_PG_SIZE),
|
||||
TLB_PG_SIZE, TLB_I | TLB_G);
|
||||
ppc4xx_tlb_reserve(CONADDR, roundup(memsize, TLB_PG_SIZE), TLB_PG_SIZE,
|
||||
TLB_I | TLB_G);
|
||||
|
||||
/* Initialize IBM405GPr CPU */
|
||||
ibm40x_memsize_init(memsize, startkernel);
|
||||
@ -185,7 +201,9 @@ void
|
||||
consinit(void)
|
||||
{
|
||||
|
||||
obs405_consinit(OBS200_COM_FREQ);
|
||||
#if (NCOM > 0)
|
||||
com_opb_cnattach(OBS200_COM_FREQ, CONADDR, CONSPEED, CONMODE);
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
@ -396,6 +414,6 @@ pci_conf_interrupt(pci_chipset_tag_t pc, int bus, int dev, int pin,
|
||||
return;
|
||||
}
|
||||
*iline = ilinemap[dev - 1];
|
||||
} else
|
||||
} else
|
||||
*iline = 19 + ((swiz + dev + 1) & 3);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: obs266_machdep.c,v 1.12 2010/03/18 13:47:04 kiyohara Exp $ */
|
||||
/* $NetBSD: obs266_machdep.c,v 1.13 2010/03/18 14:15:38 kiyohara Exp $ */
|
||||
/* Original: md_machdep.c,v 1.3 2005/01/24 18:47:37 shige Exp $ */
|
||||
|
||||
/*
|
||||
@ -68,7 +68,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: obs266_machdep.c,v 1.12 2010/03/18 13:47:04 kiyohara Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: obs266_machdep.c,v 1.13 2010/03/18 14:15:38 kiyohara Exp $");
|
||||
|
||||
#include "opt_compat_netbsd.h"
|
||||
#include "opt_ddb.h"
|
||||
@ -96,11 +96,27 @@ __KERNEL_RCSID(0, "$NetBSD: obs266_machdep.c,v 1.12 2010/03/18 13:47:04 kiyohara
|
||||
#include <powerpc/ibm4xx/openbios.h>
|
||||
#include <powerpc/ibm4xx/spr.h>
|
||||
|
||||
#include <dev/ic/comreg.h>
|
||||
#include <dev/pci/pcivar.h>
|
||||
#include <dev/pci/pciconf.h>
|
||||
|
||||
#include "ksyms.h"
|
||||
|
||||
#include "com.h"
|
||||
#if (NCOM > 0)
|
||||
#include <sys/termios.h>
|
||||
|
||||
#ifndef CONADDR
|
||||
#define CONADDR IBM405GP_UART0_BASE
|
||||
#endif
|
||||
#ifndef CONSPEED
|
||||
#define CONSPEED B9600
|
||||
#endif
|
||||
#ifndef CONMODE
|
||||
/* 8N1 */
|
||||
#define CONMODE ((TTYDEF_CFLAG & ~(CSIZE | CSTOPB | PARENB)) | CS8)
|
||||
#endif
|
||||
#endif /* NCOM */
|
||||
|
||||
#define TLB_PG_SIZE (16*1024*1024)
|
||||
|
||||
@ -134,8 +150,8 @@ initppc(u_int startkernel, u_int endkernel, char *args, void *info_block)
|
||||
ppc4xx_tlb_reserve(va, va, TLB_PG_SIZE, TLB_EX);
|
||||
|
||||
/* Map console after RAM (see pmap_tlbmiss()) */
|
||||
ppc4xx_tlb_reserve(OBS405_CONADDR, roundup(memsize, TLB_PG_SIZE),
|
||||
TLB_PG_SIZE, TLB_I | TLB_G);
|
||||
ppc4xx_tlb_reserve(CONADDR, roundup(memsize, TLB_PG_SIZE), TLB_PG_SIZE,
|
||||
TLB_I | TLB_G);
|
||||
|
||||
/* Initialize IBM405GPr CPU */
|
||||
ibm40x_memsize_init(memsize, startkernel);
|
||||
@ -176,7 +192,9 @@ void
|
||||
consinit(void)
|
||||
{
|
||||
|
||||
obs405_consinit(OBS266_COM_FREQ);
|
||||
#if (NCOM > 0)
|
||||
com_opb_cnattach(OBS266_COM_FREQ, CONADDR, CONSPEED, CONMODE);
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
|
85
sys/arch/evbppc/obs405/obs600_autoconf.c
Normal file
85
sys/arch/evbppc/obs405/obs600_autoconf.c
Normal file
@ -0,0 +1,85 @@
|
||||
/* $NetBSD: obs600_autoconf.c,v 1.1 2010/03/18 14:15:38 kiyohara Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 2004 Shigeyuki Fukushima.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Written by Shigeyuki Fukushima for The NetBSD Project.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote
|
||||
* products derived from this software without specific prior
|
||||
* written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
||||
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
||||
* DAMAGE.
|
||||
*/
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: obs600_autoconf.c,v 1.1 2010/03/18 14:15:38 kiyohara Exp $");
|
||||
|
||||
#include <sys/systm.h>
|
||||
#include <sys/device.h>
|
||||
|
||||
#include <machine/intr.h>
|
||||
#include <machine/obs600.h>
|
||||
|
||||
#include <powerpc/ibm4xx/cpu.h>
|
||||
#include <powerpc/ibm4xx/dcr4xx.h>
|
||||
|
||||
#include <dev/ic/comreg.h>
|
||||
|
||||
|
||||
/*
|
||||
* Determine device configuration for a machine.
|
||||
*/
|
||||
void
|
||||
cpu_configure(void)
|
||||
{
|
||||
|
||||
/* Initialize intr and add UICs */
|
||||
intr_init();
|
||||
uic_add(DCR_UIC1_BASE, 28); /* UIC1 cascade to irq 28 */
|
||||
uic_add(DCR_UIC2_BASE, 30); /* UIC2 cascade to irq 30 */
|
||||
|
||||
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", NULL) == NULL)
|
||||
panic("configure: mainbus not configured");
|
||||
|
||||
printf("biomask %x netmask %x ttymask %x\n",
|
||||
imask[IPL_BIO], imask[IPL_NET], imask[IPL_TTY]);
|
||||
|
||||
(void)spl0();
|
||||
|
||||
/*
|
||||
* Now allow hardware interrupts.
|
||||
*/
|
||||
__asm volatile ("wrteei 1");
|
||||
}
|
||||
|
||||
void device_register(struct device *dev, void *aux)
|
||||
{
|
||||
|
||||
obs405_device_register(dev, aux, OBS600_COM_FREQ);
|
||||
}
|
134
sys/arch/evbppc/obs405/obs600_locore.S
Normal file
134
sys/arch/evbppc/obs405/obs600_locore.S
Normal file
@ -0,0 +1,134 @@
|
||||
/* $NetBSD: obs600_locore.S,v 1.1 2010/03/18 14:15:38 kiyohara Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2009 KIYOHARA Takashi
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#undef PPC_4XX_NOCACHE
|
||||
#define _NOREGNAMES
|
||||
|
||||
#include "opt_ddb.h"
|
||||
#include "opt_ppcarch.h"
|
||||
#include "opt_ppcparam.h"
|
||||
#include "assym.h"
|
||||
#include "ksyms.h"
|
||||
|
||||
#include <machine/param.h>
|
||||
#include <machine/psl.h>
|
||||
#include <machine/trap.h>
|
||||
#include <machine/asm.h>
|
||||
|
||||
#include <powerpc/ibm4xx/spr.h>
|
||||
#include <powerpc/ibm4xx/pmap.h>
|
||||
|
||||
|
||||
/*
|
||||
* Globals
|
||||
*/
|
||||
GLOBAL(proc0paddr)
|
||||
.long 0 /* proc0 p_addr */
|
||||
|
||||
/*
|
||||
* 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):
|
||||
|
||||
/*
|
||||
* Kernel start routine for OpenBlockS600
|
||||
* this code is excuted at the very first after the kernel is loaded
|
||||
* by U-Boot.
|
||||
*/
|
||||
.text
|
||||
.globl __start
|
||||
__start:
|
||||
mr %r31, %r3 /* argc of 'go's */
|
||||
mr %r30, %r4 /* argv of 'go's */
|
||||
mr %r29, %r6 /* arg string of 'bootm's */
|
||||
|
||||
li %r0, 0
|
||||
mtmsr %r0 /* Disable FPU/MMU/exceptions */
|
||||
isync
|
||||
|
||||
#ifdef PPC_4XX_NOCACHE
|
||||
/* Disable all caches for physical addresses */
|
||||
li %r0, 0
|
||||
#else
|
||||
/* Allow cacheing for only the first 2GB of RAM */
|
||||
lis %r0, 0xffff
|
||||
#endif
|
||||
mtdccr %r0
|
||||
mticcr %r0
|
||||
|
||||
/* Invalidate all TLB entries */
|
||||
tlbia
|
||||
sync
|
||||
isync
|
||||
|
||||
/* get start of bss */
|
||||
lis %r3, _C_LABEL(_edata)-4@ha
|
||||
addi %r3, %r3, _C_LABEL(_edata)-4@l
|
||||
/* get end of kernel memory */
|
||||
lis %r8, _C_LABEL(end)@ha
|
||||
addi %r8, %r8, _C_LABEL(end)@l
|
||||
/* zero bss */
|
||||
li %r4, 0
|
||||
2: stwu %r4, %r4(3)
|
||||
cmpw %r3, %r8
|
||||
bne+ 2b
|
||||
|
||||
#if NKSYMS || defined(DDB) || defined(MODULAR)
|
||||
/* If we had symbol table location we'd store it here and would've adjusted r8 here */
|
||||
lis %r7, _C_LABEL(startsym)@ha
|
||||
addi %r7, %r7, _C_LABEL(startsym)@l
|
||||
stw %r8, 0(%r7)
|
||||
lis %r7, _C_LABEL(endsym)@ha
|
||||
addi %r7, %r7, _C_LABEL(endsym)@l
|
||||
stw %r8, 0(%r7)
|
||||
#endif
|
||||
|
||||
/* Set kernel MMU context. */
|
||||
li %r0, KERNEL_PID
|
||||
mtpid %r0
|
||||
sync
|
||||
|
||||
INIT_CPUINFO(8,1,9,0)
|
||||
mr %r4, %r8
|
||||
|
||||
lis %r3, __start@ha
|
||||
addi %r3, %r3, __start@l
|
||||
|
||||
mr %r6, %r31 /* argc of 'go's */
|
||||
mr %r7, %r30 /* argv of 'go's */
|
||||
mr %r8, %r29 /* arg strings of 'bootm's */
|
||||
|
||||
bl _C_LABEL(initppc)
|
||||
bl _C_LABEL(main)
|
||||
|
||||
not_reached:
|
||||
b not_reached
|
||||
|
||||
#include <powerpc/ibm4xx/4xx_locore.S>
|
440
sys/arch/evbppc/obs405/obs600_machdep.c
Normal file
440
sys/arch/evbppc/obs405/obs600_machdep.c
Normal file
@ -0,0 +1,440 @@
|
||||
/* $NetBSD: obs600_machdep.c,v 1.1 2010/03/18 14:15:38 kiyohara Exp $ */
|
||||
/* Original: md_machdep.c,v 1.3 2005/01/24 18:47:37 shige 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 <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: obs600_machdep.c,v 1.1 2010/03/18 14:15:38 kiyohara Exp $");
|
||||
|
||||
#include "opt_compat_netbsd.h"
|
||||
#include "opt_ddb.h"
|
||||
#include "opt_ipkdb.h"
|
||||
#include "opt_modular.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/bus.h>
|
||||
#include <sys/errno.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/ksyms.h>
|
||||
#include <sys/mount.h>
|
||||
#include <sys/reboot.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/device.h>
|
||||
|
||||
#include <uvm/uvm.h>
|
||||
#include <uvm/uvm_extern.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
#include <machine/cpu.h>
|
||||
#include <machine/obs600.h>
|
||||
|
||||
#include <powerpc/ibm4xx/amcc405ex.h>
|
||||
#include <powerpc/ibm4xx/dcr4xx.h>
|
||||
#include <powerpc/ibm4xx/dev/comopbvar.h>
|
||||
#include <powerpc/ibm4xx/dev/gpiicreg.h>
|
||||
#include <powerpc/ibm4xx/dev/opbvar.h>
|
||||
#include <powerpc/ibm4xx/spr.h>
|
||||
#include <powerpc/spr.h>
|
||||
|
||||
#include <dev/ic/comreg.h>
|
||||
|
||||
#include "ksyms.h"
|
||||
|
||||
#include "com.h"
|
||||
#if (NCOM > 0)
|
||||
#include <sys/termios.h>
|
||||
|
||||
#ifndef CONADDR
|
||||
#define CONADDR AMCC405EX_UART0_BASE
|
||||
#endif
|
||||
#ifndef CONSPEED
|
||||
#define CONSPEED B115200
|
||||
#endif
|
||||
#ifndef CONMODE
|
||||
/* 8N1 */
|
||||
#define CONMODE ((TTYDEF_CFLAG & ~(CSIZE | CSTOPB | PARENB)) | CS8)
|
||||
#endif
|
||||
#endif /* NCOM */
|
||||
|
||||
/*
|
||||
* XXXX:
|
||||
* It is very troublesome though we can calculate from various registers. X-<
|
||||
*/
|
||||
#define OBS600_CPU_FREQ (600 * 1000 * 1000)
|
||||
#define OBS600_MEM_SIZE (1 * 1024 * 1024 * 1024)
|
||||
|
||||
#define TLB_PG_SIZE (16 * 1024 * 1024)
|
||||
|
||||
/*
|
||||
* Global variables used here and there
|
||||
*/
|
||||
char bootpath[256];
|
||||
|
||||
extern paddr_t msgbuf_paddr;
|
||||
|
||||
#if NKSYMS || defined(DDB) || defined(MODULAR)
|
||||
void *startsym, *endsym;
|
||||
#endif
|
||||
|
||||
void initppc(u_int, u_int, int, char *[], char *);
|
||||
int lcsplx(int);
|
||||
static int read_eeprom(int, char *);
|
||||
|
||||
|
||||
void
|
||||
initppc(u_int startkernel, u_int endkernel, int argc, char *argv[],
|
||||
char *argstr)
|
||||
{
|
||||
vaddr_t va;
|
||||
u_int memsize;
|
||||
|
||||
memsize = OBS600_MEM_SIZE;
|
||||
|
||||
/* Linear map kernel memory */
|
||||
for (va = 0; va < endkernel; va += TLB_PG_SIZE)
|
||||
ppc4xx_tlb_reserve(va, va, TLB_PG_SIZE, TLB_EX);
|
||||
|
||||
/*
|
||||
* Map console and I2C after RAM. (see pmap_tlbmiss())
|
||||
* All peripherals mapped on a page.
|
||||
*/
|
||||
ppc4xx_tlb_reserve(AMCC405EX_OPB_BASE, roundup(memsize, TLB_PG_SIZE),
|
||||
TLB_PG_SIZE, TLB_I | TLB_G);
|
||||
|
||||
/* Initialize AMCC 405EX CPU */
|
||||
ibm40x_memsize_init(memsize, startkernel);
|
||||
ibm4xx_init((void (*)(void))ext_intr);
|
||||
|
||||
/* Disable Watchdog, PIT and FIT interrupts. (u-boot uses PIT...) */
|
||||
mtspr(SPR_TCR, 0);
|
||||
|
||||
/*
|
||||
* Set the page size.
|
||||
*/
|
||||
uvm_setpagesize();
|
||||
|
||||
/*
|
||||
* Initialize pmap module.
|
||||
*/
|
||||
pmap_bootstrap(startkernel, endkernel);
|
||||
|
||||
|
||||
#if NKSYMS || defined(DDB) || defined(MODULAR)
|
||||
ksyms_addsyms_elf((int)((u_int)endsym - (u_int)startsym), startsym, endsym);
|
||||
#endif
|
||||
#ifdef DDB
|
||||
if (boothowto & RB_KDB)
|
||||
Debugger();
|
||||
#endif
|
||||
#ifdef IPKDB
|
||||
/*
|
||||
* Now trap to IPKDB
|
||||
*/
|
||||
ipkdb_init();
|
||||
if (boothowto & RB_KDB)
|
||||
ipkdb_connect(0);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
consinit(void)
|
||||
{
|
||||
|
||||
#if (NCOM > 0)
|
||||
com_opb_cnattach(OBS600_COM_FREQ, CONADDR, CONSPEED, CONMODE);
|
||||
#endif /* NCOM */
|
||||
}
|
||||
|
||||
int
|
||||
lcsplx(int ipl)
|
||||
{
|
||||
|
||||
return spllower(ipl); /* XXX */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Machine dependent startup code.
|
||||
*/
|
||||
void
|
||||
cpu_startup(void)
|
||||
{
|
||||
prop_number_t pn;
|
||||
prop_data_t pd;
|
||||
u_char *macaddr, *macaddr1;
|
||||
static u_char buf[16]; /* MAC address x2 buffer */
|
||||
|
||||
/*
|
||||
* cpu common startup
|
||||
*/
|
||||
ibm4xx_cpu_startup("OpenBlockS600 AMCC PowerPC 405EX Board");
|
||||
|
||||
/*
|
||||
* Set up the board properties database.
|
||||
*/
|
||||
board_info_init();
|
||||
|
||||
read_eeprom(sizeof(buf), buf);
|
||||
macaddr = &buf[0];
|
||||
macaddr1 = &buf[8];
|
||||
|
||||
pn = prop_number_create_integer(OBS600_CPU_FREQ);
|
||||
KASSERT(pn != NULL);
|
||||
if (prop_dictionary_set(board_properties, "processor-frequency", pn) ==
|
||||
false)
|
||||
panic("setting processor-frequency");
|
||||
prop_object_release(pn);
|
||||
|
||||
pn = prop_number_create_integer(OBS600_MEM_SIZE);
|
||||
KASSERT(pn != NULL);
|
||||
if (prop_dictionary_set(board_properties, "mem-size", pn) == false)
|
||||
panic("setting mem-size");
|
||||
prop_object_release(pn);
|
||||
|
||||
#define ETHER_ADDR_LEN 6
|
||||
|
||||
pd = prop_data_create_data_nocopy(macaddr, ETHER_ADDR_LEN);
|
||||
KASSERT(pd != NULL);
|
||||
if (prop_dictionary_set(board_properties, "emac0-mac-addr", pd) ==
|
||||
false)
|
||||
panic("setting emac0-mac-addr");
|
||||
prop_object_release(pd);
|
||||
pd = prop_data_create_data_nocopy(macaddr1, ETHER_ADDR_LEN);
|
||||
KASSERT(pd != NULL);
|
||||
if (prop_dictionary_set(board_properties, "emac1-mac-addr", pd) ==
|
||||
false)
|
||||
panic("setting emac1-mac-addr");
|
||||
prop_object_release(pd);
|
||||
|
||||
/* emac0 connects to phy 2 and emac1 to phy 3 via RGMII. */
|
||||
pn = prop_number_create_integer(2);
|
||||
KASSERT(pn != NULL);
|
||||
if (prop_dictionary_set(board_properties, "emac0-mii-phy", pn) == false)
|
||||
panic("setting emac0-mii-phy");
|
||||
prop_object_release(pn);
|
||||
pn = prop_number_create_integer(3);
|
||||
KASSERT(pn != NULL);
|
||||
if (prop_dictionary_set(board_properties, "emac1-mii-phy", pn) == false)
|
||||
panic("setting emac1-mii-phy");
|
||||
prop_object_release(pn);
|
||||
|
||||
/*
|
||||
* Now that we have VM, malloc()s are OK in bus_space.
|
||||
*/
|
||||
bus_space_mallocok();
|
||||
|
||||
/*
|
||||
* no fake mapiodev
|
||||
*/
|
||||
fake_mapiodev = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* 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))
|
||||
ibm4xx_dumpsys();
|
||||
|
||||
doshutdownhooks();
|
||||
|
||||
pmf_system_shutdown(boothowto);
|
||||
|
||||
if ((howto & RB_POWERDOWN) == RB_POWERDOWN) {
|
||||
/* Power off here if we know how...*/
|
||||
}
|
||||
|
||||
if (howto & RB_HALT) {
|
||||
printf("halted\n\n");
|
||||
|
||||
#if 0
|
||||
goto reboot; /* XXX for now... */
|
||||
#endif
|
||||
|
||||
#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));
|
||||
|
||||
#if 0
|
||||
reboot:
|
||||
#endif
|
||||
ppc4xx_reset();
|
||||
|
||||
printf("ppc4xx_reset() failed!\n");
|
||||
#ifdef DDB
|
||||
while(1)
|
||||
Debugger();
|
||||
#else
|
||||
while (1)
|
||||
/* nothing */;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* This function assume already initialized for I2C... */
|
||||
static int
|
||||
read_eeprom(int len, char *buf)
|
||||
{
|
||||
bus_space_tag_t bst = opb_get_bus_space_tag();
|
||||
bus_space_handle_t bsh;
|
||||
uint8_t mdcntl, sts;
|
||||
int cnt, i = 0;
|
||||
|
||||
#define I2C_EEPROM_ADDR 0x52
|
||||
|
||||
if (bus_space_map(bst, AMCC405EX_IIC0_BASE, IIC_NREG, 0, &bsh))
|
||||
return ENOMEM; /* ??? */
|
||||
|
||||
/* Clear Stop Complete Bit */
|
||||
bus_space_write_1(bst, bsh, IIC_STS, IIC_STS_SCMP);
|
||||
/* Check init */
|
||||
do {
|
||||
/* Get status */
|
||||
sts = bus_space_read_1(bst, bsh, IIC_STS);
|
||||
} while ((sts & IIC_STS_PT));
|
||||
|
||||
mdcntl = bus_space_read_1(bst, bsh, IIC_MDCNTL);
|
||||
bus_space_write_1(bst, bsh, IIC_MDCNTL,
|
||||
mdcntl | IIC_MDCNTL_FMDB | IIC_MDCNTL_FSDB);
|
||||
|
||||
/* 7-bit adressing */
|
||||
bus_space_write_1(bst, bsh, IIC_HMADR, 0);
|
||||
bus_space_write_1(bst, bsh, IIC_LMADR, I2C_EEPROM_ADDR << 1);
|
||||
|
||||
bus_space_write_1(bst, bsh, IIC_MDBUF, 0);
|
||||
bus_space_write_1(bst, bsh, IIC_CNTL, IIC_CNTL_PT);
|
||||
do {
|
||||
/* Get status */
|
||||
sts = bus_space_read_1(bst, bsh, IIC_STS);
|
||||
} while ((sts & IIC_STS_PT) && !(sts & IIC_STS_ERR));
|
||||
|
||||
cnt = 0;
|
||||
while (cnt < len) {
|
||||
/* always read 4byte */
|
||||
bus_space_write_1(bst, bsh, IIC_CNTL,
|
||||
IIC_CNTL_PT | IIC_CNTL_RW | IIC_CNTL_TCT);
|
||||
do {
|
||||
/* Get status */
|
||||
sts = bus_space_read_1(bst, bsh, IIC_STS);
|
||||
} while ((sts & IIC_STS_PT) && !(sts & IIC_STS_ERR));
|
||||
|
||||
if ((sts & IIC_STS_PT) || (sts & IIC_STS_ERR))
|
||||
break;
|
||||
if (sts & IIC_STS_MDBS) {
|
||||
delay(1);
|
||||
/* read 4byte */
|
||||
for (i = 0; i < 4 && cnt < len; i++, cnt++)
|
||||
buf[cnt] =
|
||||
bus_space_read_1(bst, bsh, IIC_MDBUF);
|
||||
}
|
||||
}
|
||||
for ( ; i < 4; i++)
|
||||
(void) bus_space_read_1(bst, bsh, IIC_MDBUF);
|
||||
|
||||
bus_space_unmap(bst, bsh, IIC_NREG);
|
||||
|
||||
return (cnt == len) ? 0 : EINVAL;
|
||||
}
|
Loading…
Reference in New Issue
Block a user