Thread (37 messages) 37 messages, 5 authors, 2021-12-06

Re: [PATCH 5/5] cxl/cdat: Parse out DSMAS data from CDAT table

From: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
Date: 2021-11-18 17:02:17
Also in: linux-cxl

On Fri, 5 Nov 2021 16:50:56 -0700
[off-list ref] wrote:
From: Ira Weiny <ira.weiny@intel.com>

Parse and cache the DSMAS data from the CDAT table.  Store this data in
Unmarshaled data structures for use later.

Signed-off-by: Ira Weiny <ira.weiny@intel.com>
+static bool cdat_hdr_valid(struct cxl_memdev *cxlmd)
+{
+	u32 *data = cxlmd->cdat_table;
+	u8 *data8 = (u8 *)data;
+	u32 length, seq;
+	u8 rev, cs;
+	u8 check;
+	int i;
+
+	length = FIELD_GET(CDAT_HEADER_DW0_LENGTH, data[0]);
+	if (length < CDAT_HEADER_LENGTH_BYTES)
+		return false;
+
+	rev = FIELD_GET(CDAT_HEADER_DW1_REVISION, data[1]);
+	cs = FIELD_GET(CDAT_HEADER_DW1_CHECKSUM, data[1]);
rev and cs both parsed out but not used...

W=1 is complaining at me, hence I noticed whilst rebasing this
series.

Jonathan
+	seq = FIELD_GET(CDAT_HEADER_DW3_SEQUENCE, data[3]);
+
+	/* Store the sequence for now. */
+	cxlmd->cdat_seq = seq;
+
+	for (check = 0, i = 0; i < length; i++)
+		check += data8[i];
+
+	return check == 0;
+}
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help