blob: 2e9652670ad94f0b9b737c9c7a3e50cedcc00fab [file] [log] [blame]
Uwe Hermannf78cff12009-06-12 14:05:25 +00001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2002 Linux Networx
5 * (Written by Eric Biederman <ebiederman@lnxi.com> for Linux Networx)
6 * Copyright (C) 2005-2007 coresystems GmbH
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; version 2 of the License.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA
20 */
21
Stefan Reinauere3f3e2e2008-01-18 15:33:10 +000022#ifndef COREBOOT_TABLES_H
23#define COREBOOT_TABLES_H
Uwe Hermannce1041c2007-02-06 19:53:51 +000024
25#include <stdint.h>
26
Stefan Reinauere3f3e2e2008-01-18 15:33:10 +000027/* The coreboot table information is for conveying information
Uwe Hermannce1041c2007-02-06 19:53:51 +000028 * from the firmware to the loaded OS image. Primarily this
29 * is expected to be information that cannot be discovered by
Uwe Hermann4e3d0b32010-03-25 23:18:41 +000030 * other means, such as querying the hardware directly.
Uwe Hermannce1041c2007-02-06 19:53:51 +000031 *
32 * All of the information should be Position Independent Data.
33 * That is it should be safe to relocated any of the information
Uwe Hermann4e3d0b32010-03-25 23:18:41 +000034 * without it's meaning/correctness changing. For table that
Uwe Hermannce1041c2007-02-06 19:53:51 +000035 * can reasonably be used on multiple architectures the data
36 * size should be fixed. This should ease the transition between
37 * 32 bit and 64 bit architectures etc.
38 *
39 * The completeness test for the information in this table is:
40 * - Can all of the hardware be detected?
41 * - Are the per motherboard constants available?
42 * - Is there enough to allow a kernel to run that was written before
43 * a particular motherboard is constructed? (Assuming the kernel
44 * has drivers for all of the hardware but it does not have
45 * assumptions on how the hardware is connected together).
46 *
47 * With this test it should be straight forward to determine if a
48 * table entry is required or not. This should remove much of the
49 * long term compatibility burden as table entries which are
50 * irrelevant or have been replaced by better alternatives may be
Uwe Hermann4e3d0b32010-03-25 23:18:41 +000051 * dropped. Of course it is polite and expedite to include extra
Uwe Hermannce1041c2007-02-06 19:53:51 +000052 * table entries and be backwards compatible, but it is not required.
53 */
54
Stefan Reinauere3f3e2e2008-01-18 15:33:10 +000055/* Since coreboot is usually compiled 32bit, gcc will align 64bit
56 * types to 32bit boundaries. If the coreboot table is dumped on a
Uwe Hermannce1041c2007-02-06 19:53:51 +000057 * 64bit system, a uint64_t would be aligned to 64bit boundaries,
58 * breaking the table format.
59 *
Stefan Reinauere3f3e2e2008-01-18 15:33:10 +000060 * lb_uint64 will keep 64bit coreboot table values aligned to 32bit
Uwe Hermannce1041c2007-02-06 19:53:51 +000061 * to ensure compatibility. They can be accessed with the two functions
62 * below: unpack_lb64() and pack_lb64()
63 *
64 * See also: util/lbtdump/lbtdump.c
65 */
66
67struct lb_uint64 {
68 uint32_t lo;
69 uint32_t hi;
70};
71
Uwe Hermanna7e05482007-05-09 10:17:44 +000072struct lb_header {
73 uint8_t signature[4]; /* LBIO */
Uwe Hermannce1041c2007-02-06 19:53:51 +000074 uint32_t header_bytes;
75 uint32_t header_checksum;
76 uint32_t table_bytes;
77 uint32_t table_checksum;
78 uint32_t table_entries;
79};
80
Uwe Hermann4e3d0b32010-03-25 23:18:41 +000081/* Every entry in the boot environment list will correspond to a boot
Uwe Hermannce1041c2007-02-06 19:53:51 +000082 * info record. Encoding both type and size. The type is obviously
83 * so you can tell what it is. The size allows you to skip that
Uwe Hermann4e3d0b32010-03-25 23:18:41 +000084 * boot environment record if you don't know what it easy. This allows
Uwe Hermannce1041c2007-02-06 19:53:51 +000085 * forward compatibility with records not yet defined.
86 */
87struct lb_record {
88 uint32_t tag; /* tag ID */
89 uint32_t size; /* size of record (in bytes) */
90};
91
92#define LB_TAG_UNUSED 0x0000
93
94#define LB_TAG_MEMORY 0x0001
95
96struct lb_memory_range {
97 struct lb_uint64 start;
98 struct lb_uint64 size;
99 uint32_t type;
100#define LB_MEM_RAM 1 /* Memory anyone can use */
101#define LB_MEM_RESERVED 2 /* Don't use this memory region */
102#define LB_MEM_TABLE 16 /* Ram configuration tables are kept in */
103};
104
105struct lb_memory {
106 uint32_t tag;
107 uint32_t size;
108 struct lb_memory_range map[0];
109};
110
111#define LB_TAG_HWRPB 0x0002
112struct lb_hwrpb {
113 uint32_t tag;
114 uint32_t size;
115 uint64_t hwrpb;
116};
117
118#define LB_TAG_MAINBOARD 0x0003
119struct lb_mainboard {
120 uint32_t tag;
121 uint32_t size;
Uwe Hermanna7e05482007-05-09 10:17:44 +0000122 uint8_t vendor_idx;
123 uint8_t part_number_idx;
124 uint8_t strings[0];
Uwe Hermannce1041c2007-02-06 19:53:51 +0000125};
126
127#define LB_TAG_VERSION 0x0004
128#define LB_TAG_EXTRA_VERSION 0x0005
129#define LB_TAG_BUILD 0x0006
130#define LB_TAG_COMPILE_TIME 0x0007
131#define LB_TAG_COMPILE_BY 0x0008
132#define LB_TAG_COMPILE_HOST 0x0009
133#define LB_TAG_COMPILE_DOMAIN 0x000a
134#define LB_TAG_COMPILER 0x000b
135#define LB_TAG_LINKER 0x000c
136#define LB_TAG_ASSEMBLER 0x000d
137struct lb_string {
138 uint32_t tag;
139 uint32_t size;
Uwe Hermanna7e05482007-05-09 10:17:44 +0000140 uint8_t string[0];
Uwe Hermannce1041c2007-02-06 19:53:51 +0000141};
142
Stefan Reinauer2d853bb2009-03-17 14:39:25 +0000143#define LB_TAG_FORWARD 0x0011
144struct lb_forward {
145 uint32_t tag;
146 uint32_t size;
147 uint64_t forward;
148};
149
Stefan Reinauere3f3e2e2008-01-18 15:33:10 +0000150#endif /* COREBOOT_TABLES_H */