Jordan Crouse | f6145c3 | 2008-03-19 23:56:58 +0000 | [diff] [blame] | 1 | /* |
Jordan Crouse | f6145c3 | 2008-03-19 23:56:58 +0000 | [diff] [blame] | 2 | * |
| 3 | * Copyright (C) 2008 Advanced Micro Devices, Inc. |
| 4 | * |
| 5 | * Redistribution and use in source and binary forms, with or without |
| 6 | * modification, are permitted provided that the following conditions |
| 7 | * are met: |
| 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. |
| 15 | * |
| 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 |
| 26 | * SUCH DAMAGE. |
| 27 | */ |
| 28 | |
Uwe Hermann | fad8c2b | 2008-04-11 18:01:50 +0000 | [diff] [blame] | 29 | #ifndef _COREBOOT_TABLES_H |
| 30 | #define _COREBOOT_TABLES_H |
Jordan Crouse | f6145c3 | 2008-03-19 23:56:58 +0000 | [diff] [blame] | 31 | |
| 32 | #include <arch/types.h> |
Gabe Black | 54c800a | 2012-08-28 16:31:09 -0700 | [diff] [blame] | 33 | #include <ipchksum.h> |
Nico Huber | 14adb7e | 2020-07-18 14:23:41 +0200 | [diff] [blame] | 34 | #include <stdint.h> |
Jordan Crouse | f6145c3 | 2008-03-19 23:56:58 +0000 | [diff] [blame] | 35 | |
Patrick Georgi | 5326ad7 | 2019-05-23 12:41:44 +0200 | [diff] [blame] | 36 | enum { |
| 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, |
| 55 | CB_TAG_GPIO = 0x0013, |
| 56 | CB_TAG_TIMESTAMPS = 0x0016, |
| 57 | CB_TAG_CBMEM_CONSOLE = 0x0017, |
| 58 | CB_TAG_MRC_CACHE = 0x0018, |
| 59 | CB_TAG_VBNV = 0x0019, |
Joel Kitching | 452aaae | 2019-06-16 17:29:52 +0800 | [diff] [blame] | 60 | CB_TAG_VBOOT_HANDOFF = 0x0020, /* deprecated */ |
Patrick Georgi | 5326ad7 | 2019-05-23 12:41:44 +0200 | [diff] [blame] | 61 | CB_TAG_X86_ROM_MTRR = 0x0021, |
| 62 | CB_TAG_DMA = 0x0022, |
| 63 | CB_TAG_RAM_OOPS = 0x0023, |
| 64 | CB_TAG_ACPI_GNVS = 0x0024, |
| 65 | CB_TAG_BOARD_ID = 0x0025, |
Patrick Georgi | d0bd544 | 2019-05-23 12:41:44 +0200 | [diff] [blame] | 66 | CB_TAG_VERSION_TIMESTAMP = 0x0026, |
Patrick Georgi | 5326ad7 | 2019-05-23 12:41:44 +0200 | [diff] [blame] | 67 | CB_TAG_WIFI_CALIBRATION = 0x0027, |
| 68 | CB_TAG_RAM_CODE = 0x0028, |
| 69 | CB_TAG_SPI_FLASH = 0x0029, |
| 70 | CB_TAG_SERIALNO = 0x002a, |
| 71 | CB_TAG_MTC = 0x002b, |
| 72 | CB_TAG_VPD = 0x002c, |
| 73 | CB_TAG_SKU_ID = 0x002d, |
| 74 | CB_TAG_BOOT_MEDIA_PARAMS = 0x0030, |
Patrick Georgi | d0bd544 | 2019-05-23 12:41:44 +0200 | [diff] [blame] | 75 | CB_TAG_CBMEM_ENTRY = 0x0031, |
Patrick Georgi | 5326ad7 | 2019-05-23 12:41:44 +0200 | [diff] [blame] | 76 | CB_TAG_TSC_INFO = 0x0032, |
| 77 | CB_TAG_MAC_ADDRS = 0x0033, |
| 78 | CB_TAG_VBOOT_WORKBUF = 0x0034, |
| 79 | CB_TAG_MMC_INFO = 0x0035, |
Patrick Georgi | d0bd544 | 2019-05-23 12:41:44 +0200 | [diff] [blame] | 80 | CB_TAG_TCPA_LOG = 0x0036, |
Furquan Shaikh | 3d4923d | 2019-09-27 00:02:25 -0700 | [diff] [blame] | 81 | CB_TAG_FMAP = 0x0037, |
Patrick Rudolph | bc744f5 | 2020-04-17 16:16:49 +0200 | [diff] [blame] | 82 | CB_TAG_SMMSTOREV2 = 0x0039, |
Tim Wawrzynczak | e1a7a26 | 2020-10-09 17:07:45 -0600 | [diff] [blame] | 83 | CB_TAG_BOARD_CONFIG = 0x0040, |
Furquan Shaikh | bda86bd | 2021-06-17 22:14:13 -0700 | [diff] [blame] | 84 | CB_TAG_ACPI_CNVS = 0x0041, |
Nick Vaccaro | a62b418 | 2021-10-01 13:12:59 -0700 | [diff] [blame] | 85 | CB_TAG_TYPE_C_INFO = 0x0042, |
Arthur Heymans | cddba45 | 2022-03-03 22:59:23 +0100 | [diff] [blame] | 86 | CB_TAG_ACPI_RSDP = 0x0043, |
Jianjun Wang | d16c2aa | 2022-03-31 15:34:34 +0800 | [diff] [blame] | 87 | CB_TAG_PCIE = 0x0044, |
Patrick Georgi | 5326ad7 | 2019-05-23 12:41:44 +0200 | [diff] [blame] | 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, |
| 93 | }; |
| 94 | |
Jianjun Wang | b2537bd | 2022-04-08 16:57:28 +0800 | [diff] [blame] | 95 | typedef __aligned(4) uint64_t cb_uint64_t; |
Jordan Crouse | f6145c3 | 2008-03-19 23:56:58 +0000 | [diff] [blame] | 96 | |
| 97 | struct cb_header { |
Uwe Hermann | fad8c2b | 2008-04-11 18:01:50 +0000 | [diff] [blame] | 98 | u8 signature[4]; |
| 99 | u32 header_bytes; |
| 100 | u32 header_checksum; |
| 101 | u32 table_bytes; |
| 102 | u32 table_checksum; |
| 103 | u32 table_entries; |
Jordan Crouse | f6145c3 | 2008-03-19 23:56:58 +0000 | [diff] [blame] | 104 | }; |
| 105 | |
| 106 | struct cb_record { |
Uwe Hermann | fad8c2b | 2008-04-11 18:01:50 +0000 | [diff] [blame] | 107 | u32 tag; |
| 108 | u32 size; |
Jordan Crouse | f6145c3 | 2008-03-19 23:56:58 +0000 | [diff] [blame] | 109 | }; |
| 110 | |
Jordan Crouse | f6145c3 | 2008-03-19 23:56:58 +0000 | [diff] [blame] | 111 | struct cb_memory_range { |
Jianjun Wang | b2537bd | 2022-04-08 16:57:28 +0800 | [diff] [blame] | 112 | cb_uint64_t start; |
| 113 | cb_uint64_t size; |
Uwe Hermann | fad8c2b | 2008-04-11 18:01:50 +0000 | [diff] [blame] | 114 | u32 type; |
Jordan Crouse | f6145c3 | 2008-03-19 23:56:58 +0000 | [diff] [blame] | 115 | }; |
| 116 | |
Stefan Reinauer | d1bc331 | 2011-06-22 16:39:19 -0700 | [diff] [blame] | 117 | #define CB_MEM_RAM 1 |
| 118 | #define CB_MEM_RESERVED 2 |
| 119 | #define CB_MEM_ACPI 3 |
| 120 | #define CB_MEM_NVS 4 |
| 121 | #define CB_MEM_UNUSABLE 5 |
| 122 | #define CB_MEM_VENDOR_RSVD 6 |
| 123 | #define CB_MEM_TABLE 16 |
Jordan Crouse | f6145c3 | 2008-03-19 23:56:58 +0000 | [diff] [blame] | 124 | |
| 125 | struct cb_memory { |
Uwe Hermann | fad8c2b | 2008-04-11 18:01:50 +0000 | [diff] [blame] | 126 | u32 tag; |
| 127 | u32 size; |
Elyes Haouas | a434f48 | 2023-07-30 17:31:15 +0200 | [diff] [blame^] | 128 | struct cb_memory_range map[]; |
Jordan Crouse | f6145c3 | 2008-03-19 23:56:58 +0000 | [diff] [blame] | 129 | }; |
| 130 | |
Jordan Crouse | f6145c3 | 2008-03-19 23:56:58 +0000 | [diff] [blame] | 131 | struct cb_hwrpb { |
Uwe Hermann | fad8c2b | 2008-04-11 18:01:50 +0000 | [diff] [blame] | 132 | u32 tag; |
| 133 | u32 size; |
| 134 | u64 hwrpb; |
Jordan Crouse | f6145c3 | 2008-03-19 23:56:58 +0000 | [diff] [blame] | 135 | }; |
| 136 | |
Jordan Crouse | f6145c3 | 2008-03-19 23:56:58 +0000 | [diff] [blame] | 137 | struct cb_mainboard { |
Uwe Hermann | fad8c2b | 2008-04-11 18:01:50 +0000 | [diff] [blame] | 138 | u32 tag; |
| 139 | u32 size; |
| 140 | u8 vendor_idx; |
| 141 | u8 part_number_idx; |
Elyes Haouas | a434f48 | 2023-07-30 17:31:15 +0200 | [diff] [blame^] | 142 | u8 strings[]; |
Jordan Crouse | f6145c3 | 2008-03-19 23:56:58 +0000 | [diff] [blame] | 143 | }; |
| 144 | |
Nick Vaccaro | 15066ba | 2021-10-01 13:15:26 -0700 | [diff] [blame] | 145 | enum type_c_orientation { |
| 146 | TYPEC_ORIENTATION_NONE, |
| 147 | TYPEC_ORIENTATION_NORMAL, |
| 148 | TYPEC_ORIENTATION_REVERSE, |
| 149 | }; |
| 150 | |
Nick Vaccaro | a62b418 | 2021-10-01 13:12:59 -0700 | [diff] [blame] | 151 | struct type_c_port_info { |
| 152 | /* |
| 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. |
| 155 | */ |
| 156 | uint8_t usb2_port_number; |
| 157 | uint8_t usb3_port_number; |
| 158 | |
| 159 | /* |
| 160 | * Valid sbu_orientation and data_orientation values will be of |
| 161 | * type enum type_c_orienation. |
| 162 | */ |
| 163 | uint8_t sbu_orientation; |
| 164 | uint8_t data_orientation; |
| 165 | }; |
| 166 | |
| 167 | struct type_c_info { |
| 168 | u32 port_count; |
Elyes Haouas | a434f48 | 2023-07-30 17:31:15 +0200 | [diff] [blame^] | 169 | struct type_c_port_info port_info[]; |
Nick Vaccaro | a62b418 | 2021-10-01 13:12:59 -0700 | [diff] [blame] | 170 | }; |
| 171 | |
Jordan Crouse | f6145c3 | 2008-03-19 23:56:58 +0000 | [diff] [blame] | 172 | struct cb_string { |
Uwe Hermann | fad8c2b | 2008-04-11 18:01:50 +0000 | [diff] [blame] | 173 | u32 tag; |
| 174 | u32 size; |
Elyes Haouas | a434f48 | 2023-07-30 17:31:15 +0200 | [diff] [blame^] | 175 | u8 string[]; |
Jordan Crouse | f6145c3 | 2008-03-19 23:56:58 +0000 | [diff] [blame] | 176 | }; |
| 177 | |
Jordan Crouse | f6145c3 | 2008-03-19 23:56:58 +0000 | [diff] [blame] | 178 | struct cb_serial { |
Uwe Hermann | fad8c2b | 2008-04-11 18:01:50 +0000 | [diff] [blame] | 179 | u32 tag; |
| 180 | u32 size; |
Stefan Reinauer | d1bc331 | 2011-06-22 16:39:19 -0700 | [diff] [blame] | 181 | #define CB_SERIAL_TYPE_IO_MAPPED 1 |
| 182 | #define CB_SERIAL_TYPE_MEMORY_MAPPED 2 |
| 183 | u32 type; |
| 184 | u32 baseaddr; |
| 185 | u32 baud; |
Vadim Bendebury | 6cc5e52 | 2015-01-09 16:54:19 -0800 | [diff] [blame] | 186 | u32 regwidth; |
Lee Leahy | f92a98c | 2016-05-04 11:59:19 -0700 | [diff] [blame] | 187 | |
| 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. */ |
| 193 | u32 input_hertz; |
Jordan Crouse | f6145c3 | 2008-03-19 23:56:58 +0000 | [diff] [blame] | 194 | }; |
| 195 | |
Jordan Crouse | f6145c3 | 2008-03-19 23:56:58 +0000 | [diff] [blame] | 196 | struct cb_console { |
Uwe Hermann | fad8c2b | 2008-04-11 18:01:50 +0000 | [diff] [blame] | 197 | u32 tag; |
| 198 | u32 size; |
| 199 | u16 type; |
Jordan Crouse | f6145c3 | 2008-03-19 23:56:58 +0000 | [diff] [blame] | 200 | }; |
| 201 | |
| 202 | #define CB_TAG_CONSOLE_SERIAL8250 0 |
Stefan Reinauer | abc0c85 | 2010-11-22 08:09:50 +0000 | [diff] [blame] | 203 | #define CB_TAG_CONSOLE_VGA 1 // OBSOLETE |
| 204 | #define CB_TAG_CONSOLE_BTEXT 2 // OBSOLETE |
Stefan Reinauer | 5ae3175 | 2013-06-19 13:47:46 -0700 | [diff] [blame] | 205 | #define CB_TAG_CONSOLE_LOGBUF 3 // OBSOLETE |
Stefan Reinauer | abc0c85 | 2010-11-22 08:09:50 +0000 | [diff] [blame] | 206 | #define CB_TAG_CONSOLE_SROM 4 // OBSOLETE |
Jordan Crouse | f6145c3 | 2008-03-19 23:56:58 +0000 | [diff] [blame] | 207 | #define CB_TAG_CONSOLE_EHCI 5 |
| 208 | |
Stefan Reinauer | 5f7d506 | 2009-03-17 16:41:01 +0000 | [diff] [blame] | 209 | struct cb_forward { |
| 210 | u32 tag; |
| 211 | u32 size; |
| 212 | u64 forward; |
| 213 | }; |
| 214 | |
Nicolas Boichat | 564720f | 2019-08-06 08:23:54 +0800 | [diff] [blame] | 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, |
| 221 | }; |
| 222 | |
Stefan Reinauer | b700254 | 2010-03-25 18:56:26 +0000 | [diff] [blame] | 223 | struct cb_framebuffer { |
| 224 | u32 tag; |
| 225 | u32 size; |
| 226 | |
| 227 | u64 physical_address; |
| 228 | u32 x_resolution; |
| 229 | u32 y_resolution; |
| 230 | u32 bytes_per_line; |
| 231 | u8 bits_per_pixel; |
Stefan Tauner | 3509ad3 | 2013-06-25 19:25:46 +0200 | [diff] [blame] | 232 | u8 red_mask_pos; |
Stefan Reinauer | b700254 | 2010-03-25 18:56:26 +0000 | [diff] [blame] | 233 | u8 red_mask_size; |
| 234 | u8 green_mask_pos; |
| 235 | u8 green_mask_size; |
| 236 | u8 blue_mask_pos; |
| 237 | u8 blue_mask_size; |
| 238 | u8 reserved_mask_pos; |
| 239 | u8 reserved_mask_size; |
Nicolas Boichat | 564720f | 2019-08-06 08:23:54 +0800 | [diff] [blame] | 240 | u8 orientation; |
Stefan Reinauer | b700254 | 2010-03-25 18:56:26 +0000 | [diff] [blame] | 241 | }; |
| 242 | |
Gabe Black | 025667f | 2012-10-01 17:54:03 -0700 | [diff] [blame] | 243 | #define CB_GPIO_ACTIVE_LOW 0 |
| 244 | #define CB_GPIO_ACTIVE_HIGH 1 |
| 245 | #define CB_GPIO_MAX_NAME_LENGTH 16 |
Gabe Black | d3890cc | 2012-03-11 01:57:53 -0800 | [diff] [blame] | 246 | struct cb_gpio { |
| 247 | u32 port; |
| 248 | u32 polarity; |
| 249 | u32 value; |
Gabe Black | 025667f | 2012-10-01 17:54:03 -0700 | [diff] [blame] | 250 | u8 name[CB_GPIO_MAX_NAME_LENGTH]; |
Gabe Black | d3890cc | 2012-03-11 01:57:53 -0800 | [diff] [blame] | 251 | }; |
| 252 | |
| 253 | struct cb_gpios { |
| 254 | u32 tag; |
| 255 | u32 size; |
| 256 | |
| 257 | u32 count; |
Elyes Haouas | a434f48 | 2023-07-30 17:31:15 +0200 | [diff] [blame^] | 258 | struct cb_gpio gpios[]; |
Gabe Black | d3890cc | 2012-03-11 01:57:53 -0800 | [diff] [blame] | 259 | }; |
| 260 | |
Jianjun Wang | d16c2aa | 2022-03-31 15:34:34 +0800 | [diff] [blame] | 261 | struct cb_pcie { |
| 262 | uint32_t tag; |
| 263 | uint32_t size; |
| 264 | cb_uint64_t ctrl_base; /* Base address of PCIe controller */ |
| 265 | }; |
| 266 | |
Julius Werner | 1f5487a | 2013-08-27 15:38:54 -0700 | [diff] [blame] | 267 | struct lb_range { |
Gabe Black | d3890cc | 2012-03-11 01:57:53 -0800 | [diff] [blame] | 268 | uint32_t tag; |
Julius Werner | 1f5487a | 2013-08-27 15:38:54 -0700 | [diff] [blame] | 269 | uint32_t size; |
Jianjun Wang | b2537bd | 2022-04-08 16:57:28 +0800 | [diff] [blame] | 270 | cb_uint64_t range_start; |
Julius Werner | 1f5487a | 2013-08-27 15:38:54 -0700 | [diff] [blame] | 271 | uint32_t range_size; |
Gabe Black | d3890cc | 2012-03-11 01:57:53 -0800 | [diff] [blame] | 272 | }; |
| 273 | |
Gabe Black | d3890cc | 2012-03-11 01:57:53 -0800 | [diff] [blame] | 274 | struct cb_cbmem_tab { |
| 275 | uint32_t tag; |
| 276 | uint32_t size; |
Jianjun Wang | b2537bd | 2022-04-08 16:57:28 +0800 | [diff] [blame] | 277 | cb_uint64_t cbmem_tab; |
Gabe Black | d3890cc | 2012-03-11 01:57:53 -0800 | [diff] [blame] | 278 | }; |
| 279 | |
Aaron Durbin | a09760e | 2013-03-26 13:34:37 -0500 | [diff] [blame] | 280 | struct cb_x86_rom_mtrr { |
| 281 | uint32_t tag; |
| 282 | uint32_t size; |
| 283 | /* The variable range MTRR index covering the ROM. If one wants to |
| 284 | * enable caching the ROM, the variable MTRR needs to be set to |
| 285 | * write-protect. To disable the caching after enabling set the |
| 286 | * type to uncacheable. */ |
| 287 | uint32_t index; |
| 288 | }; |
| 289 | |
Furquan Shaikh | 493937e | 2020-11-25 17:15:09 -0800 | [diff] [blame] | 290 | /* Memory map windows to translate addresses between SPI flash space and host address space. */ |
| 291 | struct flash_mmap_window { |
| 292 | uint32_t flash_base; |
| 293 | uint32_t host_base; |
| 294 | uint32_t size; |
| 295 | }; |
| 296 | |
Dan Ehrenberg | 6addd40 | 2015-01-08 10:29:19 -0800 | [diff] [blame] | 297 | struct cb_spi_flash { |
| 298 | uint32_t tag; |
| 299 | uint32_t size; |
| 300 | uint32_t flash_size; |
| 301 | uint32_t sector_size; |
| 302 | uint32_t erase_cmd; |
Furquan Shaikh | 493937e | 2020-11-25 17:15:09 -0800 | [diff] [blame] | 303 | /* |
| 304 | * Number of mmap windows used by the platform to decode addresses between SPI flash |
| 305 | * space and host address space. This determines the number of entries in mmap_table. |
| 306 | */ |
| 307 | uint32_t mmap_count; |
Elyes Haouas | a434f48 | 2023-07-30 17:31:15 +0200 | [diff] [blame^] | 308 | struct flash_mmap_window mmap_table[]; |
Dan Ehrenberg | 6addd40 | 2015-01-08 10:29:19 -0800 | [diff] [blame] | 309 | }; |
| 310 | |
Patrick Georgi | f61b35d | 2015-07-14 17:15:24 +0100 | [diff] [blame] | 311 | struct cb_boot_media_params { |
| 312 | uint32_t tag; |
| 313 | uint32_t size; |
| 314 | /* offsets are relative to start of boot media */ |
Jianjun Wang | b2537bd | 2022-04-08 16:57:28 +0800 | [diff] [blame] | 315 | cb_uint64_t fmap_offset; |
| 316 | cb_uint64_t cbfs_offset; |
| 317 | cb_uint64_t cbfs_size; |
| 318 | cb_uint64_t boot_media_size; |
Patrick Georgi | f61b35d | 2015-07-14 17:15:24 +0100 | [diff] [blame] | 319 | }; |
| 320 | |
Jakub Czapiga | 2f236c2 | 2021-11-10 14:04:43 +0000 | [diff] [blame] | 321 | |
| 322 | struct cb_cbmem_entry { |
| 323 | uint32_t tag; |
| 324 | uint32_t size; |
| 325 | |
Jianjun Wang | b2537bd | 2022-04-08 16:57:28 +0800 | [diff] [blame] | 326 | cb_uint64_t address; |
Jakub Czapiga | 2f236c2 | 2021-11-10 14:04:43 +0000 | [diff] [blame] | 327 | uint32_t entry_size; |
| 328 | uint32_t id; |
| 329 | }; |
| 330 | |
Aaron Durbin | 152e5a0 | 2016-02-10 11:01:49 -0600 | [diff] [blame] | 331 | struct cb_tsc_info { |
| 332 | uint32_t tag; |
| 333 | uint32_t size; |
| 334 | |
| 335 | uint32_t freq_khz; |
| 336 | }; |
| 337 | |
Ronald G. Minnich | 8db7f8b | 2017-10-29 03:20:40 -0700 | [diff] [blame] | 338 | struct mac_address { |
| 339 | uint8_t mac_addr[6]; |
| 340 | uint8_t pad[2]; /* Pad it to 8 bytes to keep it simple. */ |
| 341 | }; |
| 342 | |
| 343 | struct cb_macs { |
| 344 | uint32_t tag; |
| 345 | uint32_t size; |
| 346 | uint32_t count; |
Elyes Haouas | a434f48 | 2023-07-30 17:31:15 +0200 | [diff] [blame^] | 347 | struct mac_address mac_addrs[]; |
Ronald G. Minnich | 8db7f8b | 2017-10-29 03:20:40 -0700 | [diff] [blame] | 348 | }; |
| 349 | |
Bora Guvendik | ddf2bc5 | 2018-03-30 16:03:32 -0700 | [diff] [blame] | 350 | struct cb_mmc_info { |
| 351 | uint32_t tag; |
| 352 | uint32_t size; |
| 353 | /* |
| 354 | * Passes the early mmc status to payload to indicate if firmware |
| 355 | * successfully sent CMD0, CMD1 to the card or not. In case of |
| 356 | * success, the payload can skip the first step of the initialization |
| 357 | * sequence which is to send CMD0, and instead start by sending CMD1 |
| 358 | * as described in Jedec Standard JESD83-B1 section 6.4.3. |
| 359 | * passes 1 on success |
| 360 | */ |
| 361 | int32_t early_cmd1_status; |
| 362 | }; |
| 363 | |
Tim Wawrzynczak | e1a7a26 | 2020-10-09 17:07:45 -0600 | [diff] [blame] | 364 | struct cb_board_config { |
| 365 | uint32_t tag; |
| 366 | uint32_t size; |
| 367 | |
Jianjun Wang | b2537bd | 2022-04-08 16:57:28 +0800 | [diff] [blame] | 368 | cb_uint64_t fw_config; |
Tim Wawrzynczak | e1a7a26 | 2020-10-09 17:07:45 -0600 | [diff] [blame] | 369 | uint32_t board_id; |
| 370 | uint32_t ram_code; |
| 371 | uint32_t sku_id; |
| 372 | }; |
| 373 | |
Stephen Barber | da262a63 | 2015-03-11 15:48:08 -0700 | [diff] [blame] | 374 | #define CB_MAX_SERIALNO_LENGTH 32 |
| 375 | |
Stefan Reinauer | 95a6e1c | 2008-08-07 10:21:05 +0000 | [diff] [blame] | 376 | struct cb_cmos_option_table { |
| 377 | u32 tag; |
| 378 | u32 size; |
| 379 | u32 header_length; |
| 380 | }; |
| 381 | |
Gabe Black | d94512e | 2012-10-01 18:05:50 -0700 | [diff] [blame] | 382 | #define CB_CMOS_MAX_NAME_LENGTH 32 |
Stefan Reinauer | 95a6e1c | 2008-08-07 10:21:05 +0000 | [diff] [blame] | 383 | struct cb_cmos_entries { |
| 384 | u32 tag; |
| 385 | u32 size; |
| 386 | u32 bit; |
| 387 | u32 length; |
| 388 | u32 config; |
| 389 | u32 config_id; |
Gabe Black | d94512e | 2012-10-01 18:05:50 -0700 | [diff] [blame] | 390 | u8 name[CB_CMOS_MAX_NAME_LENGTH]; |
Stefan Reinauer | 95a6e1c | 2008-08-07 10:21:05 +0000 | [diff] [blame] | 391 | }; |
| 392 | |
Gabe Black | d94512e | 2012-10-01 18:05:50 -0700 | [diff] [blame] | 393 | #define CB_CMOS_MAX_TEXT_LENGTH 32 |
Stefan Reinauer | 95a6e1c | 2008-08-07 10:21:05 +0000 | [diff] [blame] | 394 | struct cb_cmos_enums { |
| 395 | u32 tag; |
| 396 | u32 size; |
| 397 | u32 config_id; |
| 398 | u32 value; |
Gabe Black | d94512e | 2012-10-01 18:05:50 -0700 | [diff] [blame] | 399 | u8 text[CB_CMOS_MAX_TEXT_LENGTH]; |
Stefan Reinauer | 95a6e1c | 2008-08-07 10:21:05 +0000 | [diff] [blame] | 400 | }; |
| 401 | |
Gabe Black | d94512e | 2012-10-01 18:05:50 -0700 | [diff] [blame] | 402 | #define CB_CMOS_IMAGE_BUFFER_SIZE 128 |
Stefan Reinauer | 95a6e1c | 2008-08-07 10:21:05 +0000 | [diff] [blame] | 403 | struct cb_cmos_defaults { |
| 404 | u32 tag; |
| 405 | u32 size; |
| 406 | u32 name_length; |
Gabe Black | d94512e | 2012-10-01 18:05:50 -0700 | [diff] [blame] | 407 | u8 name[CB_CMOS_MAX_NAME_LENGTH]; |
| 408 | u8 default_set[CB_CMOS_IMAGE_BUFFER_SIZE]; |
Stefan Reinauer | 95a6e1c | 2008-08-07 10:21:05 +0000 | [diff] [blame] | 409 | }; |
| 410 | |
Gabe Black | d94512e | 2012-10-01 18:05:50 -0700 | [diff] [blame] | 411 | #define CB_CHECKSUM_NONE 0 |
| 412 | #define CB_CHECKSUM_PCBIOS 1 |
Stefan Reinauer | 95a6e1c | 2008-08-07 10:21:05 +0000 | [diff] [blame] | 413 | struct cb_cmos_checksum { |
| 414 | u32 tag; |
| 415 | u32 size; |
| 416 | u32 range_start; |
| 417 | u32 range_end; |
| 418 | u32 location; |
| 419 | u32 type; |
| 420 | }; |
Jordan Crouse | f6145c3 | 2008-03-19 23:56:58 +0000 | [diff] [blame] | 421 | |
Arthur Heymans | cddba45 | 2022-03-03 22:59:23 +0100 | [diff] [blame] | 422 | /* |
| 423 | * Handoff the ACPI RSDP |
| 424 | */ |
| 425 | struct cb_acpi_rsdp { |
| 426 | uint32_t tag; |
| 427 | uint32_t size; |
Jianjun Wang | b2537bd | 2022-04-08 16:57:28 +0800 | [diff] [blame] | 428 | cb_uint64_t rsdp_pointer; /* Address of the ACPI RSDP */ |
Arthur Heymans | cddba45 | 2022-03-03 22:59:23 +0100 | [diff] [blame] | 429 | }; |
| 430 | |
| 431 | |
Philip Prindeville | 46404d7 | 2011-12-23 17:09:02 -0700 | [diff] [blame] | 432 | /* Helpful inlines */ |
| 433 | |
Philip Prindeville | fe2f6b0 | 2011-12-23 17:22:05 -0700 | [diff] [blame] | 434 | static inline u16 cb_checksum(const void *ptr, unsigned len) |
| 435 | { |
| 436 | return ipchksum(ptr, len); |
| 437 | } |
| 438 | |
Philip Prindeville | 9a7c246 | 2011-12-24 22:12:37 -0700 | [diff] [blame] | 439 | static inline const char *cb_mb_vendor_string(const struct cb_mainboard *cbm) |
| 440 | { |
| 441 | return (char *)(cbm->strings + cbm->vendor_idx); |
| 442 | } |
| 443 | |
| 444 | static inline const char *cb_mb_part_string(const struct cb_mainboard *cbm) |
| 445 | { |
| 446 | return (char *)(cbm->strings + cbm->part_number_idx); |
| 447 | } |
| 448 | |
Jordan Crouse | f6145c3 | 2008-03-19 23:56:58 +0000 | [diff] [blame] | 449 | /* Helpful macros */ |
| 450 | |
| 451 | #define MEM_RANGE_COUNT(_rec) \ |
Uwe Hermann | 6a441bf | 2008-03-20 19:54:59 +0000 | [diff] [blame] | 452 | (((_rec)->size - sizeof(*(_rec))) / sizeof((_rec)->map[0])) |
Jordan Crouse | f6145c3 | 2008-03-19 23:56:58 +0000 | [diff] [blame] | 453 | |
| 454 | #define MEM_RANGE_PTR(_rec, _idx) \ |
Philip Prindeville | 7d95b3e | 2011-12-23 17:53:26 -0700 | [diff] [blame] | 455 | (void *)(((u8 *) (_rec)) + sizeof(*(_rec)) \ |
| 456 | + (sizeof((_rec)->map[0]) * (_idx))) |
Jordan Crouse | f6145c3 | 2008-03-19 23:56:58 +0000 | [diff] [blame] | 457 | |
Jordan Crouse | f6145c3 | 2008-03-19 23:56:58 +0000 | [diff] [blame] | 458 | #endif |