mirror of
https://review.coreboot.org/flashrom.git
synced 2025-07-01 22:21:16 +02:00
jedec.c: constify a bit more
Also, include chipdrivers.h to find conflicting types between exported declarations and actual implementations. Corresponding to flashrom svn r1805. 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:
@ -136,10 +136,8 @@ int unlock_lh28f008bjt(struct flashctx *flash);
|
|||||||
|
|
||||||
/* jedec.c */
|
/* jedec.c */
|
||||||
uint8_t oddparity(uint8_t val);
|
uint8_t oddparity(uint8_t val);
|
||||||
void toggle_ready_jedec(struct flashctx *flash, chipaddr dst);
|
void toggle_ready_jedec(const struct flashctx *flash, chipaddr dst);
|
||||||
void data_polling_jedec(struct flashctx *flash, chipaddr dst, uint8_t data);
|
void data_polling_jedec(const struct flashctx *flash, chipaddr dst, uint8_t data);
|
||||||
int write_byte_program_jedec(struct flashctx *flash, chipaddr bios, uint8_t *src,
|
|
||||||
chipaddr dst);
|
|
||||||
int probe_jedec(struct flashctx *flash);
|
int probe_jedec(struct flashctx *flash);
|
||||||
int write_jedec(struct flashctx *flash, const uint8_t *buf, unsigned int start, unsigned int len);
|
int write_jedec(struct flashctx *flash, const uint8_t *buf, unsigned int start, unsigned int len);
|
||||||
int write_jedec_1(struct flashctx *flash, const uint8_t *buf, unsigned int start, unsigned int len);
|
int write_jedec_1(struct flashctx *flash, const uint8_t *buf, unsigned int start, unsigned int len);
|
||||||
|
14
jedec.c
14
jedec.c
@ -23,6 +23,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "flash.h"
|
#include "flash.h"
|
||||||
|
#include "chipdrivers.h"
|
||||||
|
|
||||||
#define MAX_REFLASH_TRIES 0x10
|
#define MAX_REFLASH_TRIES 0x10
|
||||||
#define MASK_FULL 0xffff
|
#define MASK_FULL 0xffff
|
||||||
@ -111,8 +112,7 @@ static unsigned int getaddrmask(const struct flashchip *chip)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void start_program_jedec_common(struct flashctx *flash,
|
static void start_program_jedec_common(const struct flashctx *flash, unsigned int mask)
|
||||||
unsigned int mask)
|
|
||||||
{
|
{
|
||||||
chipaddr bios = flash->virtual_memory;
|
chipaddr bios = flash->virtual_memory;
|
||||||
chip_writeb(flash, 0xAA, bios + (0x5555 & mask));
|
chip_writeb(flash, 0xAA, bios + (0x5555 & mask));
|
||||||
@ -328,7 +328,7 @@ static int erase_chip_jedec_common(struct flashctx *flash, unsigned int mask)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int write_byte_program_jedec_common(struct flashctx *flash, uint8_t *src,
|
static int write_byte_program_jedec_common(const struct flashctx *flash, const uint8_t *src,
|
||||||
chipaddr dst, unsigned int mask)
|
chipaddr dst, unsigned int mask)
|
||||||
{
|
{
|
||||||
int tried = 0, failed = 0;
|
int tried = 0, failed = 0;
|
||||||
@ -358,7 +358,7 @@ retry:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* chunksize is 1 */
|
/* chunksize is 1 */
|
||||||
int write_jedec_1(struct flashctx *flash, uint8_t *src, unsigned int start,
|
int write_jedec_1(struct flashctx *flash, const uint8_t *src, unsigned int start,
|
||||||
unsigned int len)
|
unsigned int len)
|
||||||
{
|
{
|
||||||
int i, failed = 0;
|
int i, failed = 0;
|
||||||
@ -380,11 +380,11 @@ int write_jedec_1(struct flashctx *flash, uint8_t *src, unsigned int start,
|
|||||||
return failed;
|
return failed;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int write_page_write_jedec_common(struct flashctx *flash, uint8_t *src,
|
static int write_page_write_jedec_common(struct flashctx *flash, const uint8_t *src,
|
||||||
unsigned int start, unsigned int page_size)
|
unsigned int start, unsigned int page_size)
|
||||||
{
|
{
|
||||||
int i, tried = 0, failed;
|
int i, tried = 0, failed;
|
||||||
uint8_t *s = src;
|
const uint8_t *s = src;
|
||||||
chipaddr bios = flash->virtual_memory;
|
chipaddr bios = flash->virtual_memory;
|
||||||
chipaddr dst = bios + start;
|
chipaddr dst = bios + start;
|
||||||
chipaddr d = dst;
|
chipaddr d = dst;
|
||||||
@ -428,7 +428,7 @@ retry:
|
|||||||
* This function is a slightly modified copy of spi_write_chunked.
|
* This function is a slightly modified copy of spi_write_chunked.
|
||||||
* Each page is written separately in chunks with a maximum size of chunksize.
|
* Each page is written separately in chunks with a maximum size of chunksize.
|
||||||
*/
|
*/
|
||||||
int write_jedec(struct flashctx *flash, uint8_t *buf, unsigned int start,
|
int write_jedec(struct flashctx *flash, const uint8_t *buf, unsigned int start,
|
||||||
int unsigned len)
|
int unsigned len)
|
||||||
{
|
{
|
||||||
unsigned int i, starthere, lenhere;
|
unsigned int i, starthere, lenhere;
|
||||||
|
Reference in New Issue
Block a user