OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rc203soc/] [sw/] [uClinux/] [arch/] [m68k/] [boot/] [atari/] [bootstrap.h] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1623 jcastillo
/*
2
** bootstrap.h -- This file is a part of the Atari bootloader.
3
**
4
** Copyright 1993 by Arjan Knor
5
**
6
** Modified by Andreas Schwab
7
** - clear transparent translation registers
8
**
9
** This file is subject to the terms and conditions of the GNU General Public
10
** License.  See the file COPYING in the main directory of this archive
11
** for more details.
12
**
13
*/
14
 
15
#ifndef BOOTSTRAP_H
16
#define BOOTSTRAP_H
17
 
18
/* _MCH cookie values */
19
#define MACH_ST  0
20
#define MACH_STE 1
21
#define MACH_TT  2
22
#define MACH_FALCON 3
23
 
24
/* some constants for memory handling */
25
#define ST_RAM 0
26
#define TT_RAM 1
27
#define TT_RAM_BASE  (u_long)(0x01000000)
28
#define MB           (1024 * 1024)
29
#define START_MEM    (bi.memory[0].addr)
30
#define MEM_SIZE     (bi.memory[0].size)
31
 
32
/* the various CPU- and FPU-types */
33
#define AFF_68000 (1)
34
#define AFF_68020 (2)
35
#define AFF_68030 (4)
36
#define AFF_68040 (8)
37
#define AFF_68881 (16)
38
#define AFF_68882 (32)
39
 
40
/* the possible OS-languages */
41
#define USA 0
42
#define FRG 1
43
#define FRA 2
44
#define UK  3
45
#define SPA 4
46
#define ITA 5
47
#define SWE 6
48
#define SWF 7
49
#define SWG 8
50
#define TUR 9
51
#define FIN 10
52
#define NOR 11
53
#define DEN 12
54
#define SAU 13
55
#define HOL 14
56
 
57
/* some inline functions */
58
 
59
static __inline int fpu_idle_frame_size (void)
60
{
61
  char fpu_frame[216];
62
  __asm__ __volatile__ ("fnop"::);
63
  __asm__ __volatile__ ("fsave %0@" : : "a" (fpu_frame));
64
  return fpu_frame[1];
65
}
66
 
67
static __inline void change_stack (u_long *stackp)
68
{
69
    __asm__ volatile ("movel %0,sp\n\t" :: "g" (stackp) : "sp");
70
}
71
 
72
static __inline void disable_interrupts (void)
73
{
74
  __asm__ volatile ("orw #0x700,sr":);
75
}
76
 
77
extern struct bootinfo bi;
78
static __inline void disable_cache (void)
79
{
80
    __asm__ volatile ("movec %0,cacr" :: "d" (0));
81
    if (bi.cputype & CPU_68060) {
82
        /* '060: clear branch cache after disabling it;
83
         * disable superscalar operation (and enable FPU) */
84
        __asm__ volatile ("movec %0,cacr" :: "d" (0x00400000));
85
        __asm__ volatile ("moveq #0,d0;"
86
                          ".long 0x4e7b0808"    /* movec d0,pcr */
87
                          : /* no outputs */
88
                          : /* no inputs */
89
                          : "d0");
90
    }
91
}
92
 
93
static __inline void disable_mmu (void)
94
{
95
        if (bi.cputype & (CPU_68040|CPU_68060)) {
96
            __asm__ volatile ("moveq #0,d0;"
97
                                                  ".long 0x4e7b0003;"   /* movec d0,tc */
98
                                                  ".long 0x4e7b0004;"   /* movec d0,itt0 */
99
                                                  ".long 0x4e7b0005;"   /* movec d0,itt1 */
100
                                                  ".long 0x4e7b0006;"   /* movec d0,dtt0 */
101
                                                  ".long 0x4e7b0007"    /* movec d0,dtt1 */
102
                                                  : /* no outputs */
103
                                                  : /* no inputs */
104
                                                  : "d0");
105
        }
106
        else {
107
                __asm__ volatile ("subl  #4,sp\n\t"
108
                                                  "pmove tc,sp@\n\t"
109
                                                  "bclr  #7,sp@\n\t"
110
                                                  "pmove sp@,tc\n\t"
111
                                                  "addl  #4,sp");
112
                if (bi.cputype & CPU_68030) {
113
                        __asm__ volatile ("clrl sp@-\n\t"
114
                                                          ".long 0xf0170800\n\t" /* pmove sp@,tt0 */
115
                                                          ".long 0xf0170c00\n\t" /* pmove sp@,tt1 */
116
                                                          "addl  #4,sp\n");
117
                }
118
        }
119
}
120
 
121
static __inline void jump_to_mover (void *, void *, void *, void *, int, int,
122
                                    void *) __attribute__ ((noreturn));
123
static __inline void jump_to_mover (void *kernel_start, void *mem_start,
124
                                    void *ramdisk_end, void *mem_end,
125
                                    int kernel_size, int ramdisk_size,
126
                                    void *mover_addr)
127
{
128
    asm volatile ("movel %0,a0\n\t"
129
                  "movel %1,a1\n\t"
130
                  "movel %2,a2\n\t"
131
                  "movel %3,a3\n\t"
132
                  "movel %4,d0\n\t"
133
                  "movel %5,d1\n\t"
134
                  "jmp   %6@\n"
135
                  : /* no outputs */
136
                  : "g" (kernel_start), "g" (mem_start),
137
                    "g" (ramdisk_end), "g" (mem_end),
138
                    "g" (kernel_size), "g" (ramdisk_size),
139
                    "a" (mover_addr)
140
                  : "a0", "a1", "a2", "a3", "d0", "d1");
141
 
142
        /* Avoid warning that function may return */
143
        for (;;) ;
144
}
145
 
146
#endif /* BOOTSTRAP_H */
147
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.