Lines Matching refs:ctx

20 static int addr_over_limit(struct addr_ctx *ctx)
25 dram_limit_addr = FIELD_GET(DF4_DRAM_LIMIT_ADDR, ctx->map.limit);
27 dram_limit_addr = FIELD_GET(DF2_DRAM_LIMIT_ADDR, ctx->map.limit);
33 if (ctx->ret_addr > dram_limit_addr) {
34 atl_debug(ctx, "Calculated address (0x%016llx) > DRAM limit (0x%016llx)",
35 ctx->ret_addr, dram_limit_addr);
42 static bool legacy_hole_en(struct addr_ctx *ctx)
44 u32 reg = ctx->map.base;
47 reg = ctx->map.ctl;
52 static int add_legacy_hole(struct addr_ctx *ctx)
57 if (!legacy_hole_en(ctx))
63 if (df_indirect_read_broadcast(ctx->node_id, func, 0x104, &dram_hole_base))
68 if (ctx->ret_addr >= dram_hole_base)
69 ctx->ret_addr += (BIT_ULL(32) - dram_hole_base);
74 static u64 get_base_addr(struct addr_ctx *ctx)
79 base_addr = FIELD_GET(DF4_BASE_ADDR, ctx->map.base);
81 base_addr = FIELD_GET(DF2_BASE_ADDR, ctx->map.base);
86 static int add_base_and_hole(struct addr_ctx *ctx)
88 ctx->ret_addr += get_base_addr(ctx);
90 if (add_legacy_hole(ctx))
96 static bool late_hole_remove(struct addr_ctx *ctx)
104 if (ctx->map.intlv_mode == DF3_6CHAN)
112 struct addr_ctx ctx;
117 memset(&ctx, 0, sizeof(ctx));
120 ctx.ret_addr = addr;
121 ctx.inst_id = coh_st_inst_id;
123 ctx.inputs.norm_addr = addr;
124 ctx.inputs.socket_id = socket_id;
125 ctx.inputs.die_id = die_id;
126 ctx.inputs.coh_st_inst_id = coh_st_inst_id;
128 if (determine_node_id(&ctx, socket_id, die_id))
131 if (get_address_map(&ctx))
134 if (denormalize_address(&ctx))
137 if (!late_hole_remove(&ctx) && add_base_and_hole(&ctx))
140 if (dehash_address(&ctx))
143 if (late_hole_remove(&ctx) && add_base_and_hole(&ctx))
146 if (addr_over_limit(&ctx))
149 return ctx.ret_addr;