homer : Support for P9 PBA BAR initialization

Submitted by Shilpasri G Bhat on Feb. 3, 2017, 5:08 a.m.

Details

Message ID 1486098529-19241-1-git-send-email-shilpa.bhat@linux.vnet.ibm.com
State New
Headers show

Commit Message

Shilpasri G Bhat Feb. 3, 2017, 5:08 a.m.
This patch defines the BAR[0-3] components and scom address for P9.

Signed-off-by: Shilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com>
---
 hw/homer.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++------
 1 file changed, 53 insertions(+), 6 deletions(-)

Patch hide | download patch | download mbox

diff --git a/hw/homer.c b/hw/homer.c
index 84eb536..39ba10f 100644
--- a/hw/homer.c
+++ b/hw/homer.c
@@ -22,8 +22,28 @@ 
 #include <mem_region.h>
 #include <hostservices.h>
 
-#define PBA_BAR0	0x2013f00
-#define PBA_BARMASK0	0x2013f04
+#define P8_PBA_BAR0		0x2013f00
+#define P8_PBA_BARMASK0		0x2013f04
+
+#define P9_PBA_BAR0		0x5012B00
+#define P9_PBA_BARMASK0		0x5012B04
+
+enum P8_BAR {
+	P8_BAR_HOMER = 0,
+	P8_BAR_CENTAUR = 1,
+	P8_BAR_SLW = 2,
+	P8_BAR_OCC_COMMON = 3,
+};
+
+enum P9_BAR {
+	P9_BAR_HOMER = 0,
+	P9_BAR_CENTAUR = 1,
+	P9_BAR_OCC_COMMON = 2,
+	P9_BAR_SBE = 3,
+};
+
+u64 PBA_BAR0, PBA_BARMASK0;
+u8 BAR_HOMER, BAR_SLW, BAR_OCC_COMMON;
 
 static bool read_pba_bar(struct proc_chip *chip, unsigned int bar_no,
 			 uint64_t *base, uint64_t *size)
@@ -60,6 +80,7 @@  static void homer_init_chip(struct proc_chip *chip)
 	/*
 	 * PBA BARs assigned by HB:
 	 *
+	 * P8:
 	 *   0 : Entire HOMER
 	 *   1 : OCC to Centaur path (we don't care)
 	 *   2 : SLW image
@@ -68,8 +89,15 @@  static void homer_init_chip(struct proc_chip *chip)
 	 * We need to reserve the memory covered by BAR 0 and BAR 3, however
 	 * on earlier HBs, BAR0 isn't set so we need BAR 2 instead in that
 	 * case to cover SLW (OCC not running).
+	 *
+	 * P9:
+	 *   0 : Entire HOMER
+	 *   1 : OCC to Centaur path (Cumulus only)
+	 *   2 : OCC Common area
+	 *   3 : SBE communication
+	 *
 	 */
-	if (read_pba_bar(chip, 0, &hbase, &hsize)) {
+	if (read_pba_bar(chip, BAR_HOMER, &hbase, &hsize)) {
 		prlog(PR_DEBUG, "  HOMER Image at 0x%llx size %lldMB\n",
 		      hbase, hsize / 0x100000);
 
@@ -87,7 +115,8 @@  static void homer_init_chip(struct proc_chip *chip)
 	 * We always read the SLW BAR since we need to grab info about the
 	 * SLW image in the struct proc_chip for use by the slw.c code
 	 */
-	if (read_pba_bar(chip, 2, &sbase, &ssize)) {
+	if (proc_gen == proc_gen_p8 &&
+	    read_pba_bar(chip, BAR_SLW, &sbase, &ssize)) {
 		prlog(PR_DEBUG, "  SLW Image at 0x%llx size %lldMB\n",
 		      sbase, ssize / 0x100000);
 
@@ -108,7 +137,7 @@  static void homer_init_chip(struct proc_chip *chip)
 		chip->slw_image_size = ssize; /* will be adjusted later */
 	}
 
-	if (read_pba_bar(chip, 3, &obase, &osize)) {
+	if (read_pba_bar(chip, BAR_OCC_COMMON, &obase, &osize)) {
 		prlog(PR_DEBUG, "  OCC Common Area at 0x%llx size %lldMB\n",
 		      obase, osize / 0x100000);
 		chip->occ_common_base = obase;
@@ -120,8 +149,26 @@  void homer_init(void)
 {
 	struct proc_chip *chip;
 
-	if (proc_gen != proc_gen_p8 || chip_quirk(QUIRK_NO_PBA))
+	if (proc_gen < proc_gen_p8 || chip_quirk(QUIRK_NO_PBA))
+		return;
+
+	switch (proc_gen) {
+	case proc_gen_p8:
+		PBA_BAR0 = P8_PBA_BAR0;
+		PBA_BARMASK0 = P8_PBA_BARMASK0;
+		BAR_HOMER = P8_BAR_HOMER;
+		BAR_SLW = P8_BAR_SLW;
+		BAR_OCC_COMMON = P8_BAR_OCC_COMMON;
+		break;
+	case proc_gen_p9:
+		PBA_BAR0 = P9_PBA_BAR0;
+		PBA_BARMASK0 = P9_PBA_BARMASK0;
+		BAR_HOMER = P9_BAR_HOMER;
+		BAR_OCC_COMMON = P9_BAR_OCC_COMMON;
+		break;
+	default:
 		return;
+	};
 
 	/*
 	 * XXX This is temporary, on P8 we look for any configured