Revision b4bf0a9a hw/pflash_cfi01.c
b/hw/pflash_cfi01.c | ||
---|---|---|
72 | 72 |
uint8_t cfi_len; |
73 | 73 |
uint8_t cfi_table[0x52]; |
74 | 74 |
target_phys_addr_t counter; |
75 |
unsigned int writeblock_size; |
|
75 | 76 |
QEMUTimer *timer; |
76 | 77 |
ram_addr_t off; |
77 | 78 |
int fl_mem; |
... | ... | |
206 | 207 |
switch (width) { |
207 | 208 |
case 1: |
208 | 209 |
p[offset] = value; |
209 |
pflash_update(pfl, offset, 1); |
|
210 | 210 |
break; |
211 | 211 |
case 2: |
212 | 212 |
#if defined(TARGET_WORDS_BIGENDIAN) |
... | ... | |
216 | 216 |
p[offset] = value; |
217 | 217 |
p[offset + 1] = value >> 8; |
218 | 218 |
#endif |
219 |
pflash_update(pfl, offset, 2); |
|
220 | 219 |
break; |
221 | 220 |
case 4: |
222 | 221 |
#if defined(TARGET_WORDS_BIGENDIAN) |
... | ... | |
230 | 229 |
p[offset + 2] = value >> 16; |
231 | 230 |
p[offset + 3] = value >> 24; |
232 | 231 |
#endif |
233 |
pflash_update(pfl, offset, 4); |
|
234 | 232 |
break; |
235 | 233 |
} |
236 | 234 |
|
... | ... | |
307 | 305 |
case 0x40: /* Single Byte Program */ |
308 | 306 |
DPRINTF("%s: Single Byte Program\n", __func__); |
309 | 307 |
pflash_data_write(pfl, offset, value, width); |
308 |
pflash_update(pfl, offset, width); |
|
310 | 309 |
pfl->status |= 0x80; /* Ready! */ |
311 | 310 |
pfl->wcycle = 0; |
312 | 311 |
break; |
... | ... | |
359 | 358 |
pfl->status |= 0x80; |
360 | 359 |
|
361 | 360 |
if (!pfl->counter) { |
361 |
target_phys_addr_t mask = pfl->writeblock_size - 1; |
|
362 |
mask = ~mask; |
|
363 |
|
|
362 | 364 |
DPRINTF("%s: block write finished\n", __func__); |
363 | 365 |
pfl->wcycle++; |
366 |
/* Flush the entire write buffer onto backing storage. */ |
|
367 |
pflash_update(pfl, offset & mask, pfl->writeblock_size); |
|
364 | 368 |
} |
365 | 369 |
|
366 | 370 |
pfl->counter--; |
... | ... | |
606 | 610 |
} else { |
607 | 611 |
pfl->cfi_table[0x2A] = 0x0B; |
608 | 612 |
} |
613 |
pfl->writeblock_size = 1 << pfl->cfi_table[0x2A]; |
|
614 |
|
|
609 | 615 |
pfl->cfi_table[0x2B] = 0x00; |
610 | 616 |
/* Number of erase block regions (uniform) */ |
611 | 617 |
pfl->cfi_table[0x2C] = 0x01; |
Also available in: Unified diff