summaryrefslogtreecommitdiffstats
path: root/hw/m68k/bootinfo.h
blob: adbf0c5521e5dd25ed2f2957e6edd1df2a952874 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/*
 * SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note
 *
 * Bootinfo tags from linux bootinfo.h and bootinfo-mac.h:
 * This is an easily parsable and extendable structure containing all
 * information to be passed from the bootstrap to the kernel
 *
 * This structure is copied right after the kernel by the bootstrap
 * routine.
 */

#ifndef HW_M68K_BOOTINFO_H
#define HW_M68K_BOOTINFO_H

#define BOOTINFO0(as, base, id) \
    do { \
        stw_phys(as, base, id); \
        base += 2; \
        stw_phys(as, base, sizeof(struct bi_record)); \
        base += 2; \
    } while (0)

#define BOOTINFO1(as, base, id, value) \
    do { \
        stw_phys(as, base, id); \
        base += 2; \
        stw_phys(as, base, sizeof(struct bi_record) + 4); \
        base += 2; \
        stl_phys(as, base, value); \
        base += 4; \
    } while (0)

#define BOOTINFO2(as, base, id, value1, value2) \
    do { \
        stw_phys(as, base, id); \
        base += 2; \
        stw_phys(as, base, sizeof(struct bi_record) + 8); \
        base += 2; \
        stl_phys(as, base, value1); \
        base += 4; \
        stl_phys(as, base, value2); \
        base += 4; \
    } while (0)

#define BOOTINFOSTR(as, base, id, string) \
    do { \
        int i; \
        stw_phys(as, base, id); \
        base += 2; \
        stw_phys(as, base, \
                 (sizeof(struct bi_record) + strlen(string) + 2) & ~1); \
        base += 2; \
        for (i = 0; string[i]; i++) { \
            stb_phys(as, base++, string[i]); \
        } \
        stb_phys(as, base++, 0); \
        base = (parameters_base + 1) & ~1; \
    } while (0)
#endif