aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2019-07-23 10:51:15 +0100
committerPeter Maydell <peter.maydell@linaro.org>2019-07-23 10:51:15 +0100
commitcec9f94f2dec8d34f2de76cdb2f562981858a9ef (patch)
tree2361e69cb5c53b07bf8bc6b8fe9cef4669f381dc
parentecb199b177b3d94c1dfba2e7ba4595d368f780f7 (diff)
parent124e4cfaa42bb5a14eec33ea47d3502b5f46eb33 (diff)
Merge remote-tracking branch 'remotes/philmd-gitlab/tags/pflash-next-20190723' into staging
One bugfix and silent a fallthru warning. # gpg: Signature made Tue 23 Jul 2019 10:33:34 BST # gpg: using RSA key E3E32C2CDEADC0DE # gpg: Good signature from "Philippe Mathieu-Daudé (F4BUG) <f4bug@amsat.org>" [full] # Primary key fingerprint: FAAB E75E 1291 7221 DCFD 6BB2 E3E3 2C2C DEAD C0DE * remotes/philmd-gitlab/tags/pflash-next-20190723: hw/block/pflash_cfi02: Rewrite a fall through comment hw/block/pflash_cfi01: Add missing DeviceReset() handler Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r--hw/block/pflash_cfi01.c19
-rw-r--r--hw/block/pflash_cfi02.c2
2 files changed, 20 insertions, 1 deletions
diff --git a/hw/block/pflash_cfi01.c b/hw/block/pflash_cfi01.c
index 435be1e35c..a1ec1faae5 100644
--- a/hw/block/pflash_cfi01.c
+++ b/hw/block/pflash_cfi01.c
@@ -865,6 +865,24 @@ static void pflash_cfi01_realize(DeviceState *dev, Error **errp)
pfl->cfi_table[0x3f] = 0x01; /* Number of protection fields */
}
+static void pflash_cfi01_system_reset(DeviceState *dev)
+{
+ PFlashCFI01 *pfl = PFLASH_CFI01(dev);
+
+ /*
+ * The command 0x00 is not assigned by the CFI open standard,
+ * but QEMU historically uses it for the READ_ARRAY command (0xff).
+ */
+ pfl->cmd = 0x00;
+ pfl->wcycle = 0;
+ memory_region_rom_device_set_romd(&pfl->mem, true);
+ /*
+ * The WSM ready timer occurs at most 150ns after system reset.
+ * This model deliberately ignores this delay.
+ */
+ pfl->status = 0x80;
+}
+
static Property pflash_cfi01_properties[] = {
DEFINE_PROP_DRIVE("drive", PFlashCFI01, blk),
/* num-blocks is the number of blocks actually visible to the guest,
@@ -909,6 +927,7 @@ static void pflash_cfi01_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
+ dc->reset = pflash_cfi01_system_reset;
dc->realize = pflash_cfi01_realize;
dc->props = pflash_cfi01_properties;
dc->vmsd = &vmstate_pflash;
diff --git a/hw/block/pflash_cfi02.c b/hw/block/pflash_cfi02.c
index f68837a449..42886f6af5 100644
--- a/hw/block/pflash_cfi02.c
+++ b/hw/block/pflash_cfi02.c
@@ -577,7 +577,7 @@ static void pflash_write(void *opaque, hwaddr offset, uint64_t value,
pfl->cmd = 0x98;
return;
}
- /* No break here */
+ /* fall through */
default:
DPRINTF("%s: invalid write for command %02x\n",
__func__, pfl->cmd);