mirror of
				https://review.coreboot.org/flashrom.git
				synced 2025-11-04 07:00:39 +01:00 
			
		
		
		
	Small fixes
- missing spaces in code and output - improved documentation/naming/output - missing line breaks in spi probing functions Corresponding to flashrom svn r1321. Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at> Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
This commit is contained in:
		
							
								
								
									
										2
									
								
								flash.h
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								flash.h
									
									
									
									
									
								
							@@ -136,6 +136,8 @@ struct flashchip {
 | 
			
		||||
			unsigned int size; /* Eraseblock size */
 | 
			
		||||
			unsigned int count; /* Number of contiguous blocks with that size */
 | 
			
		||||
		} eraseblocks[NUM_ERASEREGIONS];
 | 
			
		||||
		/* a block_erase function should try to erase one block of size
 | 
			
		||||
		 * 'blocklen' at address 'blockaddr' and return 0 on success. */
 | 
			
		||||
		int (*block_erase) (struct flashchip *flash, unsigned int blockaddr, unsigned int blocklen);
 | 
			
		||||
	} block_erasers[NUM_ERASEFUNCTIONS];
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1312,7 +1312,7 @@ int read_flash_to_file(struct flashchip *flash, char *filename)
 | 
			
		||||
		goto out_free;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	ret = write_buf_to_file(buf, flash->total_size * 1024, filename);
 | 
			
		||||
	ret = write_buf_to_file(buf, size, filename);
 | 
			
		||||
out_free:
 | 
			
		||||
	free(buf);
 | 
			
		||||
	msg_cinfo("%s.\n", ret ? "FAILED" : "done");
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										9
									
								
								ichspi.c
									
									
									
									
									
								
							
							
						
						
									
										9
									
								
								ichspi.c
									
									
									
									
									
								
							@@ -159,9 +159,9 @@ static uint16_t REGREAD8(int X)
 | 
			
		||||
	return mmio_readb(ich_spibar + X);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#define REGWRITE32(X,Y) mmio_writel(Y, ich_spibar+X)
 | 
			
		||||
#define REGWRITE16(X,Y) mmio_writew(Y, ich_spibar+X)
 | 
			
		||||
#define REGWRITE8(X,Y)  mmio_writeb(Y, ich_spibar+X)
 | 
			
		||||
#define REGWRITE32(off,val) mmio_writel(val, ich_spibar+off)
 | 
			
		||||
#define REGWRITE16(off,val) mmio_writew(val, ich_spibar+off)
 | 
			
		||||
#define REGWRITE8(off,val)  mmio_writeb(val, ich_spibar+off)
 | 
			
		||||
 | 
			
		||||
/* Common SPI functions */
 | 
			
		||||
static int find_opcode(OPCODES *op, uint8_t opcode);
 | 
			
		||||
@@ -856,7 +856,8 @@ static int ich_spi_send_command(unsigned int writecnt, unsigned int readcnt,
 | 
			
		||||
		if (!ichspi_lock)
 | 
			
		||||
			opcode_index = reprogram_opcode_on_the_fly(cmd, writecnt, readcnt);
 | 
			
		||||
		if (opcode_index == -1) {
 | 
			
		||||
			msg_pdbg("Invalid OPCODE 0x%02x\n", cmd);
 | 
			
		||||
			msg_pdbg("Invalid OPCODE 0x%02x, will not execute.\n",
 | 
			
		||||
				 cmd);
 | 
			
		||||
			return SPI_INVALID_OPCODE;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2
									
								
								print.c
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								print.c
									
									
									
									
									
								
							@@ -54,7 +54,7 @@ char *flashbuses_to_text(enum chipbustype bustype)
 | 
			
		||||
			ret = strcat_realloc(ret, "None, ");
 | 
			
		||||
	}
 | 
			
		||||
	/* Kill last comma. */
 | 
			
		||||
	ret[strlen(ret) - 1] = '\0';
 | 
			
		||||
	ret[strlen(ret) - 2] = '\0';
 | 
			
		||||
	ret = realloc(ret, strlen(ret) + 1);
 | 
			
		||||
	return ret;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										20
									
								
								spi25.c
									
									
									
									
									
								
							
							
						
						
									
										20
									
								
								spi25.c
									
									
									
									
									
								
							@@ -119,8 +119,10 @@ static int probe_spi_rdid_generic(struct flashchip *flash, int bytes)
 | 
			
		||||
	uint32_t id1;
 | 
			
		||||
	uint32_t id2;
 | 
			
		||||
 | 
			
		||||
	if (spi_rdid(readarr, bytes))
 | 
			
		||||
	if (spi_rdid(readarr, bytes)) {
 | 
			
		||||
		msg_cdbg("\n");
 | 
			
		||||
		return 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (!oddparity(readarr[0]))
 | 
			
		||||
		msg_cdbg("RDID byte 0 parity violation. ");
 | 
			
		||||
@@ -198,8 +200,10 @@ int probe_spi_rems(struct flashchip *flash)
 | 
			
		||||
	unsigned char readarr[JEDEC_REMS_INSIZE];
 | 
			
		||||
	uint32_t id1, id2;
 | 
			
		||||
 | 
			
		||||
	if (spi_rems(readarr))
 | 
			
		||||
	if (spi_rems(readarr)) {
 | 
			
		||||
		msg_cdbg("\n");
 | 
			
		||||
		return 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	id1 = readarr[0];
 | 
			
		||||
	id2 = readarr[1];
 | 
			
		||||
@@ -254,15 +258,19 @@ int probe_spi_res1(struct flashchip *flash)
 | 
			
		||||
		return 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (spi_res(readarr, 1))
 | 
			
		||||
	if (spi_res(readarr, 1)) {
 | 
			
		||||
		msg_cdbg("\n");
 | 
			
		||||
		return 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	id2 = readarr[0];
 | 
			
		||||
 | 
			
		||||
	msg_cdbg("%s: id 0x%x\n", __func__, id2);
 | 
			
		||||
 | 
			
		||||
	if (id2 != flash->model_id)
 | 
			
		||||
	if (id2 != flash->model_id) {
 | 
			
		||||
		msg_cdbg("\n");
 | 
			
		||||
		return 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* Print the status register to tell the
 | 
			
		||||
	 * user about possible write protection.
 | 
			
		||||
@@ -276,8 +284,10 @@ int probe_spi_res2(struct flashchip *flash)
 | 
			
		||||
	unsigned char readarr[2];
 | 
			
		||||
	uint32_t id1, id2;
 | 
			
		||||
 | 
			
		||||
	if (spi_res(readarr, 2))
 | 
			
		||||
	if (spi_res(readarr, 2)) {
 | 
			
		||||
		msg_cdbg("\n");
 | 
			
		||||
		return 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	id1 = readarr[0];
 | 
			
		||||
	id2 = readarr[1];
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user