From patchwork Sat May 1 17:34:06 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Walle X-Patchwork-Id: 51456 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 1EA24B7D5E for ; Sun, 2 May 2010 03:37:11 +1000 (EST) Received: from localhost ([127.0.0.1]:48193 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O8GbD-0000zz-CU for incoming@patchwork.ozlabs.org; Sat, 01 May 2010 13:35:31 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O8Ga4-0000zV-P7 for qemu-devel@nongnu.org; Sat, 01 May 2010 13:34:20 -0400 Received: from [140.186.70.92] (port=46365 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O8Ga3-0000yc-8Y for qemu-devel@nongnu.org; Sat, 01 May 2010 13:34:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O8GZz-0007wH-Md for qemu-devel@nongnu.org; Sat, 01 May 2010 13:34:17 -0400 Received: from mail.serverraum.org ([78.47.150.89]:55978) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O8GZz-0007w9-G5 for qemu-devel@nongnu.org; Sat, 01 May 2010 13:34:15 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.serverraum.org (Postfix) with ESMTP id C98F13EE9F; Sat, 1 May 2010 19:34:13 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at mail.serverraum.org Received: from mail.serverraum.org ([127.0.0.1]) by localhost (web.serverraum.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id rsQLV+DKCugo; Sat, 1 May 2010 19:34:13 +0200 (CEST) Received: from localhost.localdomain (77-22-61-82-dynip.superkabel.de [77.22.61.82]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.serverraum.org (Postfix) with ESMTPSA id 97F343EE9D; Sat, 1 May 2010 19:34:13 +0200 (CEST) From: Michael Walle To: qemu-devel@nongnu.org Date: Sat, 1 May 2010 19:34:06 +0200 Message-Id: <1272735246-22555-1-git-send-email-michael@walle.cc> X-Mailer: git-send-email 1.5.6.5 In-Reply-To: <4BDBD0FC.7010707@mail.berlios.de> References: <4BDBD0FC.7010707@mail.berlios.de> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) Cc: Michael Walle Subject: [Qemu-devel] [PATCH] pflash_cfi01: add device ID read command X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Add support to read manufacturer and device ID. For everything else (eg. lock bits) 0 is returned. Signed-off-by: Michael Walle --- hw/pflash_cfi01.c | 20 ++++++++++++++++++++ 1 files changed, 20 insertions(+), 0 deletions(-) diff --git a/hw/pflash_cfi01.c b/hw/pflash_cfi01.c index 6b2adba..bc901e6 100644 --- a/hw/pflash_cfi01.c +++ b/hw/pflash_cfi01.c @@ -166,6 +166,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) ret = 0; @@ -283,6 +299,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;