From patchwork Fri Apr 30 22:19:22 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Walle X-Patchwork-Id: 51409 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 EC70DB7D24 for ; Sat, 1 May 2010 08:20:11 +1000 (EST) Received: from localhost ([127.0.0.1]:54364 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O7yZ6-0005hv-JT for incoming@patchwork.ozlabs.org; Fri, 30 Apr 2010 18:20:08 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O7yYU-0005fc-K0 for qemu-devel@nongnu.org; Fri, 30 Apr 2010 18:19:30 -0400 Received: from [140.186.70.92] (port=51861 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O7yYT-0005dj-A4 for qemu-devel@nongnu.org; Fri, 30 Apr 2010 18:19:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O7yYS-00065e-0i for qemu-devel@nongnu.org; Fri, 30 Apr 2010 18:19:29 -0400 Received: from mail.serverraum.org ([78.47.150.89]:58415) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O7yYR-000658-Pv for qemu-devel@nongnu.org; Fri, 30 Apr 2010 18:19:27 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.serverraum.org (Postfix) with ESMTP id D01D93EE9D for ; Sat, 1 May 2010 00:19:23 +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 ZVldoCXqTpGr for ; Sat, 1 May 2010 00:19:23 +0200 (CEST) Received: from thanatos.local (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 540393EE9C for ; Sat, 1 May 2010 00:19:23 +0200 (CEST) From: Michael Walle To: qemu-devel@nongnu.org Date: Sat, 1 May 2010 00:19:22 +0200 MIME-Version: 1.0 Content-Disposition: inline Message-Id: <201005010019.22643.michael@walle.cc> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) 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. --- 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)