1*83d290c5STom Rini /* SPDX-License-Identifier: GPL-2.0+ */ 25e2400e8SBin Meng /* 35e2400e8SBin Meng * Copyright (C) 2015, Bin Meng <bmeng.cn@gmail.com> 45e2400e8SBin Meng */ 55e2400e8SBin Meng 65e2400e8SBin Meng #ifndef _X86_TABLES_H_ 75e2400e8SBin Meng #define _X86_TABLES_H_ 85e2400e8SBin Meng 92b445e4dSAlexander Graf #include <tables_csum.h> 102b445e4dSAlexander Graf 11c3df28f6SAndy Shevchenko #define ROM_TABLE_ADDR CONFIG_ROM_TABLE_ADDR 12c3df28f6SAndy Shevchenko #define ROM_TABLE_END (CONFIG_ROM_TABLE_ADDR + CONFIG_ROM_TABLE_SIZE - 1) 135e2400e8SBin Meng 14897e1dc8SBin Meng #define ROM_TABLE_ALIGN 1024 15897e1dc8SBin Meng 163cf23719SBin Meng /* SeaBIOS expects coreboot tables at address range 0x0000-0x1000 */ 173cf23719SBin Meng #define CB_TABLE_ADDR 0x800 183cf23719SBin Meng 195e2400e8SBin Meng /** 205e2400e8SBin Meng * table_compute_checksum() - Compute a table checksum 215e2400e8SBin Meng * 225e2400e8SBin Meng * This computes an 8-bit checksum for the configuration table. 235e2400e8SBin Meng * All bytes in the configuration table, including checksum itself and 245e2400e8SBin Meng * reserved bytes must add up to zero. 255e2400e8SBin Meng * 265e2400e8SBin Meng * @v: configuration table base address 275e2400e8SBin Meng * @len: configuration table size 285e2400e8SBin Meng * @return: the 8-bit checksum 295e2400e8SBin Meng */ 305e2400e8SBin Meng u8 table_compute_checksum(void *v, int len); 315e2400e8SBin Meng 325e2400e8SBin Meng /** 337f5df8d4SBin Meng * table_fill_string() - Fill a string with pad in the configuration table 347f5df8d4SBin Meng * 357f5df8d4SBin Meng * This fills a string in the configuration table. It copies number of bytes 367f5df8d4SBin Meng * from the source string, and if source string length is shorter than the 377f5df8d4SBin Meng * required size to copy, pad the table string with the given pad character. 387f5df8d4SBin Meng * 397f5df8d4SBin Meng * @dest: where to fill a string 407f5df8d4SBin Meng * @src: where to copy from 417f5df8d4SBin Meng * @n: number of bytes to copy 427f5df8d4SBin Meng * @pad: character to pad the remaining bytes 437f5df8d4SBin Meng */ 447f5df8d4SBin Meng void table_fill_string(char *dest, const char *src, size_t n, char pad); 457f5df8d4SBin Meng 467f5df8d4SBin Meng /** 475e2400e8SBin Meng * write_tables() - Write x86 configuration tables 485e2400e8SBin Meng * 495e2400e8SBin Meng * This writes x86 configuration tables, including PIRQ routing table, 505e2400e8SBin Meng * Multi-Processor table and ACPI table. Whether a specific type of 515e2400e8SBin Meng * configuration table is written is controlled by a Kconfig option. 525e2400e8SBin Meng */ 535e2400e8SBin Meng void write_tables(void); 545e2400e8SBin Meng 555e2400e8SBin Meng /** 565e2400e8SBin Meng * write_pirq_routing_table() - Write PIRQ routing table 575e2400e8SBin Meng * 585e2400e8SBin Meng * This writes PIRQ routing table at a given address. 595e2400e8SBin Meng * 605e2400e8SBin Meng * @start: start address to write PIRQ routing table 615e2400e8SBin Meng * @return: end address of PIRQ routing table 625e2400e8SBin Meng */ 6342fd8c19SSimon Glass ulong write_pirq_routing_table(ulong start); 645e2400e8SBin Meng 655e2400e8SBin Meng #endif /* _X86_TABLES_H_ */ 66