a7538ca079
The Aspeed machines have many Static Memory Controllers (SMC), up to 8, which can only drive flash memory devices. Commit27a2c66c92
("aspeed/smc: Wire CS lines at reset") tried to ease the definitions of these devices by allowing flash devices from the command line to be attached to a SSI bus. For that, the wiring of the CS lines of the Aspeed SMC controller was moved at reset. Two assumptions are made though, first that the device has a SSI_GPIO_CS GPIO line, which is not always the case, and second that it is a flash device. Correct this problem by ensuring that the devices attached to the bus are of the correct flash type. This fixes a QEMU abort when devices without a CS line, such as the max111x, are passed on the command line. While at it, export TYPE_M25P80 used in the Xilinx Versal Virtual machine. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2228 Fixes:27a2c66c92
("aspeed/smc: Wire CS lines at reset") Reported-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Tested-by: Thomas Huth <thuth@redhat.com> [ clg: minor fixes in the commit log ] Signed-off-by: Cédric Le Goater <clg@redhat.com>
86 lines
2.7 KiB
C
86 lines
2.7 KiB
C
#ifndef HW_FLASH_H
|
|
#define HW_FLASH_H
|
|
|
|
/* NOR flash devices */
|
|
|
|
#include "exec/hwaddr.h"
|
|
#include "qom/object.h"
|
|
|
|
/* pflash_cfi01.c */
|
|
|
|
#define TYPE_PFLASH_CFI01 "cfi.pflash01"
|
|
OBJECT_DECLARE_SIMPLE_TYPE(PFlashCFI01, PFLASH_CFI01)
|
|
|
|
|
|
PFlashCFI01 *pflash_cfi01_register(hwaddr base,
|
|
const char *name,
|
|
hwaddr size,
|
|
BlockBackend *blk,
|
|
uint32_t sector_len,
|
|
int width,
|
|
uint16_t id0, uint16_t id1,
|
|
uint16_t id2, uint16_t id3,
|
|
int be);
|
|
BlockBackend *pflash_cfi01_get_blk(PFlashCFI01 *fl);
|
|
MemoryRegion *pflash_cfi01_get_memory(PFlashCFI01 *fl);
|
|
void pflash_cfi01_legacy_drive(PFlashCFI01 *dev, DriveInfo *dinfo);
|
|
|
|
/* pflash_cfi02.c */
|
|
|
|
#define TYPE_PFLASH_CFI02 "cfi.pflash02"
|
|
OBJECT_DECLARE_SIMPLE_TYPE(PFlashCFI02, PFLASH_CFI02)
|
|
|
|
|
|
PFlashCFI02 *pflash_cfi02_register(hwaddr base,
|
|
const char *name,
|
|
hwaddr size,
|
|
BlockBackend *blk,
|
|
uint32_t sector_len,
|
|
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);
|
|
|
|
/* nand.c */
|
|
DeviceState *nand_init(BlockBackend *blk, int manf_id, int chip_id);
|
|
void nand_setpins(DeviceState *dev, uint8_t cle, uint8_t ale,
|
|
uint8_t ce, uint8_t wp, uint8_t gnd);
|
|
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);
|
|
|
|
#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
|
|
|
|
/* onenand.c */
|
|
void *onenand_raw_otp(DeviceState *onenand_device);
|
|
|
|
/* ecc.c */
|
|
typedef struct {
|
|
uint8_t cp; /* Column parity */
|
|
uint16_t lp[2]; /* Line parity */
|
|
uint16_t count;
|
|
} ECCState;
|
|
|
|
uint8_t ecc_digest(ECCState *s, uint8_t sample);
|
|
void ecc_reset(ECCState *s);
|
|
extern const VMStateDescription vmstate_ecc_state;
|
|
|
|
/* m25p80.c */
|
|
|
|
#define TYPE_M25P80 "m25p80-generic"
|
|
|
|
BlockBackend *m25p80_get_blk(DeviceState *dev);
|
|
|
|
#endif
|