Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * This file is subject to the terms and conditions of the GNU General Public
0003  * License.  See the file "COPYING" in the main directory of this archive
0004  * for more details.
0005  *
0006  * Copyright (C) 2000 Silicon Graphics, Inc.
0007  * Copyright (C) 2005 Ralf Baechle <ralf@linux-mips.org>
0008  */
0009 #ifndef __ASM_MACH_IP27_KERNEL_ENTRY_H
0010 #define __ASM_MACH_IP27_KERNEL_ENTRY_H
0011 
0012 #include <asm/sn/addrs.h>
0013 #include <asm/sn/agent.h>
0014 #include <asm/sn/klkernvars.h>
0015 
0016 /*
0017  * TLB bits
0018  */
0019 #define PAGE_GLOBAL     (1 << 6)
0020 #define PAGE_VALID      (1 << 7)
0021 #define PAGE_DIRTY      (1 << 8)
0022 #define CACHE_CACHABLE_COW  (5 << 9)
0023 
0024     /*
0025      * inputs are the text nasid in t1, data nasid in t2.
0026      */
0027     .macro MAPPED_KERNEL_SETUP_TLB
0028 #ifdef CONFIG_MAPPED_KERNEL
0029     /*
0030      * This needs to read the nasid - assume 0 for now.
0031      * Drop in 0xffffffffc0000000 in tlbhi, 0+VG in tlblo_0,
0032      * 0+DVG in tlblo_1.
0033      */
0034     dli t0, 0xffffffffc0000000
0035     dmtc0   t0, CP0_ENTRYHI
0036     li  t0, 0x1c000     # Offset of text into node memory
0037     dsll    t1, NASID_SHFT      # Shift text nasid into place
0038     dsll    t2, NASID_SHFT      # Same for data nasid
0039     or  t1, t1, t0      # Physical load address of kernel text
0040     or  t2, t2, t0      # Physical load address of kernel data
0041     dsrl    t1, 12          # 4K pfn
0042     dsrl    t2, 12          # 4K pfn
0043     dsll    t1, 6           # Get pfn into place
0044     dsll    t2, 6           # Get pfn into place
0045     li  t0, ((PAGE_GLOBAL | PAGE_VALID | CACHE_CACHABLE_COW) >> 6)
0046     or  t0, t0, t1
0047     mtc0    t0, CP0_ENTRYLO0    # physaddr, VG, cach exlwr
0048     li  t0, ((PAGE_GLOBAL | PAGE_VALID |  PAGE_DIRTY | CACHE_CACHABLE_COW) >> 6)
0049     or  t0, t0, t2
0050     mtc0    t0, CP0_ENTRYLO1    # physaddr, DVG, cach exlwr
0051     li  t0, 0x1ffe000       # MAPPED_KERN_TLBMASK, TLBPGMASK_16M
0052     mtc0    t0, CP0_PAGEMASK
0053     li  t0, 0           # KMAP_INX
0054     mtc0    t0, CP0_INDEX
0055     li  t0, 1
0056     mtc0    t0, CP0_WIRED
0057     tlbwi
0058 #else
0059     mtc0    zero, CP0_WIRED
0060 #endif
0061     .endm
0062 
0063 /*
0064  * Intentionally empty macro, used in head.S. Override in
0065  * arch/mips/mach-xxx/kernel-entry-init.h when necessary.
0066  */
0067     .macro  kernel_entry_setup
0068     GET_NASID_ASM   t1
0069     move        t2, t1          # text and data are here
0070     MAPPED_KERNEL_SETUP_TLB
0071     .endm
0072 
0073 /*
0074  * Do SMP slave processor setup necessary before we can safely execute C code.
0075  */
0076     .macro  smp_slave_setup
0077     GET_NASID_ASM   t1
0078     dli t0, KLDIR_OFFSET + (KLI_KERN_VARS * KLDIR_ENT_SIZE) + \
0079             KLDIR_OFF_POINTER + CAC_BASE
0080     dsll    t1, NASID_SHFT
0081     or  t0, t0, t1
0082     ld  t0, 0(t0)           # t0 points to kern_vars struct
0083     lh  t1, KV_RO_NASID_OFFSET(t0)
0084     lh  t2, KV_RW_NASID_OFFSET(t0)
0085     MAPPED_KERNEL_SETUP_TLB
0086 
0087     /*
0088      * We might not get launched at the address the kernel is linked to,
0089      * so we jump there.
0090      */
0091     PTR_LA  t0, 0f
0092     jr  t0
0093 0:
0094     .endm
0095 
0096 #endif /* __ASM_MACH_IP27_KERNEL_ENTRY_H */