]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/sparc64/kernel/head.S
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-2.6
[linux-2.6-omap-h63xx.git] / arch / sparc64 / kernel / head.S
index 63144ad476f6663c1ab3ed98fd252503fc89ebdb..c9afef093d51b3aceed553bd0ad2c21c0858d565 100644 (file)
 #include <asm/ttable.h>
 #include <asm/mmu.h>
 #include <asm/cpudata.h>
+#include <asm/pil.h>
+#include <asm/estate.h>
+#include <asm/sfafsr.h>
+#include <asm/unistd.h>
        
 /* This section from from _start to sparc64_boot_end should fit into
  * 0x0000000000404000 to 0x0000000000408000.
@@ -98,7 +102,7 @@ sparc64_boot:
        .globl  prom_boot_mapped_pc, prom_boot_mapping_mode
        .globl  prom_boot_mapping_phys_high, prom_boot_mapping_phys_low
        .globl  prom_compatible_name, prom_cpu_path, prom_cpu_compatible
-       .globl  is_sun4v, sun4v_chip_type
+       .globl  is_sun4v, sun4v_chip_type, prom_set_trap_table_name
 prom_peer_name:
        .asciz  "peer"
 prom_compatible_name:
@@ -121,6 +125,8 @@ prom_map_name:
        .asciz  "map"
 prom_unmap_name:
        .asciz  "unmap"
+prom_set_trap_table_name:
+       .asciz  "SUNW,set-trap-table"
 prom_sun4v_name:
        .asciz  "sun4v"
 prom_niagara_prefix:
@@ -286,8 +292,12 @@ sun4v_chip_type:
        /* Leave arg2 as-is, prom_mmu_ihandle_cache */
        mov     -1, %l3
        stx     %l3, [%sp + 2047 + 128 + 0x28]  ! arg3: mode (-1 default)
-       sethi   %hi(8 * 1024 * 1024), %l3
-       stx     %l3, [%sp + 2047 + 128 + 0x30]  ! arg4: size (8MB)
+       /* 4MB align the kernel image size. */
+       set     (_end - KERNBASE), %l3
+       set     ((4 * 1024 * 1024) - 1), %l4
+       add     %l3, %l4, %l3
+       andn    %l3, %l4, %l3
+       stx     %l3, [%sp + 2047 + 128 + 0x30]  ! arg4: roundup(ksize, 4MB)
        sethi   %hi(KERNBASE), %l3
        stx     %l3, [%sp + 2047 + 128 + 0x38]  ! arg5: vaddr (KERNBASE)
        stx     %g0, [%sp + 2047 + 128 + 0x40]  ! arg6: empty
@@ -630,11 +640,36 @@ tlb_fixup_done:
        /* Not reached... */
 
 1:
+       /* If we boot on a non-zero cpu, all of the per-cpu
+        * variable references we make before setting up the
+        * per-cpu areas will use a bogus offset.  Put a
+        * compensating factor into __per_cpu_base to handle
+        * this cleanly.
+        *
+        * What the per-cpu code calculates is:
+        *
+        *      __per_cpu_base + (cpu << __per_cpu_shift)
+        *
+        * These two variables are zero initially, so to
+        * make it all cancel out to zero we need to put
+        * "0 - (cpu << 0)" into __per_cpu_base so that the
+        * above formula evaluates to zero.
+        *
+        * We cannot even perform a printk() until this stuff
+        * is setup as that calls cpu_clock() which uses
+        * per-cpu variables.
+        */
+       sub     %g0, %o0, %o1
+       sethi   %hi(__per_cpu_base), %o2
+       stx     %o1, [%o2 + %lo(__per_cpu_base)]
 #else
        mov     0, %o0
 #endif
        sth     %o0, [%g6 + TI_CPU]
 
+       call    prom_init_report
+        nop
+
        /* Off we go.... */
        call    start_kernel
         nop
@@ -691,15 +726,38 @@ setup_trap_table:
        sethi   %hi(kern_base), %g3
        ldx     [%g3 + %lo(kern_base)], %g3
        add     %g2, %g3, %o1
+       sethi   %hi(sparc64_ttable_tl0), %o0
 
-       call    prom_set_trap_table_sun4v
-        sethi  %hi(sparc64_ttable_tl0), %o0
+       set     prom_set_trap_table_name, %g2
+       stx     %g2, [%sp + 2047 + 128 + 0x00]
+       mov     2, %g2
+       stx     %g2, [%sp + 2047 + 128 + 0x08]
+       mov     0, %g2
+       stx     %g2, [%sp + 2047 + 128 + 0x10]
+       stx     %o0, [%sp + 2047 + 128 + 0x18]
+       stx     %o1, [%sp + 2047 + 128 + 0x20]
+       sethi   %hi(p1275buf), %g2
+       or      %g2, %lo(p1275buf), %g2
+       ldx     [%g2 + 0x08], %o1
+       call    %o1
+        add    %sp, (2047 + 128), %o0
 
        ba,pt   %xcc, 2f
         nop
 
-1:     call    prom_set_trap_table
-        sethi  %hi(sparc64_ttable_tl0), %o0
+1:     sethi   %hi(sparc64_ttable_tl0), %o0
+       set     prom_set_trap_table_name, %g2
+       stx     %g2, [%sp + 2047 + 128 + 0x00]
+       mov     1, %g2
+       stx     %g2, [%sp + 2047 + 128 + 0x08]
+       mov     0, %g2
+       stx     %g2, [%sp + 2047 + 128 + 0x10]
+       stx     %o0, [%sp + 2047 + 128 + 0x18]
+       sethi   %hi(p1275buf), %g2
+       or      %g2, %lo(p1275buf), %g2
+       ldx     [%g2 + 0x08], %o1
+       call    %o1
+        add    %sp, (2047 + 128), %o0
 
        /* Start using proper page size encodings in ctx register.  */
 2:     sethi   %hi(sparc64_kern_pri_context), %g3
@@ -769,7 +827,16 @@ sparc64_boot_end:
 #include "etrap.S"
 #include "rtrap.S"
 #include "winfixup.S"
-#include "entry.S"
+#include "fpu_traps.S"
+#include "ivec.S"
+#include "getsetcc.S"
+#include "utrap.S"
+#include "spiterrs.S"
+#include "cherrs.S"
+#include "misctrap.S"
+#include "syscalls.S"
+#include "helpers.S"
+#include "hvcalls.S"
 #include "sun4v_tlb_miss.S"
 #include "sun4v_ivec.S"
 #include "ktlb.S"