more evbarm files (very incomplete).

This commit is contained in:
matt 2001-09-05 04:53:39 +00:00
parent bc0d6cdd22
commit 1bf6aa62be
22 changed files with 2246 additions and 0 deletions

View File

@ -0,0 +1,198 @@
# $NetBSD: IQ80310,v 1.1 2001/09/05 04:53:39 matt Exp $
#
# IQ80310 -- Intel IQ80310 Evaluation Board Kernel
#
include "arch/evbarm/conf/std.iq80310"
# estimated number of users
maxusers 32
# Standard system options
options RTC_OFFSET=0 # hardware clock is this many mins. west of GMT
#options NTP # NTP phase/frequency locked loop
# CPU options
# For StrongARM systems
options CPU_XSCALE # Support the XScale core
makeoptions COPTS="-O2 -march=armv4 -mtune=strongarm"
#makeoptions COPTS="-O2 -march=armv5 -mtune=xscale"
# Architecture options
options I80312 # We have i80312 core logic
# File systems
file-system FFS # UFS
#file-system LFS # log-structured file system
file-system MFS # memory file system
file-system NFS # Network file system
#file-system ADOSFS # AmigaDOS-compatible file system
file-system EXT2FS # second extended file system (linux)
#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 PORTAL # portal filesystem (still experimental)
#file-system PROCFS # /proc
#file-system UMAPFS # NULLFS + uid and gid remapping
#file-system UNION # union file system
# File system options
#options QUOTA # UFS quotas
#options FFS_EI # FFS Endian Independant support
options NFSSERVER
options SOFTDEP
# 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
#options PFIL_HOOKS # pfil(9) packet filter hooks
#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 TCP_DEBUG # Record last TCP_NDEBUG packets with SO_DEBUG
options NFS_BOOT_BOOTP
options NFS_BOOT_DHCP
#options NFS_BOOT_BOOTPARAM
# Compatibility options
#options COMPAT_43 # 4.3BSD compatibility.
options COMPAT_15 # NetBSD 1.5 compatibility.
options COMPAT_14 # NetBSD 1.4 compatibility.
#options COMPAT_13 # NetBSD 1.3 compatibility.
#options COMPAT_12 # NetBSD 1.2 compatibility.
#options COMPAT_11 # NetBSD 1.1 compatibility.
#options COMPAT_10 # NetBSD 1.0 compatibility.
#options COMPAT_09 # NetBSD 0.9 compatibility.
#options TCP_COMPAT_42 # 4.2BSD TCP/IP bug compat. Not recommended.
# Shared memory options
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=1024 # 1024 pages is the default
# Device options
#options MEMORY_DISK_HOOKS # boottime setup of ramdisk
#options MEMORY_DISK_SIZE=0 # Size in blocks
#options MINIROOTSIZE=3400 # Size in blocks
#options MEMORY_DISK_IS_ROOT # use memory disk as root
# Miscellaneous kernel options
options KTRACE # system call tracing, a la ktrace(1)
options IRQSTATS # manage IRQ statistics
#options LKM # loadable kernel modules
#options KMEMSTATS # kernel memory statistics
#options SCSIVERBOSE # Verbose SCSI errors
options PCIVERBOSE # Verbose PCI descriptions
options MIIVERBOSE # Verbose MII autoconfuration messages
#options PCI_CONFIG_DUMP # verbosely dump PCI config space
#options DDB_KEYCODE=0x40
# Development and Debugging options
options DIAGNOSTIC # internally consistency checks
#options PMAP_DEBUG # Enable pmap_debug_level code
#options IPKDB # remote kernel debugging
options DDB # in-kernel debugger
options DDB_HISTORY_SIZE=100 # Enable history editing in DDB
makeoptions DEBUG="-g" # compile full symbol table
config netbsd root on ? type ?
# The main bus device
mainbus0 at root
# The boot cpu
cpu0 at mainbus?
iopxs0 at mainbus? # The 80312 itself
obio0 at iopxs0 bank 0 # On-Board I/O devices
# time-of-day device via iopxs (is there even a TOD clock? :)
#todclock0 at obio0
# PCI bus via verdi
#pci0 at iopxs? bus 0 # primary PCI bus
pci1 at iopxs? bus 1 # secondary PCI bus
# PCI bus(es) via PPBs
ppb* at pci? dev ? function ?
pci* at ppb?
# ISA bus support
#pcib* at pci? dev ? function ? # ISA bridge
#isa* at pcib?
# PCI IDE Controllers and Devices
# PCI IDE controllers - see pciide(4) for supported hardware.
# The 0x0001 flag force the driver to use DMA, even if the driver doesn't know
# how to set up DMA modes for this chip. This may work, or may cause
# a machine hang with some controllers.
pciide* at pci? dev ? function ? flags 0x0000
# IDE drives
# Flags are used only with controllers that support DMA operations
# and mode settings (e.g. some pciide controllers)
# The lowest order four bits (rightmost digit) of the flags define the PIO
# mode to use, the next set of four bits the DMA mode and the third set the
# UltraDMA mode. For each set of four bits, the 3 lower bits define the mode
# to use, and the last bit must be 1 for this setting to be used.
# For DMA and UDMA, 0xf (1111) means 'disable'.
# 0x0fac means 'use PIO mode 4, DMA mode 2, disable UltraDMA'.
# (0xc=1100, 0xa=1010, 0xf=1111)
# 0x0000 means "use whatever the drive claims to support".
wd* at pciide? channel ? drive ? flags 0x0000 # the drives themselves
# PCI network interfaces
fxp* at pci? dev ? function ? # Intel PRO/100
# MII/PHY support
inphy* at mii? phy ? # ISC-890 PHYs
ukphy* at mii? phy ? # generic unknown PHYs
# OBIO Devices
com0 at obio? instance 0 # primary com port
com1 at obio? instance 1 # secondary com port
clock0 at obio? instance 0 # 33.3MHz system clock via CPLD
# 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 4 # Berkeley packet filter
pseudo-device loop # network loopback
# miscellaneous pseudo-devices
pseudo-device pty # pseudo-terminals
pseudo-device rnd # /dev/random and in-kernel generator

View File

@ -0,0 +1,128 @@
# $NetBSD: files.evbarm,v 1.1 2001/09/05 04:53:39 matt Exp $
#
# First try for arm-specific configuration info
#
maxpartitions 8
maxusers 2 8 64
# Maintain Interrupt statistics
defopt IRQSTATS
define todservice {}
#
# ISA and mixed ISA+EISA or ISA+PCI drivers
#
include "dev/isa/files.isa"
# Include WSCONS stuff
include "dev/wscons/files.wscons"
include "dev/rasops/files.rasops"
include "dev/wsfont/files.wsfont"
# Include arm32 XScale support
include "arch/arm/conf/files.xscale"
#
# Machine-independent ATA drivers
#
include "dev/ata/files.ata"
major {wd = 16}
# ISA DMA glue
file arch/arm32/isa/isadma_machdep.c isadma
# XXX ISA joystick driver
device joy
file arch/arm32/isa/joy.c joy needs-flag
attach joy at isa with joy_isa
file arch/arm32/isa/joy_isa.c joy_isa
attach joy at isapnp with joy_isapnp
file arch/arm32/isa/joy_isapnp.c joy_isapnp
# Memory disk driver
file arch/arm32/dev/md_hooks.c md & memory_disk_hooks
major {md = 18}
# RAIDframe
major {raid = 71}
device todclock
attach todclock at todservice
file arch/arm32/dev/todclock.c todclock needs-count
#
# IQ80310 specific devices
#
define clock
device clock
attach clock at obio with clock_obio
attach com at obio with com_obio
#
# Machine-independent SCSI drivers
#
include "dev/scsipi/files.scsipi"
major {sd = 24}
major {cd = 26}
# Generic MD files
file arch/evbarm/evbarm/autoconf.c
file arch/evbarm/iq80310/iq80310_machdep.c iq80310
file arch/evbarm/iq80310/obio_machdep.c obio & iq80310
file arch/evbarm/iq80310/com_obio.c com_obio
file arch/evbarm/iq80310/clock_obio.c clock_obio
file arch/arm/arm/conf.c iq80310
file arch/arm/arm/disksubr.c disk
file arch/arm/arm/disksubr_acorn.c disk
file arch/arm/arm/disksubr_mbr.c disk
# ARM FPE
file arch/arm32/fpe-arm/armfpe_glue.S armfpe
file arch/arm32/fpe-arm/armfpe_init.c armfpe
file arch/arm32/fpe-arm/armfpe.s armfpe
# ISA support.
file arch/evbarm/iq80310/isa_machdep.c isa & iq80310
file arch/arm32/isa/isa_io.c isa
file arch/arm32/isa/isa_io_asm.S isa
# ISA Plug 'n Play autoconfiguration glue.
file arch/arm32/isa/isapnp_machdep.c isapnp
device sysbeep
attach sysbeep at pcppi with sysbeep_isa
file arch/arm32/isa/sysbeep_isa.c sysbeep_isa
device dsrtc: todservice
attach dsrtc at isa
file arch/arm32/isa/dsrtc.c dsrtc
#
# Include PCI config
#
file arch/evbarm/iq80310/pci_machdep.c pci & iq80310
include "dev/mii/files.mii" # network devices MII bus
include "dev/i2o/files.i2o" # I2O drivers.
include "dev/pci/files.pci" # PCI devices
include "dev/usb/files.usb" # USB device
include "dev/cardbus/files.cardbus" # CARDBus device
device pcib: isabus
attach pcib at pci
file arch/evbarm/pci/pcib.c pcib
# XXX THE FOLLOWING BLOCK SHOULD GO INTO dev/pci/files.pci, BUT CANNOT
# XXX BECAUSE NOT 'lpt' IS DEFINED IN files.isa, RATHER THAN files.
# XXX (when the conf/files and files.isa bogons are fixed, this can
# XXX be fixed as well.)
file arch/evbarm/pci/pciide_machdep.c pciide
include "dev/pckbc/files.pckbc"

View File

@ -0,0 +1,17 @@
# $NetBSD: std.iq80310,v 1.1 2001/09/05 04:53:39 matt Exp $
#
# standard NetBSD/evbarm for IQ80310 options
machine evbarm arm
options EXEC_ELF32
options EXEC_AOUT
options EXEC_SCRIPT
options IQ80310
# To support easy transit to ../arch/arm/arm32
options PROG32
options ARM32
makeoptions LOADADDRESS="0xA0200000"
#makeoptions LINKENTRY="-e nwstart"

View File

@ -0,0 +1,89 @@
/* $NetBSD: autoconf.c,v 1.1 2001/09/05 04:53:40 matt Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Matt Thomas <matt@3am-software.com>.
*
* 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 "opt_md.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/reboot.h>
#include <sys/disklabel.h>
#include <sys/device.h>
#include <sys/conf.h>
#include <sys/kernel.h>
#include <sys/malloc.h>
#include <machine/autoconf.h>
struct device *booted_device;
int booted_partition;
/*
* Set up the root device from the boot args
*/
void
cpu_rootconf(void)
{
printf("boot device: %s\n",
booted_device != NULL ? booted_device->dv_xname : "<unknown>");
setroot(booted_device, booted_partition);
}
/*
* void cpu_configure()
*
* Configure all the root devices
* The root devices are expected to configure their own children
*/
void
cpu_configure(void)
{
struct mainbus_attach_args maa;
maa.ma_name = "mainbus";
config_rootfound("mainbus", &maa);
/* Time to start taking interrupts so lets open the flood gates .... */
spl0();
}
void
device_register(struct device *dev, void *aux)
{
}

View File

@ -0,0 +1,120 @@
# $NetBSD: genassym.cf,v 1.1 2001/09/05 04:53:40 matt Exp $
# Copyright (c) 1982, 1990 The Regents of the University of California.
# All rights reserved.
#
# This code is derived from software contributed to Berkeley by
# William Jolitz.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. All advertising materials mentioning features or use of this software
# must display the following acknowledgement:
# This product includes software developed by the University of
# California, Berkeley and its contributors.
# 4. Neither the name of the University nor the names of its contributors
# may be used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
include <sys/param.h>
include <sys/systm.h>
include <sys/proc.h>
include <sys/resourcevar.h>
include <sys/device.h>
include <sys/user.h>
include <sys/signal.h>
include <uvm/uvm_extern.h>
include <machine/pmap.h>
include <machine/frame.h>
include <machine/vmparam.h>
define VM_MIN_ADDRESS VM_MIN_ADDRESS
define VM_MAXUSER_ADDRESS VM_MAXUSER_ADDRESS
define VM_MAXKERN_ADDRESS VM_MAXKERN_ADDRESS
define PROCESS_PAGE_TBLS_BASE PROCESS_PAGE_TBLS_BASE
define UPAGES UPAGES
define PGSHIFT PGSHIFT
define PDSHIFT PDSHIFT
define P_TRACED P_TRACED
define P_PROFIL P_PROFIL
define P_ADDR offsetof(struct proc, p_addr)
define P_BACK offsetof(struct proc, p_back)
define P_FORW offsetof(struct proc, p_forw)
define P_PRIORITY offsetof(struct proc, p_priority)
define P_STAT offsetof(struct proc, p_stat)
define P_WCHAN offsetof(struct proc, p_wchan)
define P_VMSPACE offsetof(struct proc, p_vmspace)
define P_FLAG offsetof(struct proc, p_flag)
define P_SIGLIST offsetof(struct proc, p_sigctx) + offsetof(struct sigctx, ps_siglist)
define P_SIGMASK offsetof(struct proc, p_sigctx) + offsetof(struct sigctx, ps_sigmask)
define P_USRPRI offsetof(struct proc, p_usrpri)
define SONPROC SONPROC
define PCB_PAGEDIR offsetof(struct pcb, pcb_pagedir)
define PCB_FLAGS offsetof(struct pcb, pcb_flags)
define PCB_R8 offsetof(struct pcb, pcb_r8)
define PCB_R9 offsetof(struct pcb, pcb_r9)
define PCB_R10 offsetof(struct pcb, pcb_r10)
define PCB_R11 offsetof(struct pcb, pcb_r11)
define PCB_R12 offsetof(struct pcb, pcb_r12)
define PCB_SP offsetof(struct pcb, pcb_sp)
define PCB_LR offsetof(struct pcb, pcb_lr)
define PCB_PC offsetof(struct pcb, pcb_pc)
define PCB_UND_SP offsetof(struct pcb, pcb_und_sp)
define PCB_ONFAULT offsetof(struct pcb, pcb_onfault)
define USER_SIZE sizeof(struct user)
define V_TRAP offsetof(struct uvmexp, traps)
define V_INTR offsetof(struct uvmexp, intrs)
define V_SOFT offsetof(struct uvmexp, softs)
define VM_MAP offsetof(struct vmspace, vm_map)
define VM_PMAP offsetof(struct vmspace, vm_map.pmap)
define PR_BASE offsetof(struct uprof, pr_base)
define PR_SIZE offsetof(struct uprof, pr_size)
define PR_OFF offsetof(struct uprof, pr_off)
define PR_SCALE offsetof(struct uprof, pr_scale)
define SIGF_HANDLER offsetof(struct sigframe, sf_handler)
define SIGF_SC offsetof(struct sigframe, sf_sc)
define SIGTRAP SIGTRAP
define SIGEMT SIGEMT
define TF_R0 offsetof(struct trapframe, tf_r0)
define TF_R10 offsetof(struct trapframe, tf_r10)
define TF_PC offsetof(struct trapframe, tf_pc)
define PROCSIZE sizeof(struct proc)
define TRAPFRAMESIZE sizeof(struct trapframe)
define CF_CACHE_PURGE_ID offsetof(struct cpu_functions, cf_cache_purgeID)
define CF_CONTEXT_SWITCH offsetof(struct cpu_functions, cf_context_switch)
define CF_SLEEP offsetof(struct cpu_functions, cf_sleep)
define CI_CURPRIORITY offsetof(struct cpu_info, ci_schedstate.spc_curpriority)

View File

@ -0,0 +1,16 @@
# $NetBSD: Makefile,v 1.1 2001/09/05 04:53:40 matt Exp $
KDIR= /sys/arch/evbarm/include
INCSDIR= /usr/include/arm/evbarm
INCS= bootconfig.h \
frame.h \
intr.h \
joystick.h \
katelib.h kerndebug.h \
param.h pci_machdep.h pmap.h psl.h \
rtc.h \
types.h \
vmparam.h
.include <bsd.kinc.mk>

View File

@ -0,0 +1,76 @@
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Matt Thomas <matt@3am-software.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _EVBARM_AUTOCONF_H_
#define _EVBARM_AUTOCONF_H_
#include <machine/bus.h>
struct mainbus_attach_args {
const char *ma_name;
};
/*
* There's no DMA to/from OBIO space so there's dma tag
*/
#define OBIO_MAXREGIONS 8
struct obio_attach_args {
const char *oa_name;
int oa_instance;
bus_space_tag_t oa_memt;
int oa_nregions;
bus_addr_t oa_addrs[OBIO_MAXREGIONS];
bus_size_t oa_lens[OBIO_MAXREGIONS];
int oa_irq;
int oa_itype;
struct intrsource *oa_isrc;
};
#ifdef _KERNEL
#include "locators.h"
#define obiocf_instance cf_loc[OBIOCF_INSTANCE]
#define obio_intr_establish(oa, func, arg) \
intr_establish((oa)->oa_isrc, (oa)->oa_irq, (oa)->oa_itype, func, arg)
#endif /* _KERNEL */
#endif /* _EVBARM_AUTOCONF_H_ */

View File

@ -0,0 +1,74 @@
/* $NetBSD: bootconfig.h,v 1.1 2001/09/05 04:53:40 matt Exp $ */
/*
* Copyright (c) 1994 Mark Brinicombe.
* Copyright (c) 1994 Brini.
* All rights reserved.
*
* This code is derived from software written for Brini by Mark Brinicombe
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Mark Brinicombe
* for the NetBSD Project.
* 4. The name of the company nor the name of the author may be used to
* endorse or promote products derived from this software without specific
* prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* boot configuration structures
*
* Created : 12/09/94
*
* Based on kate/boot/bootconfig.h
*/
typedef struct _PhysMem {
u_int address;
u_int pages;
} PhysMem;
#define DRAM_BLOCKS 1
typedef struct _BootConfig {
PhysMem dram[DRAM_BLOCKS];
u_int dramblocks;
} BootConfig;
extern BootConfig bootconfig;
#define MAX_BOOT_STRING 255
#ifdef _KERNEL
#define BOOTOPT_TYPE_BOOLEAN 0
#define BOOTOPT_TYPE_STRING 1
#define BOOTOPT_TYPE_INT 2
#define BOOTOPT_TYPE_BININT 3
#define BOOTOPT_TYPE_HEXINT 4
#define BOOTOPT_TYPE_MASK 7
int get_bootconf_option __P((char *string, char *option, int type, void *result));
extern char *boot_args;
extern char *boot_file;
#endif /* _KERNEL */
/* End of bootconfig.h */

View File

@ -0,0 +1,11 @@
#ifndef _EVBARM_CONF_H
#define _EVBARM_CONF_H
/*
* EVBARM specifc device includes go in here
*/
#define CONF_HAVE_SCSIPI
#define CONF_HAVE_USB
#define CONF_HAVE_WSCONS
#endif /* _EVBARM_CONF_H */

View File

@ -0,0 +1,3 @@
/* $NetBSD: frame.h,v 1.1 2001/09/05 04:53:40 matt Exp $ */
#include <arm/arm32/frame.h>

View File

@ -0,0 +1,116 @@
/* $NetBSD: intr.h,v 1.1 2001/09/05 04:53:40 matt Exp $ */
/*
* Copyright (c) 1997 Mark Brinicombe.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Mark Brinicombe
* for the NetBSD Project.
* 4. The name of the company nor the name of the author may be used to
* endorse or promote products derived from this software without specific
* prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifndef _EVBARM_INTR_H_
#define _EVBARM_INTR_H_
/* Define the various Interrupt Priority Levels */
/* Interrupt Priority Levels are mutually exclusive. */
#define IPL_NONE 0 /* no interrupts blocked */
#define IPL_SOFT 1 /* generic soft interrupts */
#define IPL_SOFTCLOCK 2 /* clock soft interrupts */
#define IPL_SOFTNET 3 /* network soft interrupts */
#define IPL_SOFTSERIAL 4 /* serial soft interrupts */
#define IPL_BIO 5 /* block I/O */
#define IPL_NET 6 /* network */
#define IPL_TTY 7 /* terminal */
#define IPL_IMP 8 /* memory allocation */
#define IPL_AUDIO 9 /* audio */
#define IPL_CLOCK 10 /* clock */
#define IPL_SERIAL 11 /* serial */
#define IPL_PERF 12 /* peformance monitoring unit */
#define IPL_HIGH 13 /* blocks all interrupts */
#define IPL_LEVELS 14
#define IST_UNUSABLE -1 /* interrupt cannot be used */
#define IST_NONE 0 /* none (dummy) */
#define IST_PULSE 1 /* pulsed */
#define IST_EDGE 2 /* edge-triggered */
#define IST_LEVEL 3 /* level-triggered */
#if defined (_KERNEL) && !defined(_LOCORE)
#include <sys/queue.h>
extern int _splraise(int);
extern int _spllower(int);
extern int _splget(int);
extern int _splset(int);
extern int _splnone(void);
extern int _softintrset(int);
extern int _softintrclr(int);
#define splsoftclock() _splraise(IPL_SOFTCLOCK)
#define splsoftnet() _splraise(IPL_SOFTNET)
#define splsoftserial() _splraise(IPL_SOFTSERIAL)
#define splbio() _splraise(IPL_BIO)
#define splnet() _splraise(IPL_NET)
#define spltty() _splraise(IPL_TTY)
#define splvm() _splraise(IPL_IMP)
#define splaudio() _splraise(IPL_AUDIO)
#define splclock() _splraise(IPL_CLOCK)
#define splserial() _splraise(IPL_SERIAL)
#define splhigh() _splraise(IPL_HIGH)
#define spl0() (void) _splnone()
#define splx(s) (void) _splset(s)
#define spllock() splhigh()
#define splsched() splclock()
#define splstatclock() splclock()
#define spllowersoftclock() _spllower(IPL_SOFTCLOCK)
#define setsoftclock() _softintrset(IPL_SOFTCLOCK)
#define setsoftnet() _softintrset(IPL_SOFTNET)
#define setsoftserial() _softintrset(IPL_SOFTSERIAL)
struct intrsource {
void *is_cookie;
LIST_ENTRY(evbarm_intrsource) is_link;
void *(*is_establish)(void *, int, int, int (*)(void *), void *);
void (*is_disestablish)(void *, void *);
void (*is_setmask)(int);
};
#define intr_establish(src, irq, type, func, arg) \
(((src)->is_establish)((src)->is_cookie, irq, type, func, arg))
#define intr_disestablish(src, ih) \
(((src)->is_disestablish)((src)->is_cookie, ih))
#endif /* _KERNEL */
#endif /* _EVBARM_INTR_H */

View File

@ -0,0 +1,23 @@
/* $NetBSD: joystick.h,v 1.1 2001/09/05 04:53:40 matt Exp $ */
#ifndef _JOY_IOCTL_H_
#define _JOY_IOCTL_H_
#include <sys/types.h>
#include <sys/ioctl.h>
struct joystick {
int x;
int y;
int b1;
int b2;
};
#define JOY_SETTIMEOUT _IOW('J', 1, int) /* set timeout */
#define JOY_GETTIMEOUT _IOR('J', 2, int) /* get timeout */
#define JOY_SET_X_OFFSET _IOW('J', 3, int) /* set offset on X-axis */
#define JOY_SET_Y_OFFSET _IOW('J', 4, int) /* set offset on X-axis */
#define JOY_GET_X_OFFSET _IOR('J', 5, int) /* get offset on X-axis */
#define JOY_GET_Y_OFFSET _IOR('J', 6, int) /* get offset on Y-axis */
#endif /* _JOY_IOCTL_H_ */

View File

@ -0,0 +1,4 @@
/* $NetBSD: katelib.h,v 1.1 2001/09/05 04:53:40 matt Exp $ */
#include <arm/arm32/katelib.h>

View File

@ -0,0 +1,132 @@
/* $NetBSD: kerndebug.h,v 1.1 2001/09/05 04:53:40 matt Exp $ */
/*
* Copyright 1997
* Digital Equipment Corporation. All rights reserved.
*
* This software is furnished under license and may be used and
* copied only in accordance with the following terms and conditions.
* Subject to these conditions, you may download, copy, install,
* use, modify and distribute this software in source and/or binary
* form. No title or ownership is transferred hereby.
*
* 1) Any source code used, modified or distributed must reproduce
* and retain this copyright notice and list of conditions as
* they appear in the source file.
*
* 2) No right is granted to use any trade name, trademark, or logo of
* Digital Equipment Corporation. Neither the "Digital Equipment
* Corporation" name nor any trademark or logo of Digital Equipment
* Corporation may be used to endorse or promote products derived
* from this software without the prior written permission of
* Digital Equipment Corporation.
*
* 3) This software is provided "AS-IS" and any express or implied
* warranties, including but not limited to, any implied warranties
* of merchantability, fitness for a particular purpose, or
* non-infringement are disclaimed. In no event shall DIGITAL be
* liable for any damages whatsoever, and in particular, DIGITAL
* shall not be liable for special, indirect, consequential, or
* incidental damages or damages for lost profits, loss of
* revenue or loss of use, whether such damages arise in contract,
* negligence, tort, under statute, in equity, at law or otherwise,
* even if advised of the possibility of such damage.
*/
/*
**++
** FACILITY:
**
** kerndebug.h
**
**
** ABSTRACT:
**
** This header provides generic debugging capabilities using printf.
** All debugging can be compiled out by not defining the
** KERNEL_DEBUG macro. In addition the amount of debug output is
** defined by individual variables controlled by each subsystem
** using this utility. Finally note that the two middle bytes of
** the kern debug flags (bits 16 to 23) are free for individual
** subsystems to use as they please (eg. define switches for
** individual functions etc).
**
** AUTHORS:
**
** John Court
**
** CREATION DATE: 2-Feb-1992
**
** MODIFICATION HISTORY:
**
**--
*/
#ifndef _KERNDEBUG_H_
#define _KERNDEBUG_H_
#define KERN_DEBUG_INFO 0x00000001
#define KERN_DEBUG_WARNING 0x00000002
#define KERN_DEBUG_ERROR 0x00000010
#define KERN_DEBUG_SMP 0x00000020
#define KERN_DEBUG_PANIC 0x40000000
#define KERN_REAL_PANIC 0x80000000
#define KERN_DEBUG_ALL KERN_DEBUG_INFO | KERN_DEBUG_WARNING | \
KERN_DEBUG_ERROR | KERN_DEBUG_PANIC
/*
** Define the type for debugging flag subsystem variables
*/
typedef unsigned int Kern_Debug_Flags;
/*
** Set up source line location macro for extra debugging and panics
*/
#ifdef __FILE__
#define KERN_DEBUG_LOC ":%s:%d:=\n\t",__FILE__,__LINE__
#else
#define KERN_DEBUG_LOC ":__FILE__ not supported :=\n\t"
#endif
/*
** This is real nasty in that it requires several printf's but is
** unavoidable due to the differences between
** preprocessors supporting standard ANSI C and others.
**
** NOTE: The format of calls to this macro must be
**
** KERN_DEBUG((Kern_Debug_Flags)CntrlVar, KERN_DEBUG_xxxx,
** (normal printf arguments));
**
** pay special attention to the extra set of () around the
** final arguement.
**
*/
#ifdef KERNEL_DEBUG
#define KERN_DEBUG(CntrlVar,Level,Output) \
{ \
if ( (CntrlVar) & (Level) ) \
{ \
if ( (CntrlVar) & (Level) & KERN_DEBUG_PANIC ) \
{ \
printf ("KERNEL:DEBUG PANIC"); \
printf (KERN_DEBUG_LOC); \
printf Output; \
panic("KERN_DEBUG Panicing"); \
} \
else \
{ \
printf Output; \
} \
} \
}
#else /* else KERNEL_DEBUG not defined */
#define KERN_DEBUG(CntrlVar,Level,Output)
#endif /* end else KERNEL_DEBUG not defined */
#endif /* _KERNDEBUG_H_ */

View File

@ -0,0 +1,49 @@
/* $NetBSD: param.h,v 1.1 2001/09/05 04:53:40 matt Exp $ */
/*
* Copyright (c) 1994,1995 Mark Brinicombe.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the RiscBSD team.
* 4. The name "RiscBSD" nor the name of the author may be used to
* endorse or promote products derived from this software without specific
* prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY RISCBSD ``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 RISCBSD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifndef _EVBARM_PARAM_H_
#define _EVBARM_PARAM_H_
/*
* Machine dependent constants
*/
#define _MACHINE evbarm
#define MACHINE "evbarm"
#define _MACHINE_ARCH arm
#define MACHINE_ARCH "arm"
#include <arm/arm32/param.h>
#endif /* _EVBARM_PARAM_H_ */

View File

@ -0,0 +1,4 @@
/* $NetBSD: pmap.h,v 1.1 2001/09/05 04:53:41 matt Exp $ */
#include <arm/arm32/pmap.h>

View File

@ -0,0 +1,4 @@
/* $NetBSD: psl.h,v 1.1 2001/09/05 04:53:41 matt Exp $ */
#include <arm/arm32/psl.h>

View File

@ -0,0 +1,3 @@
/* $NetBSD: rtc.h,v 1.1 2001/09/05 04:53:41 matt Exp $ */
#include <arm/arm32/rtc.h>

View File

@ -0,0 +1,11 @@
/* $NetBSD: types.h,v 1.1 2001/09/05 04:53:41 matt Exp $ */
#ifndef _EVBARM_TYPES_H_
#define _EVBARM_TYPES_H_
#include <arm/types.h>
#define __HAVE_DEVICE_REGISTER
#define __HAVE_NWSCONS
#endif

View File

@ -0,0 +1,197 @@
/* $NetBSD: vmparam.h,v 1.1 2001/09/05 04:53:41 matt Exp $ */
/*
* Copyright (c) 1988 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifndef _ARM32_VMPARAM_H_
#define _ARM32_VMPARAM_H_
/* for pt_entry_t definition */
#include <machine/pte.h>
#define USRTEXT VM_MIN_ADDRESS
#define USRSTACK VM_MAXUSER_ADDRESS
/*
* Note that MAXTSIZ mustn't be greater than 32M. Otherwise you'd have
* to change the compiler to not generate bl instructions
*/
#define MAXTSIZ (16*1024*1024) /* max text size */
#ifndef DFLDSIZ
#define DFLDSIZ (128*1024*1024) /* initial data size limit */
#endif
#ifndef MAXDSIZ
#define MAXDSIZ (512*1024*1024) /* max data size */
#endif
#ifndef DFLSSIZ
#define DFLSSIZ (2*1024*1024) /* initial stack size limit */
#endif
#ifndef MAXSSIZ
#define MAXSSIZ (8*1024*1024) /* max stack size */
#endif
/*
* Size of shared memory map
*/
#ifndef SHMMAXPGS
#define SHMMAXPGS 1024
#endif
/*
* The time for a process to be blocked before being very swappable.
* This is a number of seconds which the system takes as being a non-trivial
* amount of real time. You probably shouldn't change this;
* it is used in subtle ways (fractions and multiples of it are, that is, like
* half of a `long time'', almost a long time, etc.)
* It is related to human patience and other factors which don't really
* change over time.
*/
#define MAXSLP 20
/*
* Address space constants
*/
/*
* The line between user space and kernel space
* Mappings >= KERNEL_SPACE_START are constant across all processes
*/
#define KERNEL_SPACE_START 0xa0000000
/* total number of page table entries to map 4GB * size of each entry*/
#define PAGE_TABLE_SPACE ((1 << (32 - PGSHIFT)) * sizeof(pt_entry_t))
/* Address where the page tables are mapped */
#define PAGE_TABLE_SPACE_START (KERNEL_SPACE_START - PAGE_TABLE_SPACE)
/* Various constants used by the MD code*/
#define KERNEL_BASE 0xa0000000
#define KERNEL_TEXT_BASE (KERNEL_BASE + 0x00100000)
#define ALT_PAGE_TBLS_BASE (KERNEL_BASE + 0x00c00000)
#define KERNEL_VM_BASE (KERNEL_BASE + 0x01000000)
/*
* The Kernel VM Size varies depending on the machine depending on how
* much space is needed (and where) for other mappings.
* In some cases the chosen value may not be the maximum in order that
* we don't waste memory with kernel pages tables as we can't currently
* grow the kernel page tables after booting.
* You only need to increase these values if you find that the number of
* buffers is being limited due to lack of VA space.
*/
/*
* The range 0xf1000000 - 0xfcffffff is available for kernel VM space
* Footbridge registers and I/O mappings occupy 0xfd000000 - 0xffffffff
*/
#define KERNEL_VM_SIZE 0x06000000
#define PROCESS_PAGE_TBLS_BASE PAGE_TABLE_SPACE_START
/*
* Override the default pager_map size, there's not enough KVA.
*/
#define PAGER_MAP_SIZE (4 * 1024 * 1024)
/*
* Mach derived constants
*/
#define VM_MIN_ADDRESS ((vm_offset_t)0x00001000)
#define VM_MAXUSER_ADDRESS ((vm_offset_t)(PAGE_TABLE_SPACE_START - UPAGES * NBPG))
#define VM_MAX_ADDRESS ((vm_offset_t)(PAGE_TABLE_SPACE_START + (KERNEL_SPACE_START >> PGSHIFT) * sizeof(pt_entry_t)))
#define VM_MIN_KERNEL_ADDRESS ((vm_offset_t)KERNEL_TEXT_BASE)
#define VM_MAXKERN_ADDRESS ((vm_offset_t)(KERNEL_VM_BASE + KERNEL_VM_SIZE))
#define VM_MAX_KERNEL_ADDRESS ((vm_offset_t)0xffffffff)
/*
* Size of User Raw I/O map
*/
#define USRIOSIZE 300
/* XXX max. amount of KVM to be used by buffers. */
#ifndef VM_MAX_KERNEL_BUF
#define VM_MAX_KERNEL_BUF \
((VM_MAXKERN_ADDRESS - KERNEL_VM_BASE) * 4 / 10)
#endif
/* virtual sizes (bytes) for various kernel submaps */
#define VM_PHYS_SIZE (USRIOSIZE*NBPG)
/*
* max number of non-contig chunks of physical RAM you can have
*/
#define VM_PHYSSEG_MAX 32
/*
* when converting a physical address to a vm_page structure, we
* want to use a binary search on the chunks of physical memory
* to find our RAM
*/
#define VM_PHYSSEG_STRAT VM_PSTRAT_BSEARCH
/*
* this indicates that we can't add RAM to the VM system after the
* vm system is init'd.
*/
#define VM_PHYSSEG_NOADD
/*
* we support 2 free lists:
*
* - DEFAULT for all systems
* - ISADMA for the ISA DMA range on Sharks only
*/
#define VM_NFREELIST 2
#define VM_FREELIST_DEFAULT 0
#define VM_FREELIST_ISADMA 1
/*
* define structure pmap_physseg: there is one of these structures
* for each chunk of noncontig RAM you have.
*/
#define __HAVE_PMAP_PHYSSEG
struct pmap_physseg {
struct pv_head *pvhead; /* pv_entry array */
char *attrs; /* attrs array */
};
#endif /* _ARM32_VMPARAM_H_ */
/* End of vmparam.h */

View File

@ -0,0 +1,933 @@
/* $NetBSD: iq80310_machdep.c,v 1.1 2001/09/05 04:53:41 matt Exp $ */
/*
* Copyright (c) 1997,1998 Mark Brinicombe.
* Copyright (c) 1997,1998 Causality Limited.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Mark Brinicombe
* for the NetBSD Project.
* 4. The name of the company nor the name of the author may be used to
* endorse or promote products derived from this software without specific
* prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* Machine dependant functions for kernel setup for EBSA285 core architecture
* using Netwinder firmware
*
* Created : 24/11/97
*/
#include "opt_ddb.h"
#include "opt_pmap_debug.h"
#include <sys/param.h>
#include <sys/device.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/exec.h>
#include <sys/proc.h>
#include <sys/msgbuf.h>
#include <sys/reboot.h>
#include <sys/termios.h>
#include <dev/cons.h>
#include <machine/db_machdep.h>
#include <ddb/db_sym.h>
#include <ddb/db_extern.h>
#include <machine/bootconfig.h>
#include <machine/bus.h>
#include <machine/cpu.h>
#include <machine/frame.h>
#include <machine/irqhandler.h>
#include <machine/pte.h>
#include <machine/undefined.h>
#include <machine/iq80310_boot.h>
#include <arm/xscale/i80312reg.h>
#include <arm/xscale/i80312var.h>
#include "opt_ipkdb.h"
#include "isa.h"
#if NISA > 0
#include <dev/isa/isareg.h>
#include <dev/isa/isavar.h>
#endif
/*
* Address to call from cpu_reset() to reset the machine.
* This is machine architecture dependant as it varies depending
* on where the ROM appears when you turn the MMU off.
*/
u_int cpu_reset_address = I80312_ROM_BASE;
u_int dc21285_fclk = FCLK;
/* Define various stack sizes in pages */
#define IRQ_STACK_SIZE 1
#define ABT_STACK_SIZE 1
#ifdef IPKDB
#define UND_STACK_SIZE 2
#else
#define UND_STACK_SIZE 1
#endif
struct nwbootinfo nwbootinfo;
BootConfig bootconfig; /* Boot config storage */
static char bootargs[MAX_BOOT_STRING + 1];
char *boot_args = NULL;
char *boot_file = NULL;
vm_offset_t physical_start;
vm_offset_t physical_freestart;
vm_offset_t physical_freeend;
vm_offset_t physical_end;
u_int free_pages;
vm_offset_t pagetables_start;
int physmem = 0;
/*int debug_flags;*/
#ifndef PMAP_STATIC_L1S
int max_processes = 64; /* Default number */
#endif /* !PMAP_STATIC_L1S */
/* Physical and virtual addresses for some global pages */
pv_addr_t systempage;
pv_addr_t irqstack;
pv_addr_t undstack;
pv_addr_t abtstack;
pv_addr_t kernelstack;
vm_offset_t msgbufphys;
extern u_int data_abort_handler_address;
extern u_int prefetch_abort_handler_address;
extern u_int undefined_handler_address;
#ifdef PMAP_DEBUG
extern int pmap_debug_level;
#endif
#define KERNEL_PT_SYS 0 /* Page table for mapping proc0 zero page */
#define KERNEL_PT_KERNEL 1 /* Page table for mapping kernel */
#define KERNEL_PT_VMDATA 2 /* Page tables for mapping kernel VM */
#define KERNEL_PT_VMDATA_NUM (KERNEL_VM_SIZE >> (PDSHIFT + 2))
#define NUM_KERNEL_PTS (KERNEL_PT_VMDATA + KERNEL_PT_VMDATA_NUM)
pt_entry_t kernel_pt_table[NUM_KERNEL_PTS];
struct user *proc0paddr;
/* Prototypes */
void consinit __P((void));
void map_section __P((vm_offset_t pt, vm_offset_t va, vm_offset_t pa,
int cacheable));
void map_pagetable __P((vm_offset_t pt, vm_offset_t va, vm_offset_t pa));
void map_entry __P((vm_offset_t pt, vm_offset_t va, vm_offset_t pa));
void map_entry_nc __P((vm_offset_t pt, vm_offset_t va, vm_offset_t pa));
void map_entry_ro __P((vm_offset_t pt, vm_offset_t va, vm_offset_t pa));
vm_size_t map_chunk __P((vm_offset_t pd, vm_offset_t pt, vm_offset_t va,
vm_offset_t pa, vm_size_t size, u_int acc,
u_int flg));
void process_kernel_args __P((char *));
void data_abort_handler __P((trapframe_t *frame));
void prefetch_abort_handler __P((trapframe_t *frame));
void undefinedinstruction_bounce __P((trapframe_t *frame));
void zero_page_readonly __P((void));
void zero_page_readwrite __P((void));
extern void configure __P((void));
extern void db_machine_init __P((void));
extern void parse_mi_bootargs __P((char *args));
extern void dumpsys __P((void));
/* A load of console goo. */
#include "vga.h"
#if (NVGA > 0)
#include <dev/ic/mc6845reg.h>
#include <dev/ic/pcdisplayvar.h>
#include <dev/ic/vgareg.h>
#include <dev/ic/vgavar.h>
#endif
#include "pckbc.h"
#if (NPCKBC > 0)
#include <dev/ic/i8042reg.h>
#include <dev/ic/pckbcvar.h>
#endif
#include "com.h"
#if (NCOM > 0)
#include <dev/ic/comreg.h>
#include <dev/ic/comvar.h>
#ifndef CONCOMADDR
#define CONCOMADDR 0
#endif
#endif
#ifndef CONSDEVNAME
#define CONSDEVNAME "com"
#endif
#define CONSPEED B115200
#ifndef CONSPEED
#define CONSPEED B9600 /* TTYDEF_SPEED */
#endif
#ifndef CONMODE
#define CONMODE ((TTYDEF_CFLAG & ~(CSIZE | CSTOPB | PARENB)) | CS8) /* 8N1 */
#endif
int comcnspeed = CONSPEED;
int comcnmode = CONMODE;
extern struct consdev kcomcons;
static void kcomcnputc(dev_t, int);
/*
* void cpu_reboot(int howto, char *bootstr)
*
* Reboots the system
*
* Deal with any syncing, unmounting, dumping and shutdown hooks,
* then reset the CPU.
*/
void
cpu_reboot(int howto, char *bootstr)
{
#ifdef DIAGNOSTIC
/* info */
printf("boot: howto=%08x curproc=%p\n", howto, curproc);
#endif
/*
* If we are still cold then hit the air brakes
* and crash to earth fast
*/
if (cold) {
doshutdownhooks();
printf("The operating system has halted.\n");
printf("Please press any key to reboot.\n\n");
cngetc();
printf("rebooting...\n");
cpu_reset();
/*NOTREACHED*/
}
/* Disable console buffering */
/* cnpollc(1);*/
/*
* If RB_NOSYNC was not specified sync the discs.
* Note: Unless cold is set to 1 here, syslogd will die during the unmount.
* It looks like syslogd is getting woken up only to find that it cannot
* page part of the binary in as the filesystem has been unmounted.
*/
if (!(howto & RB_NOSYNC))
bootsync();
/* Say NO to interrupts */
splhigh();
/* Do a dump if requested. */
if ((howto & (RB_DUMP | RB_HALT)) == RB_DUMP)
dumpsys();
/* Run any shutdown hooks */
doshutdownhooks();
/* Make sure IRQ's are disabled */
IRQdisable;
if (howto & RB_HALT) {
printf("The operating system has halted.\n");
printf("Please press any key to reboot.\n\n");
cngetc();
}
printf("rebooting...\n");
cpu_reset();
/*NOTREACHED*/
}
/*
* Mapping table for core kernel memory. This memory is mapped at init
* time with section mappings.
*/
struct l1_sec_map {
vaddr_t va;
vaddr_t pa;
vsize_t size;
int flags;
} l1_sec_table[] = {
{
/* Map 1MB for CSR space */
I80312_ARMCSR_VBASE,
I80312_ARMCSR_BASE,
I80312_ARMCSR_VSIZE,
0
}, {
/* Map 1MB for fast cache cleaning space */
I80312_CACHE_FLUSH_VBASE,
I80312_SA_CACHE_FLUSH_BASE,
I80312_CACHE_FLUSH_VSIZE,
1
}, {
/* Map 1MB for PCI IO space */
I80312_PCI_IO_VBASE,
I80312_PCI_IO_BASE,
I80312_PCI_IO_VSIZE,
0
}, {
/* Map 1MB for PCI IACK space */
I80312_PCI_IACK_VBASE,
I80312_PCI_IACK_SPECIAL,
I80312_PCI_IACK_VSIZE,
0
}, {
/* Map 16MB of type 1 PCI config access */
I80312_PCI_TYPE_1_CONFIG_VBASE,
I80312_PCI_TYPE_1_CONFIG,
I80312_PCI_TYPE_1_CONFIG_VSIZE,
0
}, {
/* Map 16MB of type 0 PCI config access */
I80312_PCI_TYPE_0_CONFIG_VBASE,
I80312_PCI_TYPE_0_CONFIG,
I80312_PCI_TYPE_0_CONFIG_VSIZE,
0
}, {
#if NISA > 0
/* Map 1MB of 32 bit PCI address space for ISA MEM accesses via PCI */
I80312_PCI_ISA_MEM_VBASE,
I80312_PCI_MEM_BASE,
I80312_PCI_ISA_MEM_VSIZE,
0
#endif
}, {
0,
0,
0,
0,
}
};
/*
* u_int initarm(struct ebsaboot *bootinfo)
*
* Initial entry point on startup. This gets called before main() is
* entered.
* It should be responsible for setting up everything that must be
* in place when main is called.
* This includes
* Taking a copy of the boot configuration structure.
* Initialising the physical console so characters can be printed.
* Setting up page tables for the kernel
* Relocating the kernel to the bottom of physical memory
*/
u_int
initarm(bootinfo)
struct nwbootinfo *bootinfo;
{
int loop;
int loop1;
u_int l1pagetable;
u_int l2pagetable;
extern char page0[], page0_end[];
#if 0
extern int end[];
extern int *esym;
#endif
pv_addr_t kernel_l1pt;
pv_addr_t kernel_ptpt;
cn_tab = &kcomcons;
/*
* Heads up ... Setup the CPU / MMU / TLB functions
*/
if (set_cpufuncs())
panic("cpu not recognized!");
/* Fake bootconfig structure for the benefit of pmap.c */
/* XXX must make the memory description h/w independant */
bootconfig.dramblocks = 1;
bootconfig.dram[0].address = 0xa0000000;
bootconfig.dram[0].pages = 0x02000000 / NBPG; /* nwbootinfo.bi_nrpages */
/* - nwbootinfo.bt_memstart) / NBPG */;
/*
* Initialise the diagnostic serial console
* This allows a means of generating output during initarm().
* Once all the memory map changes are complete we can call consinit()
* and not have to worry about things moving.
*/
/* Talk to the user */
printf("\nNetBSD/netwinder booting ...\n");
/*
* Ok we have the following memory map
*
* virtual address == physical address apart from the areas:
* 0x00000000 -> 0x000fffff which is mapped to
* top 1MB of physical memory
* 0x00100000 -> 0x0fffffff which is mapped to
* physical addresses 0x00100000 -> 0x0fffffff
* 0x10000000 -> 0x1fffffff which is mapped to
* physical addresses 0x00000000 -> 0x0fffffff
* 0x20000000 -> 0xefffffff which is mapped to
* physical addresses 0x20000000 -> 0xefffffff
* 0xf0000000 -> 0xf03fffff which is mapped to
* physical addresses 0xa0000000 -> 0xa03fffff
*
* This means that the kernel is mapped suitably for continuing
* execution, all I/O is mapped 1:1 virtual to physical and
* physical memory is accessible.
*
* The initarm() has the responsibility for creating the kernel
* page tables.
* It must also set up various memory pointers that are used
* by pmap etc.
*/
/*
* Examine the boot args string for options we need to know about
* now.
*/
#if 0
process_kernel_args((char *)nwbootinfo.bt_args);
#endif
printf("initarm: Configuring system ...\n");
/*
* Set up the variables that define the availablilty of
* physical memory
*/
physical_start = 0 /*nwbootinfo.bt_memstart*/;
physical_freestart = physical_start;
physical_end = /*nwbootinfo.bt_memend*/ /*nwbootinfo.bi_nrpages * NBPG */ 64*1024*1024;
physical_freeend = physical_end;
free_pages = (physical_end - physical_start) / NBPG;
physmem = (physical_end - physical_start) / NBPG;
/* Tell the user about the memory */
printf("physmemory: %d pages at 0x%08lx -> 0x%08lx\n", physmem,
physical_start, physical_end - 1);
/*
* Ok the kernel occupies the bottom of physical memory.
* The first free page after the kernel can be found in
* nwbootinfo->bt_memavail
* We now need to allocate some fixed page tables to get the kernel
* going.
* We allocate one page directory and a number page tables and store
* the physical addresses in the kernel_pt_table array.
*
* Ok the next bit of physical allocation may look complex but it is
* simple really. I have done it like this so that no memory gets
* wasted during the allocation of various pages and tables that are
* all different sizes.
* The start addresses will be page aligned.
* We allocate the kernel page directory on the first free 16KB boundry
* we find.
* We allocate the kernel page tables on the first 4KB boundry we find.
* Since we allocate at least 3 L2 pagetables we know that we must
* encounter at least one 16KB aligned address.
*/
#ifdef VERBOSE_INIT_ARM
printf("Allocating page tables\n");
#endif
#if 0
/* Update the address of the first free 16KB chunk of physical memory */
physical_freestart = ((uintptr_t) &end + PGOFSET) & ~PGOFSET;
#if 0
physical_freestart += (kernexec->a_syms + sizeof(int)
+ *(u_int *)((int)end + kernexec->a_syms + sizeof(int))
+ (NBPG - 1)) & ~(NBPG - 1);
#endif
#else
physical_freestart = 0x00200000; /* start at 2MB */
#endif
free_pages -= (physical_freestart - physical_start) / NBPG;
#ifdef VERBOSE_INIT_ARM
printf("freestart = %#lx, free_pages = %d (%#x)\n",
physical_freestart, free_pages, free_pages);
#endif
/* Define a macro to simplify memory allocation */
#define valloc_pages(var, np) \
alloc_pages((var).pv_pa, (np)); \
(var).pv_va = KERNEL_BASE + (var).pv_pa - physical_start;
#define alloc_pages(var, np) \
(var) = physical_freestart; \
physical_freestart += ((np) * NBPG); \
free_pages -= (np); \
memset((char *)(var), 0, ((np) * NBPG));
loop1 = 0;
kernel_l1pt.pv_pa = 0;
for (loop = 0; loop <= NUM_KERNEL_PTS; ++loop) {
/* Are we 16KB aligned for an L1 ? */
if ((physical_freestart & (PD_SIZE - 1)) == 0
&& kernel_l1pt.pv_pa == 0) {
valloc_pages(kernel_l1pt, PD_SIZE / NBPG);
} else {
alloc_pages(kernel_pt_table[loop1], PT_SIZE / NBPG);
++loop1;
}
}
/* This should never be able to happen but better confirm that. */
if (!kernel_l1pt.pv_pa || (kernel_l1pt.pv_pa & (PD_SIZE-1)) != 0)
panic("initarm: Failed to align the kernel page directory\n");
/*
* Allocate a page for the system page mapped to V0x00000000
* This page will just contain the system vectors and can be
* shared by all processes.
*/
alloc_pages(systempage.pv_pa, 1);
/* Allocate a page for the page table to map kernel page tables*/
valloc_pages(kernel_ptpt, PT_SIZE / NBPG);
/* Allocate stacks for all modes */
valloc_pages(irqstack, IRQ_STACK_SIZE);
valloc_pages(abtstack, ABT_STACK_SIZE);
valloc_pages(undstack, UND_STACK_SIZE);
valloc_pages(kernelstack, UPAGES);
#ifdef VERBOSE_INIT_ARM
printf("IRQ stack: p0x%08lx v0x%08lx\n", irqstack.pv_pa, irqstack.pv_va);
printf("ABT stack: p0x%08lx v0x%08lx\n", abtstack.pv_pa, abtstack.pv_va);
printf("UND stack: p0x%08lx v0x%08lx\n", undstack.pv_pa, undstack.pv_va);
printf("SVC stack: p0x%08lx v0x%08lx\n", kernelstack.pv_pa, kernelstack.pv_va);
#endif
alloc_pages(msgbufphys, round_page(MSGBUFSIZE) / NBPG);
/*
* Ok we have allocated physical pages for the primary kernel
* page tables
*/
#ifdef VERBOSE_INIT_ARM
printf("Creating L1 page table at %#lx\n", kernel_l1pt.pv_pa);
#endif
/*
* Now we start consturction of the L1 page table
* We start by mapping the L2 page tables into the L1.
* This means that we can replace L1 mappings later on if necessary
*/
l1pagetable = kernel_l1pt.pv_pa;
/* Map the L2 pages tables in the L1 page table */
map_pagetable(l1pagetable, 0x00000000,
kernel_pt_table[KERNEL_PT_SYS]);
map_pagetable(l1pagetable, KERNEL_BASE,
kernel_pt_table[KERNEL_PT_KERNEL]);
for (loop = 0; loop < KERNEL_PT_VMDATA_NUM; ++loop)
map_pagetable(l1pagetable, KERNEL_VM_BASE + loop * 0x00400000,
kernel_pt_table[KERNEL_PT_VMDATA + loop]);
map_pagetable(l1pagetable, PROCESS_PAGE_TBLS_BASE,
kernel_ptpt.pv_pa);
#ifdef VERBOSE_INIT_ARM
printf("Mapping kernel\n");
#endif
/* Now we fill in the L2 pagetable for the kernel static code/data */
l2pagetable = kernel_pt_table[KERNEL_PT_KERNEL];
#if 0
{
u_int logical;
extern int etext, end;
size_t textsize = (uintptr_t) &etext - KERNEL_TEXT_BASE;
size_t totalsize = (uintptr_t) &end - KERNEL_TEXT_BASE;
/* Round down text size and round up total size
*/
textsize = textsize & ~PGOFSET;
totalsize = (totalsize + PGOFSET) & ~PGOFSET;
logical = map_chunk(0, l2pagetable, KERNEL_BASE,
physical_start, KERNEL_TEXT_BASE - KERNEL_BASE,
AP_KRW, PT_CACHEABLE);
logical += map_chunk(0, l2pagetable, KERNEL_BASE + logical,
physical_start + logical, textsize,
AP_KRW, PT_CACHEABLE);
logical += map_chunk(0, l2pagetable, KERNEL_BASE + logical,
physical_start + logical, totalsize - textsize,
AP_KRW, PT_CACHEABLE);
#if 0
logical += map_chunk(0, l2pagetable, KERNEL_BASE + logical,
physical_start + logical, kernexec->a_syms + sizeof(int)
+ *(u_int *)((int)end + kernexec->a_syms + sizeof(int)),
AP_KRW, PT_CACHEABLE);
#endif
}
#else
map_section(l1pagetable, 0xf0000000, 0x00000000, 1);
map_section(l1pagetable, 0xf0100000, 0x00100000, 1);
#endif
#if 0
/*
* PATCH PATCH ...
*
* Fixup the first word of the kernel to be the instruction
* add pc, pc, #0x41000000
*
* This traps the case where the CPU core resets due to bus contention
* on a prototype CATS system and will reboot into the firmware.
*/
*((u_int *)KERNEL_TEXT_BASE) = 0xe28ff441;
#endif
#ifdef VERBOSE_INIT_ARM
printf("Constructing L2 page tables\n");
#endif
/* Map the boot arguments page */
#if 0
map_entry_ro(l2pagetable, nwbootinfo.bt_vargp, nwbootinfo.bt_pargp);
#endif
/* Map the stack pages */
map_chunk(0, l2pagetable, irqstack.pv_va, irqstack.pv_pa,
IRQ_STACK_SIZE * NBPG, AP_KRW, PT_CACHEABLE);
map_chunk(0, l2pagetable, abtstack.pv_va, abtstack.pv_pa,
ABT_STACK_SIZE * NBPG, AP_KRW, PT_CACHEABLE);
map_chunk(0, l2pagetable, undstack.pv_va, undstack.pv_pa,
UND_STACK_SIZE * NBPG, AP_KRW, PT_CACHEABLE);
map_chunk(0, l2pagetable, kernelstack.pv_va, kernelstack.pv_pa,
UPAGES * NBPG, AP_KRW, PT_CACHEABLE);
map_chunk(0, l2pagetable, kernel_l1pt.pv_va, kernel_l1pt.pv_pa,
PD_SIZE, AP_KRW, 0);
/* Map the page table that maps the kernel pages */
map_entry_nc(l2pagetable, kernel_ptpt.pv_pa, kernel_ptpt.pv_pa);
/*
* Map entries in the page table used to map PTE's
* Basically every kernel page table gets mapped here
*/
/* The -2 is slightly bogus, it should be -log2(sizeof(pt_entry_t)) */
l2pagetable = kernel_ptpt.pv_pa;
map_entry_nc(l2pagetable, (KERNEL_BASE >> (PGSHIFT-2)),
kernel_pt_table[KERNEL_PT_KERNEL]);
map_entry_nc(l2pagetable, (PROCESS_PAGE_TBLS_BASE >> (PGSHIFT-2)),
kernel_ptpt.pv_pa);
map_entry_nc(l2pagetable, (0x00000000 >> (PGSHIFT-2)),
kernel_pt_table[KERNEL_PT_SYS]);
for (loop = 0; loop < KERNEL_PT_VMDATA_NUM; ++loop)
map_entry_nc(l2pagetable, ((KERNEL_VM_BASE +
(loop * 0x00400000)) >> (PGSHIFT-2)),
kernel_pt_table[KERNEL_PT_VMDATA + loop]);
/*
* Map the system page in the kernel page table for the bottom 1Meg
* of the virtual memory map.
*/
l2pagetable = kernel_pt_table[KERNEL_PT_SYS];
map_entry(l2pagetable, 0x00000000, systempage.pv_pa);
/* Map the core memory needed before autoconfig */
loop = 0;
while (l1_sec_table[loop].size) {
vm_size_t sz;
#ifdef VERBOSE_INIT_ARM
printf("%08lx -> %08lx @ %08lx\n", l1_sec_table[loop].pa,
l1_sec_table[loop].pa + l1_sec_table[loop].size - 1,
l1_sec_table[loop].va);
#endif
for (sz = 0; sz < l1_sec_table[loop].size; sz += L1_SEC_SIZE)
map_section(l1pagetable, l1_sec_table[loop].va + sz,
l1_sec_table[loop].pa + sz,
l1_sec_table[loop].flags);
++loop;
}
/*
* Now we have the real page tables in place so we can switch to them.
* Once this is done we will be running with the REAL kernel page tables.
*/
/* Switch tables */
#ifdef VERBOSE_INIT_ARM
printf("freestart = %#lx, free_pages = %d (%#x)\n",
physical_freestart, free_pages, free_pages);
printf("switching to new L1 page table @%#lx...", kernel_l1pt.pv_pa);
#endif
setttb(kernel_l1pt.pv_pa);
#ifdef VERBOSE_INIT_ARM
printf("done!\n");
#endif
/*
* Ok the I80312 CSR registers have just moved.
* Detach the diagnostic serial port and reattach at the new address.
*/
/*
* XXX this should only be done in main() but it useful to
* have output earlier ...
*/
consinit();
#ifdef VERBOSE_INIT_ARM
printf("bootstrap done.\n");
#endif
/* Right set up the vectors at the bottom of page 0 */
memcpy((char *)0x00000000, page0, page0_end - page0);
/* We have modified a text page so sync the icache */
cpu_cache_syncI();
/*
* Pages were allocated during the secondary bootstrap for the
* stacks for different CPU modes.
* We must now set the r13 registers in the different CPU modes to
* point to these stacks.
* Since the ARM stacks use STMFD etc. we must set r13 to the top end
* of the stack memory.
*/
printf("init subsystems: stacks ");
set_stackptr(PSR_IRQ32_MODE, irqstack.pv_va + IRQ_STACK_SIZE * NBPG);
set_stackptr(PSR_ABT32_MODE, abtstack.pv_va + ABT_STACK_SIZE * NBPG);
set_stackptr(PSR_UND32_MODE, undstack.pv_va + UND_STACK_SIZE * NBPG);
/*
* Well we should set a data abort handler.
* Once things get going this will change as we will need a proper handler.
* Until then we will use a handler that just panics but tells us
* why.
* Initialisation of the vectors will just panic on a data abort.
* This just fills in a slighly better one.
*/
printf("vectors ");
data_abort_handler_address = (u_int)data_abort_handler;
prefetch_abort_handler_address = (u_int)prefetch_abort_handler;
undefined_handler_address = (u_int)undefinedinstruction_bounce;
/* At last !
* We now have the kernel in physical memory from the bottom upwards.
* Kernel page tables are physically above this.
* The kernel is mapped to KERNEL_TEXT_BASE
* The kernel data PTs will handle the mapping of 0xf1000000-0xf3ffffff
* The page tables are mapped to 0xefc00000
*/
/* Initialise the undefined instruction handlers */
printf("undefined ");
undefined_init();
/* Boot strap pmap telling it where the kernel page table is */
printf("pmap ");
pmap_bootstrap((pd_entry_t *)kernel_l1pt.pv_va, kernel_ptpt);
/* Setup the IRQ system */
printf("irq ");
irq_init();
printf("done.\n");
#ifdef IPKDB
/* Initialise ipkdb */
ipkdb_init();
if (boothowto & RB_KDB)
ipkdb_connect(0);
#endif
#ifdef DDB
printf("ddb: ");
db_machine_init();
#if 0
ddb_init(end[0], end + 1, esym);
#endif
if (boothowto & RB_KDB)
Debugger();
#endif
/* We return the new stack pointer address */
return(kernelstack.pv_va + USPACE_SVC_STACK_TOP);
}
void
process_kernel_args(args)
char *args;
{
boothowto = 0;
/* Make a local copy of the bootargs */
strncpy(bootargs, args, MAX_BOOT_STRING);
args = bootargs;
boot_file = bootargs;
/* Skip the kernel image filename */
while (*args != ' ' && *args != 0)
++args;
if (*args != 0)
*args++ = 0;
while (*args == ' ')
++args;
boot_args = args;
printf("bootfile: %s\n", boot_file);
printf("bootargs: %s\n", boot_args);
parse_mi_bootargs(boot_args);
}
#if 0
void
arm32_cachectl(va, len, flags)
vm_offset_t va;
int len;
int flags;
{
pt_entry_t *ptep, pte;
int loop;
vm_offset_t addr;
/* printf("arm32_cachectl(%x,%x,%x)\n", va, len, flags);*/
if (flags & 1) {
addr = va;
loop = len;
while (loop > 0) {
ptep = vtopte(addr & (~PGOFSET));
pte = *ptep;
*ptep = (pte & ~(PT_C | PT_B)) | (flags & (PT_C | PT_B));
loop -= NBPG;
addr += NBPG;
}
tlb_flush();
}
cpu_cache_purgeD_rng(va, len);
}
#endif
extern struct bus_space footbridge_pci_io_bs_tag;
extern struct bus_space footbridge_pci_mem_bs_tag;
void footbridge_pci_bs_tag_init __P((void));
void
consinit(void)
{
static int consinit_called = 0;
if (consinit_called != 0)
return;
consinit_called = 1;
bust = iq80310_bs_init();
#if (NCOM > 0)
if (comcnattach(&bust, CONCOMADDR, comcnspeed,
COM_FREQ, comcnmode))
panic("can't init serial console @%x", CONCOMADDR);
#else
panic("serial console @%x not configured", CONCOMADDR);
#endif
}
}
static bus_space_handle_t kcom_base = (bus_space_handle_t) I80312_COM0_VBASE;
u_int8_t i80312_bs_r_1(void *, bus_space_handle_t, bus_size_t);
void i80312_bs_w_1(void *, bus_space_handle_t, bus_size_t, u_int8_t);
#define KCOM_GETBYTE(r) i80312_bs_r_1(0, kcom_base, (r))
#define KCOM_PUTBYTE(r,v) i80312_bs_w_1(0, kcom_base, (r), (v))
static int
kcomcngetc(dev_t dev)
{
int stat, c;
/* block until a character becomes available */
while (!ISSET(stat = KCOM_GETBYTE(com_lsr), LSR_RXRDY))
;
c = KCOM_GETBYTE(com_data);
stat = KCOM_GETBYTE(com_iir);
return c;
}
/*
* Console kernel output character routine.
*/
static void
kcomcnputc(dev_t dev, int c)
{
int timo;
/* wait for any pending transmission to finish */
timo = 150000;
while (!ISSET(KCOM_GETBYTE(com_lsr), LSR_TXRDY) && --timo)
continue;
KCOM_PUTBYTE(com_data, c);
/* wait for this transmission to complete */
timo = 1500000;
while (!ISSET(KCOM_GETBYTE(com_lsr), LSR_TXRDY) && --timo)
continue;
}
static void
kcomcnpollc(dev_t dev, int on)
{
}
struct consdev kcomcons = {
NULL, NULL, kcomcngetc, kcomcnputc, kcomcnpollc, NULL,
NODEV, CN_NORMAL
};

View File

@ -0,0 +1,38 @@
#define IQ80310_UART1 0xfe800000UL
#define UART1_LEN 8
#define IQ80310_UART2 0xfe810000UL
#define UART2_LEN 8
#define IQ80310_XINT3STS 0xfe820000UL
#define XINT3STS_LEN 1
#define XINT3_TIMER 0x01
#define XINT3_ETHERNET 0x02
#define XINT3_UART1 0x04
#define XINT3_UART2 0x08
#define XINT3_SINTD 0x10 /* Secondary PCI INTD */
#define IQ80310_BRDREV 0xfe830000UL /* rev F board feature */
#define BRDREV_LEN 1
#define BRDREV_REV(data) ((data) & 0xf) + '@')
#define IQ80310_CPLDREV 0xfe840000UL /* rev F board feature (R0) */
#define CPLDREV_LEN 1
#define CPLDREV_REV(data) ((data) & 0xf) + '@')
#define IQ80310_SEGMENT1 0xfe840000UL /* (WO) */
#define SEGMENT1_LEN 1
#define SEGMENT_A1 0x01 /* top off */
#define SEGMENT_B1 0x02 /* upper right off */
#define SEGMENT_C1 0x04 /* lower right off */
#define SEGMENT_D1 0x08 /* bottom off */
#define SEGMENT_E1 0x10 /* lower left off */
#define SEGMENT_F1 0x20 /* upper left off */
#define SEGMENT_G1 0x40 /* middle off */
#define SEGMENT_DP1 0x80 /* decimal point off */
#define IQ80310_XINT0STS 0xfe850000UL /* rev F board feature (RO) */
#define XINT0_LEN 1
#define XINT0_SINTA 0x01 /* Secondary PCI INTA */
#define XINT0_SINTB 0x02 /* Secondary PCI INTB */
#define XINT0_SINTC 0x04 /* Secondary PCI INTC */
#define IQ80310_SEGMENT2 0xfe850000UL /* (WO) */
#define SEGMENT2_LEN 1
#define IQ80310_XINT3MSK 0xfe860000UL /* rev F board feature (RO) */
#define XINT3MSK_LEN 1
#define IQ80310_BCKPLNDTCT 0xfe870000UL /* (RO) */
#define BCKPLN_PRESENT 0x01