lkml.org 
[lkml]   [2021]   [Oct]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v3 32/33] EDAC/amd64: Save the number of block instances
Date
Cache the number of block instances. This value is needed by future DF
versions.

Signed-off-by: Yazen Ghannam <yazen.ghannam@amd.com>
---
v2->v3:
* New in v3.

drivers/edac/amd64_edac.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)

diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c
index 07009901a283..bc1aa6292408 100644
--- a/drivers/edac/amd64_edac.c
+++ b/drivers/edac/amd64_edac.c
@@ -1092,6 +1092,7 @@ struct addr_ctx {
u8 intlv_num_sockets;
u8 cs_id;
u8 node_id_shift;
+ u8 num_blk_instances;
bool late_hole_remove;
int (*dehash_addr)(struct addr_ctx *ctx);
void (*make_space_for_cs_id)(struct addr_ctx *ctx);
@@ -1417,6 +1418,17 @@ struct data_fabric_ops df3_ops = {

struct data_fabric_ops *df_ops;

+static int get_blk_inst_cnt(struct addr_ctx *ctx)
+{
+ /* Read D18F0x40 (FabricBlockInstanceCount). */
+ if (df_indirect_read_broadcast(0, 0, 0x40, &ctx->tmp))
+ return -EINVAL;
+
+ ctx->num_blk_instances = ctx->tmp & 0xFF;
+
+ return 0;
+}
+
static int get_dram_offset_reg(struct addr_ctx *ctx)
{
/* Read D18F0x1B4 (DramOffset) */
@@ -1621,6 +1633,9 @@ static int umc_normaddr_to_sysaddr(u64 *addr, u16 nid, u8 df_inst_id)
ctx.nid = nid;
ctx.inst_id = df_inst_id;

+ if (get_blk_inst_cnt(&ctx))
+ return -EINVAL;
+
if (df_ops->get_masks(&ctx))
return -EINVAL;

--
2.25.1
\
 
 \ /
  Last update: 2021-10-28 20:00    [W:0.121 / U:2.620 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site