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