Zaurus Port from OpenBSD by Nonaka Kimihiro
OK gimpy
This commit is contained in:
parent
c657d4868d
commit
9dd043ccd4
3
sys/arch/zaurus/compile/Makefile
Normal file
3
sys/arch/zaurus/compile/Makefile
Normal file
@ -0,0 +1,3 @@
|
||||
# $NetBSD: Makefile,v 1.1 2006/12/16 05:59:10 ober Exp $
|
||||
|
||||
.include <bsd.prog.mk>
|
72
sys/arch/zaurus/zaurus/autoconf.c
Normal file
72
sys/arch/zaurus/zaurus/autoconf.c
Normal file
@ -0,0 +1,72 @@
|
||||
/* $NetBSD: autoconf.c,v 1.1 2006/12/16 05:57:48 ober Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2002 The NetBSD Foundation, Inc.
|
||||
* 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 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/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.1 2006/12/16 05:57:48 ober Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/conf.h>
|
||||
|
||||
void
|
||||
cpu_configure(void)
|
||||
{
|
||||
|
||||
/* Start configuration */
|
||||
splhigh();
|
||||
softintr_init();
|
||||
|
||||
if (config_rootfound("mainbus", NULL) == NULL)
|
||||
panic("no mainbus found");
|
||||
|
||||
/* Configuration is finished, turn on interrupts. */
|
||||
spl0();
|
||||
}
|
||||
|
||||
void
|
||||
cpu_rootconf(void)
|
||||
{
|
||||
|
||||
/* No boot information */
|
||||
setroot(0, 0);
|
||||
}
|
||||
|
||||
void
|
||||
device_register(struct device *dev, void *aux)
|
||||
{
|
||||
|
||||
/* Nothing to do */
|
||||
}
|
1112
sys/arch/zaurus/zaurus/machdep.c
Normal file
1112
sys/arch/zaurus/zaurus/machdep.c
Normal file
File diff suppressed because it is too large
Load Diff
83
sys/arch/zaurus/zaurus/zaurus_reg.h
Normal file
83
sys/arch/zaurus/zaurus/zaurus_reg.h
Normal file
@ -0,0 +1,83 @@
|
||||
/* $NetBSD: zaurus_reg.h,v 1.1 2006/12/16 05:57:48 ober Exp $ */
|
||||
/* $OpenBSD: zaurus_reg.h,v 1.7 2005/12/14 14:39:38 uwe Exp $ */
|
||||
/* NetBSD: lubbock_reg.h,v 1.1 2003/06/18 10:51:15 bsh Exp */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2002, 2003 Genetec Corporation. All rights reserved.
|
||||
* Written by Hiroyuki Bessho for Genetec Corporation.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of Genetec Corporation may not be used to endorse or
|
||||
* promote products derived from this software without specific prior
|
||||
* written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY GENETEC CORPORATION ``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 GENETEC CORPORATION
|
||||
* 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 _ZAURUS_REG_H
|
||||
#define _ZAURUS_REG_H
|
||||
|
||||
#include <arm/xscale/pxa2x0cpu.h>
|
||||
|
||||
/*
|
||||
* Logical mapping for onboard/integrated peripherals
|
||||
*/
|
||||
#define ZAURUS_IO_AREA_VBASE 0xfd000000
|
||||
#define ZAURUS_GPIO_VBASE 0xfd000000
|
||||
#define ZAURUS_CLKMAN_VBASE 0xfd100000
|
||||
#define ZAURUS_INTCTL_VBASE 0xfd200000
|
||||
#define ZAURUS_SCOOP0_VBASE 0xfd300000
|
||||
#define ZAURUS_SCOOP1_VBASE 0xfd400000
|
||||
#define ZAURUS_FFUART_VBASE 0xfd500000
|
||||
#define ZAURUS_BTUART_VBASE 0xfd600000
|
||||
#define ZAURUS_STUART_VBASE 0xfd700000
|
||||
#define ZAURUS_VBASE_FREE 0xfd800000
|
||||
/* FFUART, BTUART and/or STUART are mapped to this area when
|
||||
used for console or kgdb port */
|
||||
|
||||
#define ioreg_read(a) (*(volatile unsigned *)(a))
|
||||
#define ioreg_write(a,v) (*(volatile unsigned *)(a)=(v))
|
||||
|
||||
#define ioreg16_read(a) (*(volatile uint16_t *)(a))
|
||||
#define ioreg16_write(a,v) (*(volatile uint16_t *)(a)=(v))
|
||||
|
||||
#define ioreg8_read(a) (*(volatile uint8_t *)(a))
|
||||
#define ioreg8_write(a,v) (*(volatile uint8_t *)(a)=(v))
|
||||
|
||||
/*
|
||||
* Magic numbers for the C860 (PXA255) and C3000 (PXA27x).
|
||||
*/
|
||||
|
||||
/* physical adresses of companion chips */
|
||||
#define C3000_SCOOP0_BASE 0x10800000 /* XXX same as C860 */
|
||||
#define C3000_SCOOP1_BASE 0x08800040
|
||||
|
||||
/* processor IRQ numbers */
|
||||
#define C860_CF0_IRQ 17
|
||||
#define C3000_CF0_IRQ 105
|
||||
#define C3000_CF1_IRQ 106
|
||||
|
||||
/* processor GPIO pins */
|
||||
#define C860_CF0_IRQ_PIN 14
|
||||
#define C3000_RC_IRQ_PIN 13 /* remote control */
|
||||
#define C3000_CF0_IRQ_PIN 94
|
||||
#define C3000_CF1_IRQ_PIN 93
|
||||
|
||||
#endif /* _ZAURUS_REG_H */
|
117
sys/arch/zaurus/zaurus/zaurus_start.S
Normal file
117
sys/arch/zaurus/zaurus/zaurus_start.S
Normal file
@ -0,0 +1,117 @@
|
||||
/* $NetBSD: zaurus_start.S,v 1.1 2006/12/16 05:57:48 ober Exp $ */
|
||||
/* $OpenBSD: zaurus_start.S,v 1.2 2005/01/02 19:43:07 drahn Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2002, 2003 Genetec Corporation. All rights reserved.
|
||||
* Written by Hiroyuki Bessho for Genetec Corporation.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of Genetec Corporation may not be used to endorse or
|
||||
* promote products derived from this software without specific prior
|
||||
* written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY GENETEC CORPORATION ``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 GENETEC CORPORATION
|
||||
* 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/arm32/pmap.h> /* for PMAP_DOMAIN_KERNEL */
|
||||
|
||||
/*
|
||||
* CPWAIT -- Canonical method to wait for CP15 update.
|
||||
* NOTE: Clobbers the specified temp reg.
|
||||
* copied from arm/arm/cpufunc_asm_xscale.S
|
||||
* XXX: better be in a common header file.
|
||||
*/
|
||||
#define CPWAIT_BRANCH \
|
||||
sub pc, pc, #4
|
||||
|
||||
#define CPWAIT(tmp) \
|
||||
mrc p15, 0, tmp, c2, c0, 0 /* arbitrary read of CP15 */ ;\
|
||||
mov tmp, tmp /* wait for it to complete */ ;\
|
||||
CPWAIT_BRANCH /* branch to next insn */
|
||||
|
||||
/*
|
||||
* Kernel start routine for Zaurus
|
||||
*/
|
||||
.text
|
||||
|
||||
.global _C_LABEL(zaurus_start)
|
||||
_C_LABEL(zaurus_start):
|
||||
/*
|
||||
* Kernel is loaded in SDRAM (0xa0200000..), and is expected to run
|
||||
* in VA 0xc0200000..
|
||||
*/
|
||||
|
||||
/* build page table from scratch */
|
||||
ldr r0, Lstartup_pagetable
|
||||
adr r4, mmu_init_table
|
||||
b 3f
|
||||
|
||||
2:
|
||||
str r3, [r0, r2]
|
||||
add r2, r2, #4
|
||||
add r3, r3, #(L1_S_SIZE)
|
||||
adds r1, r1, #-1
|
||||
bhi 2b
|
||||
3:
|
||||
ldmia r4!, {r1,r2,r3} /* # of sections, PA|attr, VA */
|
||||
cmp r1, #0
|
||||
bne 2b
|
||||
|
||||
mcr p15, 0, r0, c2, c0, 0 /* Set TTB */
|
||||
mcr p15, 0, r0, c8, c7, 0 /* Flush TLB */
|
||||
|
||||
/* Set the Domain Access register. Very important! */
|
||||
mov r0, #((DOMAIN_CLIENT << (PMAP_DOMAIN_KERNEL*2)) | DOMAIN_CLIENT)
|
||||
mcr p15, 0, r0, c3, c0, 0
|
||||
|
||||
/* Enable MMU */
|
||||
mrc p15, 0, r0, c1, c0, 0
|
||||
orr r0, r0, #CPU_CONTROL_SYST_ENABLE
|
||||
orr r0, r0, #CPU_CONTROL_MMU_ENABLE
|
||||
mcr p15, 0, r0, c1, c0, 0
|
||||
CPWAIT(r0)
|
||||
|
||||
/* Jump to kernel code in TRUE VA */
|
||||
adr r0, Lstart
|
||||
ldr pc, [r0]
|
||||
|
||||
Lstart:
|
||||
.word start
|
||||
|
||||
#define MMU_INIT(va,pa,n_sec,attr) \
|
||||
.word (n_sec); \
|
||||
.word 4 * ((va) >> L1_S_SHIFT); \
|
||||
.word (pa)|(attr);
|
||||
|
||||
Lstartup_pagetable:
|
||||
.word 0xa0004000
|
||||
|
||||
mmu_init_table:
|
||||
/* fill all table VA==PA */
|
||||
MMU_INIT(0x00000000, 0x00000000, 1<<(32-L1_S_SHIFT), L1_TYPE_S|L1_S_AP(AP_KRW))
|
||||
/* map SDRAM VA==PA, WT cacheable */
|
||||
MMU_INIT(0xa0000000, 0xa0000000, 64, L1_TYPE_S|L1_S_C|L1_S_AP(AP_KRW))
|
||||
/* map VA 0xc0000000..0xc3ffffff to PA 0xa0000000..0xa3ffffff */
|
||||
MMU_INIT(0xc0000000, 0xa0000000, 64, L1_TYPE_S|L1_S_C|L1_S_AP(AP_KRW))
|
||||
|
||||
.word 0,0,0 /* end of table */
|
50
sys/arch/zaurus/zaurus/zaurus_var.h
Normal file
50
sys/arch/zaurus/zaurus/zaurus_var.h
Normal file
@ -0,0 +1,50 @@
|
||||
/* $NetBSD: zaurus_var.h,v 1.1 2006/12/16 05:57:48 ober Exp $ */
|
||||
/* $OpenBSD: zaurus_var.h,v 1.4 2005/07/01 23:56:47 uwe Exp $ */
|
||||
/* NetBSD: lubbock_var.h,v 1.1 2003/06/18 10:51:15 bsh Exp */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2002, 2003 Genetec Corporation. All rights reserved.
|
||||
* Written by Hiroyuki Bessho for Genetec Corporation.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of Genetec Corporation may not be used to endorse or
|
||||
* promote products derived from this software without specific prior
|
||||
* written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY GENETEC CORPORATION ``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 GENETEC CORPORATION
|
||||
* 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 _ZAURUS_ZAURUS_VAR_H
|
||||
#define _ZAURUS_ZAURUS_VAR_H
|
||||
|
||||
#ifdef _KERNEL
|
||||
|
||||
#define ZAURUS_C860 0xC0860
|
||||
#define ZAURUS_C3000 0xC3000
|
||||
|
||||
#define ZAURUS_ISC860 (zaurusmod == ZAURUS_C860)
|
||||
#define ZAURUS_ISC3000 (zaurusmod == ZAURUS_C3000)
|
||||
|
||||
extern int zaurusmod;
|
||||
extern int glass_console;
|
||||
|
||||
#endif /* _KERNEL */
|
||||
|
||||
#endif /* _ZAURUS_ZAURUS_VAR_H */
|
Loading…
Reference in New Issue
Block a user