Putting parameters into function names is not where they belong.
Signed-off-by: Stefan Tauner stefan.tauner@student.tuwien.ac.at --- chipset_enable.c | 76 ++++++++++++++++++++++++-------------------------------- programmer.h | 3 ++- 2 files changed, 34 insertions(+), 45 deletions(-)
diff --git a/chipset_enable.c b/chipset_enable.c index c85db73..00070bd 100644 --- a/chipset_enable.c +++ b/chipset_enable.c @@ -314,15 +314,6 @@ static int enable_flash_ich(struct pci_dev *dev, const char *name, uint8_t bios_ return 0; }
-static int enable_flash_ich0(struct pci_dev *dev, const char *name) -{ - internal_buses_supported = BUS_FWH; - /* FIXME: Make this use enable_flash_ich_4e() too and add IDSEL support. Unlike later chipsets, - * ICH and ICH-0 do only support mapping of the top-most 4MB and therefore do only feature - * FWH_DEC_EN (E3h, different default too) and FWH_SEL (E8h). */ - return enable_flash_ich(dev, name, 0x4e); -} - static int enable_flash_ich_fwh_decode(struct pci_dev *dev, const char *name, enum ich_chipset ich_generation) { uint32_t fwh_conf; @@ -342,6 +333,10 @@ static int enable_flash_ich_fwh_decode(struct pci_dev *dev, const char *name, en fwh_sel2 = 0xee; fwh_dec_en_lo = 0xf0; fwh_dec_en_hi = 0xe3; + } else if (ich_generation == CHIPSET_ICH) { + /* FIXME: Unlike later chipsets, ICH and ICH-0 do only support mapping of the top-most 4MB + * and therefore do only feature FWH_DEC_EN (E3h, different default too) and FWH_SEL (E8h). */ + return 0; } else { msg_perr("Error: FWH decode setting not implemented.\n"); return ERROR_FATAL; @@ -448,7 +443,8 @@ idsel_garbage_out: return 0; }
-static int enable_flash_ich_4e(struct pci_dev *dev, const char *name, enum ich_chipset ich_generation) +static int enable_flash_ich_fwh(struct pci_dev *dev, const char *name, enum ich_chipset ich_generation, + uint8_t bios_cntl) { int err;
@@ -456,48 +452,41 @@ static int enable_flash_ich_4e(struct pci_dev *dev, const char *name, enum ich_c if ((err = enable_flash_ich_fwh_decode(dev, name, ich_generation)) != 0) return err;
+ /* If we're called by enable_flash_ich_spi, it will override + * internal_buses_supported anyway. + */ internal_buses_supported = BUS_FWH; - return enable_flash_ich(dev, name, 0x4e); + return enable_flash_ich(dev, name, bios_cntl); +} + +static int enable_flash_ich0(struct pci_dev *dev, const char *name) +{ + return enable_flash_ich_fwh(dev, name, CHIPSET_ICH, 0x4e); }
static int enable_flash_ich2(struct pci_dev *dev, const char *name) { - return enable_flash_ich_4e(dev, name, CHIPSET_ICH2); + return enable_flash_ich_fwh(dev, name, CHIPSET_ICH2, 0x4e); }
static int enable_flash_ich3(struct pci_dev *dev, const char *name) { - return enable_flash_ich_4e(dev, name, CHIPSET_ICH3); + return enable_flash_ich_fwh(dev, name, CHIPSET_ICH3, 0x4e); }
static int enable_flash_ich4(struct pci_dev *dev, const char *name) { - return enable_flash_ich_4e(dev, name, CHIPSET_ICH4); + return enable_flash_ich_fwh(dev, name, CHIPSET_ICH4, 0x4e); }
static int enable_flash_ich5(struct pci_dev *dev, const char *name) { - return enable_flash_ich_4e(dev, name, CHIPSET_ICH5); -} - -static int enable_flash_ich_dc(struct pci_dev *dev, const char *name, enum ich_chipset ich_generation) -{ - int err; - - /* Configure FWH IDSEL decoder maps. */ - if ((err = enable_flash_ich_fwh_decode(dev, name, ich_generation)) != 0) - return err; - - /* If we're called by enable_flash_ich_dc_spi, it will override - * internal_buses_supported anyway. - */ - internal_buses_supported = BUS_FWH; - return enable_flash_ich(dev, name, 0xdc); + return enable_flash_ich_fwh(dev, name, CHIPSET_ICH5, 0x4e); }
static int enable_flash_ich6(struct pci_dev *dev, const char *name) { - return enable_flash_ich_dc(dev, name, CHIPSET_ICH6); + return enable_flash_ich_fwh(dev, name, CHIPSET_ICH6, 0xdc); }
static int enable_flash_poulsbo(struct pci_dev *dev, const char *name) @@ -565,8 +554,7 @@ static int enable_flash_tunnelcreek(struct pci_dev *dev, const char *name) return ret; }
-static int enable_flash_ich_dc_spi(struct pci_dev *dev, const char *name, - enum ich_chipset ich_generation) +static int enable_flash_ich_spi(struct pci_dev *dev, const char *name, enum ich_chipset ich_generation) { int ret, ret_spi; uint8_t bbs, buc; @@ -619,7 +607,7 @@ static int enable_flash_ich_dc_spi(struct pci_dev *dev, const char *name, }
/* Enable Flash Writes */ - ret = enable_flash_ich_dc(dev, name, ich_generation); + ret = enable_flash_ich_fwh(dev, name, ich_generation, 0xdc); if (ret == ERROR_FATAL) return ret;
@@ -683,58 +671,58 @@ static int enable_flash_ich_dc_spi(struct pci_dev *dev, const char *name,
static int enable_flash_ich7(struct pci_dev *dev, const char *name) { - return enable_flash_ich_dc_spi(dev, name, CHIPSET_ICH7); + return enable_flash_ich_spi(dev, name, CHIPSET_ICH7); }
static int enable_flash_ich8(struct pci_dev *dev, const char *name) { - return enable_flash_ich_dc_spi(dev, name, CHIPSET_ICH8); + return enable_flash_ich_spi(dev, name, CHIPSET_ICH8); }
static int enable_flash_ich9(struct pci_dev *dev, const char *name) { - return enable_flash_ich_dc_spi(dev, name, CHIPSET_ICH9); + return enable_flash_ich_spi(dev, name, CHIPSET_ICH9); }
static int enable_flash_ich10(struct pci_dev *dev, const char *name) { - return enable_flash_ich_dc_spi(dev, name, CHIPSET_ICH10); + return enable_flash_ich_spi(dev, name, CHIPSET_ICH10); }
/* Ibex Peak aka. 5 series & 3400 series */ static int enable_flash_pch5(struct pci_dev *dev, const char *name) { - return enable_flash_ich_dc_spi(dev, name, CHIPSET_5_SERIES_IBEX_PEAK); + return enable_flash_ich_spi(dev, name, CHIPSET_5_SERIES_IBEX_PEAK); }
/* Cougar Point aka. 6 series & c200 series */ static int enable_flash_pch6(struct pci_dev *dev, const char *name) { - return enable_flash_ich_dc_spi(dev, name, CHIPSET_6_SERIES_COUGAR_POINT); + return enable_flash_ich_spi(dev, name, CHIPSET_6_SERIES_COUGAR_POINT); }
/* Panther Point aka. 7 series */ static int enable_flash_pch7(struct pci_dev *dev, const char *name) { - return enable_flash_ich_dc_spi(dev, name, CHIPSET_7_SERIES_PANTHER_POINT); + return enable_flash_ich_spi(dev, name, CHIPSET_7_SERIES_PANTHER_POINT); }
/* Lynx Point aka. 8 series */ static int enable_flash_pch8(struct pci_dev *dev, const char *name) { - return enable_flash_ich_dc_spi(dev, name, CHIPSET_8_SERIES_LYNX_POINT); + return enable_flash_ich_spi(dev, name, CHIPSET_8_SERIES_LYNX_POINT); }
/* Lynx Point aka. 8 series low-power */ static int enable_flash_pch8_lp(struct pci_dev *dev, const char *name) { - return enable_flash_ich_dc_spi(dev, name, CHIPSET_8_SERIES_LYNX_POINT_LP); + return enable_flash_ich_spi(dev, name, CHIPSET_8_SERIES_LYNX_POINT_LP); }
/* Wellsburg (for Haswell-EP Xeons) */ static int enable_flash_pch8_wb(struct pci_dev *dev, const char *name) { - return enable_flash_ich_dc_spi(dev, name, CHIPSET_8_SERIES_WELLSBURG); + return enable_flash_ich_spi(dev, name, CHIPSET_8_SERIES_WELLSBURG); }
static int via_no_byte_merge(struct pci_dev *dev, const char *name) diff --git a/programmer.h b/programmer.h index ef96c9e..187390d 100644 --- a/programmer.h +++ b/programmer.h @@ -557,7 +557,8 @@ int register_spi_programmer(const struct spi_programmer *programmer); /* The following enum is needed by ich_descriptor_tool and ich* code as well as in chipset_enable.c. */ enum ich_chipset { CHIPSET_ICH_UNKNOWN, - CHIPSET_ICH2 = 2, + CHIPSET_ICH = 1, + CHIPSET_ICH2, CHIPSET_ICH3, CHIPSET_ICH4, CHIPSET_ICH5,