Commit 8a3c60cd authored by Carl-Daniel Hailfinger's avatar Carl-Daniel Hailfinger
Browse files

Add struct flashctx * parameter to all functions accessing flash chips


All programmer access function prototypes except init have been made
static and moved to the respective file.

A few internal functions in flash chip drivers had chipaddr parameters
which are no longer needed.

The lines touched by flashctx changes have been adjusted to 80 columns
except in header files.

Corresponding to flashrom svn r1474.
Signed-off-by: default avatarCarl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: default avatarMichael Karcher <flashrom@mkarcher.dialup.fu-berlin.de>
parent 63fd9026
......@@ -26,7 +26,7 @@ static int printlock_w39_fwh_block(struct flashctx *flash, unsigned int offset)
chipaddr wrprotect = flash->virtual_registers + offset + 2;
uint8_t locking;
locking = chip_readb(wrprotect);
locking = chip_readb(flash, wrprotect);
msg_cdbg("Lock status of block at 0x%08x is ", offset);
switch (locking & 0x7) {
case 0:
......@@ -64,7 +64,7 @@ static int unlock_w39_fwh_block(struct flashctx *flash, unsigned int offset)
chipaddr wrprotect = flash->virtual_registers + offset + 2;
uint8_t locking;
locking = chip_readb(wrprotect);
locking = chip_readb(flash, wrprotect);
/* Read or write lock present? */
if (locking & ((1 << 2) | (1 << 0))) {
/* Lockdown active? */
......@@ -73,7 +73,7 @@ static int unlock_w39_fwh_block(struct flashctx *flash, unsigned int offset)
return -1;
} else {
msg_cdbg("Unlocking block at 0x%08x\n", offset);
chip_writeb(0, wrprotect);
chip_writeb(flash, 0, wrprotect);
}
}
......@@ -86,18 +86,18 @@ static uint8_t w39_idmode_readb(struct flashctx *flash, unsigned int offset)
uint8_t val;
/* Product Identification Entry */
chip_writeb(0xAA, bios + 0x5555);
chip_writeb(0x55, bios + 0x2AAA);
chip_writeb(0x90, bios + 0x5555);
chip_writeb(flash, 0xAA, bios + 0x5555);
chip_writeb(flash, 0x55, bios + 0x2AAA);
chip_writeb(flash, 0x90, bios + 0x5555);
programmer_delay(10);
/* Read something, maybe hardware lock bits */
val = chip_readb(bios + offset);
val = chip_readb(flash, bios + offset);
/* Product Identification Exit */
chip_writeb(0xAA, bios + 0x5555);
chip_writeb(0x55, bios + 0x2AAA);
chip_writeb(0xF0, bios + 0x5555);
chip_writeb(flash, 0xAA, bios + 0x5555);
chip_writeb(flash, 0x55, bios + 0x2AAA);
chip_writeb(flash, 0xF0, bios + 0x5555);
programmer_delay(10);
return val;
......@@ -160,7 +160,7 @@ static int unlock_w39_fwh(struct flashctx *flash)
return 0;
}
int printlock_w39l040(struct flashctx * flash)
int printlock_w39l040(struct flashctx *flash)
{
uint8_t lock;
int ret;
......
......@@ -60,9 +60,12 @@ done:
return flashport;
}
static int wbsio_spi_send_command(unsigned int writecnt, unsigned int readcnt,
const unsigned char *writearr, unsigned char *readarr);
static int wbsio_spi_read(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len);
static int wbsio_spi_send_command(struct flashctx *flash, unsigned int writecnt,
unsigned int readcnt,
const unsigned char *writearr,
unsigned char *readarr);
static int wbsio_spi_read(struct flashctx *flash, uint8_t *buf,
unsigned int start, unsigned int len);
static const struct spi_programmer spi_programmer_wbsio = {
.type = SPI_CONTROLLER_WBSIO,
......@@ -110,8 +113,10 @@ int wbsio_check_for_spi(void)
* Would one more byte of RAM in the chip (to get all 24 bits) really make
* such a big difference?
*/
static int wbsio_spi_send_command(unsigned int writecnt, unsigned int readcnt,
const unsigned char *writearr, unsigned char *readarr)
static int wbsio_spi_send_command(struct flashctx *flash, unsigned int writecnt,
unsigned int readcnt,
const unsigned char *writearr,
unsigned char *readarr)
{
int i;
uint8_t mode = 0;
......@@ -194,7 +199,8 @@ static int wbsio_spi_send_command(unsigned int writecnt, unsigned int readcnt,
return 0;
}
static int wbsio_spi_read(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len)
static int wbsio_spi_read(struct flashctx *flash, uint8_t *buf,
unsigned int start, unsigned int len)
{
return read_memmapped(flash, buf, start, len);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment