15e2400e8SBin Meng /* 25e2400e8SBin Meng * Copyright (C) 2015, Bin Meng <bmeng.cn@gmail.com> 35e2400e8SBin Meng * 45e2400e8SBin Meng * SPDX-License-Identifier: GPL-2.0+ 55e2400e8SBin Meng */ 65e2400e8SBin Meng 75e2400e8SBin Meng #ifndef _X86_TABLES_H_ 85e2400e8SBin Meng #define _X86_TABLES_H_ 95e2400e8SBin Meng 105e2400e8SBin Meng /* 115e2400e8SBin Meng * All x86 tables happen to like the address range from 0xf0000 to 0x100000. 125e2400e8SBin Meng * We use 0xf0000 as the starting address to store those tables, including 135e2400e8SBin Meng * PIRQ routing table, Multi-Processor table and ACPI table. 145e2400e8SBin Meng */ 155e2400e8SBin Meng #define ROM_TABLE_ADDR 0xf0000 165e2400e8SBin Meng 175e2400e8SBin Meng /** 185e2400e8SBin Meng * table_compute_checksum() - Compute a table checksum 195e2400e8SBin Meng * 205e2400e8SBin Meng * This computes an 8-bit checksum for the configuration table. 215e2400e8SBin Meng * All bytes in the configuration table, including checksum itself and 225e2400e8SBin Meng * reserved bytes must add up to zero. 235e2400e8SBin Meng * 245e2400e8SBin Meng * @v: configuration table base address 255e2400e8SBin Meng * @len: configuration table size 265e2400e8SBin Meng * @return: the 8-bit checksum 275e2400e8SBin Meng */ 285e2400e8SBin Meng u8 table_compute_checksum(void *v, int len); 295e2400e8SBin Meng 305e2400e8SBin Meng /** 31*7f5df8d4SBin Meng * table_fill_string() - Fill a string with pad in the configuration table 32*7f5df8d4SBin Meng * 33*7f5df8d4SBin Meng * This fills a string in the configuration table. It copies number of bytes 34*7f5df8d4SBin Meng * from the source string, and if source string length is shorter than the 35*7f5df8d4SBin Meng * required size to copy, pad the table string with the given pad character. 36*7f5df8d4SBin Meng * 37*7f5df8d4SBin Meng * @dest: where to fill a string 38*7f5df8d4SBin Meng * @src: where to copy from 39*7f5df8d4SBin Meng * @n: number of bytes to copy 40*7f5df8d4SBin Meng * @pad: character to pad the remaining bytes 41*7f5df8d4SBin Meng */ 42*7f5df8d4SBin Meng void table_fill_string(char *dest, const char *src, size_t n, char pad); 43*7f5df8d4SBin Meng 44*7f5df8d4SBin Meng /** 455e2400e8SBin Meng * write_tables() - Write x86 configuration tables 465e2400e8SBin Meng * 475e2400e8SBin Meng * This writes x86 configuration tables, including PIRQ routing table, 485e2400e8SBin Meng * Multi-Processor table and ACPI table. Whether a specific type of 495e2400e8SBin Meng * configuration table is written is controlled by a Kconfig option. 505e2400e8SBin Meng */ 515e2400e8SBin Meng void write_tables(void); 525e2400e8SBin Meng 535e2400e8SBin Meng /** 545e2400e8SBin Meng * write_pirq_routing_table() - Write PIRQ routing table 555e2400e8SBin Meng * 565e2400e8SBin Meng * This writes PIRQ routing table at a given address. 575e2400e8SBin Meng * 585e2400e8SBin Meng * @start: start address to write PIRQ routing table 595e2400e8SBin Meng * @return: end address of PIRQ routing table 605e2400e8SBin Meng */ 615e2400e8SBin Meng u32 write_pirq_routing_table(u32 start); 625e2400e8SBin Meng 635e2400e8SBin Meng #endif /* _X86_TABLES_H_ */ 64