From patchwork Thu Feb 12 01:57:54 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Neuling X-Patchwork-Id: 438988 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 AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 056D61400EA for ; Thu, 12 Feb 2015 12:58:30 +1100 (AEDT) Received: from ozlabs.org (ozlabs.org [103.22.144.67]) by lists.ozlabs.org (Postfix) with ESMTP id D85E81A09FF for ; Thu, 12 Feb 2015 12:58:29 +1100 (AEDT) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Received: from ozlabs.org (ozlabs.org [103.22.144.67]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 075AC1A0A1C for ; Thu, 12 Feb 2015 12:58:10 +1100 (AEDT) Received: from localhost.localdomain (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id 70A551401AB; Thu, 12 Feb 2015 12:58:09 +1100 (AEDT) Received: by localhost.localdomain (Postfix, from userid 1000) id 59476D46EE9; Thu, 12 Feb 2015 12:58:09 +1100 (AEDT) From: Michael Neuling To: stewart@linux.vnet.ibm.com Date: Thu, 12 Feb 2015 12:57:54 +1100 Message-Id: <1423706279-12170-5-git-send-email-mikey@neuling.org> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1423706279-12170-1-git-send-email-mikey@neuling.org> References: <1423706279-12170-1-git-send-email-mikey@neuling.org> Cc: grimm@linux.vnet.ibm.com, imunsie@au.ibm.com, skiboot@lists.ozlabs.org Subject: [Skiboot] [PATCH 05/10] hw: Create xscom_read_cfam_chipid() X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.18 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" Create xscom_read_cfam_chipid() to read the cfam chipid(). We'll need to use this in a few places, so avoid replicating the code. Signed-off-by: Michael Neuling --- hw/xscom.c | 22 ++++++++++++++++------ include/xscom.h | 2 ++ 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/hw/xscom.c b/hw/xscom.c index 33c04b1..bc9fff4 100644 --- a/hw/xscom.c +++ b/hw/xscom.c @@ -433,10 +433,10 @@ int xscom_writeme(uint64_t pcb_addr, uint64_t val) return xscom_write(this_cpu()->chip_id, pcb_addr, val); } -static void xscom_init_chip_info(struct proc_chip *chip) +int64_t xscom_read_cfam_chipid(uint32_t partid, uint32_t *chip_id) { uint64_t val; - int64_t rc = 0; + int64_t rc = OPAL_SUCCESS; /* Mambo chip model lacks the f000f register, just make * something up (Murano DD2.1) @@ -444,16 +444,26 @@ static void xscom_init_chip_info(struct proc_chip *chip) if (is_mambo_chip) val = 0x221EF04980000000; else - rc = xscom_read(chip->id, 0xf000f, &val); + rc = xscom_read(partid, 0xf000f, &val); + + /* Extract CFAM id */ + *chip_id = (uint32_t)(val >> 44); + + return rc; +} + +static void xscom_init_chip_info(struct proc_chip *chip) +{ + uint32_t val; + int64_t rc; + + rc = xscom_read_cfam_chipid(chip->id, &val); if (rc) { prerror("XSCOM: Error %lld reading 0xf000f register\n", rc); /* We leave chip type to UNKNOWN */ return; } - /* Extract CFAM id */ - val >>= 44; - /* Identify chip */ switch(val & 0xff) { case 0xf9: diff --git a/include/xscom.h b/include/xscom.h index 5eed85f..b1ecaf5 100644 --- a/include/xscom.h +++ b/include/xscom.h @@ -173,4 +173,6 @@ extern void xscom_init(void); /* Mark XSCOM lock as being in console path */ extern void xscom_used_by_console(void); +extern int64_t xscom_read_cfam_chipid(uint32_t partid, uint32_t *chip_id); + #endif /* __XSCOM_H */