1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2 /*
3  * asm/bootinfo.h -- Definition of the Linux/m68k boot information structure
4  *
5  * Copyright 1992 by Greg Harp
6  *
7  * This file is subject to the terms and conditions of the GNU General Public
8  * License.  See the file COPYING in the main directory of this archive
9  * for more details.
10  */
11 
12 #ifndef _UAPI_ASM_M68K_BOOTINFO_H
13 #define _UAPI_ASM_M68K_BOOTINFO_H
14 
15 
16     /*
17      *  Bootinfo definitions
18      *
19      *  This is an easily parsable and extendable structure containing all
20      *  information to be passed from the bootstrap to the kernel.
21      *
22      *  This way I hope to keep all future changes back/forewards compatible.
23      *  Thus, keep your fingers crossed...
24      *
25      *  This structure is copied right after the kernel by the bootstrap
26      *  routine.
27      */
28 
29 struct bi_record {
30 	uint16_t tag;			/* tag ID */
31 	uint16_t size;			/* size of record (in bytes) */
32 	uint32_t data[0];			/* data */
33 };
34 
35 
36 struct mem_info {
37 	uint32_t addr;			/* physical address of memory chunk */
38 	uint32_t size;			/* length of memory chunk (in bytes) */
39 };
40 
41 
42     /*
43      *  Tag Definitions
44      *
45      *  Machine independent tags start counting from 0x0000
46      *  Machine dependent tags start counting from 0x8000
47      */
48 
49 #define BI_LAST			0x0000	/* last record (sentinel) */
50 #define BI_MACHTYPE		0x0001	/* machine type (uint32_t) */
51 #define BI_CPUTYPE		0x0002	/* cpu type (uint32_t) */
52 #define BI_FPUTYPE		0x0003	/* fpu type (uint32_t) */
53 #define BI_MMUTYPE		0x0004	/* mmu type (uint32_t) */
54 #define BI_MEMCHUNK		0x0005	/* memory chunk address and size */
55 					/* (struct mem_info) */
56 #define BI_RAMDISK		0x0006	/* ramdisk address and size */
57 					/* (struct mem_info) */
58 #define BI_COMMAND_LINE		0x0007	/* kernel command line parameters */
59 					/* (string) */
60 
61 
62     /*
63      *  Linux/m68k Architectures (BI_MACHTYPE)
64      */
65 
66 #define MACH_AMIGA		1
67 #define MACH_ATARI		2
68 #define MACH_MAC		3
69 #define MACH_APOLLO		4
70 #define MACH_SUN3		5
71 #define MACH_MVME147		6
72 #define MACH_MVME16x		7
73 #define MACH_BVME6000		8
74 #define MACH_HP300		9
75 #define MACH_Q40		10
76 #define MACH_SUN3X		11
77 #define MACH_M54XX		12
78 #define MACH_M5441X		13
79 #define MACH_VIRT		14
80 
81 
82     /*
83      *  CPU, FPU and MMU types (BI_CPUTYPE, BI_FPUTYPE, BI_MMUTYPE)
84      *
85      *  Note: we may rely on the following equalities:
86      *
87      *      CPU_68020 == MMU_68851
88      *      CPU_68030 == MMU_68030
89      *      CPU_68040 == FPU_68040 == MMU_68040
90      *      CPU_68060 == FPU_68060 == MMU_68060
91      */
92 
93 #define CPUB_68020		0
94 #define CPUB_68030		1
95 #define CPUB_68040		2
96 #define CPUB_68060		3
97 #define CPUB_COLDFIRE		4
98 
99 #define CPU_68020		(1 << CPUB_68020)
100 #define CPU_68030		(1 << CPUB_68030)
101 #define CPU_68040		(1 << CPUB_68040)
102 #define CPU_68060		(1 << CPUB_68060)
103 #define CPU_COLDFIRE		(1 << CPUB_COLDFIRE)
104 
105 #define FPUB_68881		0
106 #define FPUB_68882		1
107 #define FPUB_68040		2	/* Internal FPU */
108 #define FPUB_68060		3	/* Internal FPU */
109 #define FPUB_SUNFPA		4	/* Sun-3 FPA */
110 #define FPUB_COLDFIRE		5	/* ColdFire FPU */
111 
112 #define FPU_68881		(1 << FPUB_68881)
113 #define FPU_68882		(1 << FPUB_68882)
114 #define FPU_68040		(1 << FPUB_68040)
115 #define FPU_68060		(1 << FPUB_68060)
116 #define FPU_SUNFPA		(1 << FPUB_SUNFPA)
117 #define FPU_COLDFIRE		(1 << FPUB_COLDFIRE)
118 
119 #define MMUB_68851		0
120 #define MMUB_68030		1	/* Internal MMU */
121 #define MMUB_68040		2	/* Internal MMU */
122 #define MMUB_68060		3	/* Internal MMU */
123 #define MMUB_APOLLO		4	/* Custom Apollo */
124 #define MMUB_SUN3		5	/* Custom Sun-3 */
125 #define MMUB_COLDFIRE		6	/* Internal MMU */
126 
127 #define MMU_68851		(1 << MMUB_68851)
128 #define MMU_68030		(1 << MMUB_68030)
129 #define MMU_68040		(1 << MMUB_68040)
130 #define MMU_68060		(1 << MMUB_68060)
131 #define MMU_SUN3		(1 << MMUB_SUN3)
132 #define MMU_APOLLO		(1 << MMUB_APOLLO)
133 #define MMU_COLDFIRE		(1 << MMUB_COLDFIRE)
134 
135 
136     /*
137      * Stuff for bootinfo interface versioning
138      *
139      * At the start of kernel code, a 'struct bootversion' is located.
140      * bootstrap checks for a matching version of the interface before booting
141      * a kernel, to avoid user confusion if kernel and bootstrap don't work
142      * together :-)
143      *
144      * If incompatible changes are made to the bootinfo interface, the major
145      * number below should be stepped (and the minor reset to 0) for the
146      * appropriate machine. If a change is backward-compatible, the minor
147      * should be stepped. "Backwards-compatible" means that booting will work,
148      * but certain features may not.
149      */
150 
151 #define BOOTINFOV_MAGIC			0x4249561A	/* 'BIV^Z' */
152 #define MK_BI_VERSION(major, minor)	(((major) << 16) + (minor))
153 #define BI_VERSION_MAJOR(v)		(((v) >> 16) & 0xffff)
154 #define BI_VERSION_MINOR(v)		((v) & 0xffff)
155 
156 struct bootversion {
157 	uint16_t branch;
158 	uint32_t magic;
159 	struct {
160 		uint32_t machtype;
161 		uint32_t version;
162 	} machversions[0];
163 } QEMU_PACKED;
164 
165 
166 #endif /* _UAPI_ASM_M68K_BOOTINFO_H */
167