2 * This file is part of the libpayload project.
4 * Copyright (C) 2008 Advanced Micro Devices, Inc.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 #ifndef _COREBOOT_TABLES_H
31 #define _COREBOOT_TABLES_H
33 #include <arch/types.h>
55 #define CB_TAG_UNUSED 0x0000
56 #define CB_TAG_MEMORY 0x0001
58 struct cb_memory_range
{
59 struct cbuint64 start
;
65 #define CB_MEM_RESERVED 2
68 #define CB_MEM_UNUSABLE 5
69 #define CB_MEM_VENDOR_RSVD 6
70 #define CB_MEM_TABLE 16
75 struct cb_memory_range map
[0];
78 #define CB_TAG_HWRPB 0x0002
86 #define CB_TAG_MAINBOARD 0x0003
96 #define CB_TAG_VERSION 0x0004
97 #define CB_TAG_EXTRA_VERSION 0x0005
98 #define CB_TAG_BUILD 0x0006
99 #define CB_TAG_COMPILE_TIME 0x0007
100 #define CB_TAG_COMPILE_BY 0x0008
101 #define CB_TAG_COMPILE_HOST 0x0009
102 #define CB_TAG_COMPILE_DOMAIN 0x000a
103 #define CB_TAG_COMPILER 0x000b
104 #define CB_TAG_LINKER 0x000c
105 #define CB_TAG_ASSEMBLER 0x000d
113 #define CB_TAG_SERIAL 0x000f
118 #define CB_SERIAL_TYPE_IO_MAPPED 1
119 #define CB_SERIAL_TYPE_MEMORY_MAPPED 2
125 #define CB_TAG_CONSOLE 0x00010
133 #define CB_TAG_CONSOLE_SERIAL8250 0
134 #define CB_TAG_CONSOLE_VGA 1 // OBSOLETE
135 #define CB_TAG_CONSOLE_BTEXT 2 // OBSOLETE
136 #define CB_TAG_CONSOLE_LOGBUF 3
137 #define CB_TAG_CONSOLE_SROM 4 // OBSOLETE
138 #define CB_TAG_CONSOLE_EHCI 5
140 #define CB_TAG_FORWARD 0x00011
148 #define CB_TAG_FRAMEBUFFER 0x0012
149 struct cb_framebuffer
{
153 u64 physical_address
;
164 u8 reserved_mask_pos
;
165 u8 reserved_mask_size
;
168 #define CB_TAG_CMOS_OPTION_TABLE 0x00c8
169 struct cb_cmos_option_table
{
175 #define CB_TAG_OPTION 0x00c9
176 #define CMOS_MAX_NAME_LENGTH 32
177 struct cb_cmos_entries
{
184 u8 name
[CMOS_MAX_NAME_LENGTH
];
188 #define CB_TAG_OPTION_ENUM 0x00ca
189 #define CMOS_MAX_TEXT_LENGTH 32
190 struct cb_cmos_enums
{
195 u8 text
[CMOS_MAX_TEXT_LENGTH
];
198 #define CB_TAG_OPTION_DEFAULTS 0x00cb
199 #define CMOS_IMAGE_BUFFER_SIZE 128
200 struct cb_cmos_defaults
{
204 u8 name
[CMOS_MAX_NAME_LENGTH
];
205 u8 default_set
[CMOS_IMAGE_BUFFER_SIZE
];
208 #define CB_TAG_OPTION_CHECKSUM 0x00cc
209 #define CHECKSUM_NONE 0
210 #define CHECKSUM_PCBIOS 1
211 struct cb_cmos_checksum
{
220 /* Helpful inlines */
222 static inline u64
cb_unpack64(struct cbuint64 val
)
224 return (((u64
) val
.hi
) << 32) | val
.lo
;
227 static inline u16
cb_checksum(const void *ptr
, unsigned len
)
229 return ipchksum(ptr
, len
);
232 static inline const char *cb_mb_vendor_string(const struct cb_mainboard
*cbm
)
234 return (char *)(cbm
->strings
+ cbm
->vendor_idx
);
237 static inline const char *cb_mb_part_string(const struct cb_mainboard
*cbm
)
239 return (char *)(cbm
->strings
+ cbm
->part_number_idx
);
244 #define MEM_RANGE_COUNT(_rec) \
245 (((_rec)->size - sizeof(*(_rec))) / sizeof((_rec)->map[0]))
247 #define MEM_RANGE_PTR(_rec, _idx) \
248 (void *)(((u8 *) (_rec)) + sizeof(*(_rec)) \
249 + (sizeof((_rec)->map[0]) * (_idx)))