tables.h 2.0 KB

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