blob: 37be01240db5e6340f711999747f9054887f2223 [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Bin Meng5e2400e2015-04-24 18:10:04 +08002/*
3 * Copyright (C) 2015, Bin Meng <bmeng.cn@gmail.com>
Bin Meng5e2400e2015-04-24 18:10:04 +08004 */
5
6#ifndef _X86_TABLES_H_
7#define _X86_TABLES_H_
8
Alexander Graf2b445e42016-08-19 01:23:22 +02009#include <tables_csum.h>
10
Andy Shevchenkoc3df28f2017-07-28 20:02:15 +030011#define ROM_TABLE_ADDR CONFIG_ROM_TABLE_ADDR
12#define ROM_TABLE_END (CONFIG_ROM_TABLE_ADDR + CONFIG_ROM_TABLE_SIZE - 1)
Bin Meng5e2400e2015-04-24 18:10:04 +080013
Bin Meng897e1dc2016-02-27 22:57:59 -080014#define ROM_TABLE_ALIGN 1024
15
Bin Meng3cf23712016-02-28 23:54:50 -080016/* SeaBIOS expects coreboot tables at address range 0x0000-0x1000 */
17#define CB_TABLE_ADDR 0x800
18
Bin Meng5e2400e2015-04-24 18:10:04 +080019/**
Bin Meng7f5df8d2015-06-23 12:18:51 +080020 * table_fill_string() - Fill a string with pad in the configuration table
21 *
22 * This fills a string in the configuration table. It copies number of bytes
23 * from the source string, and if source string length is shorter than the
24 * required size to copy, pad the table string with the given pad character.
25 *
26 * @dest: where to fill a string
27 * @src: where to copy from
28 * @n: number of bytes to copy
29 * @pad: character to pad the remaining bytes
30 */
31void table_fill_string(char *dest, const char *src, size_t n, char pad);
32
33/**
Bin Meng5e2400e2015-04-24 18:10:04 +080034 * write_tables() - Write x86 configuration tables
35 *
36 * This writes x86 configuration tables, including PIRQ routing table,
37 * Multi-Processor table and ACPI table. Whether a specific type of
38 * configuration table is written is controlled by a Kconfig option.
Simon Glass38e498c2020-11-04 09:57:18 -070039 *
Heinrich Schuchardt185f8122022-01-19 18:05:50 +010040 * Return: 0 if OK, -ENOSPC if table too large
Bin Meng5e2400e2015-04-24 18:10:04 +080041 */
Simon Glass38e498c2020-11-04 09:57:18 -070042int write_tables(void);
Bin Meng5e2400e2015-04-24 18:10:04 +080043
44/**
45 * write_pirq_routing_table() - Write PIRQ routing table
46 *
47 * This writes PIRQ routing table at a given address.
48 *
49 * @start: start address to write PIRQ routing table
50 * @return: end address of PIRQ routing table
51 */
Simon Glass42fd8c12017-01-16 07:03:35 -070052ulong write_pirq_routing_table(ulong start);
Bin Meng5e2400e2015-04-24 18:10:04 +080053
54#endif /* _X86_TABLES_H_ */