From patchwork Tue Nov 10 04:18:23 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stewart Smith X-Patchwork-Id: 542159 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 AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id A1B1C14017E for ; Tue, 10 Nov 2015 15:22:13 +1100 (AEDT) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 8259A1A03F6 for ; Tue, 10 Nov 2015 15:22:13 +1100 (AEDT) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Received: from e17.ny.us.ibm.com (e17.ny.us.ibm.com [129.33.205.207]) (using TLSv1 with cipher CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 0C43B1A0410 for ; Tue, 10 Nov 2015 15:20:38 +1100 (AEDT) Received: from localhost by e17.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 9 Nov 2015 23:20:37 -0500 Received: from d01dlp02.pok.ibm.com (9.56.250.167) by e17.ny.us.ibm.com (146.89.104.204) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 9 Nov 2015 23:20:35 -0500 X-IBM-Helo: d01dlp02.pok.ibm.com X-IBM-MailFrom: stewart@linux.vnet.ibm.com X-IBM-RcptTo: skiboot@lists.ozlabs.org Received: from b01cxnp22033.gho.pok.ibm.com (b01cxnp22033.gho.pok.ibm.com [9.57.198.23]) by d01dlp02.pok.ibm.com (Postfix) with ESMTP id 29E5D6E804C for ; Mon, 9 Nov 2015 23:08:45 -0500 (EST) Received: from d01av01.pok.ibm.com (d01av01.pok.ibm.com [9.56.224.215]) by b01cxnp22033.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id tAA4KYO247644816 for ; Tue, 10 Nov 2015 04:20:34 GMT Received: from d01av01.pok.ibm.com (localhost [127.0.0.1]) by d01av01.pok.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id tAA4KXfe013176 for ; Mon, 9 Nov 2015 23:20:34 -0500 Received: from oc8180480414.ibm.com ([9.81.198.226]) by d01av01.pok.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with SMTP id tAA4KLu7012500; Mon, 9 Nov 2015 23:20:32 -0500 Received: from ka1.ozlabs.ibm.com (localhost [127.0.0.1]) by oc8180480414.ibm.com (Postfix) with ESMTP id 4A7A6576E; Tue, 10 Nov 2015 15:20:14 +1100 (AEDT) From: Stewart Smith To: skiboot@lists.ozlabs.org Date: Tue, 10 Nov 2015 15:18:23 +1100 Message-Id: <1447129110-21600-30-git-send-email-stewart@linux.vnet.ibm.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1447129110-21600-1-git-send-email-stewart@linux.vnet.ibm.com> References: <1447129110-21600-1-git-send-email-stewart@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15111004-0041-0000-0000-000002497481 Subject: [Skiboot] [PATCH 29/36] sparse: fix endian conversion for MDST table X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.20 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" hdata/spira.c:94:25: warning: incorrect type in initializer (different base types) hdata/spira.c:94:25: expected unsigned long long [unsigned] [usertype] addr hdata/spira.c:94:25: got restricted beint64_t [usertype] hdata/spira.c:95:25: warning: incorrect type in initializer (different base types) hdata/spira.c:95:25: expected unsigned int [unsigned] [usertype] type hdata/spira.c:95:25: got restricted beint32_t [usertype] hdata/spira.c:96:25: warning: incorrect type in initializer (different base types) hdata/spira.c:96:25: expected unsigned int [unsigned] [usertype] size hdata/spira.c:96:25: got restricted beint32_t [usertype] hdata/spira.c:99:25: warning: incorrect type in initializer (different base types) hdata/spira.c:99:25: expected unsigned long long [unsigned] [usertype] addr hdata/spira.c:99:25: got restricted beint64_t [usertype] hdata/spira.c:100:25: warning: incorrect type in initializer (different base types) hdata/spira.c:100:25: expected unsigned int [unsigned] [usertype] type hdata/spira.c:100:25: got restricted beint32_t [usertype] hdata/spira.c:101:25: warning: incorrect type in initializer (different base types) hdata/spira.c:101:25: expected unsigned int [unsigned] [usertype] size hdata/spira.c:101:25: got restricted beint32_t [usertype] This also means we use proper conversions in fsp-mdst-table.c This means no actual change for skiboot as it's BE. Signed-off-by: Stewart Smith --- hw/fsp/fsp-mdst-table.c | 23 ++++++++++++----------- include/fsp-mdst-table.h | 6 +++--- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/hw/fsp/fsp-mdst-table.c b/hw/fsp/fsp-mdst-table.c index 9c71cda0208e..e6018aad5bfa 100644 --- a/hw/fsp/fsp-mdst-table.c +++ b/hw/fsp/fsp-mdst-table.c @@ -103,9 +103,9 @@ static int dump_region_tce_map(void) for (i = 0; i < cur_mdst_entry; i++) { - addr = dump_mem_region[i].addr & ~TCE_MASK; - size = get_dump_region_map_size(dump_mem_region[i].addr, - dump_mem_region[i].size); + addr = be64_to_cpu(dump_mem_region[i].addr) & ~TCE_MASK; + size = get_dump_region_map_size(be64_to_cpu(dump_mem_region[i].addr), + be32_to_cpu(dump_mem_region[i].size)); if (t_size + size > max_dump_size) break; @@ -116,10 +116,11 @@ static int dump_region_tce_map(void) /* Add entry to MDST table */ mdst_table[i].type = dump_mem_region[i].type; mdst_table[i].size = dump_mem_region[i].size; - mdst_table[i].addr = PSI_DMA_HYP_DUMP + t_size; + mdst_table[i].addr = cpu_to_be64(PSI_DMA_HYP_DUMP + t_size); /* TCE alignment adjustment */ - mdst_table[i].addr += dump_mem_region[i].addr & 0xfff; + mdst_table[i].addr = cpu_to_be64(be64_to_cpu(mdst_table[i].addr) + + (be64_to_cpu(dump_mem_region[i].addr) & 0xfff)); t_size += size; } @@ -193,7 +194,7 @@ static int dump_region_del_entry(uint32_t id) lock(&mdst_lock); for (i = 0; i < cur_mdst_entry; i++) { - if (dump_mem_region[i].type != id) + if (be32_to_cpu(dump_mem_region[i].type) != id) continue; found = true; @@ -206,8 +207,8 @@ static int dump_region_del_entry(uint32_t id) } /* Adjust current dump size */ - size = get_dump_region_map_size(dump_mem_region[i].addr, - dump_mem_region[i].size); + size = get_dump_region_map_size(be64_to_cpu(dump_mem_region[i].addr), + be32_to_cpu(dump_mem_region[i].size)); cur_dump_size -= size; for ( ; i < cur_mdst_entry - 1; i++) @@ -250,9 +251,9 @@ static int __dump_region_add_entry(uint32_t id, uint64_t addr, uint32_t size) } /* Add entry to dump memory region table */ - dump_mem_region[cur_mdst_entry].type = id; - dump_mem_region[cur_mdst_entry].addr = addr; - dump_mem_region[cur_mdst_entry].size = size; + dump_mem_region[cur_mdst_entry].type = cpu_to_be32(id); + dump_mem_region[cur_mdst_entry].addr = cpu_to_be64(addr); + dump_mem_region[cur_mdst_entry].size = cpu_to_be32(size); /* Update dump region count and dump size */ cur_mdst_entry++; diff --git a/include/fsp-mdst-table.h b/include/fsp-mdst-table.h index 21cb88c9fa0c..5989cdb73c88 100644 --- a/include/fsp-mdst-table.h +++ b/include/fsp-mdst-table.h @@ -40,9 +40,9 @@ * defined in HDAT spec. */ struct dump_mdst_table { - uint64_t addr; - uint32_t type; /* DUMP_SECTION_* */ - uint32_t size; + __be64 addr; + __be32 type; /* DUMP_SECTION_* */ + __be32 size; }; #endif /* __FSPMDST_H */