#ifdef CONFIG_Q40
.globl q40_mem_cptr
#endif
+#ifdef CONFIG_HP300
+.globl hp300_phys_ram_base
+#endif
CPUTYPE_040 = 1 /* indicates an 040 */
CPUTYPE_060 = 2 /* indicates an 060 */
__INIT
ENTRY(__start)
+#ifdef CONFIG_HP300
+/* This is a hack. The HP NetBSD bootloader loads us at an arbitrary
+ address (apparently 0xff002000 in practice) which is not good if we need
+ to be able to map this to VA 0x1000. We could do it with pagetables but
+ a better solution seems to be to relocate the kernel in physical memory
+ before we start.
+
+ So, we copy the entire kernel image (code+data+bss) down to the 16MB
+ boundary that marks the start of RAM. This is slightly tricky because
+ we must not overwrite the copying code itself. :-) */
+
+/* 15/5/98. The start address of physical RAM changes depending on how much
+ RAM is present. This is actually a blessing in disguise as it provides
+ a way for us to work out the RAM size rather than hardwiring it. */
+
+ lea %pc@(_start),%a0
+ movel %a0,%d6
+ and #0xffff0000, %d6
+ lea %pc@(hp300_phys_ram_base),%a0
+ movel %d6, %a0@
+ movel %pc@(L(custom)),%a3
+ moveb #0xfe,%d7
+ moveb %d7,%a3@(0x1ffff)
+ lea %pc@(Lcopystart),%a0
+ lea %pc@(Lcopyend),%a1
+ movel %d6,%a2 /* Start of physical RAM */
+1: moveb %a0@+,%d0
+ moveb %d0,%a2@+
+ cmpl %a0,%a1
+ jbne 1b
+ movel %d6,%a2
+ moveb #0xfd,%d7
+ moveb %d7,%a3@(0x1ffff)
+ lea %pc@(_stext),%a0
+ lea %pc@(_end),%a1
+ jmp %a2@
+
+Lcopystart:
+ moveb #0xf7,%d7
+ moveb %d7,%a3@(0x1ffff)
+ movel %d6,%a2 /* Start of kernel */
+ add #0x1000,%a2
+1: moveb %a0@+,%d0
+ moveb %d0,%a2@+
+ cmpl %a0,%a1
+ jbne 1b
+ moveb #0,%d7
+ moveb %d7,%a3@(0x1ffff)
+ movel %d6,%a0
+ addl #Lstart1,%a0
+ jmp %a0@
+Lcopyend:
+
+Lstart1:
+ moveb #0x3f,%d7
+ moveb %d7,%a3@(0x1ffff)
+#endif /* CONFIG_HP300 */
+
/*
* Setup initial stack pointer
*/
* Record the CPU and machine type.
*/
+#ifndef CONFIG_HP300
get_bi_record BI_MACHTYPE
lea %pc@(m68k_machtype),%a1
movel %a0@,%a1@
get_bi_record BI_CPUTYPE
lea %pc@(m68k_cputype),%a1
movel %a0@,%a1@
+#else /* CONFIG_HP300 */
+ /* FIXME HP300 doesn't use bootinfo yet */
+ movel #MACH_HP300,%d4
+ lea %pc@(m68k_machtype),%a0
+ movel %d4,%a0@
+ movel #FPU_68881,%d0
+ lea %pc@(m68k_fputype),%a0
+ movel %d0,%a0@
+ movel #MMU_68030,%d0
+ lea %pc@(m68k_mmutype),%a0
+ movel %d0,%a0@
+ movel #CPU_68030,%d0
+ lea %pc@(m68k_cputype),%a0
+ movel %d0,%a0@
+
+ leds(0x1)
+#endif /* CONFIG_HP300 */
#ifdef CONFIG_MAC
/*
putc '\n'
putc 'A'
+#ifdef CONFIG_HP300
+ leds(0x2)
+#endif /* CONFIG_HP300 */
dputn %pc@(L(cputype))
dputn %pc@(m68k_supervisor_cachemode)
dputn %pc@(m68k_pgtable_cachemode)
movel ARG1,%d0
lea %pc@(_end),%a0
+#ifndef CONFIG_HP300
1: tstw %a0@(BIR_TAG)
jeq 3f
cmpw %a0@(BIR_TAG),%d0
3: moveq #-1,%d0
lea %a0@(BIR_SIZE),%a0
4:
+#endif /* CONFIG_HP300 */
func_return get_bi_record
__INITDATA
.align 4
-#if defined(CONFIG_ATARI) || defined(CONFIG_AMIGA) || defined(CONFIG_HP300)
+#ifdef CONFIG_HP300
+hp300_phys_ram_base:
+#endif
+
+#if defined(CONFIG_ATARI) || defined(CONFIG_AMIGA) || \
+ defined(CONFIG_HP300) || defined(CONFIG_APOLLO)
L(custom):
L(iobase):
.long 0
LSRB0 = 0x10412
LTHRB0 = 0x10416
LCPUCTRL = 0x10100
-L(iobase):
- .long 0
#endif
__FINIT
int i;
char *p, *q;
- /* The bootinfo is located right after the kernel bss */
- m68k_parse_bootinfo((const struct bi_record *)&_end);
+ if (!MACH_IS_HP300) {
+ /* The bootinfo is located right after the kernel bss */
+ m68k_parse_bootinfo((const struct bi_record *)&_end);
+ } else {
+ /* FIXME HP300 doesn't use bootinfo yet */
+ extern unsigned long hp300_phys_ram_base;
+ unsigned long hp300_mem_size = 0xffffffff-hp300_phys_ram_base;
+ m68k_cputype = CPU_68030;
+ m68k_fputype = FPU_68882;
+ m68k_memory[0].addr = hp300_phys_ram_base;
+ /* 0.5M fudge factor */
+ m68k_memory[0].size = hp300_mem_size-512*1024;
+ m68k_num_memory++;
+ }
if (CPU_IS_040)
m68k_is040or060 = 4;