From patchwork Fri Jun 27 14:24:53 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 32621 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f198.google.com (mail-ob0-f198.google.com [209.85.214.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id D7167201EF for ; Fri, 27 Jun 2014 14:26:29 +0000 (UTC) Received: by mail-ob0-f198.google.com with SMTP id uy5sf28503583obc.5 for ; Fri, 27 Jun 2014 07:26:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:date :message-id:in-reply-to:references:cc:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=pOfKPS2X3q3KsbrNsXLj+3ixBtXwaPUl58ueiiHoJ0U=; b=c+uKiwvcaW0SE/JSBT9pr89zgS2/6ZgIf4bIZaaScv6K6q7nk/573UX9pTb9jaSbz1 kL1F/N6Wfmxy0e1H/2mLuUAXqApYBuF0Q6NvP94Qhlh9tdk7glY1l2tUcvDyC6AOKTdG 4axArSF5FqTH5Zi3JTK/bb+P9/znk6nRVHFyfdLfg1dV0JXJYuh7ATZE+mUyovvRqbNp ngYHfsSZ69Ehnog/mHhsKkbmUspbvuLAft7FWHAoyAvJt4vXA78vAUq/l4EgReV51zBD +ONOONHEWuZx/Q0IK3KwViZC/S1ASFLjVs2stXEHShbwoJ9unOSdfGfdd8mRG24i4+2a d7GQ== X-Gm-Message-State: ALoCoQn36PqGVtmXPPo7xVlS8WqOuYDL+OJo6auvPl+oEx1qjEjiZaXwbJyfp3ffmoi/cPcLTGaJ X-Received: by 10.182.24.69 with SMTP id s5mr11299741obf.30.1403879189460; Fri, 27 Jun 2014 07:26:29 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.86.114 with SMTP id o105ls702313qgd.30.gmail; Fri, 27 Jun 2014 07:26:29 -0700 (PDT) X-Received: by 10.221.9.72 with SMTP id ov8mr20231320vcb.27.1403879189378; Fri, 27 Jun 2014 07:26:29 -0700 (PDT) Received: from mail-ve0-f180.google.com (mail-ve0-f180.google.com [209.85.128.180]) by mx.google.com with ESMTPS id ds1si6475811vec.32.2014.06.27.07.26.29 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 27 Jun 2014 07:26:29 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.180 as permitted sender) client-ip=209.85.128.180; Received: by mail-ve0-f180.google.com with SMTP id jw12so5348093veb.39 for ; Fri, 27 Jun 2014 07:26:29 -0700 (PDT) X-Received: by 10.220.95.2 with SMTP id b2mr1033335vcn.61.1403879189293; Fri, 27 Jun 2014 07:26:29 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp111293vcb; Fri, 27 Jun 2014 07:26:28 -0700 (PDT) X-Received: by 10.224.29.201 with SMTP id r9mr33547138qac.25.1403879188745; Fri, 27 Jun 2014 07:26:28 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id 79si14108060qgc.45.2014.06.27.07.26.28 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 27 Jun 2014 07:26:28 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:50691 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X0X6i-0006Dn-BB for patch@linaro.org; Fri, 27 Jun 2014 10:26:28 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60378) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X0X5T-00052X-Ps for qemu-devel@nongnu.org; Fri, 27 Jun 2014 10:25:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X0X5N-0003Dh-TZ for qemu-devel@nongnu.org; Fri, 27 Jun 2014 10:25:11 -0400 Received: from mx1.redhat.com ([209.132.183.28]:14162) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X0X5N-0003CK-LF for qemu-devel@nongnu.org; Fri, 27 Jun 2014 10:25:05 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s5REP3P6015252 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 27 Jun 2014 10:25:03 -0400 Received: from localhost (dhcp-64-106.muc.redhat.com [10.32.64.106]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s5REP2b6003811; Fri, 27 Jun 2014 10:25:03 -0400 From: Stefan Hajnoczi To: Date: Fri, 27 Jun 2014 16:24:53 +0200 Message-Id: <1403879093-786-5-git-send-email-stefanha@redhat.com> In-Reply-To: <1403879093-786-1-git-send-email-stefanha@redhat.com> References: <1403879093-786-1-git-send-email-stefanha@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Peter Maydell , Stefan Hajnoczi Subject: [Qemu-devel] [PULL 4/4] hw/net/eepro100: Implement read-only bits in MDI registers X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: patch@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.180 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 From: Peter Maydell Although we defined an eepro100_mdi_mask[] array indicating which bits in the registers are read-only, we weren't actually doing anything with it. Make the MDI register-write code use it rather than manually making register 1 read-only and leaving the rest as reads-as-written. (The special-case handling of register 0 remains as before since its mask is all-zeros and the special casing happens before we apply the masking.) Signed-off-by: Peter Maydell Message-id: 1402159924-13853-1-git-send-email-peter.maydell@linaro.org Signed-off-by: Stefan Hajnoczi --- hw/net/eepro100.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/net/eepro100.c b/hw/net/eepro100.c index aaa3ff2..3263e3f 100644 --- a/hw/net/eepro100.c +++ b/hw/net/eepro100.c @@ -1217,7 +1217,6 @@ static void eepro100_write_mdi(EEPRO100State *s) break; case 1: /* Status Register */ missing("not writable"); - data = s->mdimem[reg]; break; case 2: /* PHY Identification Register (Word 1) */ case 3: /* PHY Identification Register (Word 2) */ @@ -1230,7 +1229,8 @@ static void eepro100_write_mdi(EEPRO100State *s) default: missing("not implemented"); } - s->mdimem[reg] = data; + s->mdimem[reg] &= eepro100_mdi_mask[reg]; + s->mdimem[reg] |= data & ~eepro100_mdi_mask[reg]; } else if (opcode == 2) { /* MDI read */ switch (reg) {