3 * Copyright (C) 2008 Advanced Micro Devices, Inc.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. The name of the author may not be used to endorse or promote products
14 * derived from this software without specific prior written permission.
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 #ifndef _COREBOOT_TABLES_H
30 #define _COREBOOT_TABLES_H
32 #include <arch/types.h>
33 #include <commonlib/bsd/ipchksum.h>
37 CB_TAG_UNUSED
= 0x0000,
38 CB_TAG_MEMORY
= 0x0001,
39 CB_TAG_HWRPB
= 0x0002,
40 CB_TAG_MAINBOARD
= 0x0003,
41 CB_TAG_VERSION
= 0x0004,
42 CB_TAG_EXTRA_VERSION
= 0x0005,
43 CB_TAG_BUILD
= 0x0006,
44 CB_TAG_COMPILE_TIME
= 0x0007,
45 CB_TAG_COMPILE_BY
= 0x0008,
46 CB_TAG_COMPILE_HOST
= 0x0009,
47 CB_TAG_COMPILE_DOMAIN
= 0x000a,
48 CB_TAG_COMPILER
= 0x000b,
49 CB_TAG_LINKER
= 0x000c,
50 CB_TAG_ASSEMBLER
= 0x000d,
51 CB_TAG_SERIAL
= 0x000f,
52 CB_TAG_CONSOLE
= 0x0010,
53 CB_TAG_FORWARD
= 0x0011,
54 CB_TAG_FRAMEBUFFER
= 0x0012,
56 CB_TAG_TIMESTAMPS
= 0x0016,
57 CB_TAG_CBMEM_CONSOLE
= 0x0017,
58 CB_TAG_MRC_CACHE
= 0x0018,
60 CB_TAG_VBOOT_HANDOFF
= 0x0020, /* deprecated */
61 CB_TAG_X86_ROM_MTRR
= 0x0021,
63 CB_TAG_RAM_OOPS
= 0x0023,
64 CB_TAG_ACPI_GNVS
= 0x0024,
65 CB_TAG_BOARD_ID
= 0x0025,
66 CB_TAG_VERSION_TIMESTAMP
= 0x0026,
67 CB_TAG_WIFI_CALIBRATION
= 0x0027,
68 CB_TAG_RAM_CODE
= 0x0028,
69 CB_TAG_SPI_FLASH
= 0x0029,
70 CB_TAG_SERIALNO
= 0x002a,
73 CB_TAG_SKU_ID
= 0x002d,
74 CB_TAG_BOOT_MEDIA_PARAMS
= 0x0030,
75 CB_TAG_CBMEM_ENTRY
= 0x0031,
76 CB_TAG_TSC_INFO
= 0x0032,
77 CB_TAG_MAC_ADDRS
= 0x0033,
78 CB_TAG_VBOOT_WORKBUF
= 0x0034,
79 CB_TAG_MMC_INFO
= 0x0035,
80 CB_TAG_TCPA_LOG
= 0x0036,
82 CB_TAG_SMMSTOREV2
= 0x0039,
83 CB_TAG_BOARD_CONFIG
= 0x0040,
84 CB_TAG_ACPI_CNVS
= 0x0041,
85 CB_TAG_TYPE_C_INFO
= 0x0042,
86 CB_TAG_ACPI_RSDP
= 0x0043,
88 CB_TAG_CMOS_OPTION_TABLE
= 0x00c8,
89 CB_TAG_OPTION
= 0x00c9,
90 CB_TAG_OPTION_ENUM
= 0x00ca,
91 CB_TAG_OPTION_DEFAULTS
= 0x00cb,
92 CB_TAG_OPTION_CHECKSUM
= 0x00cc,
95 typedef __aligned(4) uint64_t cb_uint64_t
;
111 struct cb_memory_range
{
118 #define CB_MEM_RESERVED 2
119 #define CB_MEM_ACPI 3
121 #define CB_MEM_UNUSABLE 5
122 #define CB_MEM_VENDOR_RSVD 6
123 #define CB_MEM_TABLE 16
128 struct cb_memory_range map
[];
137 struct cb_mainboard
{
145 enum type_c_orientation
{
146 TYPEC_ORIENTATION_NONE
,
147 TYPEC_ORIENTATION_NORMAL
,
148 TYPEC_ORIENTATION_REVERSE
,
151 struct type_c_port_info
{
153 * usb2_port_number and usb3_port_number are expected to be
154 * the port numbers as seen by the USB controller in the SoC.
156 uint8_t usb2_port_number
;
157 uint8_t usb3_port_number
;
160 * Valid sbu_orientation and data_orientation values will be of
161 * type enum type_c_orienation.
163 uint8_t sbu_orientation
;
164 uint8_t data_orientation
;
169 struct type_c_port_info port_info
[];
181 #define CB_SERIAL_TYPE_IO_MAPPED 1
182 #define CB_SERIAL_TYPE_MEMORY_MAPPED 2
188 /* Crystal or input frequency to the chip containing the UART.
189 * Provide the board specific details to allow the payload to
190 * initialize the chip containing the UART and make independent
191 * decisions as to which dividers to select and their values
192 * to eventually arrive at the desired console baud-rate. */
202 #define CB_TAG_CONSOLE_SERIAL8250 0
203 #define CB_TAG_CONSOLE_VGA 1 // OBSOLETE
204 #define CB_TAG_CONSOLE_BTEXT 2 // OBSOLETE
205 #define CB_TAG_CONSOLE_LOGBUF 3 // OBSOLETE
206 #define CB_TAG_CONSOLE_SROM 4 // OBSOLETE
207 #define CB_TAG_CONSOLE_EHCI 5
215 /* Panel orientation, matches drm_connector.h in the Linux kernel. */
216 enum cb_fb_orientation
{
217 CB_FB_ORIENTATION_NORMAL
= 0,
218 CB_FB_ORIENTATION_BOTTOM_UP
= 1,
219 CB_FB_ORIENTATION_LEFT_UP
= 2,
220 CB_FB_ORIENTATION_RIGHT_UP
= 3,
223 struct cb_framebuffer_flags
{
224 u8 has_external_display
: 1;
228 struct cb_framebuffer
{
232 u64 physical_address
;
243 u8 reserved_mask_pos
;
244 u8 reserved_mask_size
;
246 struct cb_framebuffer_flags flags
;
250 #define CB_GPIO_ACTIVE_LOW 0
251 #define CB_GPIO_ACTIVE_HIGH 1
252 #define CB_GPIO_MAX_NAME_LENGTH 16
257 u8 name
[CB_GPIO_MAX_NAME_LENGTH
];
265 struct cb_gpio gpios
[];
271 cb_uint64_t ctrl_base
; /* Base address of PCIe controller */
277 cb_uint64_t range_start
;
281 struct cb_cbmem_tab
{
284 cb_uint64_t cbmem_tab
;
287 struct cb_x86_rom_mtrr
{
290 /* The variable range MTRR index covering the ROM. If one wants to
291 * enable caching the ROM, the variable MTRR needs to be set to
292 * write-protect. To disable the caching after enabling set the
293 * type to uncacheable. */
297 /* Memory map windows to translate addresses between SPI flash space and host address space. */
298 struct flash_mmap_window
{
304 struct cb_spi_flash
{
308 uint32_t sector_size
;
311 * Number of mmap windows used by the platform to decode addresses between SPI flash
312 * space and host address space. This determines the number of entries in mmap_table.
315 struct flash_mmap_window mmap_table
[];
318 struct cb_boot_media_params
{
321 /* offsets are relative to start of boot media */
322 cb_uint64_t fmap_offset
;
323 cb_uint64_t cbfs_offset
;
324 cb_uint64_t cbfs_size
;
325 cb_uint64_t boot_media_size
;
329 struct cb_cbmem_entry
{
347 uint8_t pad
[2]; /* Pad it to 8 bytes to keep it simple. */
354 struct mac_address mac_addrs
[];
361 * Passes the early mmc status to payload to indicate if firmware
362 * successfully sent CMD0, CMD1 to the card or not. In case of
363 * success, the payload can skip the first step of the initialization
364 * sequence which is to send CMD0, and instead start by sending CMD1
365 * as described in Jedec Standard JESD83-B1 section 6.4.3.
366 * passes 1 on success
368 int32_t early_cmd1_status
;
371 struct cb_board_config
{
375 cb_uint64_t fw_config
;
381 #define CB_MAX_SERIALNO_LENGTH 32
383 struct cb_cmos_option_table
{
389 #define CB_CMOS_MAX_NAME_LENGTH 32
390 struct cb_cmos_entries
{
397 u8 name
[CB_CMOS_MAX_NAME_LENGTH
];
400 #define CB_CMOS_MAX_TEXT_LENGTH 32
401 struct cb_cmos_enums
{
406 u8 text
[CB_CMOS_MAX_TEXT_LENGTH
];
409 #define CB_CMOS_IMAGE_BUFFER_SIZE 128
410 struct cb_cmos_defaults
{
414 u8 name
[CB_CMOS_MAX_NAME_LENGTH
];
415 u8 default_set
[CB_CMOS_IMAGE_BUFFER_SIZE
];
418 #define CB_CHECKSUM_NONE 0
419 #define CB_CHECKSUM_PCBIOS 1
420 struct cb_cmos_checksum
{
430 * Handoff the ACPI RSDP
432 struct cb_acpi_rsdp
{
435 cb_uint64_t rsdp_pointer
; /* Address of the ACPI RSDP */
439 /* Helpful inlines */
441 static inline u16
cb_checksum(const void *ptr
, unsigned len
)
443 return ipchksum(ptr
, len
);
446 static inline const char *cb_mb_vendor_string(const struct cb_mainboard
*cbm
)
448 return (char *)(cbm
->strings
+ cbm
->vendor_idx
);
451 static inline const char *cb_mb_part_string(const struct cb_mainboard
*cbm
)
453 return (char *)(cbm
->strings
+ cbm
->part_number_idx
);
458 #define MEM_RANGE_COUNT(_rec) \
459 (((_rec)->size - sizeof(*(_rec))) / sizeof((_rec)->map[0]))
461 #define MEM_RANGE_PTR(_rec, _idx) \
462 (void *)(((u8 *) (_rec)) + sizeof(*(_rec)) \
463 + (sizeof((_rec)->map[0]) * (_idx)))