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 102b445e4dSAlexander Graf #include <tables_csum.h> 112b445e4dSAlexander Graf 12*c3df28f6SAndy Shevchenko #define ROM_TABLE_ADDR CONFIG_ROM_TABLE_ADDR 13*c3df28f6SAndy Shevchenko #define ROM_TABLE_END (CONFIG_ROM_TABLE_ADDR + CONFIG_ROM_TABLE_SIZE - 1) 145e2400e8SBin Meng 15897e1dc8SBin Meng #define ROM_TABLE_ALIGN 1024 16897e1dc8SBin Meng 173cf23719SBin Meng /* SeaBIOS expects coreboot tables at address range 0x0000-0x1000 */ 183cf23719SBin Meng #define CB_TABLE_ADDR 0x800 193cf23719SBin Meng 205e2400e8SBin Meng /** 215e2400e8SBin Meng * table_compute_checksum() - Compute a table checksum 225e2400e8SBin Meng * 235e2400e8SBin Meng * This computes an 8-bit checksum for the configuration table. 245e2400e8SBin Meng * All bytes in the configuration table, including checksum itself and 255e2400e8SBin Meng * reserved bytes must add up to zero. 265e2400e8SBin Meng * 275e2400e8SBin Meng * @v: configuration table base address 285e2400e8SBin Meng * @len: configuration table size 295e2400e8SBin Meng * @return: the 8-bit checksum 305e2400e8SBin Meng */ 315e2400e8SBin Meng u8 table_compute_checksum(void *v, int len); 325e2400e8SBin Meng 335e2400e8SBin Meng /** 347f5df8d4SBin Meng * table_fill_string() - Fill a string with pad in the configuration table 357f5df8d4SBin Meng * 367f5df8d4SBin Meng * This fills a string in the configuration table. It copies number of bytes 377f5df8d4SBin Meng * from the source string, and if source string length is shorter than the 387f5df8d4SBin Meng * required size to copy, pad the table string with the given pad character. 397f5df8d4SBin Meng * 407f5df8d4SBin Meng * @dest: where to fill a string 417f5df8d4SBin Meng * @src: where to copy from 427f5df8d4SBin Meng * @n: number of bytes to copy 437f5df8d4SBin Meng * @pad: character to pad the remaining bytes 447f5df8d4SBin Meng */ 457f5df8d4SBin Meng void table_fill_string(char *dest, const char *src, size_t n, char pad); 467f5df8d4SBin Meng 477f5df8d4SBin Meng /** 485e2400e8SBin Meng * write_tables() - Write x86 configuration tables 495e2400e8SBin Meng * 505e2400e8SBin Meng * This writes x86 configuration tables, including PIRQ routing table, 515e2400e8SBin Meng * Multi-Processor table and ACPI table. Whether a specific type of 525e2400e8SBin Meng * configuration table is written is controlled by a Kconfig option. 535e2400e8SBin Meng */ 545e2400e8SBin Meng void write_tables(void); 555e2400e8SBin Meng 565e2400e8SBin Meng /** 575e2400e8SBin Meng * write_pirq_routing_table() - Write PIRQ routing table 585e2400e8SBin Meng * 595e2400e8SBin Meng * This writes PIRQ routing table at a given address. 605e2400e8SBin Meng * 615e2400e8SBin Meng * @start: start address to write PIRQ routing table 625e2400e8SBin Meng * @return: end address of PIRQ routing table 635e2400e8SBin Meng */ 6442fd8c19SSimon Glass ulong write_pirq_routing_table(ulong start); 655e2400e8SBin Meng 665e2400e8SBin Meng #endif /* _X86_TABLES_H_ */ 67