tables.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * Copyright (C) 2015, Bin Meng <bmeng.cn@gmail.com>
  4. */
  5. #ifndef _X86_TABLES_H_
  6. #define _X86_TABLES_H_
  7. #include <tables_csum.h>
  8. #define ROM_TABLE_ADDR CONFIG_ROM_TABLE_ADDR
  9. #define ROM_TABLE_END (CONFIG_ROM_TABLE_ADDR + CONFIG_ROM_TABLE_SIZE - 1)
  10. #define ROM_TABLE_ALIGN 1024
  11. /* SeaBIOS expects coreboot tables at address range 0x0000-0x1000 */
  12. #define CB_TABLE_ADDR 0x800
  13. /**
  14. * table_compute_checksum() - Compute a table checksum
  15. *
  16. * This computes an 8-bit checksum for the configuration table.
  17. * All bytes in the configuration table, including checksum itself and
  18. * reserved bytes must add up to zero.
  19. *
  20. * @v: configuration table base address
  21. * @len: configuration table size
  22. * @return: the 8-bit checksum
  23. */
  24. u8 table_compute_checksum(void *v, int len);
  25. /**
  26. * table_fill_string() - Fill a string with pad in the configuration table
  27. *
  28. * This fills a string in the configuration table. It copies number of bytes
  29. * from the source string, and if source string length is shorter than the
  30. * required size to copy, pad the table string with the given pad character.
  31. *
  32. * @dest: where to fill a string
  33. * @src: where to copy from
  34. * @n: number of bytes to copy
  35. * @pad: character to pad the remaining bytes
  36. */
  37. void table_fill_string(char *dest, const char *src, size_t n, char pad);
  38. /**
  39. * write_tables() - Write x86 configuration tables
  40. *
  41. * This writes x86 configuration tables, including PIRQ routing table,
  42. * Multi-Processor table and ACPI table. Whether a specific type of
  43. * configuration table is written is controlled by a Kconfig option.
  44. */
  45. void write_tables(void);
  46. /**
  47. * write_pirq_routing_table() - Write PIRQ routing table
  48. *
  49. * This writes PIRQ routing table at a given address.
  50. *
  51. * @start: start address to write PIRQ routing table
  52. * @return: end address of PIRQ routing table
  53. */
  54. ulong write_pirq_routing_table(ulong start);
  55. #endif /* _X86_TABLES_H_ */