#1: flashRom doesn't work on MotherBoard with ICH9 + MP2532 --------------------------------------------------+------------------------- Reporter: annyvonne.le_coq@… | Owner: hailfinger Type: defect | Status: assigned Priority: major | Milestone: flashrom 0.9.1 Component: flashrom | Version: Keywords: | Dependencies: Patchstatus: there is no patch | --------------------------------------------------+-------------------------
Comment(by annyvonne.le_coq@…):
Hi Carl-Daniel, and thanks for your answer. [[BR]] I'm not in the labs this evening (in France it's 10:00 pm). [[BR]] All that I can send for the moment is the attached file with the executed code. (The attach file button doesn't work, so I include the source code in this window!!!) [[BR]] I have inserted printf to trace the data. [[BR]] So, I can see that my Opcode (WREN=06) is not included in the opcode array. [[BR]] If the flashrom -V is really needed, I'll send it tomorrow. [[BR]] [[BR]] Kind regards. [[BR]] Anne
'''Spi.c'''
'''int spi_chip_erase_c7'''(struct flashchip *flash) 537{ 538 int result; 539 struct spi_command spicommands[] = { 540 { 541 .writecnt = JEDEC_WREN_OUTSIZE, 542 .writearr = (const unsigned char[]){ JEDEC_WREN }, 543 .readcnt = 0, 544 .readarr = NULL, 545 }, { 546 .writecnt = JEDEC_CE_C7_OUTSIZE, 547 .writearr = (const unsigned char[]){ JEDEC_CE_C7 }, 548 .readcnt = 0, 549 .readarr = NULL, 550 }, { 551 .writecnt = 0, 552 .writearr = NULL, 553 .readcnt = 0, 554 .readarr = NULL, 555 }}; 556 557 result = spi_disable_blockprotect(); 558 if (result) { 559 fprintf(stderr, "spi_disable_blockprotect failed\n"); 560 return result; 561 } 562 563 '''result = spi_send_multicommand(spicommands)''';
……. '''int spi_send_multicommand(struct spi_command *spicommands)''' 120{ 121 if (!spi_programmer[spi_controller].multicommand) { 122 fprintf(stderr, "%s called, but SPI is unsupported on this " 123 "hardware. Please report a bug.\n", __func__); 124 return 1; 125 } 126 127 ''' return spi_programmer[spi_controller].multicommand(spicommands);''' 128}
…. '''const struct spi_programmer spi_programmer[]''' = { 36 { /* SPI_CONTROLLER_NONE */ 37 .command = NULL, 38 .multicommand = NULL, 39 .read = NULL, 40 .write_256 = NULL, 41 }, 42 43 { /* SPI_CONTROLLER_ICH7 */ 44 .command = ich_spi_send_command, 45 .multicommand = ich_spi_send_multicommand, 46 .read = ich_spi_read, 47 .write_256 = ich_spi_write_256, 48 }, 49 50 { /* SPI_CONTROLLER_ICH9 */ 51 .command = ich_spi_send_command, 52 .multicommand = '''ich_spi_send_multicommand,''' 53 .read = ich_spi_read, 54 .write_256 = ich_spi_write_256, 55 }, 56 …..
'''Ichspi.c'''
'''int ich_spi_send_multicommand'''(struct spi_command *spicommands) 746{ 747 int ret = 0; 748 while ((spicommands->writecnt || spicommands->readcnt) && !ret) { 749 ret = '''ich_spi_send_command'''(spicommands->writecnt,spicommands->readcnt, 750 spicommands->writearr, spicommands->readarr) ; ….
'''int ich_spi_send_command'''(unsigned int writecnt, unsigned int readcnt, 691 const unsigned char *writearr, unsigned char *readarr) 692{ 693 int a; 694 int result; 695 int opcode_index = -1; 696 const unsigned char cmd = *writearr; 697 OPCODE *opcode; 698 uint32_t addr = 0; 699 uint8_t *data; 700 int count; 701 702 /* find cmd in opcodes-table */ 703 for (a = 0; a < 8; a++) { 704 if (('''curopcodes->opcode[a]).opcode == cmd''') { 705 opcode_index = a; 706 break; 707 } 708 } …. Cmd = JEDEC_WREN (that is 06) but it’s not in the following table : 170OPCODES O_ST_M25P = { 171 { 172 JEDEC_WREN, 173 0}, 174 { 175 {JEDEC_BYTE_PROGRAM, SPI_OPCODE_TYPE_WRITE_WITH_ADDRESS, 1}, // Write Byte 176 {JEDEC_READ, SPI_OPCODE_TYPE_READ_WITH_ADDRESS, 0}, // Read Data 177 {JEDEC_BE_D8, SPI_OPCODE_TYPE_WRITE_WITH_ADDRESS, 1}, // Erase Sector 178 {JEDEC_RDSR, SPI_OPCODE_TYPE_READ_NO_ADDRESS, 0}, // Read Device Status Reg 179 {JEDEC_REMS, SPI_OPCODE_TYPE_READ_WITH_ADDRESS, 0}, // Read Electronic Manufacturer Signature 180 {JEDEC_WRSR, SPI_OPCODE_TYPE_WRITE_NO_ADDRESS, 1}, // Write Status Register 181 {JEDEC_RDID, SPI_OPCODE_TYPE_READ_NO_ADDRESS, 0}, // Read JDEC ID 182 {JEDEC_CE_C7, SPI_OPCODE_TYPE_WRITE_NO_ADDRESS, 1}, // Bulk erase 183 } 184};
When I insert a printf while reading curopcodes->opcode[a].opcode, I read from JEDEC_BYTE_PROGRAM to JEDEC_CE_C7. The input cmd field is JEDEC_WREN. So, it doesn’t match !!