1/*	$NetBSD: kcore.h,v 1.5 2008/04/28 20:23:26 martin 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 Utah-derived pmaps
 56 */
 57#define	M68K_NPHYS_RAM_SEGS	8	/* XXX */
 58struct m68k_kcore_hdr {
 59	int32_t		mmutype;	/* MMU type */
 60	u_int32_t	sg_v;		/* STE bits */
 61	u_int32_t	sg_frame;
 62	u_int32_t	sg_ishift;
 63	u_int32_t	sg_pmask;
 64	u_int32_t	sg40_shift1;
 65	u_int32_t	sg40_mask2;
 66	u_int32_t	sg40_shift2;
 67	u_int32_t	sg40_mask3;
 68	u_int32_t	sg40_shift3;
 69	u_int32_t	sg40_addr1;
 70	u_int32_t	sg40_addr2;
 71	u_int32_t	pg_v;		/* PTE bits */
 72	u_int32_t	pg_frame;
 73	u_int32_t	sysseg_pa;	/* PA of Sysseg[] */
 74	u_int32_t	reloc;		/* value added to relocate a symbol
 75					   before address translation is
 76					   enabled */
 77	u_int32_t	relocend;	/* if kernbase < va < relocend, we
 78					   can do simple relocation to get
 79					   the physical address */
 80	phys_ram_seg_t	ram_segs[M68K_NPHYS_RAM_SEGS];
 81};
 82
 83/*
 84 * kcore information for the sun2
 85 */
 86struct sun2_kcore_hdr {
 87	u_int32_t	segshift;
 88	u_int32_t	pg_frame;	/* PTE bits */
 89	u_int32_t	pg_valid;
 90	u_int8_t	ksegmap[512];	/* kernel segment map */
 91};
 92
 93/*
 94 * kcore information for the sun3
 95 */
 96struct sun3_kcore_hdr {
 97	u_int32_t	segshift;
 98	u_int32_t	pg_frame;	/* PTE bits */
 99	u_int32_t	pg_valid;
100	u_int8_t	ksegmap[256];	/* kernel segment map */
101};
102
103/*
104 * kcore information for the sun3x; Motorola MMU, but a very
105 * different pmap.
106 */
107#define	SUN3X_NPHYS_RAM_SEGS	4
108struct sun3x_kcore_hdr {
109	u_int32_t	pg_frame;	/* PTE bits */
110	u_int32_t	pg_valid;
111	u_int32_t	contig_end;
112	u_int32_t	kernCbase;	/* VA of kernel level C page table */
113	phys_ram_seg_t	ram_segs[SUN3X_NPHYS_RAM_SEGS];
114};
115
116/*
117 * Catch-all header.  "un" is interpreted based on the contents of "name".
118 */
119struct cpu_kcore_hdr {
120	char		name[16];	/* machine name */
121	u_int32_t	page_size;	/* hardware page size */
122	u_int32_t	kernbase;	/* start of KVA space */
123	union {
124		struct m68k_kcore_hdr _m68k;
125		struct sun2_kcore_hdr _sun2;
126		struct sun3_kcore_hdr _sun3;
127		struct sun3x_kcore_hdr _sun3x;
128	} un;
129};
130
131typedef struct cpu_kcore_hdr cpu_kcore_hdr_t;
132
133#endif /* _M68K_KCORE_H_ */