blob: f50f6be3a31723d8080e720564635c3cc68b7c56 [file] [log] [blame]
Stefan Reinauer1c795ad12011-10-14 12:49:41 -07001/*
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 Reinauer1c795ad12011-10-14 12:49:41 -070014 */
15
16#include <stdint.h>
Duncan Laurie1f7fd722015-06-22 11:14:48 -070017#define IFDTOOL_VERSION "1.2"
18
19enum ifd_version {
20 IFD_VERSION_1,
21 IFD_VERSION_2,
22};
Stefan Reinauer1c795ad12011-10-14 12:49:41 -070023
Andrey Petrov96ecb772016-10-31 19:31:54 -070024enum platform {
25 PLATFORM_APOLLOLAKE
26};
27
Chris Douglass03ce0142014-02-26 13:30:13 -050028#define LAYOUT_LINELEN 80
29
Stefan Reinauer1c795ad12011-10-14 12:49:41 -070030enum spi_frequency {
31 SPI_FREQUENCY_20MHZ = 0,
32 SPI_FREQUENCY_33MHZ = 1,
Duncan Laurie1f7fd722015-06-22 11:14:48 -070033 SPI_FREQUENCY_48MHZ = 2,
34 SPI_FREQUENCY_50MHZ_30MHZ = 4,
35 SPI_FREQUENCY_17MHZ = 6,
Stefan Reinauer1c795ad12011-10-14 12:49:41 -070036};
37
Stefan Reinauer1b1309f2012-05-11 15:53:43 -070038enum 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 Laurie1f7fd722015-06-22 11:14:48 -070045 COMPONENT_DENSITY_32MB = 6,
46 COMPONENT_DENSITY_64MB = 7,
47 COMPONENT_DENSITY_UNUSED = 0xf
Stefan Reinauer1b1309f2012-05-11 15:53:43 -070048};
49
Stefan Reinauer1c795ad12011-10-14 12:49:41 -070050// flash descriptor
51typedef 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 Laurie1f7fd722015-06-22 11:14:48 -070061#define MAX_REGIONS 9
62#define MAX_REGIONS_OLD 5
Stefan Reinauer1c795ad12011-10-14 12:49:41 -070063typedef struct {
64 uint32_t flreg0;
65 uint32_t flreg1;
66 uint32_t flreg2;
67 uint32_t flreg3;
68 uint32_t flreg4;
Duncan Laurie1f7fd722015-06-22 11:14:48 -070069 uint32_t flreg5;
70 uint32_t flreg6;
71 uint32_t flreg7;
72 uint32_t flreg8;
Stefan Reinauer1c795ad12011-10-14 12:49:41 -070073} __attribute__((packed)) frba_t;
74
75// component section
76typedef struct {
77 uint32_t flcomp;
78 uint32_t flill;
79 uint32_t flpb;
80} __attribute__((packed)) fcba_t;
81
82// pch strap
83typedef 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 Reinauer4a17d292012-09-27 12:42:15 -0700100 uint32_t pchstrp16;
101 uint32_t pchstrp17;
Stefan Reinauer1c795ad12011-10-14 12:49:41 -0700102} __attribute__((packed)) fpsba_t;
103
Shawn Nematbakhshd2cb1182015-09-10 19:07:13 -0700104/*
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 Reinauer1c795ad12011-10-14 12:49:41 -0700113// master
114typedef struct {
115 uint32_t flmstr1;
116 uint32_t flmstr2;
117 uint32_t flmstr3;
Duncan Laurie1f7fd722015-06-22 11:14:48 -0700118 uint32_t flmstr4;
119 uint32_t flmstr5;
Stefan Reinauer1c795ad12011-10-14 12:49:41 -0700120} __attribute__((packed)) fmba_t;
121
122// processor strap
123typedef struct {
124 uint32_t data[8];
125} __attribute__((packed)) fmsba_t;
126
Stefan Reinauer4a17d292012-09-27 12:42:15 -0700127// ME VSCC
128typedef struct {
129 uint32_t jid;
130 uint32_t vscc;
131} vscc_t;
Stefan Reinauer1c795ad12011-10-14 12:49:41 -0700132
Stefan Reinauer4a17d292012-09-27 12:42:15 -0700133typedef struct {
134 // Actual number of entries specified in vtl
135 vscc_t entry[8];
136} vtba_t;
137
138typedef struct {
139 int base, limit, size;
140} region_t;
Chris Douglass03ce0142014-02-26 13:30:13 -0500141
142struct region_name {
Bill XIEfa5f9942017-09-12 11:22:29 +0800143 const char *pretty;
144 const char *terse;
Bill XIE1bf65062017-09-12 11:31:37 +0800145 const char *filename;
Chris Douglass03ce0142014-02-26 13:30:13 -0500146};