blob: 78787126ea675cedd0442e9d6cefcd4288fb043b [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
Chris Douglass03ce0142014-02-26 13:30:13 -050024#define LAYOUT_LINELEN 80
25
Stefan Reinauer1c795ad12011-10-14 12:49:41 -070026enum spi_frequency {
27 SPI_FREQUENCY_20MHZ = 0,
28 SPI_FREQUENCY_33MHZ = 1,
Duncan Laurie1f7fd722015-06-22 11:14:48 -070029 SPI_FREQUENCY_48MHZ = 2,
30 SPI_FREQUENCY_50MHZ_30MHZ = 4,
31 SPI_FREQUENCY_17MHZ = 6,
Stefan Reinauer1c795ad12011-10-14 12:49:41 -070032};
33
Stefan Reinauer1b1309f2012-05-11 15:53:43 -070034enum component_density {
35 COMPONENT_DENSITY_512KB = 0,
36 COMPONENT_DENSITY_1MB = 1,
37 COMPONENT_DENSITY_2MB = 2,
38 COMPONENT_DENSITY_4MB = 3,
39 COMPONENT_DENSITY_8MB = 4,
40 COMPONENT_DENSITY_16MB = 5,
Duncan Laurie1f7fd722015-06-22 11:14:48 -070041 COMPONENT_DENSITY_32MB = 6,
42 COMPONENT_DENSITY_64MB = 7,
43 COMPONENT_DENSITY_UNUSED = 0xf
Stefan Reinauer1b1309f2012-05-11 15:53:43 -070044};
45
Stefan Reinauer1c795ad12011-10-14 12:49:41 -070046// flash descriptor
47typedef struct {
48 uint32_t flvalsig;
49 uint32_t flmap0;
50 uint32_t flmap1;
51 uint32_t flmap2;
52 uint8_t reserved[0xefc - 0x20];
53 uint32_t flumap1;
54} __attribute__((packed)) fdbar_t;
55
56// regions
Duncan Laurie1f7fd722015-06-22 11:14:48 -070057#define MAX_REGIONS 9
58#define MAX_REGIONS_OLD 5
Stefan Reinauer1c795ad12011-10-14 12:49:41 -070059typedef struct {
60 uint32_t flreg0;
61 uint32_t flreg1;
62 uint32_t flreg2;
63 uint32_t flreg3;
64 uint32_t flreg4;
Duncan Laurie1f7fd722015-06-22 11:14:48 -070065 uint32_t flreg5;
66 uint32_t flreg6;
67 uint32_t flreg7;
68 uint32_t flreg8;
Stefan Reinauer1c795ad12011-10-14 12:49:41 -070069} __attribute__((packed)) frba_t;
70
71// component section
72typedef struct {
73 uint32_t flcomp;
74 uint32_t flill;
75 uint32_t flpb;
76} __attribute__((packed)) fcba_t;
77
78// pch strap
79typedef struct {
80 uint32_t pchstrp0;
81 uint32_t pchstrp1;
82 uint32_t pchstrp2;
83 uint32_t pchstrp3;
84 uint32_t pchstrp4;
85 uint32_t pchstrp5;
86 uint32_t pchstrp6;
87 uint32_t pchstrp7;
88 uint32_t pchstrp8;
89 uint32_t pchstrp9;
90 uint32_t pchstrp10;
91 uint32_t pchstrp11;
92 uint32_t pchstrp12;
93 uint32_t pchstrp13;
94 uint32_t pchstrp14;
95 uint32_t pchstrp15;
Stefan Reinauer4a17d292012-09-27 12:42:15 -070096 uint32_t pchstrp16;
97 uint32_t pchstrp17;
Stefan Reinauer1c795ad12011-10-14 12:49:41 -070098} __attribute__((packed)) fpsba_t;
99
Shawn Nematbakhshd2cb1182015-09-10 19:07:13 -0700100/*
101 * WR / RD bits start at different locations within the flmstr regs, but
102 * otherwise have identical meaning.
103 */
104#define FLMSTR_WR_SHIFT_V1 24
105#define FLMSTR_WR_SHIFT_V2 20
106#define FLMSTR_RD_SHIFT_V1 16
107#define FLMSTR_RD_SHIFT_V2 8
108
Stefan Reinauer1c795ad12011-10-14 12:49:41 -0700109// master
110typedef struct {
111 uint32_t flmstr1;
112 uint32_t flmstr2;
113 uint32_t flmstr3;
Duncan Laurie1f7fd722015-06-22 11:14:48 -0700114 uint32_t flmstr4;
115 uint32_t flmstr5;
Stefan Reinauer1c795ad12011-10-14 12:49:41 -0700116} __attribute__((packed)) fmba_t;
117
118// processor strap
119typedef struct {
120 uint32_t data[8];
121} __attribute__((packed)) fmsba_t;
122
Stefan Reinauer4a17d292012-09-27 12:42:15 -0700123// ME VSCC
124typedef struct {
125 uint32_t jid;
126 uint32_t vscc;
127} vscc_t;
Stefan Reinauer1c795ad12011-10-14 12:49:41 -0700128
Stefan Reinauer4a17d292012-09-27 12:42:15 -0700129typedef struct {
130 // Actual number of entries specified in vtl
131 vscc_t entry[8];
132} vtba_t;
133
134typedef struct {
135 int base, limit, size;
136} region_t;
Chris Douglass03ce0142014-02-26 13:30:13 -0500137
138struct region_name {
139 char *pretty;
140 char *terse;
141};