xref: /aosp_15_r20/external/coreboot/src/lib/coreboot_table.c (revision b9411a12aaaa7e1e6a6fb7c5e057f44ee179a49c)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <acpi/acpi.h>
4 #include <arch/cbconfig.h>
5 #include <commonlib/bsd/ipchksum.h>
6 #include <console/console.h>
7 #include <console/uart.h>
8 #include <identity.h>
9 #include <boot/coreboot_tables.h>
10 #include <boot/tables.h>
11 #include <boot_device.h>
12 #include <string.h>
13 #include <boardid.h>
14 #include <device/device.h>
15 #include <drivers/tpm/tpm_ppi.h>
16 #include <fmap.h>
17 #include <fw_config.h>
18 #include <cbfs.h>
19 #include <cbmem.h>
20 #include <bootmem.h>
21 #include <bootsplash.h>
22 #include <inttypes.h>
23 #include <spi_flash.h>
24 #include <smmstore.h>
25 #include <types.h>
26 #include <version.h>
27 
28 #if CONFIG(USE_OPTION_TABLE)
29 #include <option_table.h>
30 #endif
31 #if CONFIG(PLATFORM_USES_FSP2_0)
32 #include <fsp/util.h>
33 #else
34 void lb_string_platform_blob_version(struct lb_header *header);
35 #endif
36 
fill_lb_pcie(struct lb_pcie * pcie)37 __weak enum cb_err fill_lb_pcie(struct lb_pcie *pcie)
38 {
39 	return CB_ERR_NOT_IMPLEMENTED;
40 }
41 
lb_table_init(unsigned long addr)42 static struct lb_header *lb_table_init(unsigned long addr)
43 {
44 	struct lb_header *header;
45 
46 	addr = ALIGN_UP(addr, 16);
47 
48 	header = (void *)addr;
49 	header->signature[0] = 'L';
50 	header->signature[1] = 'B';
51 	header->signature[2] = 'I';
52 	header->signature[3] = 'O';
53 	header->header_bytes = sizeof(*header);
54 	header->header_checksum = 0;
55 	header->table_bytes = 0;
56 	header->table_checksum = 0;
57 	header->table_entries = 0;
58 	return header;
59 }
60 
lb_first_record(struct lb_header * header)61 static struct lb_record *lb_first_record(struct lb_header *header)
62 {
63 	struct lb_record *rec;
64 	rec = (void *)(((char *)header) + sizeof(*header));
65 	return rec;
66 }
67 
lb_last_record(struct lb_header * header)68 static struct lb_record *lb_last_record(struct lb_header *header)
69 {
70 	struct lb_record *rec;
71 	rec = (void *)(((char *)header) + sizeof(*header)
72 		+ header->table_bytes);
73 	return rec;
74 }
75 
lb_new_record(struct lb_header * header)76 struct lb_record *lb_new_record(struct lb_header *header)
77 {
78 	struct lb_record *rec;
79 	rec = lb_last_record(header);
80 	if (header->table_entries) {
81 		assert(IS_ALIGNED(rec->size, LB_ENTRY_ALIGN));
82 		header->table_bytes += rec->size;
83 		rec = lb_last_record(header);
84 	}
85 	header->table_entries++;
86 	rec->tag = LB_TAG_UNUSED;
87 	rec->size = sizeof(*rec);
88 	return rec;
89 }
90 
lb_memory(struct lb_header * header)91 static struct lb_memory *lb_memory(struct lb_header *header)
92 {
93 	struct lb_record *rec;
94 	struct lb_memory *mem;
95 	rec = lb_new_record(header);
96 	mem = (struct lb_memory *)rec;
97 	mem->tag = LB_TAG_MEMORY;
98 	mem->size = sizeof(*mem);
99 	return mem;
100 }
101 
lb_add_serial(struct lb_header * header)102 static void lb_add_serial(struct lb_header *header)
103 {
104 	struct lb_serial new_serial = { .tag = LB_TAG_SERIAL,
105 					.size = sizeof(struct lb_serial),
106 	};
107 	if (fill_lb_serial(&new_serial) != CB_SUCCESS)
108 		return;
109 
110 	struct lb_serial *serial = (struct lb_serial *)lb_new_record(header);
111 	memcpy(serial, &new_serial, sizeof(*serial));
112 	assert(serial->type == LB_SERIAL_TYPE_IO_MAPPED
113 	       || serial->type == LB_SERIAL_TYPE_MEMORY_MAPPED)
114 	if (serial->type == LB_SERIAL_TYPE_IO_MAPPED)
115 		lb_add_console(LB_TAG_CONSOLE_SERIAL8250, header);
116 	else
117 		lb_add_console(LB_TAG_CONSOLE_SERIAL8250MEM, header);
118 }
119 
lb_add_console(uint16_t consoletype,void * data)120 void lb_add_console(uint16_t consoletype, void *data)
121 {
122 	struct lb_header *header = (struct lb_header *)data;
123 	struct lb_console *console;
124 
125 	console = (struct lb_console *)lb_new_record(header);
126 	console->tag = LB_TAG_CONSOLE;
127 	console->size = sizeof(*console);
128 	console->type = consoletype;
129 }
130 
lb_pcie(struct lb_header * header)131 static void lb_pcie(struct lb_header *header)
132 {
133 	struct lb_pcie pcie = { .tag = LB_TAG_PCIE, .size = sizeof(pcie) };
134 
135 	if (fill_lb_pcie(&pcie) != CB_SUCCESS)
136 		return;
137 
138 	memcpy(lb_new_record(header), &pcie, sizeof(pcie));
139 }
140 
lb_framebuffer(struct lb_header * header)141 static void lb_framebuffer(struct lb_header *header)
142 {
143 	struct lb_framebuffer *framebuffer;
144 	struct lb_framebuffer fb = {0};
145 
146 	if (!CONFIG(LINEAR_FRAMEBUFFER) || fill_lb_framebuffer(&fb))
147 		return;
148 
149 	framebuffer = (struct lb_framebuffer *)lb_new_record(header);
150 	memcpy(framebuffer, &fb, sizeof(*framebuffer));
151 	framebuffer->tag = LB_TAG_FRAMEBUFFER;
152 	framebuffer->size = sizeof(*framebuffer);
153 
154 	if (CONFIG(BOOTSPLASH)) {
155 		uint8_t *fb_ptr = (uint8_t *)(uintptr_t)framebuffer->physical_address;
156 		unsigned int width = framebuffer->x_resolution;
157 		unsigned int height = framebuffer->y_resolution;
158 		unsigned int bytes_per_line = framebuffer->bytes_per_line;
159 		unsigned int depth = framebuffer->bits_per_pixel;
160 		set_bootsplash(fb_ptr, width, height, bytes_per_line, depth);
161 	}
162 }
163 
lb_add_gpios(struct lb_gpios * gpios,const struct lb_gpio * gpio_table,size_t count)164 void lb_add_gpios(struct lb_gpios *gpios, const struct lb_gpio *gpio_table,
165 		  size_t count)
166 {
167 	size_t table_size = count * sizeof(struct lb_gpio);
168 
169 	memcpy(&gpios->gpios[gpios->count], gpio_table, table_size);
170 	gpios->count += count;
171 	gpios->size += table_size;
172 }
173 
lb_gpios(struct lb_header * header)174 static void lb_gpios(struct lb_header *header)
175 {
176 	struct lb_gpios *gpios;
177 	struct lb_gpio *g;
178 
179 	gpios = (struct lb_gpios *)lb_new_record(header);
180 	gpios->tag = LB_TAG_GPIO;
181 	gpios->size = sizeof(*gpios);
182 	gpios->count = 0;
183 	fill_lb_gpios(gpios);
184 
185 	printk(BIOS_INFO, "Passing %u GPIOs to payload:\n"
186 		"            NAME |       PORT | POLARITY |     VALUE\n",
187 		gpios->count);
188 	for (g = &gpios->gpios[0]; g < &gpios->gpios[gpios->count]; g++) {
189 		printk(BIOS_INFO, "%16.16s | ", g->name);
190 		if (g->port == -1)
191 			printk(BIOS_INFO, " undefined | ");
192 		else
193 			printk(BIOS_INFO, "%#.8x | ", g->port);
194 		if (g->polarity == ACTIVE_HIGH)
195 			printk(BIOS_INFO, "    high | ");
196 		else
197 			printk(BIOS_INFO, "     low | ");
198 		switch (g->value) {
199 		case 0:
200 			printk(BIOS_INFO, "      low\n");
201 			break;
202 		case 1:
203 			printk(BIOS_INFO, "     high\n");
204 			break;
205 		default:
206 			printk(BIOS_INFO, "undefined\n");
207 			break;
208 		}
209 	}
210 }
211 
board_id(void)212 __weak uint32_t board_id(void) { return UNDEFINED_STRAPPING_ID; }
ram_code(void)213 __weak uint32_t ram_code(void) { return UNDEFINED_STRAPPING_ID; }
sku_id(void)214 __weak uint32_t sku_id(void) { return UNDEFINED_STRAPPING_ID; }
fw_config_get(void)215 __weak uint64_t fw_config_get(void) { return UNDEFINED_FW_CONFIG; }
216 
lb_boot_media_params(struct lb_header * header)217 static void lb_boot_media_params(struct lb_header *header)
218 {
219 	struct lb_boot_media_params *bmp;
220 	const struct region_device *boot_dev;
221 	const struct cbfs_boot_device *cbd = cbfs_get_boot_device(false);
222 	if (!cbd)
223 		return;
224 
225 	boot_dev = boot_device_ro();
226 	if (boot_dev == NULL)
227 		return;
228 
229 	bmp = (struct lb_boot_media_params *)lb_new_record(header);
230 	bmp->tag = LB_TAG_BOOT_MEDIA_PARAMS;
231 	bmp->size = sizeof(*bmp);
232 
233 	bmp->cbfs_offset = region_device_offset(&cbd->rdev);
234 	bmp->cbfs_size = region_device_sz(&cbd->rdev);
235 	bmp->boot_media_size = region_device_sz(boot_dev);
236 
237 	bmp->fmap_offset = get_fmap_flash_offset();
238 }
239 
lb_mmc_info(struct lb_header * header)240 static void lb_mmc_info(struct lb_header *header)
241 {
242 	struct lb_mmc_info *rec;
243 	int32_t *ms_cbmem;
244 
245 	ms_cbmem = cbmem_find(CBMEM_ID_MMC_STATUS);
246 	if (!ms_cbmem)
247 		return;
248 
249 	rec = (struct lb_mmc_info *)lb_new_record(header);
250 
251 	rec->tag = LB_TAG_MMC_INFO;
252 	rec->size = sizeof(*rec);
253 	rec->early_cmd1_status = *ms_cbmem;
254 }
255 
add_cbmem_pointers(struct lb_header * header)256 static void add_cbmem_pointers(struct lb_header *header)
257 {
258 	/*
259 	 * These CBMEM sections' addresses are included in the coreboot table
260 	 * with the appropriate tags.
261 	 */
262 	const struct section_id {
263 		int cbmem_id;
264 		int table_tag;
265 	} section_ids[] = {
266 		{CBMEM_ID_TIMESTAMP, LB_TAG_TIMESTAMPS},
267 		{CBMEM_ID_CONSOLE, LB_TAG_CBMEM_CONSOLE},
268 		{CBMEM_ID_ACPI_GNVS, LB_TAG_ACPI_GNVS},
269 		{CBMEM_ID_ACPI_CNVS, LB_TAG_ACPI_CNVS},
270 		{CBMEM_ID_VPD, LB_TAG_VPD},
271 		{CBMEM_ID_WIFI_CALIBRATION, LB_TAG_WIFI_CALIBRATION},
272 		{CBMEM_ID_TPM_CB_LOG, LB_TAG_TPM_CB_LOG},
273 		{CBMEM_ID_FMAP, LB_TAG_FMAP},
274 		{CBMEM_ID_VBOOT_WORKBUF, LB_TAG_VBOOT_WORKBUF},
275 		{CBMEM_ID_TYPE_C_INFO, LB_TAG_TYPE_C_INFO},
276 	};
277 	int i;
278 
279 	for (i = 0; i < ARRAY_SIZE(section_ids); i++) {
280 		const struct section_id *sid = section_ids + i;
281 		struct lb_cbmem_ref *cbmem_ref;
282 		void *cbmem_addr = cbmem_find(sid->cbmem_id);
283 
284 		if (!cbmem_addr)
285 			continue;  /* This section is not present */
286 
287 		cbmem_ref = (struct lb_cbmem_ref *)lb_new_record(header);
288 		if (!cbmem_ref) {
289 			printk(BIOS_ERR, "No more room in coreboot table!\n");
290 			break;
291 		}
292 		cbmem_ref->tag = sid->table_tag;
293 		cbmem_ref->size = sizeof(*cbmem_ref);
294 		cbmem_ref->cbmem_addr = (unsigned long)cbmem_addr;
295 	}
296 }
297 
lb_mainboard(struct lb_header * header)298 static struct lb_mainboard *lb_mainboard(struct lb_header *header)
299 {
300 	struct lb_record *rec;
301 	struct lb_mainboard *mainboard;
302 	rec = lb_new_record(header);
303 	mainboard = (struct lb_mainboard *)rec;
304 	mainboard->tag = LB_TAG_MAINBOARD;
305 
306 	mainboard->size = ALIGN_UP(sizeof(*mainboard) +
307 		strlen(mainboard_vendor) + 1 +
308 		strlen(mainboard_part_number) + 1, LB_ENTRY_ALIGN);
309 
310 	mainboard->vendor_idx = 0;
311 	mainboard->part_number_idx = strlen(mainboard_vendor) + 1;
312 
313 	memcpy(mainboard->strings + mainboard->vendor_idx,
314 		mainboard_vendor,      strlen(mainboard_vendor) + 1);
315 	memcpy(mainboard->strings + mainboard->part_number_idx,
316 		mainboard_part_number, strlen(mainboard_part_number) + 1);
317 
318 	return mainboard;
319 }
320 
lb_board_config(struct lb_header * header)321 static struct lb_board_config *lb_board_config(struct lb_header *header)
322 {
323 	struct lb_record *rec;
324 	struct lb_board_config *config;
325 	rec = lb_new_record(header);
326 	config = (struct lb_board_config *)rec;
327 
328 	config->tag = LB_TAG_BOARD_CONFIG;
329 	config->size = sizeof(*config);
330 
331 	const uint64_t fw_config = fw_config_get();
332 	config->board_id = board_id();
333 	config->ram_code = ram_code();
334 	config->sku_id = sku_id();
335 	config->fw_config = fw_config;
336 
337 	if (config->board_id != UNDEFINED_STRAPPING_ID)
338 		printk(BIOS_INFO, "Board ID: %d\n", config->board_id);
339 	if (config->ram_code != UNDEFINED_STRAPPING_ID)
340 		printk(BIOS_INFO, "RAM code: %d\n", config->ram_code);
341 	if (config->sku_id != UNDEFINED_STRAPPING_ID)
342 		printk(BIOS_INFO, "SKU ID: %d\n", config->sku_id);
343 	if (fw_config != UNDEFINED_FW_CONFIG)
344 		printk(BIOS_INFO, "FW config: %#" PRIx64 "\n", fw_config);
345 
346 	return config;
347 }
348 
349 #if CONFIG(USE_OPTION_TABLE)
lb_cmos_checksum(struct lb_header * header)350 static struct cmos_checksum *lb_cmos_checksum(struct lb_header *header)
351 {
352 	struct lb_record *rec;
353 	struct cmos_checksum *cmos_checksum;
354 	rec = lb_new_record(header);
355 	cmos_checksum = (struct cmos_checksum *)rec;
356 	cmos_checksum->tag = LB_TAG_OPTION_CHECKSUM;
357 
358 	cmos_checksum->size = (sizeof(*cmos_checksum));
359 
360 	cmos_checksum->range_start = LB_CKS_RANGE_START * 8;
361 	cmos_checksum->range_end = (LB_CKS_RANGE_END * 8) + 7;
362 	cmos_checksum->location = LB_CKS_LOC * 8;
363 	cmos_checksum->type = CHECKSUM_PCBIOS;
364 
365 	return cmos_checksum;
366 }
367 #endif
368 
lb_strings(struct lb_header * header)369 static void lb_strings(struct lb_header *header)
370 {
371 	static const struct {
372 		uint32_t tag;
373 		const char *string;
374 	} strings[] = {
375 		{ LB_TAG_VERSION,        coreboot_version,        },
376 		{ LB_TAG_EXTRA_VERSION,  coreboot_extra_version,  },
377 		{ LB_TAG_BUILD,          coreboot_build,          },
378 		{ LB_TAG_COMPILE_TIME,   coreboot_compile_time,   },
379 	};
380 	unsigned int i;
381 	for (i = 0; i < ARRAY_SIZE(strings); i++) {
382 		struct lb_string *rec;
383 		size_t len;
384 		rec = (struct lb_string *)lb_new_record(header);
385 		len = strlen(strings[i].string);
386 		rec->tag = strings[i].tag;
387 		rec->size = ALIGN_UP(sizeof(*rec) + len + 1, LB_ENTRY_ALIGN);
388 		memcpy(rec->string, strings[i].string, len+1);
389 	}
390 }
391 
lb_record_version_timestamp(struct lb_header * header)392 static void lb_record_version_timestamp(struct lb_header *header)
393 {
394 	struct lb_timestamp *rec;
395 	rec = (struct lb_timestamp *)lb_new_record(header);
396 	rec->tag = LB_TAG_VERSION_TIMESTAMP;
397 	rec->size = sizeof(*rec);
398 	rec->timestamp = coreboot_version_timestamp;
399 }
400 
lb_board(struct lb_header * header)401 void __weak lb_board(struct lb_header *header) { /* NOOP */ }
402 
403 /*
404  * It's possible that the system is using a SPI flash as the boot device,
405  * however it is not probing for devices to fill in specifics. In that
406  * case don't provide any information as the correct information is
407  * not known.
408  */
lb_spi_flash(struct lb_header * header)409 void __weak lb_spi_flash(struct lb_header *header) { /* NOOP */ }
410 
lb_forward(struct lb_header * header,struct lb_header * next_header)411 static struct lb_forward *lb_forward(struct lb_header *header,
412 	struct lb_header *next_header)
413 {
414 	struct lb_record *rec;
415 	struct lb_forward *forward;
416 	rec = lb_new_record(header);
417 	forward = (struct lb_forward *)rec;
418 	forward->tag = LB_TAG_FORWARD;
419 	forward->size = sizeof(*forward);
420 	forward->forward = (uint64_t)(unsigned long)next_header;
421 	return forward;
422 }
423 
lb_table_fini(struct lb_header * head)424 static unsigned long lb_table_fini(struct lb_header *head)
425 {
426 	struct lb_record *rec, *first_rec;
427 	rec = lb_last_record(head);
428 	if (head->table_entries) {
429 		assert(IS_ALIGNED(rec->size, LB_ENTRY_ALIGN));
430 		head->table_bytes += rec->size;
431 	}
432 
433 	first_rec = lb_first_record(head);
434 	head->table_checksum = ipchksum(first_rec, head->table_bytes);
435 	head->header_checksum = 0;
436 	head->header_checksum = ipchksum(head, sizeof(*head));
437 	printk(BIOS_DEBUG,
438 	       "Wrote coreboot table at: %p, 0x%x bytes, checksum %x\n",
439 	       head, head->table_bytes, head->table_checksum);
440 	return (unsigned long)rec + rec->size;
441 }
442 
lb_add_acpi_rsdp(struct lb_header * head)443 static void lb_add_acpi_rsdp(struct lb_header *head)
444 {
445 	struct lb_acpi_rsdp *acpi_rsdp;
446 	struct lb_record *rec = lb_new_record(head);
447 	acpi_rsdp = (struct lb_acpi_rsdp *)rec;
448 	acpi_rsdp->tag = LB_TAG_ACPI_RSDP;
449 	acpi_rsdp->size = sizeof(*acpi_rsdp);
450 	acpi_rsdp->rsdp_pointer = get_coreboot_rsdp();
451 }
452 
write_coreboot_forwarding_table(uintptr_t entry,uintptr_t target)453 size_t write_coreboot_forwarding_table(uintptr_t entry, uintptr_t target)
454 {
455 	struct lb_header *head;
456 
457 	printk(BIOS_DEBUG, "Writing table forward entry at %p\n",
458 		(void *)entry);
459 
460 	head = lb_table_init(entry);
461 	lb_forward(head, (struct lb_header *)target);
462 
463 	return (uintptr_t)lb_table_fini(head) - entry;
464 }
465 
write_coreboot_table(uintptr_t rom_table_end)466 static uintptr_t write_coreboot_table(uintptr_t rom_table_end)
467 {
468 	struct lb_header *head;
469 
470 	printk(BIOS_DEBUG, "Writing coreboot table at 0x%08lx\n",
471 		(long)rom_table_end);
472 
473 	head = lb_table_init(rom_table_end);
474 
475 #if CONFIG(USE_OPTION_TABLE)
476 	{
477 		struct cmos_option_table *option_table =
478 			cbfs_map("cmos_layout.bin", NULL);
479 		if (option_table) {
480 			struct lb_record *rec_dest = lb_new_record(head);
481 			/* Copy the option config table, it's already a
482 			 * lb_record...
483 			 */
484 			memcpy(rec_dest,  option_table, option_table->size);
485 			/* Create CMOS checksum entry in coreboot table */
486 			lb_cmos_checksum(head);
487 		} else {
488 			printk(BIOS_ERR,
489 				"cmos_layout.bin could not be found!\n");
490 		}
491 	}
492 #endif
493 
494 	/* Serialize resource map into mem table types (LB_MEM_*) */
495 	bootmem_write_memory_table(lb_memory(head));
496 
497 	/* Record our motherboard */
498 	lb_mainboard(head);
499 
500 	/* Record the serial ports and consoles */
501 	if (CONFIG(CONSOLE_SERIAL))
502 		lb_add_serial(head);
503 
504 	if (CONFIG(CONSOLE_USB))
505 		lb_add_console(LB_TAG_CONSOLE_EHCI, head);
506 
507 	if (CONFIG(PCI))
508 		lb_pcie(head);
509 
510 	/* Record our various random string information */
511 	lb_strings(head);
512 	if (CONFIG(PLATFORM_USES_FSP2_0))
513 		lb_string_platform_blob_version(head);
514 	lb_record_version_timestamp(head);
515 	/* Record our framebuffer */
516 	lb_framebuffer(head);
517 
518 	/* Record our GPIO settings (ChromeOS specific) */
519 	if (CONFIG(CHROMEOS))
520 		lb_gpios(head);
521 
522 	/* pass along VBNV offsets in CMOS */
523 	if (CONFIG(VBOOT_VBNV_CMOS))
524 		lb_table_add_vbnv_cmos(head);
525 
526 	/* Pass mmc early init status */
527 	lb_mmc_info(head);
528 
529 	/* Add SPI flash description if available */
530 	if (CONFIG(BOOT_DEVICE_SPI_FLASH))
531 		lb_spi_flash(head);
532 
533 	add_cbmem_pointers(head);
534 
535 	/* SMMSTORE v2 */
536 	if (CONFIG(SMMSTORE_V2))
537 		lb_smmstorev2(head);
538 
539 	/* Add board-specific table entries, if any. */
540 	lb_board(head);
541 
542 	if (CONFIG(CHROMEOS_RAMOOPS))
543 		lb_ramoops(head);
544 
545 	lb_boot_media_params(head);
546 
547 	/* Board configuration information (including straps) */
548 	lb_board_config(head);
549 
550 	if (CONFIG(TPM_PPI))
551 		lb_tpm_ppi(head);
552 
553 	/* Add architecture records. */
554 	lb_arch_add_records(head);
555 
556 	/* Add all cbmem entries into the coreboot tables. */
557 	cbmem_add_records_to_cbtable(head);
558 
559 	if (CONFIG(HAVE_ACPI_TABLES))
560 		lb_add_acpi_rsdp(head);
561 
562 	/* Remember where my valid memory ranges are */
563 	return lb_table_fini(head);
564 }
565 
write_tables(void)566 void *write_tables(void)
567 {
568 	uintptr_t cbtable_start;
569 	uintptr_t cbtable_end;
570 	size_t cbtable_size;
571 	const size_t max_table_size = COREBOOT_TABLE_SIZE;
572 
573 	cbtable_start = (uintptr_t)cbmem_add(CBMEM_ID_CBTABLE, max_table_size);
574 
575 	if (!cbtable_start) {
576 		printk(BIOS_ERR, "Could not add CBMEM for coreboot table.\n");
577 		return NULL;
578 	}
579 
580 	/* Add architecture specific tables. */
581 	arch_write_tables(cbtable_start);
582 
583 	/* Write the coreboot table. */
584 	cbtable_end = write_coreboot_table(cbtable_start);
585 	cbtable_size = cbtable_end - cbtable_start;
586 
587 	if (cbtable_size > max_table_size) {
588 		printk(BIOS_ERR, "%s: coreboot table didn't fit (%zx/%zx)\n",
589 			__func__, cbtable_size, max_table_size);
590 	}
591 
592 	printk(BIOS_DEBUG, "coreboot table: %zd bytes.\n", cbtable_size);
593 
594 	/* Print CBMEM sections */
595 	cbmem_list();
596 	return (void *)cbtable_start;
597 }
598