Lines Matching full:fw
355 static int check_register(struct host1x_firewall *fw, unsigned long offset) in check_register() argument
357 if (!fw->job->is_addr_reg) in check_register()
360 if (fw->job->is_addr_reg(fw->dev, fw->class, offset)) { in check_register()
361 if (!fw->num_relocs) in check_register()
364 if (!check_reloc(fw->reloc, fw->cmdbuf, fw->offset)) in check_register()
367 fw->num_relocs--; in check_register()
368 fw->reloc++; in check_register()
374 static int check_class(struct host1x_firewall *fw, u32 class) in check_class() argument
376 if (!fw->job->is_valid_class) { in check_class()
377 if (fw->class != class) in check_class()
380 if (!fw->job->is_valid_class(fw->class)) in check_class()
387 static int check_mask(struct host1x_firewall *fw) in check_mask() argument
389 u32 mask = fw->mask; in check_mask()
390 u32 reg = fw->reg; in check_mask()
394 if (fw->words == 0) in check_mask()
398 ret = check_register(fw, reg); in check_mask()
402 fw->words--; in check_mask()
403 fw->offset++; in check_mask()
412 static int check_incr(struct host1x_firewall *fw) in check_incr() argument
414 u32 count = fw->count; in check_incr()
415 u32 reg = fw->reg; in check_incr()
419 if (fw->words == 0) in check_incr()
422 ret = check_register(fw, reg); in check_incr()
427 fw->words--; in check_incr()
428 fw->offset++; in check_incr()
435 static int check_nonincr(struct host1x_firewall *fw) in check_nonincr() argument
437 u32 count = fw->count; in check_nonincr()
441 if (fw->words == 0) in check_nonincr()
444 ret = check_register(fw, fw->reg); in check_nonincr()
448 fw->words--; in check_nonincr()
449 fw->offset++; in check_nonincr()
456 static int validate(struct host1x_firewall *fw, struct host1x_job_gather *g) in validate() argument
458 u32 *cmdbuf_base = (u32 *)fw->job->gather_copy_mapped + in validate()
460 u32 job_class = fw->class; in validate()
463 fw->words = g->words; in validate()
464 fw->cmdbuf = g->bo; in validate()
465 fw->offset = 0; in validate()
467 while (fw->words && !err) { in validate()
468 u32 word = cmdbuf_base[fw->offset]; in validate()
471 fw->mask = 0; in validate()
472 fw->reg = 0; in validate()
473 fw->count = 0; in validate()
474 fw->words--; in validate()
475 fw->offset++; in validate()
479 fw->class = word >> 6 & 0x3ff; in validate()
480 fw->mask = word & 0x3f; in validate()
481 fw->reg = word >> 16 & 0xfff; in validate()
482 err = check_class(fw, job_class); in validate()
484 err = check_mask(fw); in validate()
489 fw->reg = word >> 16 & 0xfff; in validate()
490 fw->count = word & 0xffff; in validate()
491 err = check_incr(fw); in validate()
497 fw->reg = word >> 16 & 0xfff; in validate()
498 fw->count = word & 0xffff; in validate()
499 err = check_nonincr(fw); in validate()
505 fw->mask = word & 0xffff; in validate()
506 fw->reg = word >> 16 & 0xfff; in validate()
507 err = check_mask(fw); in validate()
527 struct host1x_firewall fw; in copy_gathers() local
532 fw.job = job; in copy_gathers()
533 fw.dev = dev; in copy_gathers()
534 fw.reloc = job->relocs; in copy_gathers()
535 fw.num_relocs = job->num_relocs; in copy_gathers()
536 fw.class = job->class; in copy_gathers()
585 if (validate(&fw, g)) in copy_gathers()
592 if (fw.num_relocs) in copy_gathers()