2018-05-06 21:58:06 +00:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0+ */
|
2015-04-24 10:10:04 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2015, Bin Meng <bmeng.cn@gmail.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _X86_TABLES_H_
|
|
|
|
#define _X86_TABLES_H_
|
|
|
|
|
2016-08-18 23:23:22 +00:00
|
|
|
#include <tables_csum.h>
|
|
|
|
|
2017-07-28 17:02:15 +00:00
|
|
|
#define ROM_TABLE_ADDR CONFIG_ROM_TABLE_ADDR
|
|
|
|
#define ROM_TABLE_END (CONFIG_ROM_TABLE_ADDR + CONFIG_ROM_TABLE_SIZE - 1)
|
2015-04-24 10:10:04 +00:00
|
|
|
|
2016-02-28 06:57:59 +00:00
|
|
|
#define ROM_TABLE_ALIGN 1024
|
|
|
|
|
2016-02-29 07:54:50 +00:00
|
|
|
/* SeaBIOS expects coreboot tables at address range 0x0000-0x1000 */
|
|
|
|
#define CB_TABLE_ADDR 0x800
|
|
|
|
|
2015-04-24 10:10:04 +00:00
|
|
|
/**
|
|
|
|
* table_compute_checksum() - Compute a table checksum
|
|
|
|
*
|
|
|
|
* This computes an 8-bit checksum for the configuration table.
|
|
|
|
* All bytes in the configuration table, including checksum itself and
|
|
|
|
* reserved bytes must add up to zero.
|
|
|
|
*
|
|
|
|
* @v: configuration table base address
|
|
|
|
* @len: configuration table size
|
|
|
|
* @return: the 8-bit checksum
|
|
|
|
*/
|
|
|
|
u8 table_compute_checksum(void *v, int len);
|
|
|
|
|
2015-06-23 04:18:51 +00:00
|
|
|
/**
|
|
|
|
* table_fill_string() - Fill a string with pad in the configuration table
|
|
|
|
*
|
|
|
|
* This fills a string in the configuration table. It copies number of bytes
|
|
|
|
* from the source string, and if source string length is shorter than the
|
|
|
|
* required size to copy, pad the table string with the given pad character.
|
|
|
|
*
|
|
|
|
* @dest: where to fill a string
|
|
|
|
* @src: where to copy from
|
|
|
|
* @n: number of bytes to copy
|
|
|
|
* @pad: character to pad the remaining bytes
|
|
|
|
*/
|
|
|
|
void table_fill_string(char *dest, const char *src, size_t n, char pad);
|
|
|
|
|
2015-04-24 10:10:04 +00:00
|
|
|
/**
|
|
|
|
* write_tables() - Write x86 configuration tables
|
|
|
|
*
|
|
|
|
* This writes x86 configuration tables, including PIRQ routing table,
|
|
|
|
* Multi-Processor table and ACPI table. Whether a specific type of
|
|
|
|
* configuration table is written is controlled by a Kconfig option.
|
2020-11-04 16:57:18 +00:00
|
|
|
*
|
2022-01-19 17:05:50 +00:00
|
|
|
* Return: 0 if OK, -ENOSPC if table too large
|
2015-04-24 10:10:04 +00:00
|
|
|
*/
|
2020-11-04 16:57:18 +00:00
|
|
|
int write_tables(void);
|
2015-04-24 10:10:04 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* write_pirq_routing_table() - Write PIRQ routing table
|
|
|
|
*
|
|
|
|
* This writes PIRQ routing table at a given address.
|
|
|
|
*
|
|
|
|
* @start: start address to write PIRQ routing table
|
|
|
|
* @return: end address of PIRQ routing table
|
|
|
|
*/
|
2017-01-16 14:03:35 +00:00
|
|
|
ulong write_pirq_routing_table(ulong start);
|
2015-04-24 10:10:04 +00:00
|
|
|
|
|
|
|
#endif /* _X86_TABLES_H_ */
|