1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */ 2384740dcSRalf Baechle /* 3384740dcSRalf Baechle * File created by Kanoj Sarcar 06/06/00. 4384740dcSRalf Baechle * Copyright 2000 Silicon Graphics, Inc. 5384740dcSRalf Baechle */ 6384740dcSRalf Baechle #ifndef __ASM_SN_MAPPED_KERNEL_H 7384740dcSRalf Baechle #define __ASM_SN_MAPPED_KERNEL_H 8384740dcSRalf Baechle 9384740dcSRalf Baechle #include <linux/mmzone.h> 10384740dcSRalf Baechle 11384740dcSRalf Baechle /* 12384740dcSRalf Baechle * Note on how mapped kernels work: the text and data section is 13384740dcSRalf Baechle * compiled at cksseg segment (LOADADDR = 0xc001c000), and the 14384740dcSRalf Baechle * init/setup/data section gets a 16M virtual address bump in the 15384740dcSRalf Baechle * ld.script file (so that tlblo0 and tlblo1 maps the sections). 16384740dcSRalf Baechle * The vmlinux.64 section addresses are put in the xkseg range 17384740dcSRalf Baechle * using the change-addresses makefile option. Use elfdump -of 18384740dcSRalf Baechle * on IRIX to see where the sections go. The Origin loader loads 19384740dcSRalf Baechle * the two sections contiguously in physical memory. The loader 20384740dcSRalf Baechle * sets the entry point into kernel_entry using a xkphys address, 21384740dcSRalf Baechle * but instead of using 0xa800000001160000, it uses the address 22384740dcSRalf Baechle * 0xa800000000160000, which is where it physically loaded that 23384740dcSRalf Baechle * code. So no jumps can be done before we have switched to using 24384740dcSRalf Baechle * cksseg addresses. 25384740dcSRalf Baechle */ 26384740dcSRalf Baechle #include <asm/addrspace.h> 27384740dcSRalf Baechle 28384740dcSRalf Baechle #define REP_BASE CAC_BASE 29384740dcSRalf Baechle 30384740dcSRalf Baechle #ifdef CONFIG_MAPPED_KERNEL 31384740dcSRalf Baechle 32384740dcSRalf Baechle #define MAPPED_ADDR_RO_TO_PHYS(x) (x - REP_BASE) 33384740dcSRalf Baechle #define MAPPED_ADDR_RW_TO_PHYS(x) (x - REP_BASE - 16777216) 34384740dcSRalf Baechle 35384740dcSRalf Baechle #define MAPPED_KERN_RO_PHYSBASE(n) (hub_data(n)->kern_vars.kv_ro_baseaddr) 36384740dcSRalf Baechle #define MAPPED_KERN_RW_PHYSBASE(n) (hub_data(n)->kern_vars.kv_rw_baseaddr) 37384740dcSRalf Baechle 38384740dcSRalf Baechle #define MAPPED_KERN_RO_TO_PHYS(x) \ 39384740dcSRalf Baechle ((unsigned long)MAPPED_ADDR_RO_TO_PHYS(x) | \ 404bf841ebSThomas Bogendoerfer MAPPED_KERN_RO_PHYSBASE(get_nasid())) 41384740dcSRalf Baechle #define MAPPED_KERN_RW_TO_PHYS(x) \ 42384740dcSRalf Baechle ((unsigned long)MAPPED_ADDR_RW_TO_PHYS(x) | \ 434bf841ebSThomas Bogendoerfer MAPPED_KERN_RW_PHYSBASE(get_nasid())) 44384740dcSRalf Baechle 45384740dcSRalf Baechle #else /* CONFIG_MAPPED_KERNEL */ 46384740dcSRalf Baechle 47384740dcSRalf Baechle #define MAPPED_KERN_RO_TO_PHYS(x) (x - REP_BASE) 48384740dcSRalf Baechle #define MAPPED_KERN_RW_TO_PHYS(x) (x - REP_BASE) 49384740dcSRalf Baechle 50384740dcSRalf Baechle #endif /* CONFIG_MAPPED_KERNEL */ 51384740dcSRalf Baechle 52384740dcSRalf Baechle #define MAPPED_KERN_RO_TO_K0(x) PHYS_TO_K0(MAPPED_KERN_RO_TO_PHYS(x)) 53384740dcSRalf Baechle #define MAPPED_KERN_RW_TO_K0(x) PHYS_TO_K0(MAPPED_KERN_RW_TO_PHYS(x)) 54384740dcSRalf Baechle 55384740dcSRalf Baechle #endif /* __ASM_SN_MAPPED_KERNEL_H */ 56