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