Merge 4.16
Change-Id: I11db70a8e25a6656c5ec640a703e7b06d5a3672e
This commit is contained in:
@@ -2,42 +2,26 @@
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
|
||||
PROGRAM = ifdtool
|
||||
|
||||
CC ?= gcc
|
||||
INSTALL = /usr/bin/env install
|
||||
PREFIX = /usr/local
|
||||
CFLAGS = -O2 -g -Wall -Wextra -Wmissing-prototypes -Werror
|
||||
CFLAGS += -I../../src/commonlib/include -I../../src/commonlib/bsd/include
|
||||
CFLAGS += -I../cbfstool/flashmap
|
||||
CFLAGS += -include ../../src/commonlib/bsd/include/commonlib/bsd/compiler.h
|
||||
LDFLAGS =
|
||||
|
||||
OBJS = ifdtool.o
|
||||
OBJS += fmap.o
|
||||
OBJS += kv_pair.o
|
||||
OBJS += valstr.o
|
||||
HOSTCC ?= $(CC)
|
||||
HOSTCFLAGS ?= $(CFLAGS)
|
||||
top := ../..
|
||||
objutil := ..
|
||||
include Makefile.inc
|
||||
|
||||
all: dep $(PROGRAM)
|
||||
PROGRAM=$(objutil)/ifdtool/ifdtool
|
||||
|
||||
$(PROGRAM): $(OBJS)
|
||||
$(CC) -o $(PROGRAM) $(OBJS) $(LDFLAGS)
|
||||
all: $(PROGRAM)
|
||||
|
||||
clean:
|
||||
rm -f $(PROGRAM) *.o *~ .dependencies
|
||||
distclean: clean
|
||||
|
||||
dep:
|
||||
@$(CC) $(CFLAGS) -MM *.c > .dependencies
|
||||
|
||||
%.o: %.c
|
||||
$(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
%.o: ../cbfstool/flashmap/%.c
|
||||
$(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
install: $(PROGRAM)
|
||||
mkdir -p $(DESTDIR)$(PREFIX)/bin
|
||||
$(INSTALL) $(PROGRAM) $(DESTDIR)$(PREFIX)/bin
|
||||
|
||||
.PHONY: all clean distclean dep
|
||||
.PHONY: all clean distclean install
|
||||
|
@@ -6,6 +6,7 @@ IFDTOOLCFLAGS = -O2 -g -Wall -Wextra -Wmissing-prototypes -Werror
|
||||
IFDTOOLCFLAGS += -I$(top)/src/commonlib/include -I$(top)/src/commonlib/bsd/include
|
||||
IFDTOOLCFLAGS += -I$(top)/util/cbfstool/flashmap
|
||||
IFDTOOLCFLAGS += -include $(top)/src/commonlib/bsd/include/commonlib/bsd/compiler.h
|
||||
IFDTOOLCFLAGS += -D_DEFAULT_SOURCE # for endianness converting functions
|
||||
|
||||
$(objutil)/ifdtool/%.o: $(top)/util/ifdtool/%.c
|
||||
$(HOSTCC) $(IFDTOOLCFLAGS) $(HOSTCFLAGS) -c -o $@ $<
|
||||
|
@@ -40,10 +40,17 @@ static const struct region_name region_names[MAX_REGIONS] = {
|
||||
{ "Intel ME", "me", "flashregion_2_intel_me.bin", "SI_ME" },
|
||||
{ "GbE", "gbe", "flashregion_3_gbe.bin", "SI_GBE" },
|
||||
{ "Platform Data", "pd", "flashregion_4_platform_data.bin", "SI_PDR" },
|
||||
{ "Reserved", "res1", "flashregion_5_reserved.bin", NULL },
|
||||
{ "Reserved", "res2", "flashregion_6_reserved.bin", NULL },
|
||||
{ "Reserved", "res3", "flashregion_7_reserved.bin", NULL },
|
||||
{ "Device Exp1", "devexp", "flashregion_5_device_exp.bin", "SI_DEVICEEXT" },
|
||||
{ "Secondary BIOS", "bios2", "flashregion_6_bios2.bin", "SI_BIOS2" },
|
||||
{ "Reserved", "res7", "flashregion_7_reserved.bin", NULL },
|
||||
{ "EC", "ec", "flashregion_8_ec.bin", "SI_EC" },
|
||||
{ "Device Exp2", "devexp2", "flashregion_9_device_exp.bin", "SI_DEVICEEXT2" },
|
||||
{ "IE", "ie", "flashregion_10_ie.bin", "SI_IE" },
|
||||
{ "10GbE_0", "10gbe_0", "flashregion_11_10gbe0.bin", "SI_10GBE0" },
|
||||
{ "10GbE_1", "10gbe_1", "flashregion_12_10gbe1.bin", "SI_10GBE1" },
|
||||
{ "Reserved", "res13", "flashregion_13_reserved.bin", NULL },
|
||||
{ "Reserved", "res14", "flashregion_14_reserved.bin", NULL },
|
||||
{ "PTT", "ptt", "flashregion_15_ptt.bin", "SI_PTT" },
|
||||
};
|
||||
|
||||
/* port from flashrom */
|
||||
@@ -224,6 +231,7 @@ static enum ich_chipset ifd2_platform_to_chipset(const int pindex)
|
||||
return CHIPSET_300_SERIES_CANNON_POINT;
|
||||
case PLATFORM_TGL:
|
||||
case PLATFORM_ADL:
|
||||
case PLATFORM_IFD2:
|
||||
return CHIPSET_500_600_SERIES_TIGER_ALDER_POINT;
|
||||
case PLATFORM_ICL:
|
||||
return CHIPSET_400_SERIES_ICE_POINT;
|
||||
@@ -253,6 +261,7 @@ static int is_platform_ifd_2(void)
|
||||
PLATFORM_EHL,
|
||||
PLATFORM_ADL,
|
||||
PLATFORM_SKLKBL,
|
||||
PLATFORM_IFD2,
|
||||
};
|
||||
unsigned int i;
|
||||
|
||||
@@ -1178,6 +1187,7 @@ static void lock_descriptor(const char *filename, char *image, int size)
|
||||
case PLATFORM_JSL:
|
||||
case PLATFORM_EHL:
|
||||
case PLATFORM_ADL:
|
||||
case PLATFORM_IFD2:
|
||||
/* CPU/BIOS can read descriptor and BIOS. */
|
||||
fmba->flmstr1 |= (1 << REGION_DESC) << rd_shift;
|
||||
fmba->flmstr1 |= (1 << REGION_BIOS) << rd_shift;
|
||||
@@ -1635,6 +1645,7 @@ static void print_usage(const char *name)
|
||||
" ehl - Elkhart Lake\n"
|
||||
" glk - Gemini Lake\n"
|
||||
" icl - Ice Lake\n"
|
||||
" ifd2 - IFDv2 Platform\n"
|
||||
" jsl - Jasper Lake\n"
|
||||
" sklkbl - Sky Lake/Kaby Lake\n"
|
||||
" tgl - Tiger Lake\n"
|
||||
@@ -1642,7 +1653,8 @@ static void print_usage(const char *name)
|
||||
" -V | --newvalue The new value to write into PCH strap specified by -S\n"
|
||||
" -v | --version: print the version\n"
|
||||
" -h | --help: print this help\n\n"
|
||||
"<region> is one of Descriptor, BIOS, ME, GbE, Platform, res1, res2, res3\n"
|
||||
"<region> is one of Descriptor, BIOS, ME, GbE, Platform Data, Secondary BIOS, "
|
||||
"Device Exp1, EC, Device Exp2, IE, 10GbE_0, 10GbE_1, PTT\n"
|
||||
"\n");
|
||||
}
|
||||
|
||||
@@ -1731,16 +1743,26 @@ int main(int argc, char *argv[])
|
||||
region_type = 2;
|
||||
else if (!strcasecmp("GbE", region_type_string))
|
||||
region_type = 3;
|
||||
else if (!strcasecmp("Platform", region_type_string))
|
||||
else if (!strcasecmp("Platform Data", region_type_string))
|
||||
region_type = 4;
|
||||
else if (!strcasecmp("res1", region_type_string))
|
||||
else if (!strcasecmp("Device Exp1", region_type_string))
|
||||
region_type = 5;
|
||||
else if (!strcasecmp("res2", region_type_string))
|
||||
else if (!strcasecmp("Secondary BIOS", region_type_string))
|
||||
region_type = 6;
|
||||
else if (!strcasecmp("res3", region_type_string))
|
||||
else if (!strcasecmp("Reserved", region_type_string))
|
||||
region_type = 7;
|
||||
else if (!strcasecmp("EC", region_type_string))
|
||||
region_type = 8;
|
||||
else if (!strcasecmp("Device Exp2", region_type_string))
|
||||
region_type = 9;
|
||||
else if (!strcasecmp("IE", region_type_string))
|
||||
region_type = 10;
|
||||
else if (!strcasecmp("10GbE_0", region_type_string))
|
||||
region_type = 11;
|
||||
else if (!strcasecmp("10GbE_1", region_type_string))
|
||||
region_type = 12;
|
||||
else if (!strcasecmp("PTT", region_type_string))
|
||||
region_type = 15;
|
||||
if (region_type == -1) {
|
||||
fprintf(stderr, "No such region type: '%s'\n\n",
|
||||
region_type_string);
|
||||
@@ -1891,6 +1913,8 @@ int main(int argc, char *argv[])
|
||||
platform = PLATFORM_TGL;
|
||||
} else if (!strcmp(optarg, "adl")) {
|
||||
platform = PLATFORM_ADL;
|
||||
} else if (!strcmp(optarg, "ifd2")) {
|
||||
platform = PLATFORM_IFD2;
|
||||
} else {
|
||||
fprintf(stderr, "Unknown platform: %s\n", optarg);
|
||||
exit(EXIT_FAILURE);
|
||||
|
@@ -58,6 +58,7 @@ enum platform {
|
||||
PLATFORM_SKLKBL,
|
||||
PLATFORM_TGL,
|
||||
PLATFORM_ADL,
|
||||
PLATFORM_IFD2,
|
||||
};
|
||||
|
||||
#define LAYOUT_LINELEN 80
|
||||
@@ -117,7 +118,7 @@ typedef struct {
|
||||
} __attribute__((packed)) fdbar_t;
|
||||
|
||||
// regions
|
||||
#define MAX_REGIONS 9
|
||||
#define MAX_REGIONS 16
|
||||
#define MAX_REGIONS_OLD 5
|
||||
|
||||
enum flash_regions {
|
||||
@@ -126,7 +127,14 @@ enum flash_regions {
|
||||
REGION_ME,
|
||||
REGION_GBE,
|
||||
REGION_PDR,
|
||||
REGION_DEV_EXP1,
|
||||
REGION_BIOS2,
|
||||
REGION_EC = 8,
|
||||
REGION_DEV_EXP2,
|
||||
REGION_IE,
|
||||
REGION_10GB_0,
|
||||
REGION_10GB_1,
|
||||
REGION_PTT = 15,
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
|
Reference in New Issue
Block a user