Add support for ADI Engineering's "Big Red Head" i80200 evaluation

and development board, based around their BECC companion chip.  Despite
its name, the board can run in big- or little-endian mode (we currently
run only in the latter).
This commit is contained in:
thorpej 2003-01-25 02:00:15 +00:00
parent b1b164a859
commit fd5a840f3c
14 changed files with 2455 additions and 0 deletions

View File

@ -0,0 +1,151 @@
/* $NetBSD: becc_mainbus.c,v 1.1 2003/01/25 02:00:16 thorpej Exp $ */
/*
* Copyright (c) 2001, 2002 Wasabi Systems, Inc.
* All rights reserved.
*
* Written by Jason R. Thorpe 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.
*/
/*
* ``Big Red Head'' front-end for the ADI Engineering Big Endian Companion
* Chip. We take care of setting up the BECC memory map, which is specific
* to the board the BECC is wired up to.
*/
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/device.h>
#include <machine/autoconf.h>
#include <machine/bus.h>
#include <evbarm/adi_brh/brhreg.h>
#include <evbarm/adi_brh/brhvar.h>
#include <arm/xscale/beccreg.h>
#include <arm/xscale/beccvar.h>
#include <dev/pci/pcireg.h>
#include <dev/pci/pcidevs.h>
int becc_mainbus_match(struct device *, struct cfdata *, void *);
void becc_mainbus_attach(struct device *, struct device *, void *);
CFATTACH_DECL(becc_mainbus, sizeof(struct becc_softc),
becc_mainbus_match, becc_mainbus_attach, NULL, NULL);
/* There can be only one. */
int becc_mainbus_found;
int
becc_mainbus_match(struct device *parent, struct cfdata *cf, void *aux)
{
#if 0
struct mainbus_attach_args *ma = aux;
#endif
if (becc_mainbus_found)
return (0);
#if 1
/* XXX Shoot arch/arm/mainbus in the head. */
return (1);
#else
if (strcmp(cf->cf_name, ma->ma_name) == 0)
return (1);
return (0);
#endif
}
void
becc_mainbus_attach(struct device *parent, struct device *self, void *aux)
{
extern paddr_t physical_start;
struct becc_softc *sc = (void *) self;
becc_mainbus_found = 1;
printf(": ADI Big Endian Companion Chip, rev. %s\n",
becc_revisions[becc_rev]);
/*
* Virtual addresses for the PCI I/O, 2 PCI MEM, and
* PCI CFG windows.
*/
sc->sc_pci_io_base = BRH_PCI_IO_VBASE;
sc->sc_pci_mem_base[0] = BRH_PCI_MEM1_VBASE;
sc->sc_pci_mem_base[1] = BRH_PCI_MEM2_VBASE;
sc->sc_pci_cfg_base = BRH_PCI_CONF_VBASE;
/*
* Ver <= 7: There are 2 32M inbound PCI memory windows. Direct-
* map them to the first 64M of SDRAM. We have limited SDRAM to
* 64M during bootstrap in this case.
*
* Ver >= 8: There is a 128M inbound PCI memory window which can
* cover all of SDRAM, which we obviously prefer to use.
*
* We map PCI:SDRAM 1:1, placing the two smaller windows after
* after the larger one.
*/
sc->sc_iwin[0].iwin_base = physical_start + 128 * 1024 * 1024;
sc->sc_iwin[0].iwin_xlate = physical_start;
sc->sc_iwin[1].iwin_base = sc->sc_iwin[0].iwin_base+BECC_PCI_MEM1_SIZE;
sc->sc_iwin[1].iwin_xlate = physical_start + BECC_PCI_MEM1_SIZE;
sc->sc_iwin[2].iwin_base = physical_start;
sc->sc_iwin[2].iwin_xlate = physical_start;
/*
* Ver <= 8: There are 2 32M outbound PCI memory windows.
* Ver >= 9: There are 3 32M outbound PCI memory windows.
*
* One of these may be byte swapped. We don't use the third
* one available on >= Ver9.
*/
sc->sc_owin_xlate[0] = 32U * 1024 * 1024;
sc->sc_owin_xlate[1] = 32U * 1024 * 1024;
sc->sc_owin_xlate[2] = 32U * 1024 * 1024;
/*
* Map the 1M PCI I/O window to PCI I/O address 0.
*/
sc->sc_ioout_xlate = 0;
/*
* No platform-specific PCI interrupt routing; it's all done
* in the BECC.
*/
becc_attach(sc);
}

View File

@ -0,0 +1,310 @@
/* $NetBSD: brh_7seg.c,v 1.1 2003/01/25 02:00:16 thorpej Exp $ */
/*
* Copyright (c) 2001, 2002 Wasabi Systems, Inc.
* All rights reserved.
*
* Written by Jason R. Thorpe 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.
*/
/*
* Support for the 7-segment display on the ADI Engineering BRH board.
*/
#include <sys/param.h>
#include <sys/systm.h>
#include <machine/bus.h>
#include <evbarm/adi_brh/brhreg.h>
#include <evbarm/adi_brh/brhvar.h>
#define WRITE(x, v) *((__volatile uint8_t *) (x)) = (v)
static int snakestate;
static const uint8_t digitmap[] = {
/* +#####+
* # #
* # #
* # #
* +-----+
* # #
* # #
* # #
* +#####+
*/
SEG_G,
/* +-----+
* | #
* | #
* | #
* +-----+
* | #
* | #
* | #
* +-----+
*/
SEG_A|SEG_D|SEG_E|SEG_F|SEG_G,
/* +#####+
* | #
* | #
* | #
* +#####+
* # |
* # |
* # |
* +#####+
*/
SEG_C|SEG_F,
/* +#####+
* | #
* | #
* | #
* +#####+
* | #
* | #
* | #
* +#####+
*/
SEG_E|SEG_F,
/* +-----+
* # #
* # #
* # #
* +#####+
* | #
* | #
* | #
* +-----+
*/
SEG_A|SEG_D|SEG_E,
/* +#####+
* # |
* # |
* # |
* +#####+
* | #
* | #
* | #
* +#####+
*/
SEG_B|SEG_E,
/* +#####+
* # |
* # |
* # |
* +#####+
* # #
* # #
* # #
* +#####+
*/
SEG_B,
/* +#####+
* | #
* | #
* | #
* +-----+
* | #
* | #
* | #
* +-----+
*/
SEG_D|SEG_E|SEG_F,
/* +#####+
* # #
* # #
* # #
* +#####+
* # #
* # #
* # #
* +#####+
*/
0,
/* +#####+
* # #
* # #
* # #
* +#####+
* | #
* | #
* | #
* +-----+
*/
SEG_D|SEG_E,
};
static uint8_t
brh_7seg_xlate(char c)
{
uint8_t rv;
if (c >= '0' && c <= '9')
rv = digitmap[c - '0'];
else if (c == '.')
rv = (u_int8_t) ~SEG_DP;
else
rv = 0xff;
return (rv);
}
void
brh_7seg(char a)
{
uint8_t ch;
ch = brh_7seg_xlate(a);
snakestate = 0;
WRITE(BRH_LED_VBASE, ch);
}
static const uint8_t snakemap[] = {
/* +#####+
* | |
* | |
* | |
* +-----+
* | |
* | |
* | |
* +-----+
*/
~SEG_A,
/* +-----+
* # |
* # |
* # |
* +-----+
* | |
* | |
* | |
* +-----+
*/
~SEG_F,
/* +-----+
* | |
* | |
* | |
* +#####+
* | |
* | |
* | |
* +-----+
*/
~SEG_G,
/* +-----+
* | |
* | |
* | |
* +-----+
* | #
* | #
* | #
* +-----+
*/
~SEG_C,
/* +-----+
* | |
* | |
* | |
* +-----+
* | |
* | |
* | |
* +#####+
*/
~SEG_D,
/* +-----+
* | |
* | |
* | |
* +-----+
* # |
* # |
* # |
* +-----+
*/
~SEG_E,
/* +-----+
* | |
* | |
* | |
* +#####+
* | |
* | |
* | |
* +-----+
*/
~SEG_G,
/* +-----+
* | #
* | #
* | #
* +-----+
* | |
* | |
* | |
* +-----+
*/
~SEG_B,
};
void
brh_7seg_snake(void)
{
int cur = snakestate;
WRITE(BRH_LED_VBASE, snakemap[cur]);
snakestate = (cur + 1) & 7;
}

View File

@ -0,0 +1,859 @@
/* $NetBSD: brh_machdep.c,v 1.1 2003/01/25 02:00:16 thorpej Exp $ */
/*
* Copyright (c) 2001, 2002 Wasabi Systems, Inc.
* All rights reserved.
*
* Written by Jason R. Thorpe 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) 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 the ADI Engineering
* BRH i80200 evaluation platform.
*/
#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 <arm/undefined.h>
#include <arm/arm32/machdep.h>
#include <arm/xscale/i80200reg.h>
#include <arm/xscale/i80200var.h>
#include <dev/pci/ppbreg.h>
#include <arm/xscale/beccreg.h>
#include <arm/xscale/beccvar.h>
#include <evbarm/adi_brh/brhreg.h>
#include <evbarm/adi_brh/brhvar.h>
#include <evbarm/adi_brh/obiovar.h>
#include "opt_ipkdb.h"
/*
* 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 = 0x00000000;
/* 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
BootConfig bootconfig; /* Boot config storage */
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;
pv_addr_t minidataclean;
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 /* L2 table for mapping zero page */
#define KERNEL_PT_KERNEL 1 /* L2 table for mapping kernel */
#define KERNEL_PT_KERNEL_NUM 2
/* L2 tables for mapping kernel VM */
#define KERNEL_PT_VMDATA (KERNEL_PT_KERNEL + KERNEL_PT_KERNEL_NUM)
#define KERNEL_PT_VMDATA_NUM 4 /* start with 16MB of KVM */
#define NUM_KERNEL_PTS (KERNEL_PT_VMDATA + KERNEL_PT_VMDATA_NUM)
pv_addr_t kernel_pt_table[NUM_KERNEL_PTS];
struct user *proc0paddr;
/* Prototypes */
void consinit(void);
#include "com.h"
#if NCOM > 0
#include <dev/ic/comreg.h>
#include <dev/ic/comvar.h>
#endif
/*
* Define the default console speed for the board. This is generally
* what the firmware provided with the board defaults to.
*/
#ifndef CONSPEED
#define CONSPEED B57600
#endif /* ! CONSPEED */
#ifndef CONUNIT
#define CONUNIT 0
#endif
#ifndef CONMODE
#define CONMODE ((TTYDEF_CFLAG & ~(CSIZE | CSTOPB | PARENB)) | CS8) /* 8N1 */
#endif
int comcnspeed = CONSPEED;
int comcnmode = CONMODE;
int comcnunit = CONUNIT;
/*
* 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");
goto reset;
}
/* Disable console buffering */
/*
* 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) {
brh_7seg('8');
printf("The operating system has halted.\n");
printf("Please press any key to reboot.\n\n");
cngetc();
}
printf("rebooting...\n\r");
reset:
cpu_reset();
}
/*
* 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;
vm_prot_t prot;
int cache;
} l1_sec_table[] = {
{
BRH_PCI_CONF_VBASE,
BECC_PCI_CONF_BASE,
BRH_PCI_CONF_VSIZE,
VM_PROT_READ|VM_PROT_WRITE,
PTE_NOCACHE,
},
{
BRH_PCI_MEM1_VBASE,
BECC_PCI_MEM1_BASE,
BRH_PCI_MEM1_VSIZE,
VM_PROT_READ|VM_PROT_WRITE,
PTE_NOCACHE,
},
{
BRH_PCI_MEM2_VBASE,
BECC_PCI_MEM2_BASE,
BRH_PCI_MEM2_VSIZE,
VM_PROT_READ|VM_PROT_WRITE,
PTE_NOCACHE,
},
{
BRH_UART1_VBASE,
BRH_UART1_BASE,
BRH_UART1_VSIZE,
VM_PROT_READ|VM_PROT_WRITE,
PTE_NOCACHE,
},
{
BRH_UART2_VBASE,
BRH_UART2_BASE,
BRH_UART2_VSIZE,
VM_PROT_READ|VM_PROT_WRITE,
PTE_NOCACHE,
},
{
BRH_LED_VBASE,
BRH_LED_BASE,
BRH_LED_VSIZE,
VM_PROT_READ|VM_PROT_WRITE,
PTE_NOCACHE,
},
{
BRH_PCI_IO_VBASE,
BECC_PCI_IO_BASE,
BRH_PCI_IO_VSIZE,
VM_PROT_READ|VM_PROT_WRITE,
PTE_NOCACHE,
},
{
BRH_BECC_VBASE,
BECC_REG_BASE,
BRH_BECC_VSIZE,
VM_PROT_READ|VM_PROT_WRITE,
PTE_NOCACHE,
},
{
0,
0,
0,
0,
0,
}
};
static void
brh_hardclock_hook(void)
{
static int snakefreq;
if ((snakefreq++ & 15) == 0)
brh_7seg_snake();
}
/*
* u_int initarm(...)
*
* 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(void *arg)
{
extern vaddr_t xscale_cache_clean_addr;
extern vsize_t xscale_minidata_clean_size;
int loop;
int loop1;
u_int l1pagetable;
pv_addr_t kernel_l1pt;
pv_addr_t kernel_ptpt;
paddr_t memstart;
psize_t memsize;
/*
* Clear out the 7-segment display. Whee, the first visual
* indication that we're running kernel code.
*/
brh_7seg(' ');
/*
* Since we have mapped the on-board devices at their permanent
* locations already, it is possible for us to initialize
* the console now.
*/
consinit();
/* Talk to the user */
printf("\nNetBSD/evbarm (ADI BRH) booting ...\n");
/* Calibrate the delay loop. */
becc_calibrate_delay();
becc_hardclock_hook = brh_hardclock_hook;
/*
* Heads up ... Setup the CPU / MMU / TLB functions
*/
if (set_cpufuncs())
panic("cpu not recognized!");
/*
* We are currently running with the MMU enabled and the
* entire address space mapped VA==PA. Memory conveniently
* starts at 0xc0000000, which is where we want it. Certain
* on-board devices have already been mapped where we want
* them to be. There is an L1 page table at 0xc0004000.
*/
becc_icu_init();
/*
* Memory always starts at 0xc0000000 on a BRH, and the
* memory size is always 128M.
*/
memstart = 0xc0000000UL;
memsize = (128UL * 1024 * 1024);
printf("initarm: Configuring system ...\n");
/* 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 = memstart;
bootconfig.dram[0].pages = memsize / NBPG;
/*
* Set up the variables that define the availablilty of
* physical memory. For now, we're going to set
* physical_freestart to 0xc0200000 (where the kernel
* was loaded), and allocate the memory we need downwards.
* If we get too close to the L1 table that we set up, we
* will panic. We will update physical_freestart and
* physical_freeend later to reflect what pmap_bootstrap()
* wants to see.
*
* XXX pmap_bootstrap() needs an enema.
*/
physical_start = bootconfig.dram[0].address;
physical_end = physical_start + (bootconfig.dram[0].pages * NBPG);
physical_freestart = 0xc0009000UL;
physical_freeend = 0xc0200000UL;
/* Tell the user about the memory */
printf("physmemory: %d pages at 0x%08lx -> 0x%08lx\n", physmem,
physical_start, physical_end - 1);
/*
* Okay, the kernel starts 2MB in from the bottom of physical
* memory. We are going to allocate our bootstrap pages downwards
* from there.
*
* We need to allocate some fixed page tables to get the kernel
* going. We allocate one page directory and a number of page
* tables and store the physical addresses in the kernel_pt_table
* array.
*
* The kernel page directory must be on a 16K boundary. The page
* tables must be on 4K bounaries. What we do is allocate the
* page directory on the first 16K boundary that we encounter, and
* the page tables on 4K boundaries otherwise. Since we allocate
* at least 3 L2 page tables, we are guaranteed to encounter at
* least one 16K aligned region.
*/
#ifdef VERBOSE_INIT_ARM
printf("Allocating page tables\n");
#endif
free_pages = (physical_freeend - physical_freestart) / NBPG;
#ifdef VERBOSE_INIT_ARM
printf("freestart = 0x%08lx, free_pages = %d (0x%08x)\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) \
physical_freeend -= ((np) * NBPG); \
if (physical_freeend < physical_freestart) \
panic("initarm: out of memory"); \
(var) = physical_freeend; \
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_freeend - L1_TABLE_SIZE) & (L1_TABLE_SIZE - 1)) == 0
&& kernel_l1pt.pv_pa == 0) {
valloc_pages(kernel_l1pt, L1_TABLE_SIZE / NBPG);
} else {
alloc_pages(kernel_pt_table[loop1].pv_pa,
L2_TABLE_SIZE / NBPG);
kernel_pt_table[loop1].pv_va =
kernel_pt_table[loop1].pv_pa;
++loop1;
}
}
/* This should never be able to happen but better confirm that. */
if (!kernel_l1pt.pv_pa || (kernel_l1pt.pv_pa & (L1_TABLE_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, L2_TABLE_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);
/* Allocate enough pages for cleaning the Mini-Data cache. */
KASSERT(xscale_minidata_clean_size <= NBPG);
valloc_pages(minidataclean, 1);
#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
/*
* XXX Defer this to later so that we can reclaim the memory
* XXX used by the RedBoot page tables.
*/
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 0x%08lx\n", kernel_l1pt.pv_pa);
#endif
/*
* Now we start construction 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 */
pmap_link_l2pt(l1pagetable, 0x00000000,
&kernel_pt_table[KERNEL_PT_SYS]);
for (loop = 0; loop < KERNEL_PT_KERNEL_NUM; loop++)
pmap_link_l2pt(l1pagetable, KERNEL_BASE + loop * 0x00400000,
&kernel_pt_table[KERNEL_PT_KERNEL + loop]);
for (loop = 0; loop < KERNEL_PT_VMDATA_NUM; loop++)
pmap_link_l2pt(l1pagetable, KERNEL_VM_BASE + loop * 0x00400000,
&kernel_pt_table[KERNEL_PT_VMDATA + loop]);
pmap_link_l2pt(l1pagetable, PTE_BASE, &kernel_ptpt);
/* update the top of the kernel VM */
pmap_curmaxkvaddr =
KERNEL_VM_BASE + (KERNEL_PT_VMDATA_NUM * 0x00400000);
#ifdef VERBOSE_INIT_ARM
printf("Mapping kernel\n");
#endif
/* Now we fill in the L2 pagetable for the kernel static code/data */
{
extern char etext[], _end[];
size_t textsize = (uintptr_t) etext - KERNEL_TEXT_BASE;
size_t totalsize = (uintptr_t) _end - KERNEL_TEXT_BASE;
u_int logical;
textsize = (textsize + PGOFSET) & ~PGOFSET;
totalsize = (totalsize + PGOFSET) & ~PGOFSET;
logical = 0x00200000; /* offset of kernel in RAM */
logical += pmap_map_chunk(l1pagetable, KERNEL_BASE + logical,
physical_start + logical, textsize,
VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE);
logical += pmap_map_chunk(l1pagetable, KERNEL_BASE + logical,
physical_start + logical, totalsize - textsize,
VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE);
}
#ifdef VERBOSE_INIT_ARM
printf("Constructing L2 page tables\n");
#endif
/* Map the stack pages */
pmap_map_chunk(l1pagetable, irqstack.pv_va, irqstack.pv_pa,
IRQ_STACK_SIZE * NBPG, VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE);
pmap_map_chunk(l1pagetable, abtstack.pv_va, abtstack.pv_pa,
ABT_STACK_SIZE * NBPG, VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE);
pmap_map_chunk(l1pagetable, undstack.pv_va, undstack.pv_pa,
UND_STACK_SIZE * NBPG, VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE);
pmap_map_chunk(l1pagetable, kernelstack.pv_va, kernelstack.pv_pa,
UPAGES * NBPG, VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE);
pmap_map_chunk(l1pagetable, kernel_l1pt.pv_va, kernel_l1pt.pv_pa,
L1_TABLE_SIZE, VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE);
/* Map the Mini-Data cache clean area. */
xscale_setup_minidata(l1pagetable, minidataclean.pv_va,
minidataclean.pv_pa);
/* Map the page table that maps the kernel pages */
pmap_map_entry(l1pagetable, kernel_ptpt.pv_va, kernel_ptpt.pv_pa,
VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE);
/*
* 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)) */
for (loop = 0; loop < KERNEL_PT_KERNEL_NUM; loop++) {
pmap_map_entry(l1pagetable,
PTE_BASE + ((KERNEL_BASE +
(loop * 0x00400000)) >> (PGSHIFT-2)),
kernel_pt_table[KERNEL_PT_KERNEL + loop].pv_pa,
VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE);
}
pmap_map_entry(l1pagetable,
PTE_BASE + (PTE_BASE >> (PGSHIFT-2)),
kernel_ptpt.pv_pa, VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE);
pmap_map_entry(l1pagetable,
PTE_BASE + (0x00000000 >> (PGSHIFT-2)),
kernel_pt_table[KERNEL_PT_SYS].pv_pa,
VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE);
for (loop = 0; loop < KERNEL_PT_VMDATA_NUM; loop++)
pmap_map_entry(l1pagetable,
PTE_BASE + ((KERNEL_VM_BASE +
(loop * 0x00400000)) >> (PGSHIFT-2)),
kernel_pt_table[KERNEL_PT_VMDATA + loop].pv_pa,
VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE);
/* Map the vector page. */
pmap_map_entry(l1pagetable, vector_page, systempage.pv_pa,
VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE);
/*
* Map devices we can map w/ section mappings.
*/
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_S_SIZE)
pmap_map_section(l1pagetable,
l1_sec_table[loop].va + sz,
l1_sec_table[loop].pa + sz,
l1_sec_table[loop].prot,
l1_sec_table[loop].cache);
++loop;
}
/*
* Give the XScale global cache clean code an appropriately
* sized chunk of unmapped VA space starting at 0xff500000
* (our device mappings end before this address).
*/
xscale_cache_clean_addr = 0xff500000U;
/*
* 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("switching to new L1 page table @%#lx...", kernel_l1pt.pv_pa);
#endif
setttb(kernel_l1pt.pv_pa);
cpu_tlb_flushID();
#ifdef VERBOSE_INIT_ARM
printf("done!\n");
#endif
#ifdef VERBOSE_INIT_ARM
printf("bootstrap done.\n");
#endif
/*
* Inform the BECC code where the BECC is mapped.
*/
becc_vaddr = BRH_BECC_VBASE;
/*
* BECC <= Rev7 can only address 64M through the inbound
* PCI windows. Limit memory to 64M on those revs. (This
* problem was fixed in Rev8 of the BECC; get an FPGA upgrade.)
*/
{
vaddr_t va = BRH_PCI_CONF_VBASE | (1U << BECC_IDSEL_BIT) |
PCI_CLASS_REG;
uint32_t reg;
reg = *(__volatile uint32_t *) va;
becc_rev = PCI_REVISION(reg);
if (becc_rev <= BECC_REV_V7 &&
memsize > (64UL * 1024 * 1024)) {
memsize = (64UL * 1024 * 1024);
bootconfig.dram[0].pages = memsize / NBPG;
physical_end = physical_start +
(bootconfig.dram[0].pages * NBPG);
printf("BECC <= Rev7: memory truncated to 64M\n");
}
}
/*
* Update the physical_freestart/physical_freeend/free_pages
* variables.
*/
{
extern char _end[];
physical_freestart = physical_start +
(((((uintptr_t) _end) + PGOFSET) & ~PGOFSET) -
KERNEL_BASE);
physical_freeend = physical_end;
free_pages = (physical_freeend - physical_freestart) / NBPG;
}
#ifdef VERBOSE_INIT_ARM
printf("freestart = 0x%08lx, free_pages = %d (0x%x)\n",
physical_freestart, free_pages, free_pages);
#endif
physmem = (physical_end - physical_start) / NBPG;
arm32_vector_init(ARM_VECTORS_LOW, ARM_VEC_ALL);
/*
* 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;
/* Initialise the undefined instruction handlers */
printf("undefined ");
undefined_init();
/* Load memory into UVM. */
printf("page ");
uvm_setpagesize(); /* initialize PAGE_SIZE-dependent variables */
uvm_page_physload(atop(physical_freestart), atop(physical_freeend),
atop(physical_freestart), atop(physical_freeend),
VM_FREELIST_DEFAULT);
/* 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 ");
becc_intr_init();
printf("done.\n");
#ifdef IPKDB
/* Initialise ipkdb */
ipkdb_init();
if (boothowto & RB_KDB)
ipkdb_connect(0);
#endif
#ifdef DDB
db_machine_init();
/* Firmware doesn't load symbols. */
ddb_init(0, NULL, NULL);
if (boothowto & RB_KDB)
Debugger();
#endif
/* We return the new stack pointer address */
return(kernelstack.pv_va + USPACE_SVC_STACK_TOP);
}
void
consinit(void)
{
static const bus_addr_t comcnaddrs[] = {
BRH_UART1_BASE, /* com0 */
BRH_UART2_BASE, /* com1 */
};
static int consinit_called;
if (consinit_called != 0)
return;
consinit_called = 1;
#if NCOM > 0
if (comcnattach(&obio_bs_tag, comcnaddrs[comcnunit], comcnspeed,
BECC_PERIPH_CLOCK, comcnmode))
panic("can't init serial console @%lx", comcnaddrs[comcnunit]);
#else
panic("serial console @%lx not configured", comcnaddrs[comcnunit]);
#endif
}

View File

@ -0,0 +1,208 @@
/* $NetBSD: brh_start.S,v 1.1 2003/01/25 02:00:17 thorpej Exp $ */
/*
* Copyright (c) 2002 Wasabi Systems, Inc.
* All rights reserved.
*
* Written by Jason R. Thorpe for Wasabi Systems, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed for the NetBSD Project by
* Wasabi Systems, Inc.
* 4. The name of Wasabi Systems, Inc. may not be used to endorse
* or promote products derived from this software without specific prior
* written permission.
*
* THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <machine/asm.h>
#include <arm/armreg.h>
#include <arm/arm32/pte.h>
#include <arm/xscale/beccreg.h>
#include <evbarm/adi_brh/brhreg.h>
.section .start,"ax",%progbits
.global _C_LABEL(brh_start)
_C_LABEL(brh_start):
/*
* Get a pointer to the LED (physical address).
*/
mov ip, #(BRH_LED_BASE)
/*
* We will go ahead and disable the MMU here so that we don't
* have to worry about flushing caches, etc.
*
* Note that we may not currently be running VA==PA, which means
* we'll need to leap to the next insn after disabing the MMU.
*/
add r8, pc, #(.Lunmapped - . - 8)
bic r8, r8, #0xff000000 /* clear upper 8 bits */
orr r8, r8, #0xc0000000 /* OR in physical base address */
mrc p15, 0, r2, c1, c0, 0
bic r2, r2, #CPU_CONTROL_MMU_ENABLE
mcr p15, 0, r2, c1, c0, 0
nop
nop
nop
mov pc, r8 /* Heave-ho! */
.Lunmapped:
/*
* We want to construct a memory map that maps us
* VA==PA (SDRAM at 0xc0000000) (which also happens
* to be where the kernel address space starts).
* We create these mappings uncached and unbuffered
* to be safe.
*
* We also map various devices at their expected locations,
* because we will need to talk to them during bootstrap.
*
* We just use section mappings for all of this to make it easy.
*
* We will put the L1 table to do all this at 0xc0004000.
*/
/*
* Step 1: Map the entire address space VA==PA.
*/
add r0, pc, #(.Ltable - . - 8)
ldr r0, [r0] /* r0 = &l1table */
mov r3, #(L1_S_AP(AP_KRW))
orr r3, r3, #(L1_TYPE_S)
mov r2, #0x100000 /* advance by 1MB */
mov r1, #0x1000 /* 4096MB */
1:
str r3, [r0], #0x04
add r3, r3, r2
subs r1, r1, #1
bgt 1b
#if 0
/*
* Step 2: Map the PCI configuration space (this is needed
* to access some of the core logic registers).
*/
add r0, pc, #(.Ltable - . - 8) /* r0 = &l1table */
ldr r0, [r0]
mov r3, #(L1_S_AP(AP_KRW))
orr r3, r3, #(L1_TYPE_S)
orr r3, r3, #(BECC_PCI_CONF_BASE)
add r0, r0, #((BRH_PCI_CONF_VBASE >> L1_S_SHIFT) * 4)
mov r1, #(BRH_PCI_CONF_VSIZE >> L1_S_SHIFT)
1:
str r3, [r0], #0x04
add r3, r3, r2
subs r1, r1, #1
bgt 1b
#endif
/*
* Step 3: Map the BECC, UARTs, and LED display.
*/
add r0, pc, #(.Ltable - . - 8) /* r0 = &l1table */
ldr r0, [r0]
mov r3, #(L1_S_AP(AP_KRW))
orr r3, r3, #(L1_TYPE_S)
orr r3, r3, #(BECC_REG_BASE)
add r2, pc, #(.Lbrh_becc_vbase - . - 8)
ldr r2, [r2]
str r3, [r0, r2]
bic r3, r3, #(BECC_REG_BASE)
orr r3, r3, #(BRH_UART1_BASE)
add r2, pc, #(.Lbrh_uart1_vbase - . - 8)
ldr r2, [r2]
str r3, [r0, r2]
bic r3, r3, #(BRH_UART1_BASE)
orr r3, r3, #(BRH_UART2_BASE)
add r2, pc, #(.Lbrh_uart2_vbase - . - 8)
ldr r2, [r2]
str r3, [r0, r2]
bic r3, r3, #(BRH_UART2_BASE)
orr r3, r3, #(BRH_LED_BASE)
add r2, pc, #(.Lbrh_led_vbase - . - 8)
ldr r2, [r2]
str r3, [r0, r2]
bic r3, r3, #(BRH_LED_BASE)
/* OK! Page table is set up. Give it to the CPU. */
add r0, pc, #(.Ltable - . - 8)
ldr r0, [r0]
mcr p15, 0, r0, c2, c0, 0
/* Flush the old TLBs, just in case. */
mcr p15, 0, r0, c8, c7, 0
/* Set the Domain Access register. Very important! */
mov r0, #1
mcr p15, 0, r0, c3, c0, 0
/* Get ready to jump to the "real" kernel entry point... */
add r0, pc, #(.Lstart - . - 8)
ldr r0, [r0]
/* OK, let's enable the MMU. */
mrc p15, 0, r2, c1, c0, 0
orr r2, r2, #CPU_CONTROL_MMU_ENABLE
mcr p15, 0, r2, c1, c0, 0
nop
nop
nop
/* CPWAIT sequence to make sure the MMU is on... */
mrc p15, 0, r2, c2, c0, 0 /* arbitrary read of CP15 */
mov r2, r2 /* force it to complete */
mov pc, r0 /* leap to kernel entry point! */
.Lbrh_becc_vbase:
.word ((BRH_BECC_VBASE >> L1_S_SHIFT) * 4)
.Lbrh_uart1_vbase:
.word ((BRH_UART1_VBASE >> L1_S_SHIFT) * 4)
.Lbrh_uart2_vbase:
.word ((BRH_UART2_VBASE >> L1_S_SHIFT) * 4)
.Lbrh_led_vbase:
.word ((BRH_LED_VBASE >> L1_S_SHIFT) * 4)
.Ltable:
.word 0xc0004000
.Lstart:
.word start

View File

@ -0,0 +1,110 @@
/* $NetBSD: brhreg.h,v 1.1 2003/01/25 02:00:17 thorpej Exp $ */
/*
* Copyright (c) 2002 Wasabi Systems, Inc.
* All rights reserved.
*
* Written by Jason R. Thorpe for Wasabi Systems, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed for the NetBSD Project by
* Wasabi Systems, Inc.
* 4. The name of Wasabi Systems, Inc. may not be used to endorse
* or promote products derived from this software without specific prior
* written permission.
*
* THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _BRHREG_H_
#define _BRHREG_H_
/*
* Memory map and register definitions for the ADI Engineering
* Big Red Head Evaluation Board.
*/
/*
* This is arranged so that we can just use section mappings for
* everything. Note the physical size of the range may be larger
* or smaller than the virtual size.
*
* We need to leave room near the top of the addres space for the
* vectors.
*/
#define BRH_PCI_CONF_VBASE 0xf9000000
#define BRH_PCI_CONF_VSIZE 0x02000000 /* 32M */
#define BRH_PCI_MEM1_VBASE 0xfb000000
#define BRH_PCI_MEM1_VSIZE 0x02000000 /* 32M */
#define BRH_PCI_MEM2_VBASE 0xfd000000
#define BRH_PCI_MEM2_VSIZE 0x02000000 /* 32M */
#define BRH_UART1_BASE 0x03000000
#define BRH_UART1_VBASE 0xff000000
#define BRH_UART1_VSIZE 0x00100000 /* 1M */
#define BRH_UART2_BASE 0x03100000
#define BRH_UART2_VBASE 0xff100000
#define BRH_UART2_VSIZE 0x00100000 /* 1M */
#define BRH_LED_BASE 0x03200000
#define BRH_LED_VBASE 0xff200000
#define BRH_LED_VSIZE 0x00100000 /* 1M */
#define BRH_PCI_IO_VBASE 0xff300000
#define BRH_PCI_IO_VSIZE 0x00100000 /* 1M */
#define BRH_BECC_VBASE 0xff400000
#define BRH_BECC_VSIZE 0x00100000 /* 1M */
/* 0xffff0000 high vectors */
/*
* The 7-segment display looks like so:
*
* A
* +-----+
* | |
* F | | B
* | G |
* +-----+
* | |
* E | | C
* | D |
* +-----+ o DP
*
* Setting a bit clears the corresponding segment on the
* display.
*/
#define SEG_A (1 << 0)
#define SEG_B (1 << 1)
#define SEG_C (1 << 2)
#define SEG_D (1 << 3)
#define SEG_E (1 << 4)
#define SEG_F (1 << 5)
#define SEG_G (1 << 6)
#define SEG_DP (1 << 7)
#endif /* _BRHREG_H_ */

View File

@ -0,0 +1,44 @@
/* $NetBSD: brhvar.h,v 1.1 2003/01/25 02:00:17 thorpej Exp $ */
/*
* Copyright (c) 2002 Wasabi Systems, Inc.
* All rights reserved.
*
* Written by Jason R. Thorpe for Wasabi Systems, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed for the NetBSD Project by
* Wasabi Systems, Inc.
* 4. The name of Wasabi Systems, Inc. may not be used to endorse
* or promote products derived from this software without specific prior
* written permission.
*
* THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _BRHVAR_H_
#define _BRHVAR_H_
void brh_7seg(char);
void brh_7seg_snake(void);
#endif /* _BRH_BRHVAR_H_ */

View File

@ -0,0 +1,101 @@
/* $NetBSD: com_obio.c,v 1.1 2003/01/25 02:00:17 thorpej 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 <sys/param.h>
#include <sys/systm.h>
#include <sys/device.h>
#include <sys/termios.h>
#include <machine/bus.h>
#include <arm/xscale/beccreg.h>
#include <arm/xscale/beccvar.h>
#include <evbarm/adi_brh/brhreg.h>
#include <evbarm/adi_brh/obiovar.h>
#include <dev/ic/comreg.h>
#include <dev/ic/comvar.h>
struct com_obio_softc {
struct com_softc sc_com;
void *sc_ih;
};
int com_obio_match(struct device *, struct cfdata *, void *);
void com_obio_attach(struct device *, struct device *, void *);
CFATTACH_DECL(com_obio, sizeof(struct com_obio_softc),
com_obio_match, com_obio_attach, NULL, NULL);
int
com_obio_match(struct device *parent, struct cfdata *cf, void *aux)
{
/* We take it on faith that the device is there. */
return (1);
}
void
com_obio_attach(struct device *parent, struct device *self, void *aux)
{
struct obio_attach_args *oba = aux;
struct com_obio_softc *osc = (void *) self;
struct com_softc *sc = &osc->sc_com;
int error;
sc->sc_iot = oba->oba_st;
sc->sc_iobase = oba->oba_addr;
sc->sc_frequency = BECC_PERIPH_CLOCK;
sc->sc_hwflags = COM_HW_NO_TXPRELOAD;
error = bus_space_map(sc->sc_iot, oba->oba_addr, 8, 0, &sc->sc_ioh);
if (error) {
printf(": failed to map registers: %d\n", error);
return;
}
com_attach_subr(sc);
osc->sc_ih = becc_intr_establish(oba->oba_irq, IPL_SERIAL,
comintr, sc);
if (osc->sc_ih == NULL)
printf("%s: unable to establish interrupt at irq %d\n",
sc->sc_dev.dv_xname, oba->oba_irq);
}

View File

@ -0,0 +1,132 @@
/* $NetBSD: obio.c,v 1.1 2003/01/25 02:00:17 thorpej Exp $ */
/*
* Copyright (c) 2001, 2002 Wasabi Systems, Inc.
* All rights reserved.
*
* Written by Jason R. Thorpe 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.
*/
/*
* On-board device autoconfiguration support for ADI BRH
* evaluation boards.
*/
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/device.h>
#include <machine/autoconf.h>
#include <machine/bus.h>
#include <arm/xscale/beccreg.h>
#include <arm/xscale/beccvar.h>
#include <evbarm/adi_brh/brhreg.h>
#include <evbarm/adi_brh/obiovar.h>
#include "locators.h"
int obio_match(struct device *, struct cfdata *, void *);
void obio_attach(struct device *, struct device *, void *);
CFATTACH_DECL(obio, sizeof(struct device),
obio_match, obio_attach, NULL, NULL);
int obio_print(void *, const char *);
int obio_search(struct device *, struct cfdata *, void *);
/* there can be only one */
int obio_found;
int
obio_match(struct device *parent, struct cfdata *cf, void *aux)
{
#if 0
struct mainbus_attach_args *ma = aux;
#endif
if (obio_found)
return (0);
#if 1
/* XXX Shoot arch/arm/mainbus in the head. */
return (1);
#else
if (strcmp(cf->cf_name, ma->ma_name) == 0)
return (1);
return (0);
#endif
}
void
obio_attach(struct device *parent, struct device *self, void *aux)
{
obio_found = 1;
printf("\n");
/*
* Attach all on-board devices as described in the kernel
* configuration file.
*/
config_search(obio_search, self, NULL);
}
int
obio_print(void *aux, const char *pnp)
{
struct obio_attach_args *oba = aux;
aprint_normal(" addr 0x%08lx", oba->oba_addr);
if (oba->oba_irq != -1)
aprint_normal(" irq %d", oba->oba_irq);
return (UNCONF);
}
int
obio_search(struct device *parent, struct cfdata *cf, void *aux)
{
struct obio_attach_args oba;
oba.oba_st = &obio_bs_tag;
oba.oba_addr = cf->cf_loc[OBIOCF_ADDR];
oba.oba_irq = cf->cf_loc[OBIOCF_IRQ];
if (config_match(parent, cf, &oba) > 0)
config_attach(parent, cf, &oba, obio_print);
return (0);
}

View File

@ -0,0 +1,238 @@
/* $NetBSD: obio_space.c,v 1.1 2003/01/25 02:00:17 thorpej Exp $ */
/*
* Copyright (c) 2001, 2002 Wasabi Systems, Inc.
* All rights reserved.
*
* Written by Jason R. Thorpe 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.
*/
/*
* bus_space functions for ADI BRH on-board devices
*/
#include <sys/param.h>
#include <sys/systm.h>
#include <uvm/uvm_extern.h>
#include <machine/bus.h>
#include <evbarm/adi_brh/brhreg.h>
/* Prototypes for all the bus_space structure functions */
bs_protos(obio);
bs_protos(generic);
bs_protos(generic_armv4);
bs_protos(bs_notimpl);
/*
* The obio bus space tag. This is constant for all instances, so
* we never have to explicitly "create" it.
*/
struct bus_space obio_bs_tag = {
/* cookie */
(void *) 0,
/* mapping/unmapping */
obio_bs_map,
obio_bs_unmap,
obio_bs_subregion,
/* allocation/deallocation */
obio_bs_alloc,
obio_bs_free,
/* get kernel virtual address */
obio_bs_vaddr,
/* mmap */
bs_notimpl_bs_mmap,
/* barrier */
obio_bs_barrier,
/* read (single) */
generic_bs_r_1,
generic_armv4_bs_r_2,
generic_bs_r_4,
bs_notimpl_bs_r_8,
/* read multiple */
generic_bs_rm_1,
bs_notimpl_bs_rm_2,
bs_notimpl_bs_rm_4,
bs_notimpl_bs_rm_8,
/* read region */
generic_bs_rr_1,
bs_notimpl_bs_rr_2,
bs_notimpl_bs_rr_4,
bs_notimpl_bs_rr_8,
/* write (single) */
generic_bs_w_1,
generic_armv4_bs_w_2,
generic_bs_w_4,
bs_notimpl_bs_w_8,
/* write multiple */
generic_bs_wm_1,
bs_notimpl_bs_wm_2,
bs_notimpl_bs_wm_4,
bs_notimpl_bs_wm_8,
/* write region */
bs_notimpl_bs_wr_1,
bs_notimpl_bs_wr_2,
bs_notimpl_bs_wr_4,
bs_notimpl_bs_wr_8,
/* set multiple */
bs_notimpl_bs_sm_1,
bs_notimpl_bs_sm_2,
bs_notimpl_bs_sm_4,
bs_notimpl_bs_sm_8,
/* set region */
bs_notimpl_bs_sr_1,
bs_notimpl_bs_sr_2,
bs_notimpl_bs_sr_4,
bs_notimpl_bs_sr_8,
/* copy */
bs_notimpl_bs_c_1,
bs_notimpl_bs_c_2,
bs_notimpl_bs_c_4,
bs_notimpl_bs_c_8,
};
int
obio_bs_map(void *t, bus_addr_t bpa, bus_size_t size, int flags,
bus_space_handle_t *bshp)
{
uint32_t startpa, endpa, pa;
vaddr_t va;
pt_entry_t *pte;
/*
* Some devices have already been mapped during bootstrap.
*/
switch (bpa) {
case BRH_UART1_BASE:
*bshp = BRH_UART1_VBASE;
break;
case BRH_UART2_BASE:
*bshp = BRH_UART2_VBASE;
break;
default:
/* XXX -- add code to check for valid request */
startpa = trunc_page(bpa);
endpa = round_page(bpa + size);
/* XXX use some extent to check for duplicate mappings? */
va = uvm_km_valloc(kernel_map, endpa - startpa);
if (! va)
return ENOMEM;
*bshp = (bus_space_handle_t) (va + (bpa - startpa));
for (pa=startpa; pa < endpa; pa += PAGE_SIZE, va += PAGE_SIZE) {
pmap_kenter_pa(va, pa, VM_PROT_READ | VM_PROT_WRITE);
pte = vtopte(va);
*pte &= ~L2_S_CACHE_MASK;
PTE_SYNC(pte);
}
pmap_update(pmap_kernel());
break;
}
return (0);
}
int
obio_bs_alloc(void *t, bus_addr_t rstart, bus_addr_t rend, bus_size_t size,
bus_size_t alignment, bus_size_t boundary, int flags, bus_addr_t *bpap,
bus_space_handle_t *bshp)
{
panic("obio_bs_alloc(): not implemented\n");
}
void
obio_bs_unmap(void *t, bus_space_handle_t bsh, bus_size_t size)
{
switch (bsh) {
case BRH_UART1_VBASE:
case BRH_UART2_VBASE:
/* Nothing to do. */
default:
/* Handle other cases, like flash? */
panic("obio_bs_unmap: impossible");
}
}
void
obio_bs_free(void *t, bus_space_handle_t bsh, bus_size_t size)
{
panic("obio_bs_free(): not implemented\n");
}
int
obio_bs_subregion(void *t, bus_space_handle_t bsh, bus_size_t offset,
bus_size_t size, bus_space_handle_t *nbshp)
{
*nbshp = bsh + offset;
return (0);
}
void *
obio_bs_vaddr(void *t, bus_space_handle_t bsh)
{
return ((void *)bsh);
}
void
obio_bs_barrier(void *t, bus_space_handle_t bsh, bus_size_t offset,
bus_size_t len, int flags)
{
/* Nothing to do. */
}

View File

@ -0,0 +1,49 @@
/* $NetBSD: obiovar.h,v 1.1 2003/01/25 02:00:17 thorpej Exp $ */
/*
* Copyright (c) 2002 Wasabi Systems, Inc.
* All rights reserved.
*
* Written by Jason R. Thorpe for Wasabi Systems, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed for the NetBSD Project by
* Wasabi Systems, Inc.
* 4. The name of Wasabi Systems, Inc. may not be used to endorse
* or promote products derived from this software without specific prior
* written permission.
*
* THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _BRH_OBIOVAR_H_
#define _BRH_OBIOVAR_H_
struct obio_attach_args {
bus_space_tag_t oba_st; /* bus space tag */
bus_addr_t oba_addr; /* address of device */
int oba_irq; /* BECC interrupt bit # */
};
extern struct bus_space obio_bs_tag;
#endif /* _BRH_OBIOVAR_H_ */

View File

@ -0,0 +1,184 @@
# $NetBSD: ADI_BRH,v 1.1 2003/01/25 02:00:15 thorpej Exp $
#
# ADI_BRH -- ADI Engineering "Big Red Head" i80200 Evaluation Board
#
include "arch/evbarm/conf/std.adi_brh"
#options INCLUDE_CONFIG_FILE # embed config file in kernel binary
# 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_80200 # Support the XScale core
makeoptions COPTS="-O2 -mcpu=xscale"
#options XSCALE_CCLKCFG=9 # 733MHz
# Architecture options
# 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_ROOT_SIZE=3400 # Size in blocks
#options MEMORY_DISK_IS_ROOT # use memory disk as root
# Console options. The default console is on connector J9 ("com0") at
# 115200 baud.
#options CONSPEED=9600 # Console speed
#options CONUNIT=1 # Console unit (0=J9, 1=J10)
# 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
#options USERCONF # userconf(4) support
#options PIPE_SOCKETPAIR # smaller, but slower pipe(2)
# Development and Debugging options
options DIAGNOSTIC # internally consistency checks
#options DEBUG
#options PMAP_DEBUG # Enable pmap_debug_level code
#options IPKDB # remote kernel debugging
#options VERBOSE_INIT_ARM # verbose bootstraping messages
options DDB # in-kernel debugger
options DDB_HISTORY_SIZE=100 # Enable history editing in DDB
makeoptions DEBUG="-g" # compile full symbol table
options SYMTAB_SPACE=200000
config netbsd root on ? type ?
config netbsd-fxp0 root on fxp0 type nfs
# The main bus device
mainbus0 at root
# The boot cpu
cpu0 at mainbus?
# On-board device support
obio* at mainbus?
# On-board 16550 UARTs
com0 at obio? addr 0x03000000 irq 24
com1 at obio? addr 0x03100000 irq 25
# i80312 Companion I/O support
becc* at mainbus?
pci0 at becc? bus ?
# PCI-PCI bridges
ppb* at pci? dev ? function ?
pci* at ppb? bus ?
#
# Networking devices
#
# PCI network devices
fxp* at pci? dev ? function ? # Intel i8255x 10/100 Eth.
# MII/PHY support
inphy* at mii? phy ? # Intel i82555 10/100 PHYs
ukphy* at mii? phy ? # Generic IEEE 802.3u PHYs
# 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
pseudo-device clockctl # user control of clock subsystem

View File

@ -0,0 +1,29 @@
# $NetBSD: files.adi_brh,v 1.1 2003/01/25 02:00:15 thorpej Exp $
#
# ADI BRH evaluation board configuration info
#
# Use the generic ARM soft interrupt code.
file arch/arm/arm/softintr.c
file arch/evbarm/adi_brh/brh_7seg.c
file arch/evbarm/adi_brh/brh_machdep.c
# BRH on-board devices
device obio {addr, [irq = -1]}: bus_space_generic
attach obio at mainbus
file arch/evbarm/adi_brh/obio.c obio
file arch/evbarm/adi_brh/obio_space.c obio
# on-board 16550 UARTs
attach com at obio with com_obio
file arch/evbarm/adi_brh/com_obio.c com_obio
# i80200 CPU support
include "arch/arm/xscale/files.i80200"
# BECC Companion support
include "arch/arm/xscale/files.becc"
attach becc at mainbus with becc_mainbus
file arch/evbarm/adi_brh/becc_mainbus.c becc_mainbus

View File

@ -0,0 +1,16 @@
# $NetBSD: mk.adi_brh,v 1.1 2003/01/25 02:00:15 thorpej Exp $
SYSTEM_FIRST_OBJ= brh_start.o
SYSTEM_FIRST_SFILE= ${THISARM}/adi_brh/brh_start.S
KERNEL_BASE_PHYS=0xc0200000
KERNEL_BASE_VIRT=0xc0200000
SYSTEM_LD_TAIL_EXTRA+=; \
echo ${OBJCOPY} -S -O srec $@ $@.srec; \
${OBJCOPY} -S -O srec $@ $@.srec; \
echo ${OBJCOPY} -S -O binary $@ $@.bin; \
${OBJCOPY} -S -O binary $@ $@.bin
EXTRA_KERNELS+= ${KERNELS:@.KERNEL.@${.KERNEL.}.srec@}
EXTRA_KERNELS+= ${KERNELS:@.KERNEL.@${.KERNEL.}.bin@}

View File

@ -0,0 +1,24 @@
# $NetBSD: std.adi_brh,v 1.1 2003/01/25 02:00:15 thorpej Exp $
#
# standard NetBSD/evbarm for ADI BRH options
machine evbarm arm
# Pull in ADI BRH config definitions.
include "arch/evbarm/conf/files.adi_brh"
options EXEC_ELF32
options EXEC_AOUT
options EXEC_SCRIPT
# To support easy transit to ../arch/arm/arm32
options ARM32
makeoptions LOADADDRESS="0xc0200000"
makeoptions BOARDTYPE="adi_brh"
makeoptions BOARDMKFRAG="${THISARM}/conf/mk.adi_brh"
options ARM_INTR_IMPL="<arch/arm/xscale/becc_intr.h>"
# We need to configure the PCI bus.
options PCI_NETBSD_CONFIGURE