Nico Huber has uploaded a new change for review. ( https://review.coreboot.org/18934 )
Change subject: fixup! flashrom: Add Skylake platform support ......................................................................
fixup! flashrom: Add Skylake platform support
ich_descriptors: Clean up chipset-gen parameter
* Make it the first parameter to comply with other functions. * Use the correct type `enum ich_chipset` instead of `int`.
Change-Id: I1b43c189cd19c573935fa553ae3ff23f2aa7e251 Signed-off-by: Nico Huber nico.huber@secunet.com --- M ich_descriptors.c M ich_descriptors.h M ichspi.c 3 files changed, 17 insertions(+), 20 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/34/18934/1
diff --git a/ich_descriptors.c b/ich_descriptors.c index 07cea8a..32cc804 100644 --- a/ich_descriptors.c +++ b/ich_descriptors.c @@ -852,13 +852,12 @@ return (1 << (19 + size_enc)); }
-static uint32_t read_descriptor_reg(uint8_t section, uint16_t offset, - void *spibar, int chipset) +static uint32_t read_descriptor_reg(enum ich_chipset cs, uint8_t section, uint16_t offset, void *spibar) { uint32_t control = 0; control |= (section << FDOC_FDSS_OFF) & FDOC_FDSS; control |= (offset << FDOC_FDSI_OFF) & FDOC_FDSI; - if (chipset == CHIPSET_100_SERIES_SUNRISE_POINT) { + if (cs == CHIPSET_100_SERIES_SUNRISE_POINT) { mmio_le_writel(control, spibar + PCH100_REG_FDOC); return mmio_le_readl(spibar + PCH100_REG_FDOD); } else { @@ -868,8 +867,7 @@
}
-int read_ich_descriptors_via_fdo(void *spibar, struct ich_descriptors *desc, - int chipset) +int read_ich_descriptors_via_fdo(enum ich_chipset cs, void *spibar, struct ich_descriptors *desc) { uint8_t i; uint8_t nr; @@ -899,15 +897,15 @@
msg_pdbg2("Reading flash descriptors mapped by the chipset via FDOC/FDOD..."); /* content section */ - desc->content.FLVALSIG = read_descriptor_reg(0, 0, spibar, chipset); - desc->content.FLMAP0 = read_descriptor_reg(0, 1, spibar, chipset); - desc->content.FLMAP1 = read_descriptor_reg(0, 2, spibar, chipset); - desc->content.FLMAP2 = read_descriptor_reg(0, 3, spibar, chipset); + desc->content.FLVALSIG = read_descriptor_reg(cs, 0, 0, spibar); + desc->content.FLMAP0 = read_descriptor_reg(cs, 0, 1, spibar); + desc->content.FLMAP1 = read_descriptor_reg(cs, 0, 2, spibar); + desc->content.FLMAP2 = read_descriptor_reg(cs, 0, 3, spibar);
/* component section */ - desc->component.FLCOMP = read_descriptor_reg(1, 0, spibar, chipset); - desc->component.FLILL = read_descriptor_reg(1, 1, spibar, chipset); - desc->component.FLPB = read_descriptor_reg(1, 2, spibar, chipset); + desc->component.FLCOMP = read_descriptor_reg(cs, 1, 0, spibar); + desc->component.FLILL = read_descriptor_reg(cs, 1, 1, spibar); + desc->component.FLPB = read_descriptor_reg(cs, 1, 2, spibar);
/* region section */ nr = desc->content.NR + 1; @@ -917,12 +915,12 @@ return ICH_RET_ERR; } for (i = 0; i <= nr; i++) - desc->region.FLREGs[i] = read_descriptor_reg(2, i, spibar, chipset); + desc->region.FLREGs[i] = read_descriptor_reg(cs, 2, i, spibar);
/* master section */ - desc->master.FLMSTR1 = read_descriptor_reg(3, 0, spibar, chipset); - desc->master.FLMSTR2 = read_descriptor_reg(3, 1, spibar, chipset); - desc->master.FLMSTR3 = read_descriptor_reg(3, 2, spibar, chipset); + desc->master.FLMSTR1 = read_descriptor_reg(cs, 3, 0, spibar); + desc->master.FLMSTR2 = read_descriptor_reg(cs, 3, 1, spibar); + desc->master.FLMSTR3 = read_descriptor_reg(cs, 3, 2, spibar);
/* Accessing the strap section via FDOC/D is only possible on ICH8 and * reading the upper map is impossible on all chipsets, so don't bother. diff --git a/ich_descriptors.h b/ich_descriptors.h index a53f397..dbf73e2 100644 --- a/ich_descriptors.h +++ b/ich_descriptors.h @@ -592,7 +592,7 @@
#else /* ICH_DESCRIPTORS_FROM_DUMP */
-int read_ich_descriptors_via_fdo(void *spibar, struct ich_descriptors *desc, int chipset); +int read_ich_descriptors_via_fdo(enum ich_chipset cs, void *spibar, struct ich_descriptors *desc); int getFCBA_component_density(enum ich_chipset cs, const struct ich_descriptors *desc, uint8_t idx);
#endif /* ICH_DESCRIPTORS_FROM_DUMP */ diff --git a/ichspi.c b/ichspi.c index 47b019a..16bb2b5 100644 --- a/ichspi.c +++ b/ichspi.c @@ -1991,8 +1991,7 @@ for (i = 0; i < 5; i++) ich9_handle_pr(i, ich_generation); if (desc_valid) { - if (read_ich_descriptors_via_fdo(ich_spibar, &desc, - ich_generation) == ICH_RET_OK) + if (read_ich_descriptors_via_fdo(ich_gen, ich_spibar, &desc) == ICH_RET_OK) prettyprint_ich_descriptors(CHIPSET_ICH_UNKNOWN, &desc); /* If the descriptor is valid and indicates multiple @@ -2176,7 +2175,7 @@ }
if (desc_valid) { - if (read_ich_descriptors_via_fdo(ich_spibar, &desc, ich_gen) == ICH_RET_OK) + if (read_ich_descriptors_via_fdo(ich_gen, ich_spibar, &desc) == ICH_RET_OK) prettyprint_ich_descriptors(ich_gen, &desc);
/* If the descriptor is valid and indicates multiple