int dpbp_clear_irq_status(struct fsl_mc_io *mc_io, uint16_t token, uint8_t irq_index, uint32_t status) { struct mc_command cmd = { 0 }; /* prepare command */ cmd.header = mc_encode_cmd_header(DPBP_CMDID_CLEAR_IRQ_STATUS, MC_CMD_PRI_LOW, token); cmd.params[0] |= mc_enc(0, 32, status); cmd.params[0] |= mc_enc(32, 8, irq_index); /* send command to mc*/ return mc_send_command(mc_io, &cmd); }
int dpbp_set_irq_mask(struct fsl_mc_io *mc_io, uint16_t token, uint8_t irq_index, uint32_t mask) { struct mc_command cmd = { 0 }; /* prepare command */ cmd.header = mc_encode_cmd_header(DPBP_CMDID_SET_IRQ_MASK, MC_CMD_PRI_LOW, token); cmd.params[0] |= mc_enc(0, 32, mask); cmd.params[0] |= mc_enc(32, 8, irq_index); /* send command to mc*/ return mc_send_command(mc_io, &cmd); }
int dpbp_get_irq(struct fsl_mc_io *mc_io, uint16_t token, uint8_t irq_index, int *type, uint64_t *irq_paddr, uint32_t *irq_val, int *user_irq_id) { struct mc_command cmd = { 0 }; int err; /* prepare command */ cmd.header = mc_encode_cmd_header(DPBP_CMDID_GET_IRQ, MC_CMD_PRI_LOW, token); cmd.params[0] |= mc_enc(32, 8, irq_index); /* send command to mc*/ err = mc_send_command(mc_io, &cmd); if (err) return err; /* retrieve response parameters */ *irq_val = (uint32_t)mc_dec(cmd.params[0], 0, 32); *irq_paddr = (uint64_t)mc_dec(cmd.params[1], 0, 64); *user_irq_id = (int)mc_dec(cmd.params[2], 0, 32); *type = (int)mc_dec(cmd.params[2], 32, 32); return 0; }
int dpmcp_set_irq_enable(struct fsl_mc_io *mc_io, uint16_t token, uint8_t irq_index, uint8_t en) { struct mc_command cmd = { 0 }; /* prepare command */ cmd.header = mc_encode_cmd_header(DPMCP_CMDID_SET_IRQ_ENABLE, MC_CMD_PRI_LOW, token); cmd.params[0] |= mc_enc(0, 8, en); cmd.params[0] |= mc_enc(32, 8, irq_index); /* send command to mc*/ return mc_send_command(mc_io, &cmd); }
int dpbp_set_irq(struct fsl_mc_io *mc_io, uint16_t token, uint8_t irq_index, uint64_t irq_paddr, uint32_t irq_val, int user_irq_id) { struct mc_command cmd = { 0 }; /* prepare command */ cmd.header = mc_encode_cmd_header(DPBP_CMDID_SET_IRQ, MC_CMD_PRI_LOW, token); cmd.params[0] |= mc_enc(0, 8, irq_index); cmd.params[0] |= mc_enc(32, 32, irq_val); cmd.params[1] |= mc_enc(0, 64, irq_paddr); cmd.params[2] |= mc_enc(0, 32, user_irq_id); /* send command to mc*/ return mc_send_command(mc_io, &cmd); }
int dpbp_open(struct fsl_mc_io *mc_io, int dpbp_id, uint16_t *token) { struct mc_command cmd = { 0 }; int err; /* prepare command */ cmd.header = mc_encode_cmd_header(DPBP_CMDID_OPEN, MC_CMD_PRI_LOW, 0); cmd.params[0] |= mc_enc(0, 32, dpbp_id); /* send command to mc*/ err = mc_send_command(mc_io, &cmd); if (err) return err; /* retrieve response parameters */ *token = MC_CMD_HDR_READ_TOKEN(cmd.header); return err; }
int dpbp_get_irq_status(struct fsl_mc_io *mc_io, uint16_t token, uint8_t irq_index, uint32_t *status) { struct mc_command cmd = { 0 }; int err; /* prepare command */ cmd.header = mc_encode_cmd_header(DPBP_CMDID_GET_IRQ_STATUS, MC_CMD_PRI_LOW, token); cmd.params[0] |= mc_enc(32, 8, irq_index); /* send command to mc*/ err = mc_send_command(mc_io, &cmd); if (err) return err; /* retrieve response parameters */ *status = (uint32_t)mc_dec(cmd.params[0], 0, 32); return 0; }
int dpmcp_create(struct fsl_mc_io *mc_io, const struct dpmcp_cfg *cfg, uint16_t *token) { struct mc_command cmd = { 0 }; int err; /* prepare command */ cmd.header = mc_encode_cmd_header(DPMCP_CMDID_CREATE, MC_CMD_PRI_LOW, 0); cmd.params[0] |= mc_enc(0, 32, cfg->portal_id); /* send command to mc*/ err = mc_send_command(mc_io, &cmd); if (err) return err; /* retrieve response parameters */ *token = MC_CMD_HDR_READ_TOKEN(cmd.header); return 0; }
int dpmcp_get_irq_enable(struct fsl_mc_io *mc_io, uint16_t token, uint8_t irq_index, uint8_t *en) { struct mc_command cmd = { 0 }; int err; /* prepare command */ cmd.header = mc_encode_cmd_header(DPMCP_CMDID_GET_IRQ_ENABLE, MC_CMD_PRI_LOW, token); cmd.params[0] |= mc_enc(32, 8, irq_index); /* send command to mc*/ err = mc_send_command(mc_io, &cmd); if (err) return err; /* retrieve response parameters */ *en = (uint8_t)mc_dec(cmd.params[0], 0, 8); return 0; }
int dpni_prepare_key_cfg(const struct dpkg_profile_cfg *cfg, uint8_t *key_cfg_buf) { int i, j; int offset = 0; int param = 1; uint64_t *params = (uint64_t *)key_cfg_buf; if (!key_cfg_buf || !cfg) return -EINVAL; params[0] |= mc_enc(0, 8, cfg->num_extracts); params[0] = cpu_to_le64(params[0]); if (cfg->num_extracts >= DPKG_MAX_NUM_OF_EXTRACTS) return -EINVAL; for (i = 0; i < cfg->num_extracts; i++) { switch (cfg->extracts[i].type) { case DPKG_EXTRACT_FROM_HDR: params[param] |= mc_enc(0, 8, cfg->extracts[i].extract.from_hdr.prot); params[param] |= mc_enc(8, 4, cfg->extracts[i].extract.from_hdr.type); params[param] |= mc_enc(16, 8, cfg->extracts[i].extract.from_hdr.size); params[param] |= mc_enc(24, 8, cfg->extracts[i].extract. from_hdr.offset); params[param] |= mc_enc(32, 32, cfg->extracts[i].extract. from_hdr.field); params[param] = cpu_to_le64(params[param]); param++; params[param] |= mc_enc(0, 8, cfg->extracts[i].extract. from_hdr.hdr_index); break; case DPKG_EXTRACT_FROM_DATA: params[param] |= mc_enc(16, 8, cfg->extracts[i].extract. from_data.size); params[param] |= mc_enc(24, 8, cfg->extracts[i].extract. from_data.offset); params[param] = cpu_to_le64(params[param]); param++; break; case DPKG_EXTRACT_FROM_PARSE: params[param] |= mc_enc(16, 8, cfg->extracts[i].extract. from_parse.size); params[param] |= mc_enc(24, 8, cfg->extracts[i].extract. from_parse.offset); params[param] = cpu_to_le64(params[param]); param++; break; default: return -EINVAL; } params[param] |= mc_enc( 24, 8, cfg->extracts[i].num_of_byte_masks); params[param] |= mc_enc(32, 4, cfg->extracts[i].type); params[param] = cpu_to_le64(params[param]); param++; for (offset = 0, j = 0; j < DPKG_NUM_OF_MASKS; offset += 16, j++) { params[param] |= mc_enc( (offset), 8, cfg->extracts[i].masks[j].mask); params[param] |= mc_enc( (offset + 8), 8, cfg->extracts[i].masks[j].offset); } params[param] = cpu_to_le64(params[param]); param++; } return 0; }