2009/2/5 <[email protected]>: > Hi Peter! > > It's my flashrom -E -V log: > ... > FAILED! > ERROR at 0x00000000: Expected=0xff, Read=0x41
Please try the patch with the same command line. yu ning
flashrom: Try to program opcode if it is not in the prepared table. Signed-off-by: FENG yu ning <[email protected]> Index: ichspi.c =================================================================== --- ichspi.c (revision 3936) +++ ichspi.c (working copy) @@ -145,6 +145,13 @@ return regval; } +static inline uint8_t REGREAD8(int X) +{ + volatile uint8_t regval; + regval = *(volatile uint8_t *)((uint8_t *) spibar + X); + return regval; +} + #define REGWRITE32(X,Y) (*(uint32_t *)((uint8_t *)spibar+X)=Y) #define REGWRITE16(X,Y) (*(uint16_t *)((uint8_t *)spibar+X)=Y) #define REGWRITE8(X,Y) (*(uint8_t *)((uint8_t *)spibar+X)=Y) @@ -194,6 +201,12 @@ } }; +/* opcode with this index in OPMENU will be programmed if prepared op table does + * not contain the opcode to be sent. + * must be in 0..7 . + */ +#define VOLATILE_OP_IDX 7 + OPCODES O_EXISTING = {}; static inline int find_opcode(OPCODES *op, uint8_t opcode) @@ -753,6 +766,8 @@ int a; int opcode_index = -1; const unsigned char cmd = *writearr; + int volatile_op; + uint8_t tmp8; OPCODE *opcode; uint32_t addr = 0; uint8_t *data; @@ -767,11 +782,35 @@ } /* unknown / not programmed command */ - if (opcode_index == -1) { + if (opcode_index == -1 && ichspi_lock) { printf_debug("Invalid OPCODE 0x%02x\n", cmd); return 1; } + if (opcode_index == -1 /* && !ichspi_lock */) { + printf_debug("%s: trying to program opcode.\n", __func__); + switch (flashbus) { + case BUS_TYPE_ICH7_SPI: + volatile_op = ICH7_REG_OPMENU + VOLATILE_OP_IDX; + break; + case BUS_TYPE_ICH9_SPI: + volatile_op = ICH9_REG_OPMENU + VOLATILE_OP_IDX; + break; + default: + printf_debug("%s: unsupported chipset.\n", __func__); + return 1; + } + printf_debug("(OPMENU + %d) <- 0x%02x", VOLATILE_OP_IDX, cmd); + REGWRITE8(volatile_op, cmd); + tmp8 = REGREAD8(volatile_op); + printf_debug("(OPMENU + %d) == 0x%02x", VOLATILE_OP_IDX, tmp8); + if (tmp8 != cmd) { + printf_debug("%s: failed to program opcode.\n", __func__); + return 1; + } + opcode_index = VOLATILE_OP_IDX; + } + opcode = &(curopcodes->opcode[opcode_index]); /* if opcode-type requires an address */
-- coreboot mailing list: [email protected] http://www.coreboot.org/mailman/listinfo/coreboot

