From nobody Tue Feb 10 13:18:10 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.221.51 as permitted sender) client-ip=209.85.221.51; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-f51.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.51 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1626037296; cv=none; d=zohomail.com; s=zohoarc; b=A9BN5NFHKQQd3+4VlEQIRRnysXoBUY0iQsab98bopQkJFPbPpTeDLHB8jC6HKGjpKnWVeKdWzGlf0789KJNvYKAA0gkKQp5crGxbNZmCoBZZu2ln7Tv7h+VGeruK565NQSBQS+osKyXV/agJEldJNESOdHwuckFiH5ep2wtB3+4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1626037296; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=xzjbO+5jo6pD19SRnGaYYtwqZATAxg4quF6D0X5U33M=; b=J5oUIYMnScv/wXlweXyr60OFGirEPKbpioDik7T3K2+3zZglMoDqpYEe2N1lGLEZFIdMAiZelR66uYRxuUb9NzLPGh2Ci0FWVPmbCdEfMuvsyAn6jxh7ejZfP+QWQZ3aeXDcdxkHMRygEf/g9mNwpu2ScM4ftiEm+y04Em8pSlg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.51 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.51]) by mx.zohomail.com with SMTPS id 1626037296985474.67245766887856; Sun, 11 Jul 2021 14:01:36 -0700 (PDT) Received: by mail-wr1-f51.google.com with SMTP id v5so22077559wrt.3 for ; Sun, 11 Jul 2021 14:01:36 -0700 (PDT) Return-Path: Return-Path: Received: from localhost.localdomain (abayonne-654-1-142-116.w86-222.abo.wanadoo.fr. [86.222.93.116]) by smtp.gmail.com with ESMTPSA id e6sm3005736wrg.18.2021.07.11.14.01.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Jul 2021 14:01:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xzjbO+5jo6pD19SRnGaYYtwqZATAxg4quF6D0X5U33M=; b=d0xq0X5mbyLIPvVJ9GNNp4IYay2e/oEyqacBTO2skJgXXQSSASbcA+1PTSf6AmS65Z 49lDtZEkUP4t4lc7Z4X0mrkO+qJRctiEOyX6/8j09pcZHnX3wTGLMIDoChexAMe0KYJB AENQYoD2Uk3/ruBdJ224vcSIZcYHvAvKO/yytTZ71I6C4wK3qOALybDeE+P9cSu9vnwa IJp4VNnK8tMQfnfqcSXCIOt1aTrymYf0jAZowaoG99vU9eVVFYfGaM6VRWRNiT5oXed6 fzSd1NxzCosfJyz3shH3CO7GjmSZS8UkuOZPqm2QYkr5u1QhvEe+NGe6zjQZFUPYgGFm G3Uw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=xzjbO+5jo6pD19SRnGaYYtwqZATAxg4quF6D0X5U33M=; b=KZSdnCvbV/H2p+pO9OtSXnpReCNBmQ6rN9su4BaCVdR1l08HW5p0uXQ8vKozVjtAyn CnMsfG51+NwzLUb4qXkFTmSIMIHxBC4KT6yAQpC3LmB+F8EGCRNngtxxMDYm83FZoJrV iQD2XHpOE4STL+GxqtV0JStKdo6KLJwY2ynF/QSXHvnlt48k3fU0VwKo2zOIMZJcbVA1 5AyWFbsdjBTbsDeduXtLzM0Ohv7IA1cruJAj65tX77A/EwDiSCLueJe5cOUGPJMg1UZy VgdLlMyHNpGEVCWtbCXhLawj0dYc09bQZY9SFXFtHWOXjoepJc6tXdUWXn0hnEXQChtU P9LQ== X-Gm-Message-State: AOAM532rA4Y9fJmRafQYdh4mJzkjrBKkNwn2B037f1K+y5q8KIq9Mn71 tYMbFs5NdA6muclWUKX9fcU= X-Google-Smtp-Source: ABdhPJwuDFuldvyM9w7IG2oBR82gCO+guYI48yH0WyvQP8t32AwWBv8M+9WlnCDe/3hH38jnWtB6og== X-Received: by 2002:a05:6000:1b02:: with SMTP id f2mr14327729wrz.315.1626037295233; Sun, 11 Jul 2021 14:01:35 -0700 (PDT) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Herv=C3=A9=20Poussineau?= , Fredrik Noring , Mark Cave-Ayland , Finn Thain , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 14/19] dp8393x: fix CAM descriptor entry index Date: Sun, 11 Jul 2021 23:00:11 +0200 Message-Id: <20210711210016.2710100-15-f4bug@amsat.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210711210016.2710100-1-f4bug@amsat.org> References: <20210711210016.2710100-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1626037297884100001 From: Mark Cave-Ayland Currently when a LOAD CAM command is executed the entries are loaded into t= he CAM from memory in order which is incorrect. According to the datasheet the first entry in the CAM descriptor is the entry index which means that each descriptor may update any single entry in the CAM rather than the Nth entry. Decode the CAM entry index and use it store the descriptor in the appropria= te slot in the CAM. This fixes the issue where the MacOS toolbox loads a single CAM descriptor into the final slot in order to perform a loopback test which must succeed before the Ethernet port is enabled. Signed-off-by: Mark Cave-Ayland Tested-by: Finn Thain Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20210625065401.30170-10-mark.cave-ayland@ilande.co.uk> Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/net/dp8393x.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/net/dp8393x.c b/hw/net/dp8393x.c index 252c0a26641..11810c9b600 100644 --- a/hw/net/dp8393x.c +++ b/hw/net/dp8393x.c @@ -270,7 +270,7 @@ static void dp8393x_update_irq(dp8393xState *s) static void dp8393x_do_load_cam(dp8393xState *s) { int width, size; - uint16_t index =3D 0; + uint16_t index; =20 width =3D (s->regs[SONIC_DCR] & SONIC_DCR_DW) ? 2 : 1; size =3D sizeof(uint16_t) * 4 * width; @@ -279,6 +279,7 @@ static void dp8393x_do_load_cam(dp8393xState *s) /* Fill current entry */ address_space_read(&s->as, dp8393x_cdp(s), MEMTXATTRS_UNSPECIFIED, s->data, size); + index =3D dp8393x_get(s, width, 0) & 0xf; s->cam[index][0] =3D dp8393x_get(s, width, 1) & 0xff; s->cam[index][1] =3D dp8393x_get(s, width, 1) >> 8; s->cam[index][2] =3D dp8393x_get(s, width, 2) & 0xff; @@ -291,7 +292,6 @@ static void dp8393x_do_load_cam(dp8393xState *s) /* Move to next entry */ s->regs[SONIC_CDC]--; s->regs[SONIC_CDP] +=3D size; - index++; } =20 /* Read CAM enable */ --=20 2.31.1