tables.h 1.9 KB

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