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 125e2400e8SBin Meng /* 135e2400e8SBin Meng * All x86 tables happen to like the address range from 0xf0000 to 0x100000. 145e2400e8SBin Meng * We use 0xf0000 as the starting address to store those tables, including 155e2400e8SBin Meng * PIRQ routing table, Multi-Processor table and ACPI table. 165e2400e8SBin Meng */ 175e2400e8SBin Meng #define ROM_TABLE_ADDR 0xf0000 185e2400e8SBin Meng 19897e1dc8SBin Meng #define ROM_TABLE_ALIGN 1024 20897e1dc8SBin Meng 213cf23719SBin Meng /* SeaBIOS expects coreboot tables at address range 0x0000-0x1000 */ 223cf23719SBin Meng #define CB_TABLE_ADDR 0x800 233cf23719SBin Meng 245e2400e8SBin Meng /** 255e2400e8SBin Meng * table_compute_checksum() - Compute a table checksum 265e2400e8SBin Meng * 275e2400e8SBin Meng * This computes an 8-bit checksum for the configuration table. 285e2400e8SBin Meng * All bytes in the configuration table, including checksum itself and 295e2400e8SBin Meng * reserved bytes must add up to zero. 305e2400e8SBin Meng * 315e2400e8SBin Meng * @v: configuration table base address 325e2400e8SBin Meng * @len: configuration table size 335e2400e8SBin Meng * @return: the 8-bit checksum 345e2400e8SBin Meng */ 355e2400e8SBin Meng u8 table_compute_checksum(void *v, int len); 365e2400e8SBin Meng 375e2400e8SBin Meng /** 387f5df8d4SBin Meng * table_fill_string() - Fill a string with pad in the configuration table 397f5df8d4SBin Meng * 407f5df8d4SBin Meng * This fills a string in the configuration table. It copies number of bytes 417f5df8d4SBin Meng * from the source string, and if source string length is shorter than the 427f5df8d4SBin Meng * required size to copy, pad the table string with the given pad character. 437f5df8d4SBin Meng * 447f5df8d4SBin Meng * @dest: where to fill a string 457f5df8d4SBin Meng * @src: where to copy from 467f5df8d4SBin Meng * @n: number of bytes to copy 477f5df8d4SBin Meng * @pad: character to pad the remaining bytes 487f5df8d4SBin Meng */ 497f5df8d4SBin Meng void table_fill_string(char *dest, const char *src, size_t n, char pad); 507f5df8d4SBin Meng 517f5df8d4SBin Meng /** 525e2400e8SBin Meng * write_tables() - Write x86 configuration tables 535e2400e8SBin Meng * 545e2400e8SBin Meng * This writes x86 configuration tables, including PIRQ routing table, 555e2400e8SBin Meng * Multi-Processor table and ACPI table. Whether a specific type of 565e2400e8SBin Meng * configuration table is written is controlled by a Kconfig option. 575e2400e8SBin Meng */ 585e2400e8SBin Meng void write_tables(void); 595e2400e8SBin Meng 605e2400e8SBin Meng /** 615e2400e8SBin Meng * write_pirq_routing_table() - Write PIRQ routing table 625e2400e8SBin Meng * 635e2400e8SBin Meng * This writes PIRQ routing table at a given address. 645e2400e8SBin Meng * 655e2400e8SBin Meng * @start: start address to write PIRQ routing table 665e2400e8SBin Meng * @return: end address of PIRQ routing table 675e2400e8SBin Meng */ 68*42fd8c19SSimon Glass ulong write_pirq_routing_table(ulong start); 695e2400e8SBin Meng 705e2400e8SBin Meng #endif /* _X86_TABLES_H_ */ 71