Home | History | Annotate | Line # | Download | only in lcboot
extern.h revision 1.1
      1  1.1  igy /* $NetBSD: extern.h,v 1.1 2003/05/01 07:02:01 igy Exp $ */
      2  1.1  igy 
      3  1.1  igy /*
      4  1.1  igy  * Copyright (c) 2002 The NetBSD Foundation, Inc.
      5  1.1  igy  * All rights reserved.
      6  1.1  igy  *
      7  1.1  igy  * This code is derived from software contributed to The NetBSD Foundation
      8  1.1  igy  * by Naoto Shimazaki of YOKOGAWA Electric Corporation.
      9  1.1  igy  *
     10  1.1  igy  * Redistribution and use in source and binary forms, with or without
     11  1.1  igy  * modification, are permitted provided that the following conditions
     12  1.1  igy  * are met:
     13  1.1  igy  * 1. Redistributions of source code must retain the above copyright
     14  1.1  igy  *    notice, this list of conditions and the following disclaimer.
     15  1.1  igy  * 2. Redistributions in binary form must reproduce the above copyright
     16  1.1  igy  *    notice, this list of conditions and the following disclaimer in the
     17  1.1  igy  *    documentation and/or other materials provided with the distribution.
     18  1.1  igy  * 3. All advertising materials mentioning features or use of this software
     19  1.1  igy  *    must display the following acknowledgement:
     20  1.1  igy  *        This product includes software developed by the NetBSD
     21  1.1  igy  *        Foundation, Inc. and its contributors.
     22  1.1  igy  * 4. Neither the name of The NetBSD Foundation nor the names of its
     23  1.1  igy  *    contributors may be used to endorse or promote products derived
     24  1.1  igy  *    from this software without specific prior written permission.
     25  1.1  igy  *
     26  1.1  igy  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     27  1.1  igy  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     28  1.1  igy  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     29  1.1  igy  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     30  1.1  igy  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     31  1.1  igy  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     32  1.1  igy  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     33  1.1  igy  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     34  1.1  igy  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     35  1.1  igy  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     36  1.1  igy  * POSSIBILITY OF SUCH DAMAGE.
     37  1.1  igy  */
     38  1.1  igy 
     39  1.1  igy #ifndef _LOCORE
     40  1.1  igy #include <sys/types.h>
     41  1.1  igy #include <mips/cpuregs.h>
     42  1.1  igy 
     43  1.1  igy #include <dev/ic/comreg.h>
     44  1.1  igy #include <dev/ic/ns16550reg.h>
     45  1.1  igy #include <dev/ic/st16650reg.h>
     46  1.1  igy #define com_lcr com_cfcr
     47  1.1  igy 
     48  1.1  igy struct bootmenu_command {
     49  1.1  igy 	const char	*c_name;
     50  1.1  igy 	void (*c_fn)(char*);
     51  1.1  igy };
     52  1.1  igy 
     53  1.1  igy #define ROMCS0_BASE	0xbe000000U
     54  1.1  igy #define ROMCS3_BASE	0xbf800000U
     55  1.1  igy #define FLASH_BASE	ROMCS0_BASE
     56  1.1  igy 
     57  1.1  igy #ifdef ROMICE
     58  1.1  igy #define KERN_ROMBASE	0x80800000U
     59  1.1  igy #else
     60  1.1  igy #define KERN_ROMBASE	0xbf800000U
     61  1.1  igy #endif
     62  1.1  igy 
     63  1.1  igy #define __REG_1(reg)	*((volatile u_int8_t*) (reg))
     64  1.1  igy #define __REG_2(reg)	*((volatile u_int16_t*) (reg))
     65  1.1  igy #define __REG_4(reg)	*((volatile u_int32_t*) (reg))
     66  1.1  igy 
     67  1.1  igy #define ISSET(t, f)	((t) & (f))
     68  1.1  igy 
     69  1.1  igy #define REGWRITE_1(base, off, val)	\
     70  1.1  igy 		(__REG_1(MIPS_PHYS_TO_KSEG1((u_int32_t) (base) + (off))) \
     71  1.1  igy 		 = (val))
     72  1.1  igy #define REGWRITE_2(base, off, val)	\
     73  1.1  igy 		(__REG_2(MIPS_PHYS_TO_KSEG1((u_int32_t) (base) + (off))) \
     74  1.1  igy 		 = (val))
     75  1.1  igy #define REGWRITE_4(base, off, val)	\
     76  1.1  igy 		(__REG_4(MIPS_PHYS_TO_KSEG1((u_int32_t) (base) + (off))) \
     77  1.1  igy 		 = (val))
     78  1.1  igy 
     79  1.1  igy #define REGREAD_1(base, off)	\
     80  1.1  igy 		(__REG_1(MIPS_PHYS_TO_KSEG1((u_int32_t) (base) + (off))))
     81  1.1  igy #define REGREAD_2(base, off)	\
     82  1.1  igy 		(__REG_2(MIPS_PHYS_TO_KSEG1((u_int32_t) (base) + (off))))
     83  1.1  igy #define REGREAD_4(base, off)	\
     84  1.1  igy 		(__REG_4(MIPS_PHYS_TO_KSEG1((u_int32_t) (base) + (off))))
     85  1.1  igy 
     86  1.1  igy #define ISKEY	ISSET(REGREAD_1(VR4181_SIU_ADDR, com_lsr), LSR_RXRDY)
     87  1.1  igy 
     88  1.1  igy #define bus_space_write_1(iot, ioh, off, val)	REGWRITE_1((ioh), (off), (val))
     89  1.1  igy #define bus_space_write_2(iot, ioh, off, val)	REGWRITE_2((ioh), (off), (val))
     90  1.1  igy #define bus_space_write_4(iot, ioh, off, val)	REGWRITE_4((ioh), (off), (val))
     91  1.1  igy #define bus_space_read_1(iot, ioh, off)	REGREAD_1((ioh), (off))
     92  1.1  igy #define bus_space_read_2(iot, ioh, off)	REGREAD_2((ioh), (off))
     93  1.1  igy #define bus_space_read_4(iot, ioh, off)	REGREAD_4((ioh), (off))
     94  1.1  igy typedef void		*bus_space_tag_t;
     95  1.1  igy typedef u_int32_t	bus_space_handle_t;
     96  1.1  igy typedef size_t		bus_size_t;
     97  1.1  igy 
     98  1.1  igy void comcninit(void);
     99  1.1  igy int iskey(void);
    100  1.1  igy void start_netbsd(void);
    101  1.1  igy int i28f128_probe(void *base);
    102  1.1  igy int i28f128_region_write(void *dst, const void *src, size_t len);
    103  1.1  igy 
    104  1.1  igy #endif /* !_LOCORE */
    105  1.1  igy 
    106  1.1  igy #define	LCBOOT_STARTADDR	0x80001000
    107  1.1  igy #define	LCBOOT_ROMSTARTADDR	0xbfd01000
    108  1.1  igy #define	NETBSD_STARTADDR	0x80040000
    109