blob: ef85555e060e37b36cd31b0219f95bd4eb9bd480 [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 {
Furquan Shaikhc0257dd2018-05-02 23:29:04 -070025 PLATFORM_APL,
26 PLATFORM_CNL,
27 PLATFORM_GLK,
Furquan Shaikh088b6e82018-03-21 10:42:37 -070028 PLATFORM_SKLKBL,
Andrey Petrov96ecb772016-10-31 19:31:54 -070029};
30
Chris Douglass03ce0142014-02-26 13:30:13 -050031#define LAYOUT_LINELEN 80
32
Stefan Reinauer1c795ad12011-10-14 12:49:41 -070033enum spi_frequency {
34 SPI_FREQUENCY_20MHZ = 0,
35 SPI_FREQUENCY_33MHZ = 1,
Duncan Laurie1f7fd722015-06-22 11:14:48 -070036 SPI_FREQUENCY_48MHZ = 2,
37 SPI_FREQUENCY_50MHZ_30MHZ = 4,
38 SPI_FREQUENCY_17MHZ = 6,
Stefan Reinauer1c795ad12011-10-14 12:49:41 -070039};
40
Stefan Reinauer1b1309f2012-05-11 15:53:43 -070041enum component_density {
42 COMPONENT_DENSITY_512KB = 0,
43 COMPONENT_DENSITY_1MB = 1,
44 COMPONENT_DENSITY_2MB = 2,
45 COMPONENT_DENSITY_4MB = 3,
46 COMPONENT_DENSITY_8MB = 4,
47 COMPONENT_DENSITY_16MB = 5,
Duncan Laurie1f7fd722015-06-22 11:14:48 -070048 COMPONENT_DENSITY_32MB = 6,
49 COMPONENT_DENSITY_64MB = 7,
50 COMPONENT_DENSITY_UNUSED = 0xf
Stefan Reinauer1b1309f2012-05-11 15:53:43 -070051};
52
Stefan Reinauer1c795ad12011-10-14 12:49:41 -070053// flash descriptor
54typedef struct {
55 uint32_t flvalsig;
56 uint32_t flmap0;
57 uint32_t flmap1;
58 uint32_t flmap2;
59 uint8_t reserved[0xefc - 0x20];
60 uint32_t flumap1;
61} __attribute__((packed)) fdbar_t;
62
63// regions
Duncan Laurie1f7fd722015-06-22 11:14:48 -070064#define MAX_REGIONS 9
65#define MAX_REGIONS_OLD 5
Bill XIE4651d452017-09-12 11:54:48 +080066
Stefan Reinauer1c795ad12011-10-14 12:49:41 -070067typedef struct {
Bill XIE4651d452017-09-12 11:54:48 +080068 uint32_t flreg[MAX_REGIONS];
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
Bill XIE4651d452017-09-12 11:54:48 +080079#define MAX_PCHSTRP 18
80
Stefan Reinauer1c795ad12011-10-14 12:49:41 -070081typedef struct {
Bill XIE4651d452017-09-12 11:54:48 +080082 uint32_t pchstrp[MAX_PCHSTRP];
Stefan Reinauer1c795ad12011-10-14 12:49:41 -070083} __attribute__((packed)) fpsba_t;
84
Shawn Nematbakhshd2cb1182015-09-10 19:07:13 -070085/*
86 * WR / RD bits start at different locations within the flmstr regs, but
87 * otherwise have identical meaning.
88 */
89#define FLMSTR_WR_SHIFT_V1 24
90#define FLMSTR_WR_SHIFT_V2 20
91#define FLMSTR_RD_SHIFT_V1 16
92#define FLMSTR_RD_SHIFT_V2 8
93
Stefan Reinauer1c795ad12011-10-14 12:49:41 -070094// master
95typedef struct {
96 uint32_t flmstr1;
97 uint32_t flmstr2;
98 uint32_t flmstr3;
Duncan Laurie1f7fd722015-06-22 11:14:48 -070099 uint32_t flmstr4;
100 uint32_t flmstr5;
Stefan Reinauer1c795ad12011-10-14 12:49:41 -0700101} __attribute__((packed)) fmba_t;
102
103// processor strap
104typedef struct {
105 uint32_t data[8];
106} __attribute__((packed)) fmsba_t;
107
Stefan Reinauer4a17d292012-09-27 12:42:15 -0700108// ME VSCC
109typedef struct {
110 uint32_t jid;
111 uint32_t vscc;
112} vscc_t;
Stefan Reinauer1c795ad12011-10-14 12:49:41 -0700113
Stefan Reinauer4a17d292012-09-27 12:42:15 -0700114typedef struct {
115 // Actual number of entries specified in vtl
116 vscc_t entry[8];
117} vtba_t;
118
119typedef struct {
120 int base, limit, size;
121} region_t;
Chris Douglass03ce0142014-02-26 13:30:13 -0500122
123struct region_name {
Bill XIEfa5f9942017-09-12 11:22:29 +0800124 const char *pretty;
125 const char *terse;
Bill XIE1bf65062017-09-12 11:31:37 +0800126 const char *filename;
Chris Douglass03ce0142014-02-26 13:30:13 -0500127};