summaryrefslogtreecommitdiffstats
path: root/chipset_enable.c
diff options
context:
space:
mode:
authorStefan Tauner <stefan.tauner@alumni.tuwien.ac.at>2011-11-06 23:51:09 +0000
committerStefan Tauner <stefan.tauner@alumni.tuwien.ac.at>2011-11-06 23:51:09 +0000
commita8d838d9d3a0373b51408a2ecb647c320e1aaff9 (patch)
tree8524bb99c9ff890da6311769656a6480abb0a1d5 /chipset_enable.c
parent532c717bccc95aa93bae7af8be0695bee83c32b5 (diff)
downloadast2050-flashrom-a8d838d9d3a0373b51408a2ecb647c320e1aaff9.zip
ast2050-flashrom-a8d838d9d3a0373b51408a2ecb647c320e1aaff9.tar.gz
ichspi: use a variable to distinguish ich generations instead of spi_programmer->type
The type member is enough most of the time to derive the wanted information, but - not always (e.g. ich_set_bbar), - only available after registration, which we want to delay till the end of init, and - we really want to distinguish between chipset version-grained attributes which are not reflected by the registered programmer. Hence this patch introduces a new static variable which is set up early by the init functions and allows us to get rid of all "switch (spi_programmer->type)" in ichspi.c. We reuse the enum introduced for descriptor mode for the type of the new variable. Previously magic numbers were passed by chipset_enable wrappers. Now they use the enumeration items too. To get this working the enum definition had to be moved to programmer.h. Another noteworthy detail: previously we have checked for a valid programmer/ich generation all over the place. I have removed those checks and added one single check in the init method. Calling any function of a programmer without executing the init method first, is undefined behavior. Corresponding to flashrom svn r1460. Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at> Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Diffstat (limited to 'chipset_enable.c')
-rw-r--r--chipset_enable.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/chipset_enable.c b/chipset_enable.c
index d2d81e0..15bd3eb 100644
--- a/chipset_enable.c
+++ b/chipset_enable.c
@@ -489,7 +489,7 @@ static int enable_flash_vt8237s_spi(struct pci_dev *dev, const char *name)
}
static int enable_flash_ich_dc_spi(struct pci_dev *dev, const char *name,
- int ich_generation)
+ enum ich_chipset ich_generation)
{
int ret;
uint8_t bbs, buc;
@@ -504,7 +504,7 @@ static int enable_flash_ich_dc_spi(struct pci_dev *dev, const char *name,
static const char *const straps_names_unknown[] = { "unknown", "unknown", "unknown", "unknown" };
switch (ich_generation) {
- case 7:
+ case CHIPSET_ICH7:
/* EP80579 may need further changes, but this is the least
* intrusive way to get correct BOOT Strap printing without
* changing the rest of its code path). */
@@ -513,13 +513,13 @@ static int enable_flash_ich_dc_spi(struct pci_dev *dev, const char *name,
else
straps_names = straps_names_ich7_nm10;
break;
- case 8:
- case 9:
- case 10:
+ case CHIPSET_ICH8:
+ case CHIPSET_ICH9:
+ case CHIPSET_ICH10:
straps_names = straps_names_ich8910;
break;
- case 11:
- case 12:
+ case CHIPSET_5_SERIES_IBEX_PEAK:
+ case CHIPSET_6_SERIES_COUGAR_POINT:
straps_names = straps_names_pch56;
break;
default:
@@ -557,7 +557,7 @@ static int enable_flash_ich_dc_spi(struct pci_dev *dev, const char *name,
* on ICH7 when the southbridge is strapped to LPC
*/
buses_supported = BUS_FWH;
- if (ich_generation == 7) {
+ if (ich_generation == CHIPSET_ICH7) {
if (bbs == 0x03) {
/* If strapped to LPC, no further SPI initialization is
* required. */
@@ -579,34 +579,34 @@ 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, 7);
+ return enable_flash_ich_dc_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, 8);
+ return enable_flash_ich_dc_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, 9);
+ return enable_flash_ich_dc_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, 10);
+ return enable_flash_ich_dc_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, 11);
+ return enable_flash_ich_dc_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, 12);
+ return enable_flash_ich_dc_spi(dev, name, CHIPSET_6_SERIES_COUGAR_POINT);
}
static int via_no_byte_merge(struct pci_dev *dev, const char *name)
OpenPOWER on IntegriCloud