Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * File created by Kanoj Sarcar 06/06/00.
0004  * Copyright 2000 Silicon Graphics, Inc.
0005  */
0006 #ifndef __ASM_SN_MAPPED_KERNEL_H
0007 #define __ASM_SN_MAPPED_KERNEL_H
0008 
0009 #include <linux/mmzone.h>
0010 
0011 /*
0012  * Note on how mapped kernels work: the text and data section is
0013  * compiled at cksseg segment (LOADADDR = 0xc001c000), and the
0014  * init/setup/data section gets a 16M virtual address bump in the
0015  * ld.script file (so that tlblo0 and tlblo1 maps the sections).
0016  * The vmlinux.64 section addresses are put in the xkseg range
0017  * using the change-addresses makefile option. Use elfdump -of
0018  * on IRIX to see where the sections go. The Origin loader loads
0019  * the two sections contiguously in physical memory. The loader
0020  * sets the entry point into kernel_entry using a xkphys address,
0021  * but instead of using 0xa800000001160000, it uses the address
0022  * 0xa800000000160000, which is where it physically loaded that
0023  * code. So no jumps can be done before we have switched to using
0024  * cksseg addresses.
0025  */
0026 #include <asm/addrspace.h>
0027 
0028 #define REP_BASE    CAC_BASE
0029 
0030 #ifdef CONFIG_MAPPED_KERNEL
0031 
0032 #define MAPPED_ADDR_RO_TO_PHYS(x)   (x - REP_BASE)
0033 #define MAPPED_ADDR_RW_TO_PHYS(x)   (x - REP_BASE - 16777216)
0034 
0035 #define MAPPED_KERN_RO_PHYSBASE(n) (hub_data(n)->kern_vars.kv_ro_baseaddr)
0036 #define MAPPED_KERN_RW_PHYSBASE(n) (hub_data(n)->kern_vars.kv_rw_baseaddr)
0037 
0038 #define MAPPED_KERN_RO_TO_PHYS(x) \
0039                 ((unsigned long)MAPPED_ADDR_RO_TO_PHYS(x) | \
0040                 MAPPED_KERN_RO_PHYSBASE(get_nasid()))
0041 #define MAPPED_KERN_RW_TO_PHYS(x) \
0042                 ((unsigned long)MAPPED_ADDR_RW_TO_PHYS(x) | \
0043                 MAPPED_KERN_RW_PHYSBASE(get_nasid()))
0044 
0045 #else /* CONFIG_MAPPED_KERNEL */
0046 
0047 #define MAPPED_KERN_RO_TO_PHYS(x)   (x - REP_BASE)
0048 #define MAPPED_KERN_RW_TO_PHYS(x)   (x - REP_BASE)
0049 
0050 #endif /* CONFIG_MAPPED_KERNEL */
0051 
0052 #define MAPPED_KERN_RO_TO_K0(x) PHYS_TO_K0(MAPPED_KERN_RO_TO_PHYS(x))
0053 #define MAPPED_KERN_RW_TO_K0(x) PHYS_TO_K0(MAPPED_KERN_RW_TO_PHYS(x))
0054 
0055 #endif /* __ASM_SN_MAPPED_KERNEL_H  */