blob: 0aa6d9b33eafe70cf760f53a0b572559be50f424 [file] [log] [blame]
Bin Meng5e2400e2015-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
10/*
11 * All x86 tables happen to like the address range from 0xf0000 to 0x100000.
12 * We use 0xf0000 as the starting address to store those tables, including
13 * PIRQ routing table, Multi-Processor table and ACPI table.
14 */
15#define ROM_TABLE_ADDR 0xf0000
16
17/**
18 * table_compute_checksum() - Compute a table checksum
19 *
20 * This computes an 8-bit checksum for the configuration table.
21 * All bytes in the configuration table, including checksum itself and
22 * reserved bytes must add up to zero.
23 *
24 * @v: configuration table base address
25 * @len: configuration table size
26 * @return: the 8-bit checksum
27 */
28u8 table_compute_checksum(void *v, int len);
29
30/**
Bin Meng7f5df8d2015-06-23 12:18:51 +080031 * table_fill_string() - Fill a string with pad in the configuration table
32 *
33 * This fills a string in the configuration table. It copies number of bytes
34 * from the source string, and if source string length is shorter than the
35 * required size to copy, pad the table string with the given pad character.
36 *
37 * @dest: where to fill a string
38 * @src: where to copy from
39 * @n: number of bytes to copy
40 * @pad: character to pad the remaining bytes
41 */
42void table_fill_string(char *dest, const char *src, size_t n, char pad);
43
44/**
Bin Meng5e2400e2015-04-24 18:10:04 +080045 * write_tables() - Write x86 configuration tables
46 *
47 * This writes x86 configuration tables, including PIRQ routing table,
48 * Multi-Processor table and ACPI table. Whether a specific type of
49 * configuration table is written is controlled by a Kconfig option.
50 */
51void write_tables(void);
52
53/**
54 * write_pirq_routing_table() - Write PIRQ routing table
55 *
56 * This writes PIRQ routing table at a given address.
57 *
58 * @start: start address to write PIRQ routing table
59 * @return: end address of PIRQ routing table
60 */
61u32 write_pirq_routing_table(u32 start);
62
63#endif /* _X86_TABLES_H_ */