From patchwork Thu Jul 26 02:18:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oliver O'Halloran X-Patchwork-Id: 949423 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41bbQH098Kz9ryl for ; Thu, 26 Jul 2018 12:19:35 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="iyaxTzTY"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 41bbQG5bxKzF0PZ for ; Thu, 26 Jul 2018 12:19:34 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="iyaxTzTY"; dkim-atps=neutral X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:400e:c01::241; helo=mail-pl0-x241.google.com; envelope-from=oohall@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="iyaxTzTY"; dkim-atps=neutral Received: from mail-pl0-x241.google.com (mail-pl0-x241.google.com [IPv6:2607:f8b0:400e:c01::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 41bbPW2grHzDqnG for ; Thu, 26 Jul 2018 12:18:55 +1000 (AEST) Received: by mail-pl0-x241.google.com with SMTP id w3-v6so90747plq.2 for ; Wed, 25 Jul 2018 19:18:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=XwrWp/wseOETgVrYivv5Pdp85QRX+b1yc4b2R+Nekqc=; b=iyaxTzTYcZLWkPtyNQ2ivVY5rinL47G+sQiaa+HIZyMWNy14HPJAfnTYfr7d4B0ZaV 7c8VEsd4U2tel40Zgd0G7ZAsQR/nASu4F+dziDVJV0bOi1doxWSy8LhRqB9B+zl6ldlx ormS50deQe8kAgdQdolhMFzaPJZJZaqudWHGd7uYLYXGaYtlU/bnI9TLL/ChM2FwAH9B M9bQG0nJm4u7AukzzENRjuGJ5Ja/dwDgiFIVvGSLHBelcl5PZmBV2bzuHMzAI7XprDWK M8kvfk/p9X4LxGBmVNjp5uSQcc0Hg3g3Xh/F/jbymJzy5fOKDe0+uqYwmaeMwrQ+QOW0 AARg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=XwrWp/wseOETgVrYivv5Pdp85QRX+b1yc4b2R+Nekqc=; b=QKwnPHG6XO4YMGyffh8u864Ivw7D0Wrb08FVGiKNbskpPfxeIFzgRKXscoZjvin+AH Z7CGK3lXSZyPCjL47QGFVaaX1oFPqdtDh18A7XHZNhbmuMzYTfDQD64DwGzT0BLEoLpl a7khzDx7Vmcsal0PMBxO+Rsmai6Zujgdp7JHNNSNaEU7d/IV2P0U1X/hRN/qgZKLHJk7 cZgfoeTtaqFJtr0WuV4Kek1Z7a0SIk4fzOUws5sUlue2rXz+CZP/eBIPYzlLTg9NcDRY QOupPgHfmlZDdkUz0EHNnNFT/wsIBJ8Gg5qYokArXKuOJY7VORCbTaOIGN0dtlKrc8x+ wqDQ== X-Gm-Message-State: AOUpUlG32QrMpunuklkP4nKDjkRG+pq0NKz5yqWWdJKAO4izQfU1lcf2 n0VbC+S3RKfcVo4ljvXCcPtrTjtG X-Google-Smtp-Source: AAOMgpdnJaxM23R+42RB76eTRAqiDqkV/NjHSC/5V+iziQcdxRpQNlZR3Cbreiv/jr8uPtcd8OvlJA== X-Received: by 2002:a17:902:900b:: with SMTP id a11-v6mr45310plp.143.1532571532932; Wed, 25 Jul 2018 19:18:52 -0700 (PDT) Received: from flat-canetoad.ozlabs.ibm.com ([122.99.82.10]) by smtp.gmail.com with ESMTPSA id l85-v6sm110914pfk.34.2018.07.25.19.18.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Jul 2018 19:18:52 -0700 (PDT) From: Oliver O'Halloran To: skiboot@lists.ozlabs.org Date: Thu, 26 Jul 2018 12:18:38 +1000 Message-Id: <20180726021838.20999-3-oohall@gmail.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20180726021838.20999-1-oohall@gmail.com> References: <20180726021838.20999-1-oohall@gmail.com> Subject: [Skiboot] [PATCH 3/3] hw/phb4: Add helpers to dump the IODA tables X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" The IODA tables are stored inside the PHB itself rather than in memory. This makes accessing them slightly tedious, but the process is more or less the same for every table. This patch adds a helper function for dumping the contents of the IODA tables to help with debugging PHB issues. Signed-off-by: Oliver O'Halloran --- hw/phb4.c | 89 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) diff --git a/hw/phb4.c b/hw/phb4.c index 965f3b5af8af..72c9b529dccc 100644 --- a/hw/phb4.c +++ b/hw/phb4.c @@ -1982,6 +1982,95 @@ static void __unused phb4_dump_peltv(struct phb4 *p) } } +static void __unused phb4_dump_ioda_table(struct phb4 *p, int table) +{ + const char *name; + int entries, i; + + switch (table) { + case IODA3_TBL_LIST: + name = "LIST"; + entries = 8; + break; + case IODA3_TBL_MIST: + name = "MIST"; + entries = 1024; + break; + case IODA3_TBL_RCAM: + name = "RCAM"; + entries = 128; + break; + case IODA3_TBL_MRT: + name = "MRT"; + entries = 16; + break; + case IODA3_TBL_PESTA: + name = "PESTA"; + entries = 512; + break; + case IODA3_TBL_PESTB: + name = "PESTB"; + entries = 512; + break; + case IODA3_TBL_TVT: + name = "TVT"; + entries = 512; + break; + case IODA3_TBL_TCAM: + name = "TCAM"; + entries = 1024; + break; + case IODA3_TBL_TDR: + name = "TDR"; + entries = 1024; + break; + case IODA3_TBL_MBT: /* special case, see below */ + name = "MBT"; + entries = 64; + break; + case IODA3_TBL_MDT: + name = "MDT"; + entries = 512; + break; + case IODA3_TBL_PEEV: + name = "PEEV"; + entries = 8; + break; + default: + PHBERR(p, "Invalid IODA table %d!\n", table); + return; + } + + PHBERR(p, "Start %s dump (only non-zero entries are printed):\n", name); + + phb4_ioda_sel(p, table, 0, true); + + /* + * Each entry in the MBT is 16 bytes. Every other table has 8 byte + * entries so we special case the MDT to keep the output readable. + */ + if (table == IODA3_TBL_MBT) { + for (i = 0; i < 32; i++) { + uint64_t v1 = phb4_read_reg_asb(p, PHB_IODA_DATA0); + uint64_t v2 = phb4_read_reg_asb(p, PHB_IODA_DATA0); + + if (!v1 && !v2) + continue; + PHBERR(p, "MBT[%03x] = %016llx %016llx\n", i, v1, v2); + } + } else { + for (i = 0; i < entries; i++) { + uint64_t v = phb4_read_reg_asb(p, PHB_IODA_DATA0); + + if (!v) + continue; + PHBERR(p, "%s[%03x] = %016llx\n", name, i, v); + } + } + + PHBERR(p, "End %s dump\n", name); +} + static void phb4_eeh_dump_regs(struct phb4 *p) { struct OpalIoPhb4ErrorData *s;