[v5,7/7] vas: Define vas_get_wcbs_bar interface

Submitted by Sukadev Bhattiprolu on Jan. 26, 2017, 1:32 a.m.

Details

Message ID 1485394353-30319-8-git-send-email-sukadev@linux.vnet.ibm.com
State Under Review
Headers show

Commit Message

Sukadev Bhattiprolu Jan. 26, 2017, 1:32 a.m.
Implement the function vas_get_wcbs_bar() that returns the Window
Context Backing store address register. NX driver uses this function
to initialize its UMAC Send WC register.

Rather than caching the allocated WCBS buffer in memmory, we read it
back from the WC register we wrote it to.

Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
---
 core/vas.c    | 21 +++++++++++++++++++++
 include/vas.h |  1 +
 2 files changed, 22 insertions(+)

Patch hide | download patch | download mbox

diff --git a/core/vas.c b/core/vas.c
index a86444e..ce2ce5e 100644
--- a/core/vas.c
+++ b/core/vas.c
@@ -64,6 +64,27 @@  static inline int vas_scom_read(struct proc_chip *chip, uint64_t reg,
 	return xscom_read(chip->id, compute_vas_scom_addr(reg), val);
 }
 
+/* Interface for NX - make sure VAS is fully initialized first */
+__attrconst uint64_t vas_get_wcbs_bar(int chipid)
+{
+	struct proc_chip *chip;
+	uint64_t wcbs;
+	int rc;
+
+	if (!vas_initialized)
+		return 0ULL;
+
+	chip = get_chip(chipid);
+	if (!chip)
+		return 0ULL;
+
+	rc = vas_scom_read(chip, VAS_WCBS_BAR, &wcbs);
+	if (rc)
+		return 0ULL;
+
+	return wcbs;
+}
+
 static int init_north_ctl(struct proc_chip *chip)
 {
 	uint64_t val = 0ULL;
diff --git a/include/vas.h b/include/vas.h
index 904c663..728b0dc 100644
--- a/include/vas.h
+++ b/include/vas.h
@@ -38,6 +38,7 @@ 
 
 extern void vas_init(void);
 extern __attrconst uint64_t vas_get_hvwc_mmio_bar(const int chipid);
+extern __attrconst uint64_t vas_get_wcbs_bar(int chipid);
 
 /*
  * HVWC and UWC BAR.