Home | History | Annotate | Line # | Download | only in ppcboot
kickstart.S revision 1.2
      1  1.2  is /*	$NetBSD: kickstart.S,v 1.2 1999/12/30 21:09:56 is Exp $	*/
      2  1.1  is 
      3  1.2  is /*-
      4  1.2  is  * Copyright (c) 1999 The NetBSD Foundation, Inc.
      5  1.2  is  * All rights reserved.
      6  1.2  is  *
      7  1.2  is  * This code is derived from software contributed to The NetBSD Foundation
      8  1.2  is  * by Ignatios Souvatzis.
      9  1.2  is  *
     10  1.2  is  * Redistribution and use in source and binary forms, with or without
     11  1.2  is  * modification, are permitted provided that the following conditions
     12  1.2  is  * are met:
     13  1.2  is  * 1. Redistributions of source code must retain the above copyright
     14  1.2  is  *    notice, this list of conditions and the following disclaimer.
     15  1.2  is  * 2. Redistributions in binary form must reproduce the above copyright
     16  1.2  is  *    notice, this list of conditions and the following disclaimer in the
     17  1.2  is  *    documentation and/or other materials provided with the distribution.
     18  1.2  is  * 3. All advertising materials mentioning features or use of this software
     19  1.2  is  *    must display the following acknowledgement:
     20  1.2  is  *        This product includes software developed by the NetBSD
     21  1.2  is  *        Foundation, Inc. and its contributors.
     22  1.2  is  * 4. Neither the name of The NetBSD Foundation nor the names of its
     23  1.2  is  *    contributors may be used to endorse or promote products derived
     24  1.2  is  *    from this software without specific prior written permission.
     25  1.2  is  *
     26  1.2  is  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     27  1.2  is  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     28  1.2  is  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     29  1.2  is  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     30  1.2  is  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     31  1.2  is  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     32  1.2  is  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     33  1.2  is  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     34  1.2  is  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     35  1.2  is  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     36  1.2  is  * POSSIBILITY OF SUCH DAMAGE.
     37  1.1  is  */
     38  1.1  is 
     39  1.1  is #define PPC_CACHESIZE 16384
     40  1.1  is #define PPC_LINESIZE 32
     41  1.1  is 
     42  1.1  is /*
     43  1.1  is Memst:	.long	0x08000000
     44  1.1  is Krnst:	.long	0x082f3400
     45  1.1  is Krnsz:	.long	0x00100000
     46  1.1  is  */
     47  1.1  is 	.globl _start
     48  1.1  is _start:
     49  1.1  is 	bl	L2	/* we start with this address @ 0xfff00100 */
     50  1.1  is L2:
     51  1.1  is 	lis	13,0xf60000@ha
     52  1.1  is 	li	14,0x08
     53  1.1  is 	stb	14,0xf60000@l(13)
     54  1.1  is #ifdef DEBUG
     55  1.1  is 	lis	13,0xdff180@h
     56  1.1  is 	ori	13,13,0xdff180@l
     57  1.1  is 
     58  1.1  is 	lis	12,1000000@h
     59  1.1  is 	ori	12,12,1000000@l
     60  1.1  is 	mtctr	12
     61  1.1  is L2a:
     62  1.1  is 	li	14,0x00f
     63  1.1  is 	sth	14,0(13)
     64  1.1  is 	sync
     65  1.1  is 	li	14,0xf0f
     66  1.1  is 	sth	14,0(13)
     67  1.1  is 	sync
     68  1.1  is 	bdnz	L2a
     69  1.1  is #endif
     70  1.1  is 	mflr	3
     71  1.1  is 	lwz	4,-16(3)
     72  1.1  is 	lwz	5,-12(3)
     73  1.1  is 	lwz	6,-8(3)
     74  1.1  is 	li	7,3
     75  1.1  is 	addi	8,6,3
     76  1.1  is 	cmplw	4,5
     77  1.1  is 	andc	8,8,7
     78  1.1  is 	srwi	9,8,2
     79  1.1  is 	mtctr	9
     80  1.1  is 	bgt	Lb0
     81  1.1  is /* here: copying downwards and forwards */
     82  1.1  is 	lwz	9,0(5)
     83  1.1  is 	stw	9,0(4)
     84  1.1  is 	bdz	Lflush
     85  1.1  is Lf1:	lwzu	7,4(5)
     86  1.1  is 	stwu	7,4(4)
     87  1.1  is 	bdnz	Lf1
     88  1.1  is 	b	Lflush
     89  1.1  is 
     90  1.1  is Lb0:	add	4,4,8	/* add the rounded up length */
     91  1.1  is 	add	5,5,8	/* add the rounded up length */
     92  1.1  is Lb1:	lwzu	7,-4(5)
     93  1.1  is 	stwu	7,-4(4)
     94  1.1  is 	bdnz	Lb1
     95  1.1  is 
     96  1.1  is Lflush:
     97  1.1  is #ifdef DEBUG
     98  1.1  is 	li	14,0xff0
     99  1.1  is 	sth	14,0(13)
    100  1.1  is 	sync
    101  1.1  is #endif
    102  1.1  is 	li	10,PPC_CACHESIZE/PPC_LINESIZE
    103  1.1  is 	li	11,PPC_LINESIZE
    104  1.1  is /* dcbst loop */
    105  1.1  is 	mtctr	10
    106  1.1  is 	lwz	12,-8(3)
    107  1.1  is Lfl1:	dcbst	0,12
    108  1.1  is 	add	12,12,11
    109  1.1  is 	bdnz	Lfl1
    110  1.1  is 	sync		/* and wait for past instructions to finish */
    111  1.1  is /* icbi loop */
    112  1.1  is 	mtctr	10
    113  1.1  is 	lwz	12,-8(3)
    114  1.1  is Lfl2:	icbi	0,12
    115  1.1  is 	add	12,12,11
    116  1.1  is 	bdnz	Lfl2
    117  1.1  is 	sync		/* and wait for past instructions to finish */
    118  1.1  is 	isync		/* and flush instruction queue */
    119  1.1  is Ljump:
    120  1.1  is #ifdef DEBUG
    121  1.1  is 	li	14,0x0f0
    122  1.1  is 	sth	14,0(13)
    123  1.1  is 	sync
    124  1.1  is #endif
    125  1.1  is 	lwz	3,-16(3)
    126  1.1  is 	mtlr	3
    127  1.1  is 	blr
    128  1.1  is /* NOTREACHED */
    129