xref: /openbmc/qemu/hw/m68k/bootinfo.h (revision e3a99063)
1 /*
2  * SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note
3  *
4  * Bootinfo tags from linux bootinfo.h and bootinfo-mac.h:
5  * This is an easily parsable and extendable structure containing all
6  * information to be passed from the bootstrap to the kernel
7  *
8  * This structure is copied right after the kernel by the bootstrap
9  * routine.
10  */
11 
12 #ifndef HW_M68K_BOOTINFO_H
13 #define HW_M68K_BOOTINFO_H
14 struct bi_record {
15     uint16_t tag;        /* tag ID */
16     uint16_t size;       /* size of record */
17     uint32_t data[];     /* data */
18 };
19 
20 /* machine independent tags */
21 
22 #define BI_LAST         0x0000 /* last record */
23 #define BI_MACHTYPE     0x0001 /* machine type (u_long) */
24 #define BI_CPUTYPE      0x0002 /* cpu type (u_long) */
25 #define BI_FPUTYPE      0x0003 /* fpu type (u_long) */
26 #define BI_MMUTYPE      0x0004 /* mmu type (u_long) */
27 #define BI_MEMCHUNK     0x0005 /* memory chunk address and size */
28                                /* (struct mem_info) */
29 #define BI_RAMDISK      0x0006 /* ramdisk address and size */
30                                /* (struct mem_info) */
31 #define BI_COMMAND_LINE 0x0007 /* kernel command line parameters */
32                                /* (string) */
33 
34 /*  Macintosh-specific tags (all u_long) */
35 
36 #define BI_MAC_MODEL    0x8000  /* Mac Gestalt ID (model type) */
37 #define BI_MAC_VADDR    0x8001  /* Mac video base address */
38 #define BI_MAC_VDEPTH   0x8002  /* Mac video depth */
39 #define BI_MAC_VROW     0x8003  /* Mac video rowbytes */
40 #define BI_MAC_VDIM     0x8004  /* Mac video dimensions */
41 #define BI_MAC_VLOGICAL 0x8005  /* Mac video logical base */
42 #define BI_MAC_SCCBASE  0x8006  /* Mac SCC base address */
43 #define BI_MAC_BTIME    0x8007  /* Mac boot time */
44 #define BI_MAC_GMTBIAS  0x8008  /* Mac GMT timezone offset */
45 #define BI_MAC_MEMSIZE  0x8009  /* Mac RAM size (sanity check) */
46 #define BI_MAC_CPUID    0x800a  /* Mac CPU type (sanity check) */
47 #define BI_MAC_ROMBASE  0x800b  /* Mac system ROM base address */
48 
49 /*  Macintosh hardware profile data */
50 
51 #define BI_MAC_VIA1BASE 0x8010  /* Mac VIA1 base address (always present) */
52 #define BI_MAC_VIA2BASE 0x8011  /* Mac VIA2 base address (type varies) */
53 #define BI_MAC_VIA2TYPE 0x8012  /* Mac VIA2 type (VIA, RBV, OSS) */
54 #define BI_MAC_ADBTYPE  0x8013  /* Mac ADB interface type */
55 #define BI_MAC_ASCBASE  0x8014  /* Mac Apple Sound Chip base address */
56 #define BI_MAC_SCSI5380 0x8015  /* Mac NCR 5380 SCSI (base address, multi) */
57 #define BI_MAC_SCSIDMA  0x8016  /* Mac SCSI DMA (base address) */
58 #define BI_MAC_SCSI5396 0x8017  /* Mac NCR 53C96 SCSI (base address, multi) */
59 #define BI_MAC_IDETYPE  0x8018  /* Mac IDE interface type */
60 #define BI_MAC_IDEBASE  0x8019  /* Mac IDE interface base address */
61 #define BI_MAC_NUBUS    0x801a  /* Mac Nubus type (none, regular, pseudo) */
62 #define BI_MAC_SLOTMASK 0x801b  /* Mac Nubus slots present */
63 #define BI_MAC_SCCTYPE  0x801c  /* Mac SCC serial type (normal, IOP) */
64 #define BI_MAC_ETHTYPE  0x801d  /* Mac builtin ethernet type (Sonic, MACE */
65 #define BI_MAC_ETHBASE  0x801e  /* Mac builtin ethernet base address */
66 #define BI_MAC_PMU      0x801f  /* Mac power management / poweroff hardware */
67 #define BI_MAC_IOP_SWIM 0x8020  /* Mac SWIM floppy IOP */
68 #define BI_MAC_IOP_ADB  0x8021  /* Mac ADB IOP */
69 
70 #define BOOTINFO0(as, base, id) \
71     do { \
72         stw_phys(as, base, id); \
73         base += 2; \
74         stw_phys(as, base, sizeof(struct bi_record)); \
75         base += 2; \
76     } while (0)
77 
78 #define BOOTINFO1(as, base, id, value) \
79     do { \
80         stw_phys(as, base, id); \
81         base += 2; \
82         stw_phys(as, base, sizeof(struct bi_record) + 4); \
83         base += 2; \
84         stl_phys(as, base, value); \
85         base += 4; \
86     } while (0)
87 
88 #define BOOTINFO2(as, base, id, value1, value2) \
89     do { \
90         stw_phys(as, base, id); \
91         base += 2; \
92         stw_phys(as, base, sizeof(struct bi_record) + 8); \
93         base += 2; \
94         stl_phys(as, base, value1); \
95         base += 4; \
96         stl_phys(as, base, value2); \
97         base += 4; \
98     } while (0)
99 
100 #define BOOTINFOSTR(as, base, id, string) \
101     do { \
102         int i; \
103         stw_phys(as, base, id); \
104         base += 2; \
105         stw_phys(as, base, \
106                  (sizeof(struct bi_record) + strlen(string) + 2) & ~1); \
107         base += 2; \
108         for (i = 0; string[i]; i++) { \
109             stb_phys(as, base++, string[i]); \
110         } \
111         stb_phys(as, base++, 0); \
112         base = (parameters_base + 1) & ~1; \
113     } while (0)
114 #endif
115