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. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program; if not, write to the Free Software |
| 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA |
| 18 | */ |
| 19 | |
| 20 | #include <stdint.h> |
Stefan Reinauer | 3c53d33 | 2012-09-26 17:33:39 -0700 | [diff] [blame] | 21 | #define IFDTOOL_VERSION "1.1" |
Stefan Reinauer | 1c795ad1 | 2011-10-14 12:49:41 -0700 | [diff] [blame] | 22 | |
Chris Douglass | 03ce014 | 2014-02-26 13:30:13 -0500 | [diff] [blame] | 23 | #define LAYOUT_LINELEN 80 |
| 24 | |
Stefan Reinauer | 1c795ad1 | 2011-10-14 12:49:41 -0700 | [diff] [blame] | 25 | enum spi_frequency { |
| 26 | SPI_FREQUENCY_20MHZ = 0, |
| 27 | SPI_FREQUENCY_33MHZ = 1, |
| 28 | SPI_FREQUENCY_50MHZ = 4, |
| 29 | }; |
| 30 | |
Stefan Reinauer | 1b1309f | 2012-05-11 15:53:43 -0700 | [diff] [blame] | 31 | enum component_density { |
| 32 | COMPONENT_DENSITY_512KB = 0, |
| 33 | COMPONENT_DENSITY_1MB = 1, |
| 34 | COMPONENT_DENSITY_2MB = 2, |
| 35 | COMPONENT_DENSITY_4MB = 3, |
| 36 | COMPONENT_DENSITY_8MB = 4, |
| 37 | COMPONENT_DENSITY_16MB = 5, |
| 38 | }; |
| 39 | |
Stefan Reinauer | 1c795ad1 | 2011-10-14 12:49:41 -0700 | [diff] [blame] | 40 | // flash descriptor |
| 41 | typedef struct { |
| 42 | uint32_t flvalsig; |
| 43 | uint32_t flmap0; |
| 44 | uint32_t flmap1; |
| 45 | uint32_t flmap2; |
| 46 | uint8_t reserved[0xefc - 0x20]; |
| 47 | uint32_t flumap1; |
| 48 | } __attribute__((packed)) fdbar_t; |
| 49 | |
| 50 | // regions |
| 51 | typedef struct { |
| 52 | uint32_t flreg0; |
| 53 | uint32_t flreg1; |
| 54 | uint32_t flreg2; |
| 55 | uint32_t flreg3; |
| 56 | uint32_t flreg4; |
| 57 | } __attribute__((packed)) frba_t; |
| 58 | |
| 59 | // component section |
| 60 | typedef struct { |
| 61 | uint32_t flcomp; |
| 62 | uint32_t flill; |
| 63 | uint32_t flpb; |
| 64 | } __attribute__((packed)) fcba_t; |
| 65 | |
| 66 | // pch strap |
| 67 | typedef struct { |
| 68 | uint32_t pchstrp0; |
| 69 | uint32_t pchstrp1; |
| 70 | uint32_t pchstrp2; |
| 71 | uint32_t pchstrp3; |
| 72 | uint32_t pchstrp4; |
| 73 | uint32_t pchstrp5; |
| 74 | uint32_t pchstrp6; |
| 75 | uint32_t pchstrp7; |
| 76 | uint32_t pchstrp8; |
| 77 | uint32_t pchstrp9; |
| 78 | uint32_t pchstrp10; |
| 79 | uint32_t pchstrp11; |
| 80 | uint32_t pchstrp12; |
| 81 | uint32_t pchstrp13; |
| 82 | uint32_t pchstrp14; |
| 83 | uint32_t pchstrp15; |
Stefan Reinauer | 4a17d29 | 2012-09-27 12:42:15 -0700 | [diff] [blame] | 84 | uint32_t pchstrp16; |
| 85 | uint32_t pchstrp17; |
Stefan Reinauer | 1c795ad1 | 2011-10-14 12:49:41 -0700 | [diff] [blame] | 86 | } __attribute__((packed)) fpsba_t; |
| 87 | |
| 88 | // master |
| 89 | typedef struct { |
| 90 | uint32_t flmstr1; |
| 91 | uint32_t flmstr2; |
| 92 | uint32_t flmstr3; |
| 93 | } __attribute__((packed)) fmba_t; |
| 94 | |
| 95 | // processor strap |
| 96 | typedef struct { |
| 97 | uint32_t data[8]; |
| 98 | } __attribute__((packed)) fmsba_t; |
| 99 | |
Stefan Reinauer | 4a17d29 | 2012-09-27 12:42:15 -0700 | [diff] [blame] | 100 | // ME VSCC |
| 101 | typedef struct { |
| 102 | uint32_t jid; |
| 103 | uint32_t vscc; |
| 104 | } vscc_t; |
Stefan Reinauer | 1c795ad1 | 2011-10-14 12:49:41 -0700 | [diff] [blame] | 105 | |
Stefan Reinauer | 4a17d29 | 2012-09-27 12:42:15 -0700 | [diff] [blame] | 106 | typedef struct { |
| 107 | // Actual number of entries specified in vtl |
| 108 | vscc_t entry[8]; |
| 109 | } vtba_t; |
| 110 | |
| 111 | typedef struct { |
| 112 | int base, limit, size; |
| 113 | } region_t; |
Chris Douglass | 03ce014 | 2014-02-26 13:30:13 -0500 | [diff] [blame] | 114 | |
| 115 | struct region_name { |
| 116 | char *pretty; |
| 117 | char *terse; |
| 118 | }; |