]> git.hungrycats.org Git - linux/commitdiff
[PATCH] M68k update (part 20)
authorGeert Uytterhoeven <geert@linux-m68k.org>
Tue, 23 Jul 2002 13:22:24 +0000 (06:22 -0700)
committerLinus Torvalds <torvalds@home.transmeta.com>
Tue, 23 Jul 2002 13:22:24 +0000 (06:22 -0700)
Merge remaining bits of core HP300 support

arch/m68k/kernel/head.S
arch/m68k/kernel/setup.c

index de001eef22a556ac29f13f981128ce56f39b1be4..2cb593986772fd825e38c79a99e2c88cb527092a 100644 (file)
 #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 */
@@ -596,6 +599,64 @@ ENTRY(_start)
 __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
  */
@@ -605,6 +666,7 @@ ENTRY(__start)
  * Record the CPU and machine type.
  */
 
+#ifndef CONFIG_HP300
        get_bi_record   BI_MACHTYPE
        lea     %pc@(m68k_machtype),%a1
        movel   %a0@,%a1@
@@ -620,6 +682,23 @@ ENTRY(__start)
        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
 /*
@@ -893,6 +972,9 @@ L(nocon):
 
        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)
@@ -1490,6 +1572,7 @@ func_start        get_bi_record,%d1
 
        movel   ARG1,%d0
        lea     %pc@(_end),%a0
+#ifndef CONFIG_HP300
 1:     tstw    %a0@(BIR_TAG)
        jeq     3f
        cmpw    %a0@(BIR_TAG),%d0
@@ -1503,6 +1586,7 @@ func_start        get_bi_record,%d1
 3:     moveq   #-1,%d0
        lea     %a0@(BIR_SIZE),%a0
 4:
+#endif /* CONFIG_HP300 */
 func_return    get_bi_record
 
 
@@ -3739,7 +3823,12 @@ L(showtest):
 __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
@@ -3830,8 +3919,6 @@ L(mac_sccbase):
 LSRB0        = 0x10412
 LTHRB0       = 0x10416
 LCPUCTRL     = 0x10100
-L(iobase):
-        .long 0
 #endif
 
 __FINIT
index eaa843742b0fc289da8f4468e036d475369332d2..86ca4c954d6f7c04ef4e889ac35a269453de9e80 100644 (file)
@@ -217,8 +217,20 @@ void __init setup_arch(char **cmdline_p)
        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;