linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Wei Yang <weiyang@linux.vnet.ibm.com>
To: aik@ozlabs.ru, benh@kernel.crashing.org
Cc: linuxppc-dev@ozlabs.org, Wei Yang <weiyang@linux.vnet.ibm.com>
Subject: [PATCH] powerpc/powernv: retrieve m64_bar_idx from device node
Date: Wed, 21 Oct 2015 15:17:34 +0800	[thread overview]
Message-ID: <1445411854-6951-1-git-send-email-weiyang@linux.vnet.ibm.com> (raw)

Count of M64 BAR would differ with the evolution of hardware.

This patch retieves this count from device node instead of a hard coded
value.

Signed-off-by: Wei Yang <weiyang@linux.vnet.ibm.com>
---
 arch/powerpc/platforms/powernv/pci-ioda.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
index 5c65d8f..4635d25 100644
--- a/arch/powerpc/platforms/powernv/pci-ioda.c
+++ b/arch/powerpc/platforms/powernv/pci-ioda.c
@@ -368,6 +368,7 @@ static void __init pnv_ioda_parse_m64_window(struct pnv_phb *phb)
 	struct resource *res;
 	const u32 *r;
 	u64 pci_addr;
+	const __be32 *prop32;
 
 	/* FIXME: Support M64 for P7IOC */
 	if (phb->type != PNV_PHB_IODA2) {
@@ -402,7 +403,11 @@ static void __init pnv_ioda_parse_m64_window(struct pnv_phb *phb)
 			res->start, res->end, pci_addr);
 
 	/* Use last M64 BAR to cover M64 window */
-	phb->ioda.m64_bar_idx = 15;
+	prop32 = of_get_property(dn, "ibm,opal-m64-count", NULL);
+	if (prop32)
+		phb->ioda.m64_bar_idx = be32_to_cpup(prop32) - 1;
+	else
+		phb->ioda.m64_bar_idx = 15;
 	phb->init_m64 = pnv_ioda2_init_m64;
 	phb->reserve_m64_pe = pnv_ioda2_reserve_m64_pe;
 	phb->pick_m64_pe = pnv_ioda2_pick_m64_pe;
-- 
2.5.0

             reply	other threads:[~2015-10-21  7:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-21  7:17 Wei Yang [this message]
2015-10-21  7:52 ` [PATCH] powerpc/powernv: retrieve m64_bar_idx from device node Michael Ellerman
2015-10-21  8:20   ` Wei Yang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1445411854-6951-1-git-send-email-weiyang@linux.vnet.ibm.com \
    --to=weiyang@linux.vnet.ibm.com \
    --cc=aik@ozlabs.ru \
    --cc=benh@kernel.crashing.org \
    --cc=linuxppc-dev@ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).