coreboot_tables.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. /*
  2. * This file is part of the coreboot project.
  3. *
  4. * Copyright (C) 2002 Linux Networx
  5. * (Written by Eric Biederman <ebiederman@lnxi.com> for Linux Networx)
  6. * Copyright (C) 2005-2007 coresystems GmbH
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; version 2 of the License.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA
  20. */
  21. #ifndef COREBOOT_TABLES_H
  22. #define COREBOOT_TABLES_H
  23. #include <stdint.h>
  24. /* The coreboot table information is for conveying information
  25. * from the firmware to the loaded OS image. Primarily this
  26. * is expected to be information that cannot be discovered by
  27. * other means, such as querying the hardware directly.
  28. *
  29. * All of the information should be Position Independent Data.
  30. * That is it should be safe to relocated any of the information
  31. * without it's meaning/correctness changing. For table that
  32. * can reasonably be used on multiple architectures the data
  33. * size should be fixed. This should ease the transition between
  34. * 32 bit and 64 bit architectures etc.
  35. *
  36. * The completeness test for the information in this table is:
  37. * - Can all of the hardware be detected?
  38. * - Are the per motherboard constants available?
  39. * - Is there enough to allow a kernel to run that was written before
  40. * a particular motherboard is constructed? (Assuming the kernel
  41. * has drivers for all of the hardware but it does not have
  42. * assumptions on how the hardware is connected together).
  43. *
  44. * With this test it should be straight forward to determine if a
  45. * table entry is required or not. This should remove much of the
  46. * long term compatibility burden as table entries which are
  47. * irrelevant or have been replaced by better alternatives may be
  48. * dropped. Of course it is polite and expedite to include extra
  49. * table entries and be backwards compatible, but it is not required.
  50. */
  51. /* Since coreboot is usually compiled 32bit, gcc will align 64bit
  52. * types to 32bit boundaries. If the coreboot table is dumped on a
  53. * 64bit system, a uint64_t would be aligned to 64bit boundaries,
  54. * breaking the table format.
  55. *
  56. * lb_uint64 will keep 64bit coreboot table values aligned to 32bit
  57. * to ensure compatibility. They can be accessed with the two functions
  58. * below: unpack_lb64() and pack_lb64()
  59. *
  60. * See also: util/lbtdump/lbtdump.c
  61. */
  62. struct lb_uint64 {
  63. uint32_t lo;
  64. uint32_t hi;
  65. };
  66. struct lb_header {
  67. uint8_t signature[4]; /* LBIO */
  68. uint32_t header_bytes;
  69. uint32_t header_checksum;
  70. uint32_t table_bytes;
  71. uint32_t table_checksum;
  72. uint32_t table_entries;
  73. };
  74. /* Every entry in the boot environment list will correspond to a boot
  75. * info record. Encoding both type and size. The type is obviously
  76. * so you can tell what it is. The size allows you to skip that
  77. * boot environment record if you don't know what it easy. This allows
  78. * forward compatibility with records not yet defined.
  79. */
  80. struct lb_record {
  81. uint32_t tag; /* tag ID */
  82. uint32_t size; /* size of record (in bytes) */
  83. };
  84. #define LB_TAG_UNUSED 0x0000
  85. #define LB_TAG_MEMORY 0x0001
  86. struct lb_memory_range {
  87. struct lb_uint64 start;
  88. struct lb_uint64 size;
  89. uint32_t type;
  90. #define LB_MEM_RAM 1 /* Memory anyone can use */
  91. #define LB_MEM_RESERVED 2 /* Don't use this memory region */
  92. #define LB_MEM_TABLE 16 /* Ram configuration tables are kept in */
  93. };
  94. struct lb_memory {
  95. uint32_t tag;
  96. uint32_t size;
  97. struct lb_memory_range map[0];
  98. };
  99. #define LB_TAG_HWRPB 0x0002
  100. struct lb_hwrpb {
  101. uint32_t tag;
  102. uint32_t size;
  103. uint64_t hwrpb;
  104. };
  105. #define LB_TAG_MAINBOARD 0x0003
  106. struct lb_mainboard {
  107. uint32_t tag;
  108. uint32_t size;
  109. uint8_t vendor_idx;
  110. uint8_t part_number_idx;
  111. uint8_t strings[0];
  112. };
  113. #define LB_TAG_VERSION 0x0004
  114. #define LB_TAG_EXTRA_VERSION 0x0005
  115. #define LB_TAG_BUILD 0x0006
  116. #define LB_TAG_COMPILE_TIME 0x0007
  117. #define LB_TAG_COMPILE_BY 0x0008
  118. #define LB_TAG_COMPILE_HOST 0x0009
  119. #define LB_TAG_COMPILE_DOMAIN 0x000a
  120. #define LB_TAG_COMPILER 0x000b
  121. #define LB_TAG_LINKER 0x000c
  122. #define LB_TAG_ASSEMBLER 0x000d
  123. struct lb_string {
  124. uint32_t tag;
  125. uint32_t size;
  126. uint8_t string[0];
  127. };
  128. #define LB_TAG_FORWARD 0x0011
  129. struct lb_forward {
  130. uint32_t tag;
  131. uint32_t size;
  132. uint64_t forward;
  133. };
  134. #endif /* COREBOOT_TABLES_H */