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