mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 08:43:55 -06:00
pflash_cfi01: Log use of flawed "write to buffer"
Our implementation of "write to buffer" (command 0xE8) is flawed. LOG_UNIMP its use, and add some FIXME comments. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20190308094610.21210-4-armbru@redhat.com>
This commit is contained in:
parent
2d93bebf81
commit
4dbda935e0
1 changed files with 13 additions and 0 deletions
|
@ -502,6 +502,10 @@ static void pflash_write(PFlashCFI01 *pfl, hwaddr offset,
|
||||||
break;
|
break;
|
||||||
case 0xe8: /* Write to buffer */
|
case 0xe8: /* Write to buffer */
|
||||||
DPRINTF("%s: Write to buffer\n", __func__);
|
DPRINTF("%s: Write to buffer\n", __func__);
|
||||||
|
/* FIXME should save @offset, @width for case 1+ */
|
||||||
|
qemu_log_mask(LOG_UNIMP,
|
||||||
|
"%s: Write to buffer emulation is flawed\n",
|
||||||
|
__func__);
|
||||||
pfl->status |= 0x80; /* Ready! */
|
pfl->status |= 0x80; /* Ready! */
|
||||||
break;
|
break;
|
||||||
case 0xf0: /* Probe for AMD flash */
|
case 0xf0: /* Probe for AMD flash */
|
||||||
|
@ -545,6 +549,7 @@ static void pflash_write(PFlashCFI01 *pfl, hwaddr offset,
|
||||||
/* Mask writeblock size based on device width, or bank width if
|
/* Mask writeblock size based on device width, or bank width if
|
||||||
* device width not specified.
|
* device width not specified.
|
||||||
*/
|
*/
|
||||||
|
/* FIXME check @offset, @width */
|
||||||
if (pfl->device_width) {
|
if (pfl->device_width) {
|
||||||
value = extract32(value, 0, pfl->device_width * 8);
|
value = extract32(value, 0, pfl->device_width * 8);
|
||||||
} else {
|
} else {
|
||||||
|
@ -582,7 +587,13 @@ static void pflash_write(PFlashCFI01 *pfl, hwaddr offset,
|
||||||
case 2:
|
case 2:
|
||||||
switch (pfl->cmd) {
|
switch (pfl->cmd) {
|
||||||
case 0xe8: /* Block write */
|
case 0xe8: /* Block write */
|
||||||
|
/* FIXME check @offset, @width */
|
||||||
if (!pfl->ro) {
|
if (!pfl->ro) {
|
||||||
|
/*
|
||||||
|
* FIXME writing straight to memory is *wrong*. We
|
||||||
|
* should write to a buffer, and flush it to memory
|
||||||
|
* only on confirm command (see below).
|
||||||
|
*/
|
||||||
pflash_data_write(pfl, offset, value, width, be);
|
pflash_data_write(pfl, offset, value, width, be);
|
||||||
} else {
|
} else {
|
||||||
pfl->status |= 0x10; /* Programming error */
|
pfl->status |= 0x10; /* Programming error */
|
||||||
|
@ -598,6 +609,7 @@ static void pflash_write(PFlashCFI01 *pfl, hwaddr offset,
|
||||||
pfl->wcycle++;
|
pfl->wcycle++;
|
||||||
if (!pfl->ro) {
|
if (!pfl->ro) {
|
||||||
/* Flush the entire write buffer onto backing storage. */
|
/* Flush the entire write buffer onto backing storage. */
|
||||||
|
/* FIXME premature! */
|
||||||
pflash_update(pfl, offset & mask, pfl->writeblock_size);
|
pflash_update(pfl, offset & mask, pfl->writeblock_size);
|
||||||
} else {
|
} else {
|
||||||
pfl->status |= 0x10; /* Programming error */
|
pfl->status |= 0x10; /* Programming error */
|
||||||
|
@ -614,6 +626,7 @@ static void pflash_write(PFlashCFI01 *pfl, hwaddr offset,
|
||||||
switch (pfl->cmd) {
|
switch (pfl->cmd) {
|
||||||
case 0xe8: /* Block write */
|
case 0xe8: /* Block write */
|
||||||
if (cmd == 0xd0) {
|
if (cmd == 0xd0) {
|
||||||
|
/* FIXME this is where we should write out the buffer */
|
||||||
pfl->wcycle = 0;
|
pfl->wcycle = 0;
|
||||||
pfl->status |= 0x80;
|
pfl->status |= 0x80;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue