Flashrom

Flashrom Svn Source Tree

Root/trunk/coreboot_tables.h

1/*
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
22#ifndef COREBOOT_TABLES_H
23#define COREBOOT_TABLES_H
24
25#include <stdint.h>
26
27/* The coreboot table information is for conveying information
28 * from the firmware to the loaded OS image. Primarily this
29 * is expected to be information that cannot be discovered by
30 * other means, such as querying the hardware directly.
31 *
32 * All of the information should be Position Independent Data.
33 * That is it should be safe to relocated any of the information
34 * without it's meaning/correctness changing. For table that
35 * 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
51 * dropped. Of course it is polite and expedite to include extra
52 * table entries and be backwards compatible, but it is not required.
53 */
54
55/* Since coreboot is usually compiled 32bit, gcc will align 64bit
56 * types to 32bit boundaries. If the coreboot table is dumped on a
57 * 64bit system, a uint64_t would be aligned to 64bit boundaries,
58 * breaking the table format.
59 *
60 * lb_uint64 will keep 64bit coreboot table values aligned to 32bit
61 * 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 {
68uint32_t lo;
69uint32_t hi;
70};
71
72struct lb_header {
73uint8_t signature[4];/* LBIO */
74uint32_t header_bytes;
75uint32_t header_checksum;
76uint32_t table_bytes;
77uint32_t table_checksum;
78uint32_t table_entries;
79};
80
81/* Every entry in the boot environment list will correspond to a boot
82 * 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
84 * boot environment record if you don't know what it easy. This allows
85 * forward compatibility with records not yet defined.
86 */
87struct lb_record {
88uint32_t tag;/* tag ID */
89uint32_t size;/* size of record (in bytes) */
90};
91
92#define LB_TAG_UNUSED0x0000
93
94#define LB_TAG_MEMORY0x0001
95
96struct lb_memory_range {
97struct lb_uint64 start;
98struct lb_uint64 size;
99uint32_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 {
106uint32_t tag;
107uint32_t size;
108struct lb_memory_range map[0];
109};
110
111#define LB_TAG_HWRPB0x0002
112struct lb_hwrpb {
113uint32_t tag;
114uint32_t size;
115uint64_t hwrpb;
116};
117
118#define LB_TAG_MAINBOARD0x0003
119struct lb_mainboard {
120uint32_t tag;
121uint32_t size;
122uint8_t vendor_idx;
123uint8_t part_number_idx;
124uint8_t strings[0];
125};
126
127#define LB_TAG_VERSION0x0004
128#define LB_TAG_EXTRA_VERSION0x0005
129#define LB_TAG_BUILD0x0006
130#define LB_TAG_COMPILE_TIME0x0007
131#define LB_TAG_COMPILE_BY0x0008
132#define LB_TAG_COMPILE_HOST0x0009
133#define LB_TAG_COMPILE_DOMAIN0x000a
134#define LB_TAG_COMPILER0x000b
135#define LB_TAG_LINKER0x000c
136#define LB_TAG_ASSEMBLER0x000d
137struct lb_string {
138uint32_t tag;
139uint32_t size;
140uint8_t string[0];
141};
142
143#define LB_TAG_FORWARD0x0011
144struct lb_forward {
145uint32_t tag;
146uint32_t size;
147uint64_t forward;
148};
149
150#endif/* COREBOOT_TABLES_H */
151

Archive Download this file

Revision: HEAD