~pmdj/ubuntu/trusty/qemu/2.9+applesmc+fadtv3

« back to all changes in this revision

Viewing changes to roms/openbios/libopenbios/linuxbios.h

  • Committer: Phil Dennis-Jordan
  • Date: 2017-07-21 08:03:43 UTC
  • mfrom: (1.1.1)
  • Revision ID: phil@philjordan.eu-20170721080343-2yr2vdj7713czahv
New upstream release 2.9.0.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef LINUXBIOS_TABLES_H
 
2
#define LINUXBIOS_TABLES_H
 
3
 
 
4
/* The linuxbios table information is for conveying information
 
5
 * from the firmware to the loaded OS image.  Primarily this
 
6
 * is expected to be information that cannot be discovered by
 
7
 * other means, such as quering the hardware directly.
 
8
 *
 
9
 * All of the information should be Position Independent Data.
 
10
 * That is it should be safe to relocated any of the information
 
11
 * without it's meaning/correctnes changing.   For table that
 
12
 * can reasonably be used on multiple architectures the data
 
13
 * size should be fixed.  This should ease the transition between
 
14
 * 32 bit and 64 bit architectures etc.
 
15
 *
 
16
 * The completeness test for the information in this table is:
 
17
 * - Can all of the hardware be detected?
 
18
 * - Are the per motherboard constants available?
 
19
 * - Is there enough to allow a kernel to run that was written before
 
20
 *   a particular motherboard is constructed? (Assuming the kernel
 
21
 *   has drivers for all of the hardware but it does not have
 
22
 *   assumptions on how the hardware is connected together).
 
23
 *
 
24
 * With this test it should be straight forward to determine if a
 
25
 * table entry is required or not.  This should remove much of the
 
26
 * long term compatibility burden as table entries which are
 
27
 * irrelevant or have been replaced by better alternatives may be
 
28
 * dropped.  Of course it is polite and expidite to include extra
 
29
 * table entries and be backwards compatible, but it is not required.
 
30
 */
 
31
 
 
32
 
 
33
struct lb_header
 
34
{
 
35
        uint8_t  signature[4]; /* LBIO */
 
36
        uint32_t header_bytes;
 
37
        uint32_t header_checksum;
 
38
        uint32_t table_bytes;
 
39
        uint32_t table_checksum;
 
40
        uint32_t table_entries;
 
41
};
 
42
 
 
43
/* Every entry in the boot enviroment list will correspond to a boot
 
44
 * info record.  Encoding both type and size.  The type is obviously
 
45
 * so you can tell what it is.  The size allows you to skip that
 
46
 * boot enviroment record if you don't know what it easy.  This allows
 
47
 * forward compatibility with records not yet defined.
 
48
 */
 
49
struct lb_record {
 
50
        uint32_t tag;           /* tag ID */
 
51
        uint32_t size;          /* size of record (in bytes) */
 
52
};
 
53
 
 
54
#define LB_TAG_UNUSED   0x0000
 
55
 
 
56
#define LB_TAG_MEMORY   0x0001
 
57
 
 
58
struct lb_memory_range {
 
59
        uint64_t start;
 
60
        uint64_t size;
 
61
        uint32_t type;
 
62
#define LB_MEM_RAM       1      /* Memory anyone can use */
 
63
#define LB_MEM_RESERVED  2      /* Don't use this memory region */
 
64
#define LB_MEM_TABLE     16     /* Ram configuration tables are kept in */
 
65
 
 
66
};
 
67
 
 
68
struct lb_memory {
 
69
        uint32_t tag;
 
70
        uint32_t size;
 
71
        struct lb_memory_range map[0];
 
72
};
 
73
 
 
74
#define LB_TAG_HWRPB    0x0002
 
75
struct lb_hwrpb {
 
76
        uint32_t tag;
 
77
        uint32_t size;
 
78
        uint64_t hwrpb;
 
79
};
 
80
 
 
81
#define LB_TAG_MAINBOARD        0x0003
 
82
struct lb_mainboard {
 
83
        uint32_t tag;
 
84
        uint32_t size;
 
85
        uint8_t  vendor_idx;
 
86
        uint8_t  part_number_idx;
 
87
        uint8_t  strings[0];
 
88
};
 
89
 
 
90
#define LB_TAG_VERSION          0x0004
 
91
#define LB_TAG_EXTRA_VERSION    0x0005
 
92
#define LB_TAG_BUILD            0x0006
 
93
#define LB_TAG_COMPILE_TIME     0x0007
 
94
#define LB_TAG_COMPILE_BY       0x0008
 
95
#define LB_TAG_COMPILE_HOST     0x0009
 
96
#define LB_TAG_COMPILE_DOMAIN   0x000a
 
97
#define LB_TAG_COMPILER         0x000b
 
98
#define LB_TAG_LINKER           0x000c
 
99
#define LB_TAG_ASSEMBLER        0x000d
 
100
struct lb_string {
 
101
        uint32_t tag;
 
102
        uint32_t size;
 
103
        uint8_t  string[0];
 
104
};
 
105
 
 
106
/* The following structures are for the cmos definitions table */
 
107
#define LB_TAG_CMOS_OPTION_TABLE 200
 
108
/* cmos header record */
 
109
struct cmos_option_table {
 
110
        uint32_t tag;               /* CMOS definitions table type */
 
111
        uint32_t size;               /* size of the entire table */
 
112
        uint32_t header_length;      /* length of header */
 
113
};
 
114
 
 
115
/* cmos entry record
 
116
        This record is variable length.  The name field may be
 
117
        shorter than CMOS_MAX_NAME_LENGTH. The entry may start
 
118
        anywhere in the byte, but can not span bytes unless it
 
119
        starts at the beginning of the byte and the length is
 
120
        fills complete bytes.
 
121
*/
 
122
#define LB_TAG_OPTION 201
 
123
struct cmos_entries {
 
124
        uint32_t tag;                /* entry type */
 
125
        uint32_t size;               /* length of this record */
 
126
        uint32_t bit;                /* starting bit from start of image */
 
127
        uint32_t length;             /* length of field in bits */
 
128
        uint32_t config;             /* e=enumeration, h=hex, r=reserved */
 
129
        uint32_t config_id;          /* a number linking to an enumeration record */
 
130
#define CMOS_MAX_NAME_LENGTH 32
 
131
        uint8_t name[CMOS_MAX_NAME_LENGTH]; /* name of entry in ascii,
 
132
                                               variable length int aligned */
 
133
};
 
134
 
 
135
 
 
136
/* cmos enumerations record
 
137
        This record is variable length.  The text field may be
 
138
        shorter than CMOS_MAX_TEXT_LENGTH.
 
139
*/
 
140
#define LB_TAG_OPTION_ENUM 202
 
141
struct cmos_enums {
 
142
        uint32_t tag;                /* enumeration type */
 
143
        uint32_t size;               /* length of this record */
 
144
        uint32_t config_id;          /* a number identifying the config id */
 
145
        uint32_t value;              /* the value associated with the text */
 
146
#define CMOS_MAX_TEXT_LENGTH 32
 
147
        uint8_t text[CMOS_MAX_TEXT_LENGTH]; /* enum description in ascii,
 
148
                                                variable length int aligned */
 
149
};
 
150
 
 
151
/* cmos defaults record
 
152
        This record contains default settings for the cmos ram.
 
153
*/
 
154
#define LB_TAG_OPTION_DEFAULTS 203
 
155
struct cmos_defaults {
 
156
        uint32_t tag;                /* default type */
 
157
        uint32_t size;               /* length of this record */
 
158
        uint32_t name_length;        /* length of the following name field */
 
159
        uint8_t name[CMOS_MAX_NAME_LENGTH]; /* name identifying the default */
 
160
#define CMOS_IMAGE_BUFFER_SIZE 128
 
161
        uint8_t default_set[CMOS_IMAGE_BUFFER_SIZE]; /* default settings */
 
162
};
 
163
 
 
164
#define LB_TAG_OPTION_CHECKSUM 204
 
165
struct  cmos_checksum {
 
166
        uint32_t tag;
 
167
        uint32_t size;
 
168
        /* In practice everything is byte aligned, but things are measured
 
169
         * in bits to be consistent.
 
170
         */
 
171
        uint32_t range_start;   /* First bit that is checksummed (byte aligned) */
 
172
        uint32_t range_end;     /* Last bit that is checksummed (byte aligned) */
 
173
        uint32_t location;      /* First bit of the checksum (byte aligned) */
 
174
        uint32_t type;          /* Checksum algorithm that is used */
 
175
#define CHECKSUM_NONE   0
 
176
#define CHECKSUM_PCBIOS 1
 
177
};
 
178
 
 
179
 
 
180
 
 
181
#endif /* LINUXBIOS_TABLES_H */