diff mbox

[v4,4/5] VAS: Define vas_get_wcbs_bar interface

Message ID 1481666104-17832-5-git-send-email-sukadev@linux.vnet.ibm.com
State Superseded
Headers show

Commit Message

Sukadev Bhattiprolu Dec. 13, 2016, 9:55 p.m. UTC
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(+)
diff mbox

Patch

diff --git a/core/vas.c b/core/vas.c
index b9077ec..8776e2f 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.