Home | History | Annotate | Line # | Download | only in include
      1 /*	$NetBSD: kcore.h,v 1.9 2025/11/26 23:02:11 thorpej Exp $	*/
      2 
      3 /*-
      4  * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
      5  * All rights reserved.
      6  *
      7  * This code is derived from software contributed to The NetBSD Foundation
      8  * by Gordon W. Ross, Jason R. Thorpe, and Leo Weppelman.
      9  *
     10  * Redistribution and use in source and binary forms, with or without
     11  * modification, are permitted provided that the following conditions
     12  * are met:
     13  * 1. Redistributions of source code must retain the above copyright
     14  *    notice, this list of conditions and the following disclaimer.
     15  * 2. Redistributions in binary form must reproduce the above copyright
     16  *    notice, this list of conditions and the following disclaimer in the
     17  *    documentation and/or other materials provided with the distribution.
     18  *
     19  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     20  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     21  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     22  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     23  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     24  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     29  * POSSIBILITY OF SUCH DAMAGE.
     30  */
     31 
     32 #ifndef _M68K_KCORE_H_
     33 #define	_M68K_KCORE_H_
     34 
     35 /*
     36  * Unified m68k kcore header descriptions.
     37  *
     38  * NOTE: We must have all possible m68k kcore types defined in this
     39  * file.  Otherwise, we require kernel sources for all m68k platforms
     40  * to build userland.
     41  *
     42  * We must provide STE/PTE bits in the kcore header for a couple
     43  * of reasons:
     44  *
     45  *	- different platforms may have the MMUs configured for different
     46  *	  page sizes
     47  *	- we may not have a specific platform's pte.h available to us
     48  *
     49  * These are on-disk structures; use fixed-sized types!
     50  *
     51  * The total size of the cpu_kcore_hdr should be <= DEV_BSIZE!
     52  */
     53 
     54 /*
     55  * kcore information for the new generic 68k pmap module.  This works
     56  * for all pmap implementations that support the 68851, 68030, 68040,
     57  * and 68060 MMUs (as well as the 68851-like HP MMU), because it relies
     58  * entirely on generic hardware configuration information, and not
     59  * any software-defined usage.
     60  *
     61  * The hardware description is in 68851 terms.  Both the 68040/68060
     62  * and HP MMU can be described that way.  All of the configuration
     63  * information necessary is in the Translation Control Register.
     64  *
     65  * Transparent Translation information is also included, as is the
     66  * kernel's MMU_* value for this system.
     67  */
     68 #define	GEN68K_NPHYS_RAM_SEGS	8	/* XXX */
     69 struct gen68k_kcore_hdr {
     70 	uint32_t	tcr;		/* Translation Control Register */
     71 	uint32_t	srp[2];		/* Supervisor Root Pointer */
     72 
     73 	uint32_t	tt0;		/* 68030 TT0 / 68040 DTT0 */
     74 	uint32_t	tt1;		/* 68030 TT1 / 68040 DTT1 */
     75 
     76 	uint32_t	itt0;		/* 68040 ITT0 */
     77 	uint32_t	itt1;		/* 68040 ITT1 */
     78 
     79 	int32_t		mmutype;	/* MMU_* value */
     80 	uint32_t	reloc;		/* value added to relocate a symbol
     81 					   before address translation is
     82 					   enabled */
     83 	uint32_t	relocend;	/* if kernbase < va < relocend, we
     84 					   can do simple relocation to get
     85 					   the physical address */
     86 
     87 	phys_ram_seg_t	ram_segs[GEN68K_NPHYS_RAM_SEGS];
     88 };
     89 
     90 /*
     91  * kcore information for Utah-derived pmaps
     92  */
     93 #define	M68K_NPHYS_RAM_SEGS	8	/* XXX */
     94 struct m68k_kcore_hdr {
     95 	int32_t		mmutype;	/* MMU type */
     96 	uint32_t	sg_v;		/* STE bits */
     97 	uint32_t	sg_frame;
     98 	uint32_t	sg_ishift;
     99 	uint32_t	sg_pmask;
    100 	uint32_t	sg40_shift1;
    101 	uint32_t	sg40_mask2;
    102 	uint32_t	sg40_shift2;
    103 	uint32_t	sg40_mask3;
    104 	uint32_t	sg40_shift3;
    105 	uint32_t	sg40_addr1;
    106 	uint32_t	sg40_addr2;
    107 	uint32_t	pg_v;		/* PTE bits */
    108 	uint32_t	pg_frame;
    109 	uint32_t	sysseg_pa;	/* PA of Sysseg[] */
    110 	uint32_t	reloc;		/* value added to relocate a symbol
    111 					   before address translation is
    112 					   enabled */
    113 	uint32_t	relocend;	/* if kernbase < va < relocend, we
    114 					   can do simple relocation to get
    115 					   the physical address */
    116 	phys_ram_seg_t	ram_segs[M68K_NPHYS_RAM_SEGS];
    117 };
    118 
    119 /*
    120  * kcore information for the sun2
    121  */
    122 struct sun2_kcore_hdr {
    123 	uint32_t	segshift;
    124 	uint32_t	pg_frame;	/* PTE bits */
    125 	uint32_t	pg_valid;
    126 	uint8_t		ksegmap[512];	/* kernel segment map */
    127 };
    128 
    129 /*
    130  * kcore information for the sun3
    131  */
    132 struct sun3_kcore_hdr {
    133 	uint32_t	segshift;
    134 	uint32_t	pg_frame;	/* PTE bits */
    135 	uint32_t	pg_valid;
    136 	uint8_t		ksegmap[256];	/* kernel segment map */
    137 };
    138 
    139 /*
    140  * kcore information for the sun3x; Motorola MMU, but a very
    141  * different pmap.
    142  */
    143 #define	SUN3X_NPHYS_RAM_SEGS	4
    144 struct sun3x_kcore_hdr {
    145 	uint32_t	pg_frame;	/* PTE bits */
    146 	uint32_t	pg_valid;
    147 	uint32_t	contig_end;
    148 	uint32_t	kernCbase;	/* VA of kernel level C page table */
    149 	phys_ram_seg_t	ram_segs[SUN3X_NPHYS_RAM_SEGS];
    150 };
    151 
    152 /*
    153  * Catch-all header.  "un" is interpreted based on the contents of "name".
    154  */
    155 struct cpu_kcore_hdr {
    156 	char		name[16];	/* machine name */
    157 	uint32_t	page_size;	/* hardware page size */
    158 	uint32_t	kernbase;	/* start of KVA space */
    159 	union {
    160 		struct gen68k_kcore_hdr _gen68k;
    161 		struct m68k_kcore_hdr _m68k;
    162 		struct sun2_kcore_hdr _sun2;
    163 		struct sun3_kcore_hdr _sun3;
    164 		struct sun3x_kcore_hdr _sun3x;
    165 	} un;
    166 };
    167 
    168 typedef struct cpu_kcore_hdr cpu_kcore_hdr_t;
    169 
    170 #endif /* _M68K_KCORE_H_ */
    171