Lines Matching +full:write +full:- +full:enable

1 // SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later
36 /* Enable bit field mask for KeyGen General Configuration Register */
96 /* Hard-coded configuration:
97 * These values are used as hard-coded values for KeyGen configuration
98 * and they replace user selections for this hard-coded version
109 * - the value for symmetric hash usage must be in accordance with hash
111 * - according to tests performed, spreading is not working if symmetric
173 u32 fmkg_eeer; /* 0x010: KeyGen Error Event Enable Register */
177 u32 fmkg_seeer; /* 0x020: KeyGen Scheme Error Event Enable Register */
207 * Must be between 1 and 2^24-1
237 * Write Action Register with specified value, wait for GO bit field to be
247 iowrite32be(fmkg_ar, &regs->fmkg_ar); in keygen_write_ar_wait()
251 fmkg_ar = ioread32be(&regs->fmkg_ar); in keygen_write_ar_wait()
254 return -EINVAL; in keygen_write_ar_wait()
265 * write: true for action to write the scheme or false for read action
269 static u32 build_ar_scheme(u8 scheme_id, bool update_counter, bool write) in build_ar_scheme() argument
271 u32 rw = (u32)(write ? FM_KG_KGAR_WRITE : FM_KG_KGAR_READ); in build_ar_scheme()
286 * write: true for action to write the bind or false for read action
290 static u32 build_ar_bind_scheme(u8 hwport_id, bool write) in build_ar_bind_scheme() argument
292 u32 rw = write ? (u32)FM_KG_KGAR_WRITE : (u32)FM_KG_KGAR_READ; in build_ar_bind_scheme()
303 * Write Scheme Partition Register with specified value
315 tmp = ioread32be(&regs->fmkg_pe.fmkg_pe_sp); in keygen_write_sp()
322 iowrite32be(tmp, &regs->fmkg_pe.fmkg_pe_sp); in keygen_write_sp()
330 * write: true for action to write the CP or false for read action
334 static u32 build_ar_bind_cls_plan(u8 hwport_id, bool write) in build_ar_bind_cls_plan() argument
336 u32 rw = write ? (u32)FM_KG_KGAR_WRITE : (u32)FM_KG_KGAR_READ; in build_ar_bind_cls_plan()
347 * Write Classification Plan Partition Register with specified value
356 iowrite32be(cpp, &regs->fmkg_pe.fmkg_pe_cpp); in keygen_write_cpp()
361 * Write all Schemes Registers with specified values
377 /* Write indirect scheme registers */ in keygen_write_scheme()
378 iowrite32be(scheme_regs->kgse_mode, &regs->fmkg_sch.kgse_mode); in keygen_write_scheme()
379 iowrite32be(scheme_regs->kgse_ekfc, &regs->fmkg_sch.kgse_ekfc); in keygen_write_scheme()
380 iowrite32be(scheme_regs->kgse_ekdv, &regs->fmkg_sch.kgse_ekdv); in keygen_write_scheme()
381 iowrite32be(scheme_regs->kgse_bmch, &regs->fmkg_sch.kgse_bmch); in keygen_write_scheme()
382 iowrite32be(scheme_regs->kgse_bmcl, &regs->fmkg_sch.kgse_bmcl); in keygen_write_scheme()
383 iowrite32be(scheme_regs->kgse_fqb, &regs->fmkg_sch.kgse_fqb); in keygen_write_scheme()
384 iowrite32be(scheme_regs->kgse_hc, &regs->fmkg_sch.kgse_hc); in keygen_write_scheme()
385 iowrite32be(scheme_regs->kgse_ppc, &regs->fmkg_sch.kgse_ppc); in keygen_write_scheme()
386 iowrite32be(scheme_regs->kgse_spc, &regs->fmkg_sch.kgse_spc); in keygen_write_scheme()
387 iowrite32be(scheme_regs->kgse_dv0, &regs->fmkg_sch.kgse_dv0); in keygen_write_scheme()
388 iowrite32be(scheme_regs->kgse_dv1, &regs->fmkg_sch.kgse_dv1); in keygen_write_scheme()
389 iowrite32be(scheme_regs->kgse_ccbs, &regs->fmkg_sch.kgse_ccbs); in keygen_write_scheme()
390 iowrite32be(scheme_regs->kgse_mv, &regs->fmkg_sch.kgse_mv); in keygen_write_scheme()
391 iowrite32be(scheme_regs->kgse_om, &regs->fmkg_sch.kgse_om); in keygen_write_scheme()
392 iowrite32be(scheme_regs->kgse_vsp, &regs->fmkg_sch.kgse_vsp); in keygen_write_scheme()
395 iowrite32be(scheme_regs->kgse_gec[i], in keygen_write_scheme()
396 &regs->fmkg_sch.kgse_gec[i]); in keygen_write_scheme()
398 /* Write AR (Action register) */ in keygen_write_scheme()
416 * Return: 0 on success, -EINVAL when the are no available free schemes
423 if (!keygen->schemes[i].used) { in get_free_scheme_id()
428 return -EINVAL; in get_free_scheme_id()
445 return &keygen->schemes[scheme_id]; in get_scheme()
462 struct fman_kg_regs __iomem *keygen_regs = keygen->keygen_regs; in keygen_bind_port_to_schemes()
471 return -EINVAL; in keygen_bind_port_to_schemes()
473 if (!scheme->used) { in keygen_bind_port_to_schemes()
475 return -EINVAL; in keygen_bind_port_to_schemes()
478 schemes_vector |= 1 << (31 - scheme_id); in keygen_bind_port_to_schemes()
480 ar_reg = build_ar_bind_scheme(scheme->hw_port_id, false); in keygen_bind_port_to_schemes()
489 ar_reg = build_ar_bind_scheme(scheme->hw_port_id, true); in keygen_bind_port_to_schemes()
505 * enable: true to enable scheme or false to disable it
510 bool enable) in keygen_scheme_setup() argument
512 struct fman_kg_regs __iomem *keygen_regs = keygen->keygen_regs; in keygen_scheme_setup()
521 return -EINVAL; in keygen_scheme_setup()
523 if (enable && scheme->used) { in keygen_scheme_setup()
525 return -EINVAL; in keygen_scheme_setup()
534 if (enable) { in keygen_scheme_setup()
535 /* Enable Scheme */ in keygen_scheme_setup()
543 scheme_regs.kgse_mv = scheme->match_vector; in keygen_scheme_setup()
550 /* Configure Hard-Coded Rx Hashing: */ in keygen_scheme_setup()
552 if (scheme->use_hashing) { in keygen_scheme_setup()
571 tmp_reg |= ((scheme->hash_fqid_count - 1) << in keygen_scheme_setup()
573 tmp_reg |= scheme->hashShift << KG_SCH_HASH_CONFIG_SHIFT_SHIFT; in keygen_scheme_setup()
575 if (scheme->symmetric_hash) { in keygen_scheme_setup()
578 * But because extraction is hard-coded, we are sure in keygen_scheme_setup()
594 tmp_reg |= scheme->base_fqid; in keygen_scheme_setup()
597 /* features not used by hard-coded configuration */ in keygen_scheme_setup()
602 /* Write scheme registers */ in keygen_scheme_setup()
610 scheme->used = enable; in keygen_scheme_setup()
636 keygen->keygen_regs = keygen_regs; in keygen_init()
641 iowrite32be(ENQUEUE_KG_DFLT_NIA, &keygen_regs->fmkg_gcr); in keygen_init()
644 &keygen_regs->fmkg_eer); in keygen_init()
646 iowrite32be(0, &keygen_regs->fmkg_fdor); in keygen_init()
647 iowrite32be(0, &keygen_regs->fmkg_gdv0r); in keygen_init()
648 iowrite32be(0, &keygen_regs->fmkg_gdv1r); in keygen_init()
665 /* Enable all scheme interrupts */ in keygen_init()
666 iowrite32be(0xFFFFFFFF, &keygen_regs->fmkg_seer); in keygen_init()
667 iowrite32be(0xFFFFFFFF, &keygen_regs->fmkg_seeer); in keygen_init()
669 /* Enable KyeGen */ in keygen_init()
670 iowrite32be(ioread32be(&keygen_regs->fmkg_gcr) | FM_KG_KGGCR_EN, in keygen_init()
671 &keygen_regs->fmkg_gcr); in keygen_init()
697 pr_err("Base FQID must be between 1 and 2^24-1\n"); in keygen_port_hashing_init()
698 return -EINVAL; in keygen_port_hashing_init()
700 if (hash_size == 0 || (hash_size & (hash_size - 1)) != 0) { in keygen_port_hashing_init()
702 return -EINVAL; in keygen_port_hashing_init()
709 return -EINVAL; in keygen_port_hashing_init()
712 /* Create and configure Hard-Coded Scheme: */ in keygen_port_hashing_init()
717 return -EINVAL; in keygen_port_hashing_init()
719 if (scheme->used) { in keygen_port_hashing_init()
721 return -EINVAL; in keygen_port_hashing_init()
730 scheme->hw_port_id = hw_port_id; in keygen_port_hashing_init()
731 scheme->use_hashing = true; in keygen_port_hashing_init()
732 scheme->base_fqid = hash_base_fqid; in keygen_port_hashing_init()
733 scheme->hash_fqid_count = hash_size; in keygen_port_hashing_init()
734 scheme->symmetric_hash = DEFAULT_SYMMETRIC_HASH; in keygen_port_hashing_init()
735 scheme->hashShift = DEFAULT_HASH_SHIFT; in keygen_port_hashing_init()
737 /* All Schemes in hard-coded configuration in keygen_port_hashing_init()
740 scheme->match_vector = 0; in keygen_port_hashing_init()