2011-10-14 21:49:41 +02:00
|
|
|
/*
|
|
|
|
* ifdtool - dump Intel Firmware Descriptor information
|
|
|
|
*
|
|
|
|
* Copyright (C) 2011 The ChromiumOS Authors. All rights reserved.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; version 2 of the License.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdint.h>
|
2015-06-22 20:14:48 +02:00
|
|
|
#define IFDTOOL_VERSION "1.2"
|
|
|
|
|
|
|
|
enum ifd_version {
|
|
|
|
IFD_VERSION_1,
|
|
|
|
IFD_VERSION_2,
|
|
|
|
};
|
2011-10-14 21:49:41 +02:00
|
|
|
|
2016-11-01 03:31:54 +01:00
|
|
|
enum platform {
|
2018-03-21 18:42:37 +01:00
|
|
|
PLATFORM_APOLLOLAKE,
|
|
|
|
PLATFORM_SKLKBL,
|
2016-11-01 03:31:54 +01:00
|
|
|
};
|
|
|
|
|
2014-02-26 19:30:13 +01:00
|
|
|
#define LAYOUT_LINELEN 80
|
|
|
|
|
2011-10-14 21:49:41 +02:00
|
|
|
enum spi_frequency {
|
|
|
|
SPI_FREQUENCY_20MHZ = 0,
|
|
|
|
SPI_FREQUENCY_33MHZ = 1,
|
2015-06-22 20:14:48 +02:00
|
|
|
SPI_FREQUENCY_48MHZ = 2,
|
|
|
|
SPI_FREQUENCY_50MHZ_30MHZ = 4,
|
|
|
|
SPI_FREQUENCY_17MHZ = 6,
|
2011-10-14 21:49:41 +02:00
|
|
|
};
|
|
|
|
|
2012-05-12 00:53:43 +02:00
|
|
|
enum component_density {
|
|
|
|
COMPONENT_DENSITY_512KB = 0,
|
|
|
|
COMPONENT_DENSITY_1MB = 1,
|
|
|
|
COMPONENT_DENSITY_2MB = 2,
|
|
|
|
COMPONENT_DENSITY_4MB = 3,
|
|
|
|
COMPONENT_DENSITY_8MB = 4,
|
|
|
|
COMPONENT_DENSITY_16MB = 5,
|
2015-06-22 20:14:48 +02:00
|
|
|
COMPONENT_DENSITY_32MB = 6,
|
|
|
|
COMPONENT_DENSITY_64MB = 7,
|
|
|
|
COMPONENT_DENSITY_UNUSED = 0xf
|
2012-05-12 00:53:43 +02:00
|
|
|
};
|
|
|
|
|
2011-10-14 21:49:41 +02:00
|
|
|
// flash descriptor
|
|
|
|
typedef struct {
|
|
|
|
uint32_t flvalsig;
|
|
|
|
uint32_t flmap0;
|
|
|
|
uint32_t flmap1;
|
|
|
|
uint32_t flmap2;
|
|
|
|
uint8_t reserved[0xefc - 0x20];
|
|
|
|
uint32_t flumap1;
|
|
|
|
} __attribute__((packed)) fdbar_t;
|
|
|
|
|
|
|
|
// regions
|
2015-06-22 20:14:48 +02:00
|
|
|
#define MAX_REGIONS 9
|
|
|
|
#define MAX_REGIONS_OLD 5
|
2017-09-12 05:54:48 +02:00
|
|
|
|
2011-10-14 21:49:41 +02:00
|
|
|
typedef struct {
|
2017-09-12 05:54:48 +02:00
|
|
|
uint32_t flreg[MAX_REGIONS];
|
2011-10-14 21:49:41 +02:00
|
|
|
} __attribute__((packed)) frba_t;
|
|
|
|
|
|
|
|
// component section
|
|
|
|
typedef struct {
|
|
|
|
uint32_t flcomp;
|
|
|
|
uint32_t flill;
|
|
|
|
uint32_t flpb;
|
|
|
|
} __attribute__((packed)) fcba_t;
|
|
|
|
|
|
|
|
// pch strap
|
2017-09-12 05:54:48 +02:00
|
|
|
#define MAX_PCHSTRP 18
|
|
|
|
|
2011-10-14 21:49:41 +02:00
|
|
|
typedef struct {
|
2017-09-12 05:54:48 +02:00
|
|
|
uint32_t pchstrp[MAX_PCHSTRP];
|
2011-10-14 21:49:41 +02:00
|
|
|
} __attribute__((packed)) fpsba_t;
|
|
|
|
|
2015-09-11 04:07:13 +02:00
|
|
|
/*
|
|
|
|
* WR / RD bits start at different locations within the flmstr regs, but
|
|
|
|
* otherwise have identical meaning.
|
|
|
|
*/
|
|
|
|
#define FLMSTR_WR_SHIFT_V1 24
|
|
|
|
#define FLMSTR_WR_SHIFT_V2 20
|
|
|
|
#define FLMSTR_RD_SHIFT_V1 16
|
|
|
|
#define FLMSTR_RD_SHIFT_V2 8
|
|
|
|
|
2011-10-14 21:49:41 +02:00
|
|
|
// master
|
|
|
|
typedef struct {
|
|
|
|
uint32_t flmstr1;
|
|
|
|
uint32_t flmstr2;
|
|
|
|
uint32_t flmstr3;
|
2015-06-22 20:14:48 +02:00
|
|
|
uint32_t flmstr4;
|
|
|
|
uint32_t flmstr5;
|
2011-10-14 21:49:41 +02:00
|
|
|
} __attribute__((packed)) fmba_t;
|
|
|
|
|
|
|
|
// processor strap
|
|
|
|
typedef struct {
|
|
|
|
uint32_t data[8];
|
|
|
|
} __attribute__((packed)) fmsba_t;
|
|
|
|
|
2012-09-27 21:42:15 +02:00
|
|
|
// ME VSCC
|
|
|
|
typedef struct {
|
|
|
|
uint32_t jid;
|
|
|
|
uint32_t vscc;
|
|
|
|
} vscc_t;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
// Actual number of entries specified in vtl
|
|
|
|
vscc_t entry[8];
|
|
|
|
} vtba_t;
|
2011-10-14 21:49:41 +02:00
|
|
|
|
2012-09-27 21:42:15 +02:00
|
|
|
typedef struct {
|
|
|
|
int base, limit, size;
|
|
|
|
} region_t;
|
2014-02-26 19:30:13 +01:00
|
|
|
|
|
|
|
struct region_name {
|
2017-09-12 05:22:29 +02:00
|
|
|
const char *pretty;
|
|
|
|
const char *terse;
|
2017-09-12 05:31:37 +02:00
|
|
|
const char *filename;
|
2014-02-26 19:30:13 +01:00
|
|
|
};
|