Stefan Reinauer | 1c795ad1 | 2011-10-14 12:49:41 -0700 | [diff] [blame] | 1 | /* |
| 2 | * ifdtool - dump Intel Firmware Descriptor information |
| 3 | * |
| 4 | * Copyright (C) 2011 The ChromiumOS Authors. All rights reserved. |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; version 2 of the License. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
Stefan Reinauer | 1c795ad1 | 2011-10-14 12:49:41 -0700 | [diff] [blame] | 14 | */ |
| 15 | |
| 16 | #include <stdint.h> |
Duncan Laurie | 1f7fd72 | 2015-06-22 11:14:48 -0700 | [diff] [blame] | 17 | #define IFDTOOL_VERSION "1.2" |
| 18 | |
| 19 | enum ifd_version { |
| 20 | IFD_VERSION_1, |
| 21 | IFD_VERSION_2, |
| 22 | }; |
Stefan Reinauer | 1c795ad1 | 2011-10-14 12:49:41 -0700 | [diff] [blame] | 23 | |
Andrey Petrov | 96ecb77 | 2016-10-31 19:31:54 -0700 | [diff] [blame] | 24 | enum platform { |
| 25 | PLATFORM_APOLLOLAKE |
| 26 | }; |
| 27 | |
Chris Douglass | 03ce014 | 2014-02-26 13:30:13 -0500 | [diff] [blame] | 28 | #define LAYOUT_LINELEN 80 |
| 29 | |
Stefan Reinauer | 1c795ad1 | 2011-10-14 12:49:41 -0700 | [diff] [blame] | 30 | enum spi_frequency { |
| 31 | SPI_FREQUENCY_20MHZ = 0, |
| 32 | SPI_FREQUENCY_33MHZ = 1, |
Duncan Laurie | 1f7fd72 | 2015-06-22 11:14:48 -0700 | [diff] [blame] | 33 | SPI_FREQUENCY_48MHZ = 2, |
| 34 | SPI_FREQUENCY_50MHZ_30MHZ = 4, |
| 35 | SPI_FREQUENCY_17MHZ = 6, |
Stefan Reinauer | 1c795ad1 | 2011-10-14 12:49:41 -0700 | [diff] [blame] | 36 | }; |
| 37 | |
Stefan Reinauer | 1b1309f | 2012-05-11 15:53:43 -0700 | [diff] [blame] | 38 | enum component_density { |
| 39 | COMPONENT_DENSITY_512KB = 0, |
| 40 | COMPONENT_DENSITY_1MB = 1, |
| 41 | COMPONENT_DENSITY_2MB = 2, |
| 42 | COMPONENT_DENSITY_4MB = 3, |
| 43 | COMPONENT_DENSITY_8MB = 4, |
| 44 | COMPONENT_DENSITY_16MB = 5, |
Duncan Laurie | 1f7fd72 | 2015-06-22 11:14:48 -0700 | [diff] [blame] | 45 | COMPONENT_DENSITY_32MB = 6, |
| 46 | COMPONENT_DENSITY_64MB = 7, |
| 47 | COMPONENT_DENSITY_UNUSED = 0xf |
Stefan Reinauer | 1b1309f | 2012-05-11 15:53:43 -0700 | [diff] [blame] | 48 | }; |
| 49 | |
Stefan Reinauer | 1c795ad1 | 2011-10-14 12:49:41 -0700 | [diff] [blame] | 50 | // flash descriptor |
| 51 | typedef struct { |
| 52 | uint32_t flvalsig; |
| 53 | uint32_t flmap0; |
| 54 | uint32_t flmap1; |
| 55 | uint32_t flmap2; |
| 56 | uint8_t reserved[0xefc - 0x20]; |
| 57 | uint32_t flumap1; |
| 58 | } __attribute__((packed)) fdbar_t; |
| 59 | |
| 60 | // regions |
Duncan Laurie | 1f7fd72 | 2015-06-22 11:14:48 -0700 | [diff] [blame] | 61 | #define MAX_REGIONS 9 |
| 62 | #define MAX_REGIONS_OLD 5 |
Stefan Reinauer | 1c795ad1 | 2011-10-14 12:49:41 -0700 | [diff] [blame] | 63 | typedef struct { |
| 64 | uint32_t flreg0; |
| 65 | uint32_t flreg1; |
| 66 | uint32_t flreg2; |
| 67 | uint32_t flreg3; |
| 68 | uint32_t flreg4; |
Duncan Laurie | 1f7fd72 | 2015-06-22 11:14:48 -0700 | [diff] [blame] | 69 | uint32_t flreg5; |
| 70 | uint32_t flreg6; |
| 71 | uint32_t flreg7; |
| 72 | uint32_t flreg8; |
Stefan Reinauer | 1c795ad1 | 2011-10-14 12:49:41 -0700 | [diff] [blame] | 73 | } __attribute__((packed)) frba_t; |
| 74 | |
| 75 | // component section |
| 76 | typedef struct { |
| 77 | uint32_t flcomp; |
| 78 | uint32_t flill; |
| 79 | uint32_t flpb; |
| 80 | } __attribute__((packed)) fcba_t; |
| 81 | |
| 82 | // pch strap |
| 83 | typedef struct { |
| 84 | uint32_t pchstrp0; |
| 85 | uint32_t pchstrp1; |
| 86 | uint32_t pchstrp2; |
| 87 | uint32_t pchstrp3; |
| 88 | uint32_t pchstrp4; |
| 89 | uint32_t pchstrp5; |
| 90 | uint32_t pchstrp6; |
| 91 | uint32_t pchstrp7; |
| 92 | uint32_t pchstrp8; |
| 93 | uint32_t pchstrp9; |
| 94 | uint32_t pchstrp10; |
| 95 | uint32_t pchstrp11; |
| 96 | uint32_t pchstrp12; |
| 97 | uint32_t pchstrp13; |
| 98 | uint32_t pchstrp14; |
| 99 | uint32_t pchstrp15; |
Stefan Reinauer | 4a17d29 | 2012-09-27 12:42:15 -0700 | [diff] [blame] | 100 | uint32_t pchstrp16; |
| 101 | uint32_t pchstrp17; |
Stefan Reinauer | 1c795ad1 | 2011-10-14 12:49:41 -0700 | [diff] [blame] | 102 | } __attribute__((packed)) fpsba_t; |
| 103 | |
Shawn Nematbakhsh | d2cb118 | 2015-09-10 19:07:13 -0700 | [diff] [blame] | 104 | /* |
| 105 | * WR / RD bits start at different locations within the flmstr regs, but |
| 106 | * otherwise have identical meaning. |
| 107 | */ |
| 108 | #define FLMSTR_WR_SHIFT_V1 24 |
| 109 | #define FLMSTR_WR_SHIFT_V2 20 |
| 110 | #define FLMSTR_RD_SHIFT_V1 16 |
| 111 | #define FLMSTR_RD_SHIFT_V2 8 |
| 112 | |
Stefan Reinauer | 1c795ad1 | 2011-10-14 12:49:41 -0700 | [diff] [blame] | 113 | // master |
| 114 | typedef struct { |
| 115 | uint32_t flmstr1; |
| 116 | uint32_t flmstr2; |
| 117 | uint32_t flmstr3; |
Duncan Laurie | 1f7fd72 | 2015-06-22 11:14:48 -0700 | [diff] [blame] | 118 | uint32_t flmstr4; |
| 119 | uint32_t flmstr5; |
Stefan Reinauer | 1c795ad1 | 2011-10-14 12:49:41 -0700 | [diff] [blame] | 120 | } __attribute__((packed)) fmba_t; |
| 121 | |
| 122 | // processor strap |
| 123 | typedef struct { |
| 124 | uint32_t data[8]; |
| 125 | } __attribute__((packed)) fmsba_t; |
| 126 | |
Stefan Reinauer | 4a17d29 | 2012-09-27 12:42:15 -0700 | [diff] [blame] | 127 | // ME VSCC |
| 128 | typedef struct { |
| 129 | uint32_t jid; |
| 130 | uint32_t vscc; |
| 131 | } vscc_t; |
Stefan Reinauer | 1c795ad1 | 2011-10-14 12:49:41 -0700 | [diff] [blame] | 132 | |
Stefan Reinauer | 4a17d29 | 2012-09-27 12:42:15 -0700 | [diff] [blame] | 133 | typedef struct { |
| 134 | // Actual number of entries specified in vtl |
| 135 | vscc_t entry[8]; |
| 136 | } vtba_t; |
| 137 | |
| 138 | typedef struct { |
| 139 | int base, limit, size; |
| 140 | } region_t; |
Chris Douglass | 03ce014 | 2014-02-26 13:30:13 -0500 | [diff] [blame] | 141 | |
| 142 | struct region_name { |
Bill XIE | fa5f994 | 2017-09-12 11:22:29 +0800 | [diff] [blame] | 143 | const char *pretty; |
| 144 | const char *terse; |
Bill XIE | 1bf6506 | 2017-09-12 11:31:37 +0800 | [diff] [blame^] | 145 | const char *filename; |
Chris Douglass | 03ce014 | 2014-02-26 13:30:13 -0500 | [diff] [blame] | 146 | }; |