4 * Copyright (c) 2001 Minoura Makoto
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
39 * via stack: (firstpa, physsize, esym)
40 * via regs: %d6: bootdev
42 * for /boot, only %d6 is used.
49 jbsr _C_LABEL(bootmain)
54 jbsr _C_LABEL(getchar)
57 reboot_msg: .asciz "\n[Hit key to reboot]"
61 * Detect MPU type. From locore.s.
62 * Note we've already confirmed it is not 68000/010.
64 ENTRY_NOPROFILE(detectmpu)
65 movl #0x200,%d0 | data freeze bit
66 movc %d0,%cacr | only exists on 68030
67 movc %cacr,%d0 | read it back
69 jeq Lnot68030 | yes, we have 68020/68040/68060
71 jra Lgo | no, we have 68030
73 bset #31,%d0 | data cache enable bit
74 movc %d0,%cacr | only exists on 68040/68060
75 movc %cacr,%d0 | read it back
77 jeq Lis68020 | yes, we have 68020
78 moveq #0,%d0 | now turn it back off
79 movec %d0,%cacr | before we access any data
80 .word 0xf4d8 | cinva bc - invalidate caches XXX
81 bset #30,%d0 | data cache no allocate mode bit
82 movc %d0,%cacr | only exists on 68060
83 movc %cacr,%d0 | read it back
85 jeq Lis68040 | yes, we have 68040
92 movl #2,%d0 | and a 68020 CPU
97 * Check if the given address is valid for byte read.
98 * From boot_ufs/boot.S.
100 ENTRY_NOPROFILE(badbaddr)
101 lea 0x0008:W,%a1 | MPU Bus Error vector
105 oriw #0x0700,%sr | keep out interrupts
107 movel %a0,%a1@ | set bus error vector
108 movel %sp,%d1 | save sp
110 tstb %a0@ | try read...
111 moveq #0,%d0 | this is skipped on bus error
112 badr1: moveal %d1,%sp | restore sp