From patchwork Tue Aug 1 13:00:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oliver O'Halloran X-Patchwork-Id: 796223 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xMGhn6FKRz9sR8 for ; Tue, 1 Aug 2017 23:03:21 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="e9RTV5N2"; 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 3xMGhn4pqFzDsWM for ; Tue, 1 Aug 2017 23:03:21 +1000 (AEST) 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="e9RTV5N2"; dkim-atps=neutral X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Received: from mail-pf0-x242.google.com (mail-pf0-x242.google.com [IPv6:2607:f8b0:400e:c00::242]) (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 3xMGdv1mbCzDrM6 for ; Tue, 1 Aug 2017 23:00:50 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="e9RTV5N2"; dkim-atps=neutral Received: by mail-pf0-x242.google.com with SMTP id c65so2231558pfl.0 for ; Tue, 01 Aug 2017 06:00:49 -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=41fLq6FsizML0tKRfic6qiDQSQ2aWySHGtSvvt6V9GQ=; b=e9RTV5N214z0sS05HrEr1nGVYzvZgRTDMD7eQ94ccSqXSPSSTRJ1lWY82OO8/R07xT E0hCMZNI5DvQESSYYlUQfT9+lAhrPKhgYZCopQdz+K00BIuoXAaK2OKT60TE+EOgopHo zIng/ekH4B68G/rhWcPWVIJ0DR/K+YwtHODZnZTlfznyyiZ5bArbb/7VAeq/MFW3Hb6x cY8aydO/ijLrDhcQWZC4JZq7LxoGNsKKCFC6bdhMDHk0DJ34qWhy1mH49yc9JJKeq8dt c/M3Z/WkZeU1I/FOfVgrbyQrnsDnck9cqo8Oxzfm6xjh0vf4R+47HTbN8myZLUecKSmI 1orQ== 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=41fLq6FsizML0tKRfic6qiDQSQ2aWySHGtSvvt6V9GQ=; b=Y7d7ONJONkV28ggnwrto274wB+yZ6G1YxqOYGpoPGOEIqGDx5BU87PNQvJDQkMErXN 6CR/nZR5QD7WGgXva+vcSla/HGiM5eUXtSH8aTOzuw7VvZpfGLEWgyvb7MbvDv3NzaI6 /ZY26zhhzPvi33LYWZiHEYy/wsDc2ZRSkBJe0yP4ue3FdON+0IHFQlV9cMp3OjwFpwQN a3gZa8JOUrDgjQ+//AMCExto0/hiXjItE1TowqT65zWRdVLFFMkI0npLzIFxY55pRun0 GDUOkg2yg1GCjTKcFrWoSa+P+EgG94gbzNp+PwQz/6IdzTSSVZrkUumJXZbVC67kOPhU 8fjg== X-Gm-Message-State: AIVw113Tk885ABdW/EUiv4+XGWCobGAKtvYiLWfPLS0XBolN44ecNqj0 Cq4Rc711fTDbYFVM X-Received: by 10.84.232.78 with SMTP id f14mr20363275pln.87.1501592447904; Tue, 01 Aug 2017 06:00:47 -0700 (PDT) Received: from flat-canetoad.ozlabs.ibm.com ([122.99.82.10]) by smtp.gmail.com with ESMTPSA id g22sm3235806pgn.65.2017.08.01.06.00.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 01 Aug 2017 06:00:47 -0700 (PDT) From: Oliver O'Halloran To: skiboot@lists.ozlabs.org Date: Tue, 1 Aug 2017 23:00:06 +1000 Message-Id: <20170801130007.8990-12-oohall@gmail.com> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170801130007.8990-1-oohall@gmail.com> References: <20170801130007.8990-1-oohall@gmail.com> Subject: [Skiboot] [RFC 11/12] astbmc/slots: Add ST_PHB_ENTRY helper X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.23 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 PHB slot tables are very verbose and mostly the same. Add a macro to with the three actual paramaters (chip id, phb and slots) to highlight the actual differences and remove the boilerplate. --- platforms/astbmc/astbmc.h | 10 ++++++ platforms/astbmc/barreleye.c | 38 +++++---------------- platforms/astbmc/firestone.c | 32 ++++-------------- platforms/astbmc/garrison.c | 50 ++++++--------------------- platforms/astbmc/habanero.c | 19 +++-------- platforms/astbmc/p8dnu.c | 50 ++++++--------------------- platforms/astbmc/p8dtu.c | 76 +++++++++--------------------------------- platforms/astbmc/palmetto.c | 19 +++-------- platforms/astbmc/witherspoon.c | 56 ++++++------------------------- 9 files changed, 80 insertions(+), 270 deletions(-) diff --git a/platforms/astbmc/astbmc.h b/platforms/astbmc/astbmc.h index e094e2506d76..c1236ae22bf0 100644 --- a/platforms/astbmc/astbmc.h +++ b/platforms/astbmc/astbmc.h @@ -37,6 +37,16 @@ #define ST_LOC_NPU_TARGET(chip_id, group_id) \ (ST_LOC_NVLINK_VALID | ((chip_id) << 16) | (group_id)) +/* + * Helper to reduce the noise in the PHB table + */ +#define ST_PHB_ENTRY(chip_id, phb_id, child_table) \ +{ \ + .etype = st_phb, \ + .location = ST_LOC_PHB(chip_id, phb_id), \ + .children = child_table \ +} + struct slot_table_entry { enum slot_table_etype { st_end, /* End of list */ diff --git a/platforms/astbmc/barreleye.c b/platforms/astbmc/barreleye.c index f8c77e3b00d3..9c116a977867 100644 --- a/platforms/astbmc/barreleye.c +++ b/platforms/astbmc/barreleye.c @@ -112,36 +112,14 @@ static const struct slot_table_entry barreleye_phb8_2_slot[] = { }; static const struct slot_table_entry barreleye_phb_table[] = { - { - .etype = st_phb, - .location = ST_LOC_PHB(0,0), - .children = barreleye_phb0_0_slot, - }, - { - .etype = st_phb, - .location = ST_LOC_PHB(0,1), - .children = barreleye_phb0_1_slot, - }, - { - .etype = st_phb, - .location = ST_LOC_PHB(0,2), - .children = barreleye_phb0_2_slot, - }, - { - .etype = st_phb, - .location = ST_LOC_PHB(8,0), - .children = barreleye_phb8_0_slot, - }, - { - .etype = st_phb, - .location = ST_LOC_PHB(8,1), - .children = barreleye_phb8_1_slot, - }, - { - .etype = st_phb, - .location = ST_LOC_PHB(8,2), - .children = barreleye_phb8_2_slot, - }, + ST_PHB_ENTRY(0, 0, barreleye_phb0_0_slot), + ST_PHB_ENTRY(0, 1, barreleye_phb0_1_slot), + ST_PHB_ENTRY(0, 2, barreleye_phb0_2_slot), + + ST_PHB_ENTRY(8, 0, barreleye_phb8_0_slot), + ST_PHB_ENTRY(8, 1, barreleye_phb8_1_slot), + ST_PHB_ENTRY(8, 2, barreleye_phb8_2_slot), + { .etype = st_end }, }; diff --git a/platforms/astbmc/firestone.c b/platforms/astbmc/firestone.c index 7434a4802fc5..401a9d07a26c 100644 --- a/platforms/astbmc/firestone.c +++ b/platforms/astbmc/firestone.c @@ -103,31 +103,13 @@ static const struct slot_table_entry firestone_phb8_2_slot[] = { }; static const struct slot_table_entry firestone_phb_table[] = { - { - .etype = st_phb, - .location = ST_LOC_PHB(0,0), - .children = firestone_phb0_0_slot, - }, - { - .etype = st_phb, - .location = ST_LOC_PHB(0,1), - .children = firestone_phb0_1_slot, - }, - { - .etype = st_phb, - .location = ST_LOC_PHB(8,0), - .children = firestone_phb8_0_slot, - }, - { - .etype = st_phb, - .location = ST_LOC_PHB(8,1), - .children = firestone_phb8_1_slot, - }, - { - .etype = st_phb, - .location = ST_LOC_PHB(8,2), - .children = firestone_phb8_2_slot, - }, + ST_PHB_ENTRY(0, 0, firestone_phb0_0_slot), + ST_PHB_ENTRY(0, 1, firestone_phb0_1_slot), + + ST_PHB_ENTRY(8, 0, firestone_phb8_0_slot), + ST_PHB_ENTRY(8, 1, firestone_phb8_1_slot), + ST_PHB_ENTRY(8, 2, firestone_phb8_2_slot), + { .etype = st_end }, }; diff --git a/platforms/astbmc/garrison.c b/platforms/astbmc/garrison.c index a467672ea7a0..3f2725e2515b 100644 --- a/platforms/astbmc/garrison.c +++ b/platforms/astbmc/garrison.c @@ -131,46 +131,16 @@ static const struct slot_table_entry garrison_phb1_3_slot[] = { }; static const struct slot_table_entry garrison_phb_table[] = { - { - .etype = st_phb, - .location = ST_LOC_PHB(0,0), - .children = garrison_phb0_0_slot, - }, - { - .etype = st_phb, - .location = ST_LOC_PHB(0,1), - .children = garrison_phb0_1_slot, - }, - { - .etype = st_phb, - .location = ST_LOC_PHB(0,2), - .children = garrison_phb0_2_slot, - }, - { - .etype = st_phb, - .location = ST_LOC_PHB(0,3), - .children = garrison_phb0_3_slot, - }, - { - .etype = st_phb, - .location = ST_LOC_PHB(1,0), - .children = garrison_phb1_0_slot, - }, - { - .etype = st_phb, - .location = ST_LOC_PHB(1,1), - .children = garrison_phb1_1_slot, - }, - { - .etype = st_phb, - .location = ST_LOC_PHB(1,2), - .children = garrison_phb1_2_slot, - }, - { - .etype = st_phb, - .location = ST_LOC_PHB(1,3), - .children = garrison_phb1_3_slot, - }, + ST_PHB_ENTRY(0, 0, garrison_phb0_0_slot), + ST_PHB_ENTRY(0, 1, garrison_phb0_1_slot), + ST_PHB_ENTRY(0, 2, garrison_phb0_2_slot), + ST_PHB_ENTRY(0, 3, garrison_phb0_3_slot), + + ST_PHB_ENTRY(1, 0, garrison_phb1_0_slot), + ST_PHB_ENTRY(1, 1, garrison_phb1_1_slot), + ST_PHB_ENTRY(1, 2, garrison_phb1_2_slot), + ST_PHB_ENTRY(1, 3, garrison_phb1_3_slot), + { .etype = st_end }, }; diff --git a/platforms/astbmc/habanero.c b/platforms/astbmc/habanero.c index 2ff1a7eeee79..545a5372209a 100644 --- a/platforms/astbmc/habanero.c +++ b/platforms/astbmc/habanero.c @@ -95,21 +95,10 @@ static const struct slot_table_entry habanero_phb2_slot[] = { }; static const struct slot_table_entry habanero_phb_table[] = { - { - .etype = st_phb, - .location = ST_LOC_PHB(0,0), - .children = habanero_phb0_slot, - }, - { - .etype = st_phb, - .location = ST_LOC_PHB(0,1), - .children = habanero_phb1_slot, - }, - { - .etype = st_phb, - .location = ST_LOC_PHB(0,2), - .children = habanero_phb2_slot, - }, + ST_PHB_ENTRY(0, 0, habanero_phb0_slot), + ST_PHB_ENTRY(0, 1, habanero_phb1_slot), + ST_PHB_ENTRY(0, 2, habanero_phb2_slot), + { .etype = st_end }, }; diff --git a/platforms/astbmc/p8dnu.c b/platforms/astbmc/p8dnu.c index 5502af86bdaf..b25ebc73601d 100644 --- a/platforms/astbmc/p8dnu.c +++ b/platforms/astbmc/p8dnu.c @@ -173,46 +173,16 @@ static const struct slot_table_entry p8dnu_phb1_3_slot[] = { }; static const struct slot_table_entry p8dnu_phb_table[] = { - { - .etype = st_phb, - .location = ST_LOC_PHB(0,0), - .children = p8dnu_phb0_0_slot, - }, - { - .etype = st_phb, - .location = ST_LOC_PHB(0,1), - .children = p8dnu_phb0_1_slot, - }, - { - .etype = st_phb, - .location = ST_LOC_PHB(0,2), - .children = p8dnu_phb0_2_slot, - }, - { - .etype = st_phb, - .location = ST_LOC_PHB(0,3), - .children = p8dnu_phb0_3_slot, - }, - { - .etype = st_phb, - .location = ST_LOC_PHB(1,0), - .children = p8dnu_phb1_0_slot, - }, - { - .etype = st_phb, - .location = ST_LOC_PHB(1,1), - .children = p8dnu_phb1_1_slot, - }, - { - .etype = st_phb, - .location = ST_LOC_PHB(1,2), - .children = p8dnu_phb1_2_slot, - }, - { - .etype = st_phb, - .location = ST_LOC_PHB(1,3), - .children = p8dnu_phb1_3_slot, - }, + ST_PHB_ENTRY(0, 0, p8dnu_phb0_0_slot), + ST_PHB_ENTRY(0, 1, p8dnu_phb0_1_slot), + ST_PHB_ENTRY(0, 2, p8dnu_phb0_2_slot), + ST_PHB_ENTRY(0, 3, p8dnu_phb0_3_slot), + + ST_PHB_ENTRY(1, 0, p8dnu_phb1_0_slot), + ST_PHB_ENTRY(1, 1, p8dnu_phb1_1_slot), + ST_PHB_ENTRY(1, 2, p8dnu_phb1_2_slot), + ST_PHB_ENTRY(1, 3, p8dnu_phb1_3_slot), + { .etype = st_end }, }; diff --git a/platforms/astbmc/p8dtu.c b/platforms/astbmc/p8dtu.c index 7c3b41b71680..f607b8ee687d 100644 --- a/platforms/astbmc/p8dtu.c +++ b/platforms/astbmc/p8dtu.c @@ -136,70 +136,26 @@ static const struct slot_table_entry p8dtu1u_phb8_2_slot[] = { }; static const struct slot_table_entry p8dtu2u_phb_table[] = { - { - .etype = st_phb, - .location = ST_LOC_PHB(0,0), - .children = p8dtu_phb0_0_slot, - }, - { - .etype = st_phb, - .location = ST_LOC_PHB(0,1), - .children = p8dtu_phb0_1_slot, - }, - { - .etype = st_phb, - .location = ST_LOC_PHB(0,2), - .children = p8dtu_phb0_2_slot, - }, - { - .etype = st_phb, - .location = ST_LOC_PHB(8,0), - .children = p8dtu_phb8_0_slot, - }, - { - .etype = st_phb, - .location = ST_LOC_PHB(8,1), - .children = p8dtu2u_phb8_1_slot, - }, - { - .etype = st_phb, - .location = ST_LOC_PHB(8,2), - .children = p8dtu2u_phb8_2_slot, - }, + ST_PHB_ENTRY(0, 0, p8dtu_phb0_0_slot), + ST_PHB_ENTRY(0, 1, p8dtu_phb0_1_slot), + ST_PHB_ENTRY(0, 2, p8dtu_phb0_2_slot), + + ST_PHB_ENTRY(8, 0, p8dtu_phb8_0_slot), + ST_PHB_ENTRY(8, 1, p8dtu2u_phb8_1_slot), + ST_PHB_ENTRY(8, 2, p8dtu2u_phb8_2_slot), + { .etype = st_end }, }; static const struct slot_table_entry p8dtu1u_phb_table[] = { - { - .etype = st_phb, - .location = ST_LOC_PHB(0,0), - .children = p8dtu_phb0_0_slot, - }, - { - .etype = st_phb, - .location = ST_LOC_PHB(0,1), - .children = p8dtu_phb0_1_slot, - }, - { - .etype = st_phb, - .location = ST_LOC_PHB(0,2), - .children = p8dtu_phb0_2_slot, - }, - { - .etype = st_phb, - .location = ST_LOC_PHB(8,0), - .children = p8dtu_phb8_0_slot, - }, - { - .etype = st_phb, - .location = ST_LOC_PHB(8,1), - .children = p8dtu1u_phb8_1_slot, - }, - { - .etype = st_phb, - .location = ST_LOC_PHB(8,2), - .children = p8dtu1u_phb8_2_slot, - }, + ST_PHB_ENTRY(0, 0, p8dtu_phb0_0_slot), + ST_PHB_ENTRY(0, 1, p8dtu_phb0_1_slot), + ST_PHB_ENTRY(0, 2, p8dtu_phb0_2_slot), + + ST_PHB_ENTRY(8, 0, p8dtu_phb8_0_slot), + ST_PHB_ENTRY(8, 1, p8dtu1u_phb8_1_slot), + ST_PHB_ENTRY(8, 2, p8dtu1u_phb8_2_slot), + { .etype = st_end }, }; diff --git a/platforms/astbmc/palmetto.c b/platforms/astbmc/palmetto.c index fb115dc31f29..0521ac105f4f 100644 --- a/platforms/astbmc/palmetto.c +++ b/platforms/astbmc/palmetto.c @@ -85,21 +85,10 @@ static const struct slot_table_entry palmetto_phb0_2_slot[] = { }; static const struct slot_table_entry palmetto_phb_table[] = { - { - .etype = st_phb, - .location = ST_LOC_PHB(0,0), - .children = palmetto_phb0_0_slot, - }, - { - .etype = st_phb, - .location = ST_LOC_PHB(0,1), - .children = palmetto_phb0_1_slot, - }, - { - .etype = st_phb, - .location = ST_LOC_PHB(0,2), - .children = palmetto_phb0_2_slot, - }, + ST_PHB_ENTRY(0, 0, palmetto_phb0_0_slot), + ST_PHB_ENTRY(0, 1, palmetto_phb0_1_slot), + ST_PHB_ENTRY(0, 2, palmetto_phb0_2_slot), + { .etype = st_end }, }; diff --git a/platforms/astbmc/witherspoon.c b/platforms/astbmc/witherspoon.c index f05eaede51b9..bba2350ccfaa 100644 --- a/platforms/astbmc/witherspoon.c +++ b/platforms/astbmc/witherspoon.c @@ -201,51 +201,17 @@ static const struct slot_table_entry witherspoon_net_phb[] = { */ static const struct slot_table_entry witherspoon_phb_table[] = { - { - .etype = st_phb, - .location = ST_LOC_PHB(0,0), - .children = witherspoon_slot4, /* XXX: Might be slot 3 */ - }, - { - .etype = st_phb, - .location = ST_LOC_PHB(0,2), - .children = witherspoon_bmc_phb, /* BMC */ - }, - { - .etype = st_phb, - .location = ST_LOC_PHB(0,3), - .children = witherspoon_slot2_shared, /* shared */ - }, - { - .etype = st_phb, - .location = ST_LOC_PHB(0,4), - .children = witherspoon_plx0_phb, /* chip 1 PLX connection */ - }, - { - .etype = st_phb, - .location = ST_LOC_PHB(0,5), - .children = witherspoon_net_phb, /* builtin ethernet */ - }, - { - .etype = st_phb, - .location = ST_LOC_PHB(8,0), - .children = witherspoon_slot3, /* XXX: might be slot 4 */ - }, - { - .etype = st_phb, - .location = ST_LOC_PHB(8,3), - .children = witherspoon_slot2_shared, /* shared slot */ - }, - { - .etype = st_phb, - .location = ST_LOC_PHB(8,4), - .children = witherspoon_slot1, - }, - { - .etype = st_phb, - .location = ST_LOC_PHB(8,5), - .children = witherspoon_plx1_phb, /* Chip 2 PLX up */ - }, + ST_PHB_ENTRY(0, 0, witherspoon_slot4), /* XXX: might be slot3 */ + ST_PHB_ENTRY(0, 2, witherspoon_bmc_phb), /* BMC */ + ST_PHB_ENTRY(0, 3, witherspoon_slot2_shared), /* shared */ + ST_PHB_ENTRY(0, 4, witherspoon_plx0_phb), + ST_PHB_ENTRY(0, 5, witherspoon_net_phb), + + ST_PHB_ENTRY(8, 0, witherspoon_slot3), /* XXX: might be swapped with 4 */ + ST_PHB_ENTRY(8, 3, witherspoon_slot2_shared), + ST_PHB_ENTRY(8, 4, witherspoon_slot1), + ST_PHB_ENTRY(8, 5, witherspoon_plx1_phb), + { .etype = st_end }, };