]> err.no Git - linux-2.6/blobdiff - arch/sparc64/kernel/head.S
[SPARC64]: Elminate all usage of hard-coded trap globals.
[linux-2.6] / arch / sparc64 / kernel / head.S
index 4c942f71184daa9d69345404794dc82be834fa2c..82ce5bced9c70defe5d553583feec4919aadba4d 100644 (file)
 #include <asm/head.h>
 #include <asm/ttable.h>
 #include <asm/mmu.h>
+#include <asm/cpudata.h>
        
 /* This section from from _start to sparc64_boot_end should fit into
- * 0x0000.0000.0040.4000 to 0x0000.0000.0040.8000 and will be sharing space
- * with bootup_user_stack, which is from 0x0000.0000.0040.4000 to
- * 0x0000.0000.0040.6000 and empty_bad_page, which is from
- * 0x0000.0000.0040.6000 to 0x0000.0000.0040.8000. 
+ * 0x0000000000404000 to 0x0000000000408000.
  */
-
        .text
        .globl  start, _start, stext, _stext
 _start:
 start:
 _stext:
 stext:
-bootup_user_stack:
 ! 0x0000000000404000
        b       sparc64_boot
         flushw                                 /* Flush register file.      */
@@ -392,31 +388,30 @@ tlb_fixup_done:
         * former does use this code, the latter does not yet due
         * to some complexities.  That should be fixed up at some
         * point.
+        *
+        * There used to be enormous complexity wrt. transferring
+        * over from the firwmare's trap table to the Linux kernel's.
+        * For example, there was a chicken & egg problem wrt. building
+        * the OBP page tables, yet needing to be on the Linux kernel
+        * trap table (to translate PAGE_OFFSET addresses) in order to
+        * do that.
+        *
+        * We now handle OBP tlb misses differently, via linear lookups
+        * into the prom_trans[] array.  So that specific problem no
+        * longer exists.  Yet, unfortunately there are still some issues
+        * preventing trampoline.S from using this code... ho hum.
         */
        .globl  setup_trap_table
 setup_trap_table:
        save    %sp, -192, %sp
 
-       /* Force interrupts to be disabled.  Transferring over to
-        * the Linux trap table is a very delicate operation.
-        * Until we are actually on the Linux trap table, we cannot
-        * get the PAGE_OFFSET linear mappings translated.  We need
-        * that mapping to be setup in order to initialize the firmware
-        * page tables.
-        *
-        * So there is this window of time, from the return from
-        * prom_set_trap_table() until inherit_prom_mappings_post()
-        * (in arch/sparc64/mm/init.c) completes, during which no
-        * firmware address space accesses can be made.
-        */
+       /* Force interrupts to be disabled. */
        rdpr    %pstate, %o1
        andn    %o1, PSTATE_IE, %o1
        wrpr    %o1, 0x0, %pstate
        wrpr    %g0, 15, %pil
 
-       /* Ok, now make the final valid firmware call to jump over
-        * to the Linux trap table.
-        */
+       /* Make the firmware call to jump over to the Linux trap table.  */
        call    prom_set_trap_table
         sethi  %hi(sparc64_ttable_tl0), %o0
 
@@ -427,69 +422,6 @@ setup_trap_table:
        stxa    %g2, [%g1] ASI_DMMU
        membar  #Sync
 
-       /* The Linux trap handlers expect various trap global registers
-        * to be setup with some fixed values.  So here we set these
-        * up very carefully.  These globals are:
-        *
-        * Alternate Globals (PSTATE_AG):
-        *
-        * %g6                  --> current_thread_info()
-        *
-        * MMU Globals (PSTATE_MG):
-        *
-        * %g1                  --> TLB_SFSR
-        * %g2                  --> ((_PAGE_VALID | _PAGE_SZ4MB |
-        *                            _PAGE_CP | _PAGE_CV | _PAGE_P | _PAGE_W)
-        *                           ^ 0xfffff80000000000)
-        * (this %g2 value is used for computing the PAGE_OFFSET kernel
-        *  TLB entries quickly, the virtual address of the fault XOR'd
-        *  with this %g2 value is the PTE to load into the TLB)
-        * %g3                  --> VPTE_BASE_CHEETAH or VPTE_BASE_SPITFIRE
-        *
-        * Interrupt Globals (PSTATE_IG, setup by init_irqwork_curcpu()):
-        *
-        * %g6                  --> __irq_work[smp_processor_id()]
-        */
-
-       rdpr    %pstate, %o1
-       mov     %g6, %o2
-       wrpr    %o1, PSTATE_AG, %pstate
-       mov     %o2, %g6
-
-#define KERN_HIGHBITS          ((_PAGE_VALID|_PAGE_SZ4MB)^0xfffff80000000000)
-#define KERN_LOWBITS           (_PAGE_CP | _PAGE_CV | _PAGE_P | _PAGE_W)
-       wrpr    %o1, PSTATE_MG, %pstate
-       mov     TSB_REG, %g1
-       stxa    %g0, [%g1] ASI_DMMU
-       membar  #Sync
-       stxa    %g0, [%g1] ASI_IMMU
-       membar  #Sync
-       mov     TLB_SFSR, %g1
-       sethi   %uhi(KERN_HIGHBITS), %g2
-       or      %g2, %ulo(KERN_HIGHBITS), %g2
-       sllx    %g2, 32, %g2
-       or      %g2, KERN_LOWBITS, %g2
-
-       BRANCH_IF_ANY_CHEETAH(g3,g7,8f)
-       ba,pt   %xcc, 9f
-        nop
-
-8:
-       sethi           %uhi(VPTE_BASE_CHEETAH), %g3
-       or              %g3, %ulo(VPTE_BASE_CHEETAH), %g3
-       ba,pt           %xcc, 2f
-        sllx           %g3, 32, %g3
-
-9:
-       sethi           %uhi(VPTE_BASE_SPITFIRE), %g3
-       or              %g3, %ulo(VPTE_BASE_SPITFIRE), %g3
-       sllx            %g3, 32, %g3
-
-2:
-       clr     %g7
-#undef KERN_HIGHBITS
-#undef KERN_LOWBITS
-
        /* Kill PROM timer */
        sethi   %hi(0x80000000), %o2
        sllx    %o2, 32, %o2
@@ -508,7 +440,6 @@ setup_trap_table:
 
 2:
        wrpr    %g0, %g0, %wstate
-       wrpr    %o1, 0x0, %pstate
 
        call    init_irqwork_curcpu
         nop
@@ -540,15 +471,22 @@ setup_tba:        /* i0 = is_starfire */
 
        ret
         restore
+sparc64_boot_end:
+
+#include "systbls.S"
+#include "ktlb.S"
+#include "tsb.S"
+#include "etrap.S"
+#include "rtrap.S"
+#include "winfixup.S"
+#include "entry.S"
 
 /*
- * The following skips make sure the trap table in ttable.S is aligned
+ * The following skip makes sure the trap table in ttable.S is aligned
  * on a 32K boundary as required by the v9 specs for TBA register.
  */
-sparc64_boot_end:
-       .skip   0x2000 + _start - sparc64_boot_end
-bootup_user_stack_end:
-       .skip   0x2000
+1:
+       .skip   0x4000 + _start - 1b
 
 #ifdef CONFIG_SBUS
 /* This is just a hack to fool make depend config.h discovering
@@ -560,15 +498,6 @@ bootup_user_stack_end:
 ! 0x0000000000408000
 
 #include "ttable.S"
-#include "systbls.S"
-#include "ktlb.S"
-#include "etrap.S"
-#include "rtrap.S"
-#include "winfixup.S"
-#include "entry.S"
-
-       /* This is just anal retentiveness on my part... */
-       .align  16384
 
        .data
        .align  8