On Wed, 14 Sep 2011 00:27:47 +0200 Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net wrote:
Am 20.06.2011 15:15 schrieb Stefan Tauner:
and if we are at it... shouldn't we tell the user, that writes will most probably fail in cases where we could not enable bios writes?
Ah, you assume that this is an interface similar to SPI where commands exist. That is not the case. Parallel/LPC/FWH flash uses normal reads/writes as commands, and the state machine inside the flash chip decides whether a write is indeed a write of the flash chip or rather a command sent to the flash chip. Due to that, a Parallel/LPC/FWH programmer with disabled write can't even probe because the probe function uses writes which are treated as commands by the chip. If you want an appropriate warning, it should be something like this: "Could not enable full flash access on chipset FOO. flashrom may be unable to find the flash chip and/or write to it."
e.g. the dell optiplex in the "It is hard to report a bug...."-thread: BIOS Lock Enable: enabled, BIOS Write Enable: disabled, BIOS_CNTL is 0x2 tried to set 0xdc to 0x3 on ICH8/ICH8R failed (WARNING ONLY)
as far as i understand this, an SMI is triggered and in this case the SMM prohibits us from setting the BIOS WE bit, but this may not be always the case. is there a way around it? i don't know enough about SMM to be sure if that's correct.
in any case we won't be able to erase/write if the WE bit is not set and we should indicate this clearly to the user imho. what do you think?
Sure, warning the user is good. But please consider the problems outlined above.
after a quick recheck on IRC the real problem is this: we always try to set the BIOS write enable bit in enable_flash_ich and warn it this fails even though it may not be necessary for accessing the attached flash chip (because we think SPI is not affected).
a patch for this problem would need to know which bus we want to access. this is (more or less) derivable from the chipset's boot straps in GCS. the best option is probably to not call enable_flash_ich at all if the motherboard is strapped to spi (or pci), rename enable_flash_ich to enable_flash_ich_lpc (or so) and to add a warning to it like the one mentioned by carldani above.
does that sound like a plan?