tables.h 2.1 KB

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