From patchwork Fri Apr 30 22:19:22 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: pflash_cfi01: add device ID read command Date: Fri, 30 Apr 2010 12:19:22 -0000 From: Michael Walle X-Patchwork-Id: 51409 Message-Id: <201005010019.22643.michael@walle.cc> To: qemu-devel@nongnu.org Add support to read manufacturer and device ID. For everything else (eg. lock bits) 0 is returned. --- hw/pflash_cfi01.c | 20 ++++++++++++++++++++ 1 files changed, 20 insertions(+), 0 deletions(-) ret = 0; @@ -290,6 +306,10 @@ static void pflash_write(pflash_t *pfl, target_phys_addr_t offset, DPRINTF("%s: Read status register\n", __func__); pfl->cmd = cmd; return; + case 0x90: /* Read Device ID */ + DPRINTF("%s: Read Device information\n", __func__); + pfl->cmd = cmd; + return; case 0x98: /* CFI query */ DPRINTF("%s: CFI query\n", __func__); break; diff --git a/hw/pflash_cfi01.c b/hw/pflash_cfi01.c index dfdced9..2d30968 100644 --- a/hw/pflash_cfi01.c +++ b/hw/pflash_cfi01.c @@ -165,6 +165,22 @@ static uint32_t pflash_read (pflash_t *pfl, target_phys_addr_t offset, ret = pfl->status; DPRINTF("%s: status %x\n", __func__, ret); break; + case 0x90: + switch (boff) { + case 0: + ret = pfl->ident[0] << 8 | pfl->ident[1]; + DPRINTF("%s: Manufacturer Code %04x\n", __func__, ret); + break; + case 1: + ret = pfl->ident[2] << 8 | pfl->ident[3]; + DPRINTF("%s: Device ID Code %04x\n", __func__, ret); + break; + default: + DPRINTF("%s: Read Device Information boff=%x\n", __func__, boff); + ret = 0; + break; + } + break; case 0x98: /* Query mode */ if (boff > pfl->cfi_len)