1 |
27 |
unneback |
#ifndef CYGONCE_HAL_HALBOOT_SI /* -*-asm-*- */
|
2 |
|
|
#define CYGONCE_HAL_HALBOOT_SI
|
3 |
|
|
// ====================================================================
|
4 |
|
|
//
|
5 |
|
|
// /halboot.si
|
6 |
|
|
//
|
7 |
|
|
// HAL bootup platform-oriented code (assembler)
|
8 |
|
|
//
|
9 |
|
|
// ====================================================================
|
10 |
|
|
//####ECOSGPLCOPYRIGHTBEGIN####
|
11 |
|
|
// -------------------------------------------
|
12 |
|
|
// This file is part of eCos, the Embedded Configurable Operating System.
|
13 |
|
|
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
|
14 |
|
|
//
|
15 |
|
|
// eCos is free software; you can redistribute it and/or modify it under
|
16 |
|
|
// the terms of the GNU General Public License as published by the Free
|
17 |
|
|
// Software Foundation; either version 2 or (at your option) any later version.
|
18 |
|
|
//
|
19 |
|
|
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
|
20 |
|
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
21 |
|
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
22 |
|
|
// for more details.
|
23 |
|
|
//
|
24 |
|
|
// You should have received a copy of the GNU General Public License along
|
25 |
|
|
// with eCos; if not, write to the Free Software Foundation, Inc.,
|
26 |
|
|
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
|
27 |
|
|
//
|
28 |
|
|
// As a special exception, if other files instantiate templates or use macros
|
29 |
|
|
// or inline functions from this file, or you compile this file and link it
|
30 |
|
|
// with other works to produce a work based on this file, this file does not
|
31 |
|
|
// by itself cause the resulting work to be covered by the GNU General Public
|
32 |
|
|
// License. However the source code for this file must still be made available
|
33 |
|
|
// in accordance with section (3) of the GNU General Public License.
|
34 |
|
|
//
|
35 |
|
|
// This exception does not invalidate any other reasons why a work based on
|
36 |
|
|
// this file might be covered by the GNU General Public License.
|
37 |
|
|
//
|
38 |
|
|
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
|
39 |
|
|
// at http://sources.redhat.com/ecos/ecos-license/
|
40 |
|
|
// -------------------------------------------
|
41 |
|
|
//####ECOSGPLCOPYRIGHTEND####
|
42 |
|
|
// ====================================================================
|
43 |
|
|
//#####DESCRIPTIONBEGIN####
|
44 |
|
|
//
|
45 |
|
|
// Author(s): hmt
|
46 |
|
|
// Contributors: hmt
|
47 |
|
|
// Date: 1999-02-01
|
48 |
|
|
// Purpose: Bootup code, platform oriented.
|
49 |
|
|
// Description:
|
50 |
|
|
//
|
51 |
|
|
//####DESCRIPTIONEND####
|
52 |
|
|
//
|
53 |
|
|
// ====================================================================
|
54 |
|
|
|
55 |
|
|
// External Platform Initial Setup
|
56 |
|
|
//
|
57 |
|
|
// This should set up RAM and caches, and calm down any external
|
58 |
|
|
// interrupt sources.
|
59 |
|
|
//
|
60 |
|
|
// It is just plain included in vectors.S
|
61 |
|
|
//
|
62 |
|
|
// RAM has not yet been touched at all; in fact all you have is a
|
63 |
|
|
// register window selected.
|
64 |
|
|
|
65 |
|
|
|
66 |
|
|
! Empty macro for debugging vectors.S
|
67 |
|
|
.macro led val
|
68 |
|
|
.endm
|
69 |
|
|
|
70 |
|
|
! Set memory according to simulator config
|
71 |
|
|
|
72 |
|
|
set 0x80000000, %l0 ! LEON register base address
|
73 |
|
|
|
74 |
|
|
ld [%l0 + 0x14], %l1 ! chech if we have been initialized
|
75 |
|
|
andcc %l1, 0x1, %g0
|
76 |
|
|
bne 4f
|
77 |
|
|
nop
|
78 |
|
|
|
79 |
|
|
flush ! if we are here, we are running on
|
80 |
|
|
set 0x1000f, %l1 ! the simulator....
|
81 |
|
|
|
82 |
|
|
st %l1, [%l0 + 0x14] ! enable caches
|
83 |
|
|
|
84 |
|
|
st %g0, [%l0 + 0x1c] ! clear LEON registers
|
85 |
|
|
st %g0, [%l0 + 0x20] !
|
86 |
|
|
st %g0, [%l0 + 0x90] !
|
87 |
|
|
st %g0, [%l0 + 0x94] !
|
88 |
|
|
st %g0, [%l0 + 0x98] !
|
89 |
|
|
st %g0, [%l0 + 0x9C] !
|
90 |
|
|
st %g0, [%l0 + 0xA0] !
|
91 |
|
|
st %g0, [%l0 + 0xA4] !
|
92 |
|
|
st %g0, [%l0 + 0xA4] !
|
93 |
|
|
st %g0, [%l0 + 0x78] !
|
94 |
|
|
st %g0, [%l0 + 0x88] !
|
95 |
|
|
|
96 |
|
|
ld [%l0 + 0xF8], %g1 ! load simulator rom size
|
97 |
|
|
clr %l2
|
98 |
|
|
subcc %g1, 0, %g0
|
99 |
|
|
be 3f
|
100 |
|
|
srl %g1, 13, %g1 ! calculate appropriate rom size
|
101 |
|
|
1:
|
102 |
|
|
srl %g1, 1, %g1
|
103 |
|
|
tst %g1
|
104 |
|
|
bne,a 1b
|
105 |
|
|
inc %l2
|
106 |
|
|
sll %l2, 14, %l2
|
107 |
|
|
st %l2, [%l0 + 0x00] ! set prom size in memcfg1
|
108 |
|
|
|
109 |
|
|
set 0, %l2
|
110 |
|
|
ld [%l0 + 0xF4], %g2 ! load simulator ram size
|
111 |
|
|
srl %g2, 13, %g1 ! calculate appropriate ram size
|
112 |
|
|
1:
|
113 |
|
|
srl %g1, 1, %g1
|
114 |
|
|
tst %g1
|
115 |
|
|
bne,a 1b
|
116 |
|
|
inc %l2
|
117 |
|
|
sll %l2, 9, %l2
|
118 |
|
|
or %l2, 0x20, %l2
|
119 |
|
|
st %l2, [%l0 + 0x04] ! set ram size in memcfg2
|
120 |
|
|
set 0x40000000, %l2
|
121 |
|
|
add %g2, %l2, %fp
|
122 |
|
|
sub %fp, 96*4, %sp
|
123 |
|
|
3:
|
124 |
|
|
st %g0, [%sp] !probe for FPU
|
125 |
|
|
! ld [%sp], %fsr
|
126 |
|
|
set 49, %l1
|
127 |
|
|
st %l1, [%l0 + 0x64] ! scaler = 49
|
128 |
|
|
st %l1, [%l0 + 0x60] ! scaler = 49
|
129 |
|
|
|
130 |
|
|
2:
|
131 |
|
|
|
132 |
|
|
set -1, %l1
|
133 |
|
|
st %l1, [%l0 + 0x44] ! timer 1 = 0xffffff
|
134 |
|
|
set 7, %l1
|
135 |
|
|
st %l1, [%l0 + 0x48] ! start timer 1
|
136 |
|
|
st %l1, [%l0 + 0x78] ! enable UARTS
|
137 |
|
|
st %l1, [%l0 + 0x88]
|
138 |
|
|
|
139 |
|
|
4:
|
140 |
|
|
! then copy the branch instructions into the vector
|
141 |
|
|
rd %tbr, %g1
|
142 |
|
|
andn %g1, 0xfff, %g1 ! clear non-address bits
|
143 |
|
|
sethi %hi(real_vector_instructions), %l0
|
144 |
|
|
or %l0, %lo(real_vector_instructions), %l0
|
145 |
|
|
ld [ %l0 ], %l1
|
146 |
|
|
st %l1, [ %g1 ] ! into the vector
|
147 |
|
|
ld [ %l0 + 4 ], %l1
|
148 |
|
|
st %l1, [ %g1 + 4 ] ! into the vector
|
149 |
|
|
|
150 |
|
|
#endif /* CYGONCE_HAL_HALBOOT_SI */
|
151 |
|
|
/* EOF halboot.si */
|