xref: /openbmc/qemu/hw/m68k/bootinfo.h (revision 2182e405)
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 
15 #define BOOTINFO0(as, base, id) \
16     do { \
17         stw_phys(as, base, id); \
18         base += 2; \
19         stw_phys(as, base, sizeof(struct bi_record)); \
20         base += 2; \
21     } while (0)
22 
23 #define BOOTINFO1(as, base, id, value) \
24     do { \
25         stw_phys(as, base, id); \
26         base += 2; \
27         stw_phys(as, base, sizeof(struct bi_record) + 4); \
28         base += 2; \
29         stl_phys(as, base, value); \
30         base += 4; \
31     } while (0)
32 
33 #define BOOTINFO2(as, base, id, value1, value2) \
34     do { \
35         stw_phys(as, base, id); \
36         base += 2; \
37         stw_phys(as, base, sizeof(struct bi_record) + 8); \
38         base += 2; \
39         stl_phys(as, base, value1); \
40         base += 4; \
41         stl_phys(as, base, value2); \
42         base += 4; \
43     } while (0)
44 
45 #define BOOTINFOSTR(as, base, id, string) \
46     do { \
47         int i; \
48         stw_phys(as, base, id); \
49         base += 2; \
50         stw_phys(as, base, \
51                  (sizeof(struct bi_record) + strlen(string) + 2) & ~1); \
52         base += 2; \
53         for (i = 0; string[i]; i++) { \
54             stb_phys(as, base++, string[i]); \
55         } \
56         stb_phys(as, base++, 0); \
57         base = (parameters_base + 1) & ~1; \
58     } while (0)
59 #endif
60