Home | History | Annotate | Line # | Download | only in ofwboot
ofwstart.S revision 1.1
      1  1.1  garbled /* $NetBSD: ofwstart.S,v 1.1 2008/01/09 19:34:45 garbled Exp $ */
      2  1.1  garbled 
      3  1.1  garbled /*-
      4  1.1  garbled  * Copyright (c) 2008 The NetBSD Foundation, Inc.
      5  1.1  garbled  * All rights reserved.
      6  1.1  garbled  *
      7  1.1  garbled  * This code is derived from software contributed to The NetBSD Foundation
      8  1.1  garbled  * by Tim Rightnour
      9  1.1  garbled  *
     10  1.1  garbled  * Redistribution and use in source and binary forms, with or without
     11  1.1  garbled  * modification, are permitted provided that the following conditions
     12  1.1  garbled  * are met:
     13  1.1  garbled  * 1. Redistributions of source code must retain the above copyright
     14  1.1  garbled  *    notice, this list of conditions and the following disclaimer.
     15  1.1  garbled  * 2. Redistributions in binary form must reproduce the above copyright
     16  1.1  garbled  *    notice, this list of conditions and the following disclaimer in the
     17  1.1  garbled  *    documentation and/or other materials provided with the distribution.
     18  1.1  garbled  * 3. All advertising materials mentioning features or use of this software
     19  1.1  garbled  *    must display the following acknowledgement:
     20  1.1  garbled  *        This product includes software developed by the NetBSD
     21  1.1  garbled  *        Foundation, Inc. and its contributors.
     22  1.1  garbled  * 4. Neither the name of The NetBSD Foundation nor the names of its
     23  1.1  garbled  *    contributors may be used to endorse or promote products derived
     24  1.1  garbled  *    from this software without specific prior written permission.
     25  1.1  garbled  *
     26  1.1  garbled  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     27  1.1  garbled  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     28  1.1  garbled  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     29  1.1  garbled  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     30  1.1  garbled  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     31  1.1  garbled  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     32  1.1  garbled  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     33  1.1  garbled  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     34  1.1  garbled  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     35  1.1  garbled  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     36  1.1  garbled  * POSSIBILITY OF SUCH DAMAGE.
     37  1.1  garbled  */
     38  1.1  garbled 
     39  1.1  garbled #ifdef XCOFF_GLUE
     40  1.1  garbled 	.text
     41  1.1  garbled 	.globl	_entry
     42  1.1  garbled _entry:
     43  1.1  garbled 	.long	_start,0,0
     44  1.1  garbled #endif /* XCOFF_GLUE */
     45  1.1  garbled 
     46  1.1  garbled 	.text
     47  1.1  garbled 	.globl	_start
     48  1.1  garbled 	/* This is the magical note section that IBM machines require
     49  1.1  garbled 	 * to boot.  This should be a note, but gnu ld will not let us
     50  1.1  garbled 	 * position it at the start of the file.
     51  1.1  garbled 	 */
     52  1.1  garbled 	# length of name
     53  1.1  garbled 	.long	8
     54  1.1  garbled 	# note descriptor size
     55  1.1  garbled 	.long	24
     56  1.1  garbled 	# note type (IEEE 1275)
     57  1.1  garbled 	.long	0x1275
     58  1.1  garbled 	# name of owner
     59  1.1  garbled 	.asciz  "PowerPC"
     60  1.1  garbled 	.balign 4
     61  1.1  garbled 
     62  1.1  garbled 	# note descriptor
     63  1.1  garbled 	# real mode (-1) or virtual mode (0)
     64  1.1  garbled 	.long	0
     65  1.1  garbled 	# real-base
     66  1.1  garbled 	.long	-1
     67  1.1  garbled 	# real-size
     68  1.1  garbled 	.long	-1
     69  1.1  garbled 	# virt-base
     70  1.1  garbled 	.long	-1
     71  1.1  garbled 	# virt-size
     72  1.1  garbled 	.long	-1
     73  1.1  garbled 	# load-base
     74  1.1  garbled 	.long	0x4000
     75  1.1  garbled 
     76  1.1  garbled 	/* note for dealing with IBM LPARs */
     77  1.1  garbled 	# length of name
     78  1.1  garbled 	.long 24
     79  1.1  garbled 	# note descriptor size
     80  1.1  garbled 	.long 28
     81  1.1  garbled 	# note type
     82  1.1  garbled 	.long 0x12759999
     83  1.1  garbled 	# name of owner
     84  1.1  garbled 	.asciz "IBM,RPA-Client-Config"
     85  1.1  garbled 	.balign 4
     86  1.1  garbled 
     87  1.1  garbled 	# lpar affinity
     88  1.1  garbled 	.long 0
     89  1.1  garbled 	# minimum size in megabytes
     90  1.1  garbled 	.long 64
     91  1.1  garbled 	# minimum percentage size
     92  1.1  garbled 	.long 0
     93  1.1  garbled 	# max pft size ( 2^48 bytes )
     94  1.1  garbled 	.long 48
     95  1.1  garbled 	# splpar
     96  1.1  garbled 	.long 1
     97  1.1  garbled 	# min load ?
     98  1.1  garbled 	.long -1
     99  1.1  garbled 	# new mem def ?
    100  1.1  garbled 	.long 0
    101  1.1  garbled 
    102  1.1  garbled _start:
    103  1.1  garbled 	sync
    104  1.1  garbled 	isync
    105  1.1  garbled 	lis	%r1,stack@ha
    106  1.1  garbled 	addi	%r1,%r1,stack@l
    107  1.1  garbled 	addi	%r1,%r1,8192
    108  1.1  garbled 
    109  1.1  garbled 	mfmsr	%r8
    110  1.1  garbled 	li	%r0,0
    111  1.1  garbled 	mtmsr	%r0
    112  1.1  garbled 	isync
    113  1.1  garbled 
    114  1.1  garbled 	mtibatu	0,%r0
    115  1.1  garbled 	mtibatu	1,%r0
    116  1.1  garbled 	mtibatu	2,%r0
    117  1.1  garbled 	mtibatu	3,%r0
    118  1.1  garbled 	mtdbatu	0,%r0
    119  1.1  garbled 	mtdbatu	1,%r0
    120  1.1  garbled 	mtdbatu	2,%r0
    121  1.1  garbled 	mtdbatu	3,%r0
    122  1.1  garbled 
    123  1.1  garbled 	li	%r9,0x12 	/* BATL(0, BAT_M, BAT_PP_RW) */
    124  1.1  garbled 	mtibatl	0,%r9
    125  1.1  garbled 	mtdbatl	0,%r9
    126  1.1  garbled 	li	%r9,0x1ffe	/* BATU(0, BAT_BL_256M, BAT_Vs) */
    127  1.1  garbled 	mtibatu	0,%r9
    128  1.1  garbled 	mtdbatu	0,%r9
    129  1.1  garbled 	isync
    130  1.1  garbled 
    131  1.1  garbled 	mtmsr	%r8
    132  1.1  garbled 	isync
    133  1.1  garbled 
    134  1.1  garbled 	/*
    135  1.1  garbled 	 * Make sure that .bss is zeroed
    136  1.1  garbled 	 */
    137  1.1  garbled 
    138  1.1  garbled 	li	%r0,0
    139  1.1  garbled 	lis	%r8,_edata@ha
    140  1.1  garbled 	addi	%r8,%r8,_edata@l
    141  1.1  garbled 	lis	%r9,_end@ha
    142  1.1  garbled 	addi	%r9,%r9,_end@l
    143  1.1  garbled 
    144  1.1  garbled 5:	cmpw	0,%r8,%r9
    145  1.1  garbled 	bge	6f
    146  1.1  garbled 	stw	%r0,0(%r8)
    147  1.1  garbled 	addi	%r8,%r8,4
    148  1.1  garbled 	b	5b
    149  1.1  garbled 
    150  1.1  garbled 6:	b	startup
    151