Lines Matching refs:ctx
56 void apei_exec_ctx_init(struct apei_exec_context *ctx, in apei_exec_ctx_init() argument
62 ctx->ins_table = ins_table; in apei_exec_ctx_init()
63 ctx->instructions = instructions; in apei_exec_ctx_init()
64 ctx->action_table = action_table; in apei_exec_ctx_init()
65 ctx->entries = entries; in apei_exec_ctx_init()
82 int apei_exec_read_register(struct apei_exec_context *ctx, in apei_exec_read_register() argument
91 ctx->value = val; in apei_exec_read_register()
97 int apei_exec_read_register_value(struct apei_exec_context *ctx, in apei_exec_read_register_value() argument
102 rc = apei_exec_read_register(ctx, entry); in apei_exec_read_register_value()
105 ctx->value = (ctx->value == entry->value); in apei_exec_read_register_value()
130 int apei_exec_write_register(struct apei_exec_context *ctx, in apei_exec_write_register() argument
133 return __apei_exec_write_register(entry, ctx->value); in apei_exec_write_register()
137 int apei_exec_write_register_value(struct apei_exec_context *ctx, in apei_exec_write_register_value() argument
142 ctx->value = entry->value; in apei_exec_write_register_value()
143 rc = apei_exec_write_register(ctx, entry); in apei_exec_write_register_value()
149 int apei_exec_noop(struct apei_exec_context *ctx, in apei_exec_noop() argument
160 int __apei_exec_run(struct apei_exec_context *ctx, u8 action, in __apei_exec_run() argument
168 ctx->ip = 0; in __apei_exec_run()
178 for (i = 0; i < ctx->entries; i++) { in __apei_exec_run()
179 entry = &ctx->action_table[i]; in __apei_exec_run()
182 if (ip == ctx->ip) { in __apei_exec_run()
183 if (entry->instruction >= ctx->instructions || in __apei_exec_run()
184 !ctx->ins_table[entry->instruction].run) { in __apei_exec_run()
190 run = ctx->ins_table[entry->instruction].run; in __apei_exec_run()
191 rc = run(ctx, entry); in __apei_exec_run()
195 ctx->ip++; in __apei_exec_run()
198 if (ctx->ip < ip) in __apei_exec_run()
206 typedef int (*apei_exec_entry_func_t)(struct apei_exec_context *ctx,
210 static int apei_exec_for_each_entry(struct apei_exec_context *ctx, in apei_exec_for_each_entry() argument
218 struct apei_exec_ins_type *ins_table = ctx->ins_table; in apei_exec_for_each_entry()
220 for (i = 0; i < ctx->entries; i++) { in apei_exec_for_each_entry()
221 entry = ctx->action_table + i; in apei_exec_for_each_entry()
225 if (ins >= ctx->instructions || !ins_table[ins].run) { in apei_exec_for_each_entry()
231 rc = func(ctx, entry, data); in apei_exec_for_each_entry()
239 static int pre_map_gar_callback(struct apei_exec_context *ctx, in pre_map_gar_callback() argument
245 if (ctx->ins_table[ins].flags & APEI_EXEC_INS_ACCESS_REGISTER) in pre_map_gar_callback()
255 int apei_exec_pre_map_gars(struct apei_exec_context *ctx) in apei_exec_pre_map_gars() argument
259 rc = apei_exec_for_each_entry(ctx, pre_map_gar_callback, in apei_exec_pre_map_gars()
263 memcpy(&ctx_unmap, ctx, sizeof(*ctx)); in apei_exec_pre_map_gars()
272 static int post_unmap_gar_callback(struct apei_exec_context *ctx, in post_unmap_gar_callback() argument
278 if (ctx->ins_table[ins].flags & APEI_EXEC_INS_ACCESS_REGISTER) in post_unmap_gar_callback()
285 int apei_exec_post_unmap_gars(struct apei_exec_context *ctx) in apei_exec_post_unmap_gars() argument
287 return apei_exec_for_each_entry(ctx, post_unmap_gar_callback, in apei_exec_post_unmap_gars()
715 static int collect_res_callback(struct apei_exec_context *ctx, in collect_res_callback() argument
726 if (!(ctx->ins_table[ins].flags & APEI_EXEC_INS_ACCESS_REGISTER)) in collect_res_callback()
749 int apei_exec_collect_resources(struct apei_exec_context *ctx, in apei_exec_collect_resources() argument
752 return apei_exec_for_each_entry(ctx, collect_res_callback, in apei_exec_collect_resources()