blob: c784a2aeec78e4a7664b365b4470afc933e4988f [file] [log] [blame]
Bin Mengf17cea62015-04-24 18:10:04 +08001/*
2 * Copyright (C) 2015, Bin Meng <bmeng.cn@gmail.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0+
5 */
6
7#ifndef _X86_TABLES_H_
8#define _X86_TABLES_H_
9
Alexander Graf120b0412016-08-19 01:23:22 +020010#include <tables_csum.h>
11
Andy Shevchenkoa364e622017-07-28 20:02:15 +030012#define ROM_TABLE_ADDR CONFIG_ROM_TABLE_ADDR
13#define ROM_TABLE_END (CONFIG_ROM_TABLE_ADDR + CONFIG_ROM_TABLE_SIZE - 1)
Bin Mengf17cea62015-04-24 18:10:04 +080014
Bin Meng900e49a2016-02-27 22:57:59 -080015#define ROM_TABLE_ALIGN 1024
16
Bin Meng96030fa2016-02-28 23:54:50 -080017/* SeaBIOS expects coreboot tables at address range 0x0000-0x1000 */
18#define CB_TABLE_ADDR 0x800
19
Bin Mengf17cea62015-04-24 18:10:04 +080020/**
21 * table_compute_checksum() - Compute a table checksum
22 *
23 * This computes an 8-bit checksum for the configuration table.
24 * All bytes in the configuration table, including checksum itself and
25 * reserved bytes must add up to zero.
26 *
27 * @v: configuration table base address
28 * @len: configuration table size
29 * @return: the 8-bit checksum
30 */
31u8 table_compute_checksum(void *v, int len);
32
33/**
Bin Mengf91cf6b2015-06-23 12:18:51 +080034 * table_fill_string() - Fill a string with pad in the configuration table
35 *
36 * This fills a string in the configuration table. It copies number of bytes
37 * from the source string, and if source string length is shorter than the
38 * required size to copy, pad the table string with the given pad character.
39 *
40 * @dest: where to fill a string
41 * @src: where to copy from
42 * @n: number of bytes to copy
43 * @pad: character to pad the remaining bytes
44 */
45void table_fill_string(char *dest, const char *src, size_t n, char pad);
46
47/**
Bin Mengf17cea62015-04-24 18:10:04 +080048 * write_tables() - Write x86 configuration tables
49 *
50 * This writes x86 configuration tables, including PIRQ routing table,
51 * Multi-Processor table and ACPI table. Whether a specific type of
52 * configuration table is written is controlled by a Kconfig option.
53 */
54void write_tables(void);
55
56/**
57 * write_pirq_routing_table() - Write PIRQ routing table
58 *
59 * This writes PIRQ routing table at a given address.
60 *
61 * @start: start address to write PIRQ routing table
62 * @return: end address of PIRQ routing table
63 */
Simon Glassca37a392017-01-16 07:03:35 -070064ulong write_pirq_routing_table(ulong start);
Bin Mengf17cea62015-04-24 18:10:04 +080065
66#endif /* _X86_TABLES_H_ */