2012-12-06 15:15:58 +04:00
|
|
|
#ifndef HW_FLASH_H
|
2016-06-29 16:29:06 +03:00
|
|
|
#define HW_FLASH_H
|
2012-12-06 15:15:58 +04:00
|
|
|
|
2007-11-17 20:14:51 +03:00
|
|
|
/* NOR flash devices */
|
2011-08-04 16:55:30 +04:00
|
|
|
|
2019-08-12 08:23:46 +03:00
|
|
|
#include "exec/hwaddr.h"
|
2020-09-03 23:43:22 +03:00
|
|
|
#include "qom/object.h"
|
2011-08-04 16:55:30 +04:00
|
|
|
|
2019-03-08 12:45:56 +03:00
|
|
|
/* pflash_cfi01.c */
|
|
|
|
|
2019-03-08 12:45:59 +03:00
|
|
|
#define TYPE_PFLASH_CFI01 "cfi.pflash01"
|
2020-09-16 21:25:19 +03:00
|
|
|
OBJECT_DECLARE_SIMPLE_TYPE(PFlashCFI01, PFLASH_CFI01)
|
2016-06-22 15:24:48 +03:00
|
|
|
|
2007-11-17 20:14:51 +03:00
|
|
|
|
2019-03-08 12:45:56 +03:00
|
|
|
PFlashCFI01 *pflash_cfi01_register(hwaddr base,
|
2019-03-08 12:46:09 +03:00
|
|
|
const char *name,
|
2019-03-08 12:45:56 +03:00
|
|
|
hwaddr size,
|
|
|
|
BlockBackend *blk,
|
2019-03-08 12:46:10 +03:00
|
|
|
uint32_t sector_len,
|
2019-03-08 12:45:56 +03:00
|
|
|
int width,
|
|
|
|
uint16_t id0, uint16_t id1,
|
|
|
|
uint16_t id2, uint16_t id3,
|
|
|
|
int be);
|
2019-03-08 16:14:41 +03:00
|
|
|
BlockBackend *pflash_cfi01_get_blk(PFlashCFI01 *fl);
|
2019-03-08 12:45:56 +03:00
|
|
|
MemoryRegion *pflash_cfi01_get_memory(PFlashCFI01 *fl);
|
2019-05-07 14:55:02 +03:00
|
|
|
void pflash_cfi01_legacy_drive(PFlashCFI01 *dev, DriveInfo *dinfo);
|
2007-12-10 03:28:27 +03:00
|
|
|
|
|
|
|
/* pflash_cfi02.c */
|
2019-03-08 12:45:56 +03:00
|
|
|
|
2019-03-08 12:45:59 +03:00
|
|
|
#define TYPE_PFLASH_CFI02 "cfi.pflash02"
|
2020-09-16 21:25:19 +03:00
|
|
|
OBJECT_DECLARE_SIMPLE_TYPE(PFlashCFI02, PFLASH_CFI02)
|
2019-03-08 12:45:56 +03:00
|
|
|
|
|
|
|
|
|
|
|
PFlashCFI02 *pflash_cfi02_register(hwaddr base,
|
2019-03-08 12:46:09 +03:00
|
|
|
const char *name,
|
2019-03-08 12:45:56 +03:00
|
|
|
hwaddr size,
|
|
|
|
BlockBackend *blk,
|
2019-03-08 12:46:10 +03:00
|
|
|
uint32_t sector_len,
|
2019-03-08 12:45:56 +03:00
|
|
|
int nb_mappings,
|
|
|
|
int width,
|
|
|
|
uint16_t id0, uint16_t id1,
|
|
|
|
uint16_t id2, uint16_t id3,
|
|
|
|
uint16_t unlock_addr0,
|
|
|
|
uint16_t unlock_addr1,
|
|
|
|
int be);
|
2011-08-04 16:55:30 +04:00
|
|
|
|
2007-11-17 20:14:51 +03:00
|
|
|
/* nand.c */
|
2014-10-07 15:59:18 +04:00
|
|
|
DeviceState *nand_init(BlockBackend *blk, int manf_id, int chip_id);
|
2011-07-29 19:35:24 +04:00
|
|
|
void nand_setpins(DeviceState *dev, uint8_t cle, uint8_t ale,
|
2010-12-03 03:39:22 +03:00
|
|
|
uint8_t ce, uint8_t wp, uint8_t gnd);
|
2011-07-29 19:35:24 +04:00
|
|
|
void nand_getpins(DeviceState *dev, int *rb);
|
|
|
|
void nand_setio(DeviceState *dev, uint32_t value);
|
|
|
|
uint32_t nand_getio(DeviceState *dev);
|
|
|
|
uint32_t nand_getbuswidth(DeviceState *dev);
|
2007-11-17 20:14:51 +03:00
|
|
|
|
2023-03-14 12:50:01 +03:00
|
|
|
#define NAND_MFR_TOSHIBA 0x98
|
|
|
|
#define NAND_MFR_SAMSUNG 0xec
|
|
|
|
#define NAND_MFR_FUJITSU 0x04
|
|
|
|
#define NAND_MFR_NATIONAL 0x8f
|
|
|
|
#define NAND_MFR_RENESAS 0x07
|
|
|
|
#define NAND_MFR_STMICRO 0x20
|
|
|
|
#define NAND_MFR_HYNIX 0xad
|
|
|
|
#define NAND_MFR_MICRON 0x2c
|
2007-11-17 20:14:51 +03:00
|
|
|
|
2008-04-15 01:57:44 +04:00
|
|
|
/* onenand.c */
|
2011-08-28 20:22:17 +04:00
|
|
|
void *onenand_raw_otp(DeviceState *onenand_device);
|
2008-04-15 01:57:44 +04:00
|
|
|
|
2007-11-17 20:14:51 +03:00
|
|
|
/* ecc.c */
|
2009-05-10 04:44:56 +04:00
|
|
|
typedef struct {
|
2023-03-14 12:50:01 +03:00
|
|
|
uint8_t cp; /* Column parity */
|
|
|
|
uint16_t lp[2]; /* Line parity */
|
2007-11-17 20:14:51 +03:00
|
|
|
uint16_t count;
|
2009-05-10 04:44:56 +04:00
|
|
|
} ECCState;
|
2007-11-17 20:14:51 +03:00
|
|
|
|
2009-05-10 04:44:56 +04:00
|
|
|
uint8_t ecc_digest(ECCState *s, uint8_t sample);
|
|
|
|
void ecc_reset(ECCState *s);
|
2021-04-08 17:07:06 +03:00
|
|
|
extern const VMStateDescription vmstate_ecc_state;
|
2012-12-06 15:15:58 +04:00
|
|
|
|
2023-06-07 07:39:40 +03:00
|
|
|
/* m25p80.c */
|
|
|
|
|
2024-03-19 10:33:20 +03:00
|
|
|
#define TYPE_M25P80 "m25p80-generic"
|
|
|
|
|
2023-06-07 07:39:40 +03:00
|
|
|
BlockBackend *m25p80_get_blk(DeviceState *dev);
|
|
|
|
|
2012-12-06 15:15:58 +04:00
|
|
|
#endif
|