blob: f847d9bd8ef1ae67e3a0322164df1f91e01499d1 [file] [log] [blame]
Martin Roth61ea5412016-03-07 20:58:18 -07001#ifndef COREBOOT_TABLES_H
2#define COREBOOT_TABLES_H
Martin Roth9b1b3352016-02-24 12:27:06 -08003
4#include "stdint.h"
5
Martin Roth61ea5412016-03-07 20:58:18 -07006/* The coreboot table information is for conveying information
Martin Roth9b1b3352016-02-24 12:27:06 -08007 * from the firmware to the loaded OS image. Primarily this
8 * is expected to be information that cannot be discovered by
Martin Roth61ea5412016-03-07 20:58:18 -07009 * other means, such as querying the hardware directly.
Martin Roth9b1b3352016-02-24 12:27:06 -080010 *
Martin Roth4dcd13d2016-02-24 13:53:07 -080011 * All of the information should be Position Independent Data.
Martin Roth9b1b3352016-02-24 12:27:06 -080012 * That is it should be safe to relocated any of the information
Martin Roth61ea5412016-03-07 20:58:18 -070013 * without it's meaning/correctness changing. For table that
Martin Roth9b1b3352016-02-24 12:27:06 -080014 * 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
Martin Roth61ea5412016-03-07 20:58:18 -070030 * dropped. Of course it is polite and expedite to include extra
Martin Roth9b1b3352016-02-24 12:27:06 -080031 * table entries and be backwards compatible, but it is not required.
32 */
33
34
35struct lb_header
36{
37 uint8_t signature[4]; /* LBIO */
38 uint32_t header_bytes;
39 uint32_t header_checksum;
40 uint32_t table_bytes;
41 uint32_t table_checksum;
42 uint32_t table_entries;
43};
44
Martin Roth61ea5412016-03-07 20:58:18 -070045/* Every entry in the boot environment list will correspond to a boot
Martin Roth9b1b3352016-02-24 12:27:06 -080046 * info record. Encoding both type and size. The type is obviously
47 * so you can tell what it is. The size allows you to skip that
Martin Roth61ea5412016-03-07 20:58:18 -070048 * boot environment record if you don't know what it is. This allows
Martin Roth9b1b3352016-02-24 12:27:06 -080049 * forward compatibility with records not yet defined.
50 */
51struct lb_record {
52 uint32_t tag; /* tag ID */
53 uint32_t size; /* size of record (in bytes) */
54};
55
56#define LB_TAG_UNUSED 0x0000
57
58#define LB_TAG_MEMORY 0x0001
Martin Roth61ea5412016-03-07 20:58:18 -070059#define LB_TAG_FORWARD 0x0011
Martin Roth9b1b3352016-02-24 12:27:06 -080060
61struct lb_memory_range {
62 uint64_t start;
63 uint64_t size;
64 uint32_t type;
Martin Roth61ea5412016-03-07 20:58:18 -070065#define LB_MEM_RAM 1 /* Memory anyone can use */
66#define LB_MEM_RESERVED 2 /* Don't use this memory region */
67#define LB_MEM_ACPI 3 /* ACPI Tables */
68#define LB_MEM_NVS 4 /* ACPI NVS Memory */
69#define LB_MEM_UNUSABLE 5 /* Unusable address space */
70#define LB_MEM_VENDOR_RSVD 6 /* Vendor Reserved */
71#define LB_MEM_TABLE 16 /* Ram configuration tables are kept in */
Martin Roth9b1b3352016-02-24 12:27:06 -080072};
73
74struct lb_memory {
75 uint32_t tag;
76 uint32_t size;
77 struct lb_memory_range map[0];
78};
79
Martin Roth9b1b3352016-02-24 12:27:06 -080080struct lb_forward {
Martin Roth61ea5412016-03-07 20:58:18 -070081 uint32_t tag;
82 uint32_t size;
83 uint64_t forward;
Martin Roth9b1b3352016-02-24 12:27:06 -080084};
85
Martin Roth61ea5412016-03-07 20:58:18 -070086#endif