[flashrom] [PATCH 3/6] ichspi: don't touch the nonexistent(?) BBAR register on ICH8

Stefan Tauner stefan.tauner at student.tuwien.ac.at
Sun Aug 14 09:07:35 CEST 2011


There is no sign of BBAR (BIOS Base Address Configuration Register)
in the public datasheet (or specification update) of the ICH8. Also,
the offset of that register has changed between ICH7 (SPIBAR + 50h)
and ICH9 (SPIBAR + A0h), so we have no clue if or where it is on
ICH8. Better don't try to touch it at all and assume/hope it is 0.

---

Until now we implicitly accessed it via the ICH9 offset. I think
this is an evident sign that the naming of the spi controller types
in ichspi.c (SPI_CONTROLLER_VIA, SPI_CONTROLLER_ICH7,
SPI_CONTROLLER_ICH9) might not cut it and we should think about
introducing a special ICH8 one, even if its struct is identical to
the ICH9. having most of the ICH8 code path guarded/controlled by
SPI_CONTROLLER_ICH7 or SPI_CONTROLLER_ICH9 (depending on which is
more similar in one situation), is an open invitation to similar
bugs because one easily forgets that ICH8 is very special.

Signed-off-by: Stefan Tauner <stefan.tauner at student.tuwien.ac.at>
---
 ichspi.c |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/ichspi.c b/ichspi.c
index 85f82fa..daa4a8a 100644
--- a/ichspi.c
+++ b/ichspi.c
@@ -658,11 +658,6 @@ static int ich_init_opcodes(void)
 		msg_pdbg("Programming OPCODES... ");
 		curopcodes_done = &O_ST_M25P;
 		rc = program_opcodes(curopcodes_done, 1);
-		/* Technically not part of opcode init, but it allows opcodes
-		 * to run without transaction errors by setting the lowest
-		 * allowed address to zero.
-		 */
-		ich_set_bbar(0);
 	}
 
 	if (rc) {
@@ -1269,6 +1264,7 @@ int ich_init_spi(struct pci_dev *dev, uint32_t base, void *rcrb,
 			msg_pinfo("WARNING: SPI Configuration Lockdown activated.\n");
 			ichspi_lock = 1;
 		}
+		ich_set_bbar(0);
 		ich_init_opcodes();
 		break;
 	case SPI_CONTROLLER_ICH9:
@@ -1350,6 +1346,7 @@ int ich_init_spi(struct pci_dev *dev, uint32_t base, void *rcrb,
 
 			tmp = mmio_readl(ich_spibar + ICH9_REG_FPB);
 			msg_pdbg("0xD0: 0x%08x (FPB)\n", tmp);
+			ich_set_bbar(0);
 		}
 
 		msg_pdbg("\n");
@@ -1440,6 +1437,7 @@ int via_init_spi(struct pci_dev *dev)
 		ichspi_lock = 1;
 	}
 
+	ich_set_bbar(0);
 	ich_init_opcodes();
 
 	return 0;
-- 
1.7.1





More information about the flashrom mailing list