Revision 4b6fedca
b/hw/block/pflash_cfi01.c | ||
---|---|---|
71 | 71 |
BlockDriverState *bs; |
72 | 72 |
uint32_t nb_blocs; |
73 | 73 |
uint64_t sector_len; |
74 |
uint8_t width; |
|
74 |
uint8_t bank_width;
|
|
75 | 75 |
uint8_t be; |
76 | 76 |
uint8_t wcycle; /* if 0, the flash is read normally */ |
77 | 77 |
int ro; |
... | ... | |
126 | 126 |
ret = -1; |
127 | 127 |
boff = offset & 0xFF; /* why this here ?? */ |
128 | 128 |
|
129 |
if (pfl->width == 2)
|
|
129 |
if (pfl->bank_width == 2) {
|
|
130 | 130 |
boff = boff >> 1; |
131 |
else if (pfl->width == 4)
|
|
131 |
} else if (pfl->bank_width == 4) {
|
|
132 | 132 |
boff = boff >> 2; |
133 |
} |
|
133 | 134 |
|
134 | 135 |
#if 0 |
135 | 136 |
DPRINTF("%s: reading offset " TARGET_FMT_plx " under cmd %02x width %d\n", |
... | ... | |
665 | 666 |
pfl->cfi_table[0x28] = 0x02; |
666 | 667 |
pfl->cfi_table[0x29] = 0x00; |
667 | 668 |
/* Max number of bytes in multi-bytes write */ |
668 |
if (pfl->width == 1) { |
|
669 |
if (pfl->bank_width == 1) {
|
|
669 | 670 |
pfl->cfi_table[0x2A] = 0x08; |
670 | 671 |
} else { |
671 | 672 |
pfl->cfi_table[0x2A] = 0x0B; |
... | ... | |
706 | 707 |
DEFINE_PROP_DRIVE("drive", struct pflash_t, bs), |
707 | 708 |
DEFINE_PROP_UINT32("num-blocks", struct pflash_t, nb_blocs, 0), |
708 | 709 |
DEFINE_PROP_UINT64("sector-length", struct pflash_t, sector_len, 0), |
709 |
DEFINE_PROP_UINT8("width", struct pflash_t, width, 0), |
|
710 |
DEFINE_PROP_UINT8("width", struct pflash_t, bank_width, 0),
|
|
710 | 711 |
DEFINE_PROP_UINT8("big-endian", struct pflash_t, be, 0), |
711 | 712 |
DEFINE_PROP_UINT16("id0", struct pflash_t, ident0, 0), |
712 | 713 |
DEFINE_PROP_UINT16("id1", struct pflash_t, ident1, 0), |
... | ... | |
745 | 746 |
DeviceState *qdev, const char *name, |
746 | 747 |
hwaddr size, |
747 | 748 |
BlockDriverState *bs, |
748 |
uint32_t sector_len, int nb_blocs, int width,
|
|
749 |
uint16_t id0, uint16_t id1, |
|
749 |
uint32_t sector_len, int nb_blocs, |
|
750 |
int bank_width, uint16_t id0, uint16_t id1,
|
|
750 | 751 |
uint16_t id2, uint16_t id3, int be) |
751 | 752 |
{ |
752 | 753 |
DeviceState *dev = qdev_create(NULL, TYPE_CFI_PFLASH01); |
... | ... | |
756 | 757 |
} |
757 | 758 |
qdev_prop_set_uint32(dev, "num-blocks", nb_blocs); |
758 | 759 |
qdev_prop_set_uint64(dev, "sector-length", sector_len); |
759 |
qdev_prop_set_uint8(dev, "width", width); |
|
760 |
qdev_prop_set_uint8(dev, "width", bank_width);
|
|
760 | 761 |
qdev_prop_set_uint8(dev, "big-endian", !!be); |
761 | 762 |
qdev_prop_set_uint16(dev, "id0", id0); |
762 | 763 |
qdev_prop_set_uint16(dev, "id1", id1); |
Also available in: Unified diff