Home | History | Annotate | Line # | Download | only in include
      1 /*	$NetBSD: pmap.h,v 1.42 2026/05/19 21:41:21 andvar Exp $	*/
      2 
      3 #ifndef _MAC68K_PMAP_H_
      4 #define	_MAC68K_PMAP_H_
      5 
      6 #ifdef __HAVE_NEW_PMAP_68K
      7 /*
      8  * On mac68k, pmap_bootstrap1() may be called with the MMU off
      9  * (and running VA==PA) *or* with the MMU on with foreign mappings
     10  * (this can be the case on Macs where the frame buffer is located
     11  * at $0000.0000 and the MMU is used by MacOS to simulate the
     12  * traditional MacOS memory map).
     13  *
     14  * In either case, we do not need any relocations to reference global
     15  * symbols.  However, in the latter case, we have to account for where
     16  * we've actually been loaded in order to access any real physical
     17  * addresses.
     18  *
     19  * To override these macros, define them before including <m68k/pmap_68k.h>.
     20  */
     21 #define	PMAP_BOOTSTRAP_RELOC_GLOB(va)	((vaddr_t)(va))
     22 #define	PMAP_BOOTSTRAP_RELOC_PA(pa)	(((vaddr_t)(pa)) - reloff)
     23 
     24 #include <m68k/pmap_68k.h>
     25 
     26 /*
     27  * We need to map the region between the start of kernel text and
     28  * start() read/write-write-through-cacheable, as this region contains
     29  * the vector table and the MacOS "low ram" with a bunch of variables
     30  * used by the ROMs.  We override the default kernel text protection
     31  * mode for pmap_bootstrap1() here, and then fix up the region between
     32  * start() and etext to be read-only once we're running on the kernel's
     33  * mappings.
     34  */
     35 #define	PMAP_BOOTSTRAP_TEXT_PROTO_PTE	(PTE_VALID|PTE_WIRED)
     36 
     37 #define	PMAP_MACHINE_CHECK_BOOTSTRAP_ALLOCATIONS
     38 #else
     39 #include <m68k/pmap_motorola.h>
     40 
     41 paddr_t	pmap_bootstrap1(paddr_t, paddr_t);
     42 #endif /* __HAVE_NEW_PMAP_68K */
     43 
     44 void	pmap_machine_check_bootstrap_allocations(paddr_t, paddr_t);
     45 
     46 #include <m68k/mmu_30.h>
     47 
     48 /*
     49  * Transparent translation register used in locore.s:get_pte().
     50  * User Data set up for R/W access of the entire address space.
     51  *
     52  * (XXX TT30_RW isn't actually needed because of TT30_RWM, but
     53  * this the value historically used.)
     54  */
     55 #define	MAC68K_TT_GET_PTE	(0x00000000 |				\
     56 				 __SHIFTIN(0xff,TT30_LAM) |		\
     57 				 TT30_E | TT30_CI | TT30_RW | TT30_RWM |\
     58 				 TT30_USERD)
     59 
     60 #endif /* _MAC68K_PMAP_H_ */
     61