1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-07-01 22:21:16 +02:00

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: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Michael Karcher <flashrom@mkarcher.dialup.fu-berlin.de>
This commit is contained in:
Carl-Daniel Hailfinger
2011-12-18 15:01:24 +00:00
parent 63fd9026f1
commit 8a3c60cdd0
42 changed files with 727 additions and 541 deletions

View File

@ -34,8 +34,10 @@
static int fd = -1;
static int linux_spi_shutdown(void *data);
static int linux_spi_send_command(unsigned int writecnt, unsigned int readcnt,
const unsigned char *txbuf, unsigned char *rxbuf);
static int linux_spi_send_command(struct flashctx *flash, unsigned int writecnt,
unsigned int readcnt,
const unsigned char *txbuf,
unsigned char *rxbuf);
static int linux_spi_read(struct flashctx *flash, uint8_t *buf,
unsigned int start, unsigned int len);
static int linux_spi_write_256(struct flashctx *flash, uint8_t *buf,
@ -107,8 +109,10 @@ static int linux_spi_shutdown(void *data)
return 0;
}
static int linux_spi_send_command(unsigned int writecnt, unsigned int readcnt,
const unsigned char *txbuf, unsigned char *rxbuf)
static int linux_spi_send_command(struct flashctx *flash, unsigned int writecnt,
unsigned int readcnt,
const unsigned char *txbuf,
unsigned char *rxbuf)
{
struct spi_ioc_transfer msg[2] = {
{
@ -134,11 +138,13 @@ static int linux_spi_send_command(unsigned int writecnt, unsigned int readcnt,
static int linux_spi_read(struct flashctx *flash, uint8_t *buf,
unsigned int start, unsigned int len)
{
return spi_read_chunked(flash, buf, start, len, (unsigned)getpagesize());
return spi_read_chunked(flash, buf, start, len,
(unsigned int)getpagesize());
}
static int linux_spi_write_256(struct flashctx *flash, uint8_t *buf,
unsigned int start, unsigned int len)
{
return spi_write_chunked(flash, buf, start, len, ((unsigned)getpagesize()) - 4);
return spi_write_chunked(flash, buf, start, len,
((unsigned int)getpagesize()) - 4);
}