blob: d32832131cde2622bbbb1bc3f4d4e9bcb077fbfa [file] [log] [blame]
Stefan Reinauere3f3e2e2008-01-18 15:33:10 +00001#ifndef COREBOOT_TABLES_H
2#define COREBOOT_TABLES_H
Uwe Hermannce1041c2007-02-06 19:53:51 +00003
4#include <stdint.h>
5
Stefan Reinauere3f3e2e2008-01-18 15:33:10 +00006/* The coreboot table information is for conveying information
Uwe Hermannce1041c2007-02-06 19:53:51 +00007 * from the firmware to the loaded OS image. Primarily this
8 * is expected to be information that cannot be discovered by
9 * other means, such as quering the hardware directly.
10 *
11 * All of the information should be Position Independent Data.
12 * That is it should be safe to relocated any of the information
13 * without it's meaning/correctnes changing. For table that
14 * can reasonably be used on multiple architectures the data
15 * size should be fixed. This should ease the transition between
16 * 32 bit and 64 bit architectures etc.
17 *
18 * The completeness test for the information in this table is:
19 * - Can all of the hardware be detected?
20 * - Are the per motherboard constants available?
21 * - Is there enough to allow a kernel to run that was written before
22 * a particular motherboard is constructed? (Assuming the kernel
23 * has drivers for all of the hardware but it does not have
24 * assumptions on how the hardware is connected together).
25 *
26 * With this test it should be straight forward to determine if a
27 * table entry is required or not. This should remove much of the
28 * long term compatibility burden as table entries which are
29 * irrelevant or have been replaced by better alternatives may be
30 * dropped. Of course it is polite and expidite to include extra
31 * table entries and be backwards compatible, but it is not required.
32 */
33
Stefan Reinauere3f3e2e2008-01-18 15:33:10 +000034/* Since coreboot is usually compiled 32bit, gcc will align 64bit
35 * types to 32bit boundaries. If the coreboot table is dumped on a
Uwe Hermannce1041c2007-02-06 19:53:51 +000036 * 64bit system, a uint64_t would be aligned to 64bit boundaries,
37 * breaking the table format.
38 *
Stefan Reinauere3f3e2e2008-01-18 15:33:10 +000039 * lb_uint64 will keep 64bit coreboot table values aligned to 32bit
Uwe Hermannce1041c2007-02-06 19:53:51 +000040 * to ensure compatibility. They can be accessed with the two functions
41 * below: unpack_lb64() and pack_lb64()
42 *
43 * See also: util/lbtdump/lbtdump.c
44 */
45
46struct lb_uint64 {
47 uint32_t lo;
48 uint32_t hi;
49};
50
Uwe Hermanna7e05482007-05-09 10:17:44 +000051struct lb_header {
52 uint8_t signature[4]; /* LBIO */
Uwe Hermannce1041c2007-02-06 19:53:51 +000053 uint32_t header_bytes;
54 uint32_t header_checksum;
55 uint32_t table_bytes;
56 uint32_t table_checksum;
57 uint32_t table_entries;
58};
59
60/* Every entry in the boot enviroment list will correspond to a boot
61 * info record. Encoding both type and size. The type is obviously
62 * so you can tell what it is. The size allows you to skip that
63 * boot enviroment record if you don't know what it easy. This allows
64 * forward compatibility with records not yet defined.
65 */
66struct lb_record {
67 uint32_t tag; /* tag ID */
68 uint32_t size; /* size of record (in bytes) */
69};
70
71#define LB_TAG_UNUSED 0x0000
72
73#define LB_TAG_MEMORY 0x0001
74
75struct lb_memory_range {
76 struct lb_uint64 start;
77 struct lb_uint64 size;
78 uint32_t type;
79#define LB_MEM_RAM 1 /* Memory anyone can use */
80#define LB_MEM_RESERVED 2 /* Don't use this memory region */
81#define LB_MEM_TABLE 16 /* Ram configuration tables are kept in */
82};
83
84struct lb_memory {
85 uint32_t tag;
86 uint32_t size;
87 struct lb_memory_range map[0];
88};
89
90#define LB_TAG_HWRPB 0x0002
91struct lb_hwrpb {
92 uint32_t tag;
93 uint32_t size;
94 uint64_t hwrpb;
95};
96
97#define LB_TAG_MAINBOARD 0x0003
98struct lb_mainboard {
99 uint32_t tag;
100 uint32_t size;
Uwe Hermanna7e05482007-05-09 10:17:44 +0000101 uint8_t vendor_idx;
102 uint8_t part_number_idx;
103 uint8_t strings[0];
Uwe Hermannce1041c2007-02-06 19:53:51 +0000104};
105
106#define LB_TAG_VERSION 0x0004
107#define LB_TAG_EXTRA_VERSION 0x0005
108#define LB_TAG_BUILD 0x0006
109#define LB_TAG_COMPILE_TIME 0x0007
110#define LB_TAG_COMPILE_BY 0x0008
111#define LB_TAG_COMPILE_HOST 0x0009
112#define LB_TAG_COMPILE_DOMAIN 0x000a
113#define LB_TAG_COMPILER 0x000b
114#define LB_TAG_LINKER 0x000c
115#define LB_TAG_ASSEMBLER 0x000d
116struct lb_string {
117 uint32_t tag;
118 uint32_t size;
Uwe Hermanna7e05482007-05-09 10:17:44 +0000119 uint8_t string[0];
Uwe Hermannce1041c2007-02-06 19:53:51 +0000120};
121
Stefan Reinauer2d853bb2009-03-17 14:39:25 +0000122#define LB_TAG_FORWARD 0x0011
123struct lb_forward {
124 uint32_t tag;
125 uint32_t size;
126 uint64_t forward;
127};
128
Stefan Reinauere3f3e2e2008-01-18 15:33:10 +0000129#endif /* COREBOOT_TABLES_H */