Jordan Crouse | f6145c3 | 2008-03-19 23:56:58 +0000 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the libpayload project. |
| 3 | * |
| 4 | * Copyright (C) 2008 Advanced Micro Devices, Inc. |
| 5 | * |
| 6 | * Redistribution and use in source and binary forms, with or without |
| 7 | * modification, are permitted provided that the following conditions |
| 8 | * are met: |
| 9 | * 1. Redistributions of source code must retain the above copyright |
| 10 | * notice, this list of conditions and the following disclaimer. |
| 11 | * 2. Redistributions in binary form must reproduce the above copyright |
| 12 | * notice, this list of conditions and the following disclaimer in the |
| 13 | * documentation and/or other materials provided with the distribution. |
| 14 | * 3. The name of the author may not be used to endorse or promote products |
| 15 | * derived from this software without specific prior written permission. |
| 16 | * |
| 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND |
| 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |
| 21 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
| 23 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| 24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
| 25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 27 | * SUCH DAMAGE. |
| 28 | */ |
| 29 | |
Uwe Hermann | fad8c2b | 2008-04-11 18:01:50 +0000 | [diff] [blame^] | 30 | #ifndef _COREBOOT_TABLES_H |
| 31 | #define _COREBOOT_TABLES_H |
Jordan Crouse | f6145c3 | 2008-03-19 23:56:58 +0000 | [diff] [blame] | 32 | |
| 33 | #include <arch/types.h> |
| 34 | |
| 35 | struct cbuint64 { |
Uwe Hermann | fad8c2b | 2008-04-11 18:01:50 +0000 | [diff] [blame^] | 36 | u32 lo; |
| 37 | u32 hi; |
Jordan Crouse | f6145c3 | 2008-03-19 23:56:58 +0000 | [diff] [blame] | 38 | }; |
| 39 | |
| 40 | struct cb_header { |
Uwe Hermann | fad8c2b | 2008-04-11 18:01:50 +0000 | [diff] [blame^] | 41 | u8 signature[4]; |
| 42 | u32 header_bytes; |
| 43 | u32 header_checksum; |
| 44 | u32 table_bytes; |
| 45 | u32 table_checksum; |
| 46 | u32 table_entries; |
Jordan Crouse | f6145c3 | 2008-03-19 23:56:58 +0000 | [diff] [blame] | 47 | }; |
| 48 | |
| 49 | struct cb_record { |
Uwe Hermann | fad8c2b | 2008-04-11 18:01:50 +0000 | [diff] [blame^] | 50 | u32 tag; |
| 51 | u32 size; |
Jordan Crouse | f6145c3 | 2008-03-19 23:56:58 +0000 | [diff] [blame] | 52 | }; |
| 53 | |
| 54 | #define CB_TAG_UNUSED 0x0000 |
| 55 | #define CB_TAG_MEMORY 0x0001 |
| 56 | |
| 57 | struct cb_memory_range { |
| 58 | struct cbuint64 start; |
| 59 | struct cbuint64 size; |
Uwe Hermann | fad8c2b | 2008-04-11 18:01:50 +0000 | [diff] [blame^] | 60 | u32 type; |
Jordan Crouse | f6145c3 | 2008-03-19 23:56:58 +0000 | [diff] [blame] | 61 | }; |
| 62 | |
| 63 | #define CB_MEM_RAM 1 |
| 64 | #define CB_MEM_RESERVED 2 |
| 65 | #define CB_MEM_TABLE 16 |
| 66 | |
| 67 | struct cb_memory { |
Uwe Hermann | fad8c2b | 2008-04-11 18:01:50 +0000 | [diff] [blame^] | 68 | u32 tag; |
| 69 | u32 size; |
Jordan Crouse | f6145c3 | 2008-03-19 23:56:58 +0000 | [diff] [blame] | 70 | struct cb_memory_range map[0]; |
| 71 | }; |
| 72 | |
| 73 | #define CB_TAG_HWRPB 0x0002 |
| 74 | |
| 75 | struct cb_hwrpb { |
Uwe Hermann | fad8c2b | 2008-04-11 18:01:50 +0000 | [diff] [blame^] | 76 | u32 tag; |
| 77 | u32 size; |
| 78 | u64 hwrpb; |
Jordan Crouse | f6145c3 | 2008-03-19 23:56:58 +0000 | [diff] [blame] | 79 | }; |
| 80 | |
| 81 | #define CB_TAG_MAINBOARD 0x0003 |
| 82 | |
| 83 | struct cb_mainboard { |
Uwe Hermann | fad8c2b | 2008-04-11 18:01:50 +0000 | [diff] [blame^] | 84 | u32 tag; |
| 85 | u32 size; |
| 86 | u8 vendor_idx; |
| 87 | u8 part_number_idx; |
| 88 | u8 strings[0]; |
Jordan Crouse | f6145c3 | 2008-03-19 23:56:58 +0000 | [diff] [blame] | 89 | }; |
| 90 | |
| 91 | #define CB_TAG_VERSION 0x0004 |
| 92 | #define CB_TAG_EXTRA_VERSION 0x0005 |
| 93 | #define CB_TAG_BUILD 0x0006 |
| 94 | #define CB_TAG_COMPILE_TIME 0x0007 |
| 95 | #define CB_TAG_COMPILE_BY 0x0008 |
| 96 | #define CB_TAG_COMPILE_HOST 0x0009 |
| 97 | #define CB_TAG_COMPILE_DOMAIN 0x000a |
| 98 | #define CB_TAG_COMPILER 0x000b |
| 99 | #define CB_TAG_LINKER 0x000c |
| 100 | #define CB_TAG_ASSEMBLER 0x000d |
| 101 | |
| 102 | struct cb_string { |
Uwe Hermann | fad8c2b | 2008-04-11 18:01:50 +0000 | [diff] [blame^] | 103 | u32 tag; |
| 104 | u32 size; |
| 105 | u8 string[0]; |
Jordan Crouse | f6145c3 | 2008-03-19 23:56:58 +0000 | [diff] [blame] | 106 | }; |
| 107 | |
| 108 | #define CB_TAG_SERIAL 0x000f |
| 109 | |
| 110 | struct cb_serial { |
Uwe Hermann | fad8c2b | 2008-04-11 18:01:50 +0000 | [diff] [blame^] | 111 | u32 tag; |
| 112 | u32 size; |
| 113 | u16 ioport; |
Jordan Crouse | f6145c3 | 2008-03-19 23:56:58 +0000 | [diff] [blame] | 114 | }; |
| 115 | |
| 116 | #define CB_TAG_CONSOLE 0x00010 |
| 117 | |
| 118 | struct cb_console { |
Uwe Hermann | fad8c2b | 2008-04-11 18:01:50 +0000 | [diff] [blame^] | 119 | u32 tag; |
| 120 | u32 size; |
| 121 | u16 type; |
Jordan Crouse | f6145c3 | 2008-03-19 23:56:58 +0000 | [diff] [blame] | 122 | }; |
| 123 | |
| 124 | #define CB_TAG_CONSOLE_SERIAL8250 0 |
| 125 | #define CB_TAG_CONSOLE_VGA 1 |
Uwe Hermann | 6a441bf | 2008-03-20 19:54:59 +0000 | [diff] [blame] | 126 | #define CB_TAG_CONSOLE_BTEXT 2 |
Jordan Crouse | f6145c3 | 2008-03-19 23:56:58 +0000 | [diff] [blame] | 127 | #define CB_TAG_CONSOLE_LOGBUF 3 |
| 128 | #define CB_TAG_CONSOLE_SROM 4 |
| 129 | #define CB_TAG_CONSOLE_EHCI 5 |
| 130 | |
Uwe Hermann | 6a441bf | 2008-03-20 19:54:59 +0000 | [diff] [blame] | 131 | /* Still to come: CMOS information. */ |
Jordan Crouse | f6145c3 | 2008-03-19 23:56:58 +0000 | [diff] [blame] | 132 | |
| 133 | /* Helpful macros */ |
| 134 | |
| 135 | #define MEM_RANGE_COUNT(_rec) \ |
Uwe Hermann | 6a441bf | 2008-03-20 19:54:59 +0000 | [diff] [blame] | 136 | (((_rec)->size - sizeof(*(_rec))) / sizeof((_rec)->map[0])) |
Jordan Crouse | f6145c3 | 2008-03-19 23:56:58 +0000 | [diff] [blame] | 137 | |
| 138 | #define MEM_RANGE_PTR(_rec, _idx) \ |
Uwe Hermann | fad8c2b | 2008-04-11 18:01:50 +0000 | [diff] [blame^] | 139 | (((u8 *) (_rec)) + sizeof(*(_rec)) \ |
Uwe Hermann | 6a441bf | 2008-03-20 19:54:59 +0000 | [diff] [blame] | 140 | + (sizeof((_rec)->map[0]) * (_idx))) |
Jordan Crouse | f6145c3 | 2008-03-19 23:56:58 +0000 | [diff] [blame] | 141 | |
| 142 | #define MB_VENDOR_STRING(_mb) \ |
| 143 | (((unsigned char *) ((_mb)->strings)) + (_mb)->vendor_idx) |
| 144 | |
| 145 | #define MB_PART_STRING(_mb) \ |
| 146 | (((unsigned char *) ((_mb)->strings)) + (_mb)->part_number_idx) |
| 147 | |
| 148 | #define UNPACK_CB64(_in) \ |
Uwe Hermann | fad8c2b | 2008-04-11 18:01:50 +0000 | [diff] [blame^] | 149 | ( (((u64) _in.hi) << 32) | _in.lo ) |
Jordan Crouse | f6145c3 | 2008-03-19 23:56:58 +0000 | [diff] [blame] | 150 | |
| 151 | #endif |