/****************************************************************************** * TYPE DEFINITIONS
******************************************************************************/
/** * set_queue_last_ind_bit() - Indicate the end of current HW descriptors flow * and release the HW engines. * * @pdesc: Pointer to HW descriptor struct
*/ staticinlinevoid set_queue_last_ind_bit(struct cc_hw_desc *pdesc)
{
pdesc->word[3] |= FIELD_PREP(WORD3_QUEUE_LAST_IND, 1);
}
/** * set_din_type() - Set the DIN field of a HW descriptor * * @pdesc: Pointer to HW descriptor struct * @dma_mode: The DMA mode: NO_DMA, SRAM, DLLI, MLLI, CONSTANT * @addr: DIN address * @size: Data size in bytes * @axi_sec: AXI secure bit
*/ staticinlinevoid set_din_type(struct cc_hw_desc *pdesc, enum cc_dma_mode dma_mode, dma_addr_t addr,
u32 size, enum cc_axi_sec axi_sec)
{
pdesc->word[0] = lower_32_bits(addr); #ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
pdesc->word[5] |= FIELD_PREP(WORD5_DIN_ADDR_HIGH, upper_32_bits(addr)); #endif
pdesc->word[1] |= FIELD_PREP(WORD1_DIN_DMA_MODE, dma_mode) |
FIELD_PREP(WORD1_DIN_SIZE, size) |
FIELD_PREP(WORD1_NS_BIT, axi_sec);
}
/** * set_din_no_dma() - Set the DIN field of a HW descriptor to NO DMA mode. * Used for NOP descriptor, register patches and other special modes. * * @pdesc: Pointer to HW descriptor struct * @addr: DIN address * @size: Data size in bytes
*/ staticinlinevoid set_din_no_dma(struct cc_hw_desc *pdesc, u32 addr, u32 size)
{
pdesc->word[0] = addr;
pdesc->word[1] |= FIELD_PREP(WORD1_DIN_SIZE, size);
}
/** * set_cpp_crypto_key() - Setup the special CPP descriptor * * @pdesc: Pointer to HW descriptor struct * @slot: Slot number
*/ staticinlinevoid set_cpp_crypto_key(struct cc_hw_desc *pdesc, u8 slot)
{
pdesc->word[0] |= CC_CPP_DIN_ADDR;
/** * set_din_sram() - Set the DIN field of a HW descriptor to SRAM mode. * Note: No need to check SRAM alignment since host requests do not use SRAM and * the adaptor will enforce alignment checks. * * @pdesc: Pointer to HW descriptor struct * @addr: DIN address * @size: Data size in bytes
*/ staticinlinevoid set_din_sram(struct cc_hw_desc *pdesc, u32 addr, u32 size)
{
pdesc->word[0] = addr;
pdesc->word[1] |= FIELD_PREP(WORD1_DIN_SIZE, size) |
FIELD_PREP(WORD1_DIN_DMA_MODE, DMA_SRAM);
}
/** * set_din_const() - Set the DIN field of a HW descriptor to CONST mode * * @pdesc: Pointer to HW descriptor struct * @val: DIN const value * @size: Data size in bytes
*/ staticinlinevoid set_din_const(struct cc_hw_desc *pdesc, u32 val, u32 size)
{
pdesc->word[0] = val;
pdesc->word[1] |= FIELD_PREP(WORD1_DIN_CONST_VALUE, 1) |
FIELD_PREP(WORD1_DIN_DMA_MODE, DMA_SRAM) |
FIELD_PREP(WORD1_DIN_SIZE, size);
}
/** * set_din_not_last_indication() - Set the DIN not last input data indicator * * @pdesc: Pointer to HW descriptor struct
*/ staticinlinevoid set_din_not_last_indication(struct cc_hw_desc *pdesc)
{
pdesc->word[1] |= FIELD_PREP(WORD1_NOT_LAST, 1);
}
/** * set_dout_type() - Set the DOUT field of a HW descriptor * * @pdesc: Pointer to HW descriptor struct * @dma_mode: The DMA mode: NO_DMA, SRAM, DLLI, MLLI, CONSTANT * @addr: DOUT address * @size: Data size in bytes * @axi_sec: AXI secure bit
*/ staticinlinevoid set_dout_type(struct cc_hw_desc *pdesc, enum cc_dma_mode dma_mode, dma_addr_t addr,
u32 size, enum cc_axi_sec axi_sec)
{
pdesc->word[2] = lower_32_bits(addr); #ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
pdesc->word[5] |= FIELD_PREP(WORD5_DOUT_ADDR_HIGH, upper_32_bits(addr)); #endif
pdesc->word[3] |= FIELD_PREP(WORD3_DOUT_DMA_MODE, dma_mode) |
FIELD_PREP(WORD3_DOUT_SIZE, size) |
FIELD_PREP(WORD3_NS_BIT, axi_sec);
}
/** * set_dout_dlli() - Set the DOUT field of a HW descriptor to DLLI type * The LAST INDICATION is provided by the user * * @pdesc: Pointer to HW descriptor struct * @addr: DOUT address * @size: Data size in bytes * @axi_sec: AXI secure bit * @last_ind: The last indication bit
*/ staticinlinevoid set_dout_dlli(struct cc_hw_desc *pdesc, dma_addr_t addr,
u32 size, enum cc_axi_sec axi_sec,
u32 last_ind)
{
set_dout_type(pdesc, DMA_DLLI, addr, size, axi_sec);
pdesc->word[3] |= FIELD_PREP(WORD3_DOUT_LAST_IND, last_ind);
}
/** * set_dout_mlli() - Set the DOUT field of a HW descriptor to MLLI type * The LAST INDICATION is provided by the user * * @pdesc: Pointer to HW descriptor struct * @addr: DOUT address * @size: Data size in bytes * @axi_sec: AXI secure bit * @last_ind: The last indication bit
*/ staticinlinevoid set_dout_mlli(struct cc_hw_desc *pdesc, u32 addr, u32 size, enum cc_axi_sec axi_sec, bool last_ind)
{
set_dout_type(pdesc, DMA_MLLI, addr, size, axi_sec);
pdesc->word[3] |= FIELD_PREP(WORD3_DOUT_LAST_IND, last_ind);
}
/** * set_dout_no_dma() - Set the DOUT field of a HW descriptor to NO DMA mode. * Used for NOP descriptor, register patches and other special modes. * * @pdesc: pointer to HW descriptor struct * @addr: DOUT address * @size: Data size in bytes * @write_enable: Enables a write operation to a register
*/ staticinlinevoid set_dout_no_dma(struct cc_hw_desc *pdesc, u32 addr,
u32 size, bool write_enable)
{
pdesc->word[2] = addr;
pdesc->word[3] |= FIELD_PREP(WORD3_DOUT_SIZE, size) |
FIELD_PREP(WORD3_DOUT_LAST_IND, write_enable);
}
/** * set_xor_val() - Set the word for the XOR operation. * * @pdesc: Pointer to HW descriptor struct * @val: XOR data value
*/ staticinlinevoid set_xor_val(struct cc_hw_desc *pdesc, u32 val)
{
pdesc->word[2] = val;
}
/** * set_xor_active() - Set the XOR indicator bit in the descriptor * * @pdesc: Pointer to HW descriptor struct
*/ staticinlinevoid set_xor_active(struct cc_hw_desc *pdesc)
{
pdesc->word[3] |= FIELD_PREP(WORD3_HASH_XOR_BIT, 1);
}
/** * set_aes_not_hash_mode() - Select the AES engine instead of HASH engine when * setting up combined mode with AES XCBC MAC * * @pdesc: Pointer to HW descriptor struct
*/ staticinlinevoid set_aes_not_hash_mode(struct cc_hw_desc *pdesc)
{
pdesc->word[4] |= FIELD_PREP(WORD4_AES_SEL_N_HASH, 1);
}
/** * set_aes_xor_crypto_key() - Set aes xor crypto key, which in some scenarios * selects the SM3 engine * * @pdesc: Pointer to HW descriptor struct
*/ staticinlinevoid set_aes_xor_crypto_key(struct cc_hw_desc *pdesc)
{
pdesc->word[4] |= FIELD_PREP(WORD4_AES_XOR_CRYPTO_KEY, 1);
}
/** * set_dout_sram() - Set the DOUT field of a HW descriptor to SRAM mode * Note: No need to check SRAM alignment since host requests do not use SRAM and * the adaptor will enforce alignment checks. * * @pdesc: Pointer to HW descriptor struct * @addr: DOUT address * @size: Data size in bytes
*/ staticinlinevoid set_dout_sram(struct cc_hw_desc *pdesc, u32 addr, u32 size)
{
pdesc->word[2] = addr;
pdesc->word[3] |= FIELD_PREP(WORD3_DOUT_DMA_MODE, DMA_SRAM) |
FIELD_PREP(WORD3_DOUT_SIZE, size);
}
/** * set_xex_data_unit_size() - Set the data unit size for XEX mode in * data_out_addr[15:0] * * @pdesc: Pointer to HW descriptor struct * @size: Data unit size for XEX mode
*/ staticinlinevoid set_xex_data_unit_size(struct cc_hw_desc *pdesc, u32 size)
{
pdesc->word[2] = size;
}
/** * set_multi2_num_rounds() - Set the number of rounds for Multi2 in * data_out_addr[15:0] * * @pdesc: Pointer to HW descriptor struct * @num: Number of rounds for Multi2
*/ staticinlinevoid set_multi2_num_rounds(struct cc_hw_desc *pdesc, u32 num)
{
pdesc->word[2] = num;
}
/** * set_flow_mode() - Set the flow mode. * * @pdesc: Pointer to HW descriptor struct * @mode: Any one of the modes defined in [CC7x-DESC]
*/ staticinlinevoid set_flow_mode(struct cc_hw_desc *pdesc, enum cc_flow_mode mode)
{
pdesc->word[4] |= FIELD_PREP(WORD4_DATA_FLOW_MODE, mode);
}
/** * set_cipher_mode() - Set the cipher mode. * * @pdesc: Pointer to HW descriptor struct * @mode: Any one of the modes defined in [CC7x-DESC]
*/ staticinlinevoid set_cipher_mode(struct cc_hw_desc *pdesc, int mode)
{
pdesc->word[4] |= FIELD_PREP(WORD4_CIPHER_MODE, mode);
}
/** * set_hash_cipher_mode() - Set the cipher mode for hash algorithms. * * @pdesc: Pointer to HW descriptor struct * @cipher_mode: Any one of the modes defined in [CC7x-DESC] * @hash_mode: specifies which hash is being handled
*/ staticinlinevoid set_hash_cipher_mode(struct cc_hw_desc *pdesc, enum drv_cipher_mode cipher_mode, enum drv_hash_mode hash_mode)
{
set_cipher_mode(pdesc, cipher_mode); if (hash_mode == DRV_HASH_SM3)
set_aes_xor_crypto_key(pdesc);
}
/** * set_cipher_config0() - Set the cipher configuration fields. * * @pdesc: Pointer to HW descriptor struct * @mode: Any one of the modes defined in [CC7x-DESC]
*/ staticinlinevoid set_cipher_config0(struct cc_hw_desc *pdesc, int mode)
{
pdesc->word[4] |= FIELD_PREP(WORD4_CIPHER_CONF0, mode);
}
/** * set_key_size_des() - Set DES key size. * * @pdesc: Pointer to HW descriptor struct * @size: Key size in bytes (NOT size code)
*/ staticinlinevoid set_key_size_des(struct cc_hw_desc *pdesc, u32 size)
{
set_key_size(pdesc, ((size >> 3) - 1));
}
/** * set_setup_mode() - Set the descriptor setup mode * * @pdesc: Pointer to HW descriptor struct * @mode: Any one of the setup modes defined in [CC7x-DESC]
*/ staticinlinevoid set_setup_mode(struct cc_hw_desc *pdesc, enum cc_setup_op mode)
{
pdesc->word[4] |= FIELD_PREP(WORD4_SETUP_OPERATION, mode);
}
/** * set_cipher_do() - Set the descriptor cipher DO * * @pdesc: Pointer to HW descriptor struct * @config: Any one of the cipher do defined in [CC7x-DESC]
*/ staticinlinevoid set_cipher_do(struct cc_hw_desc *pdesc, enum cc_hash_cipher_pad config)
{
pdesc->word[4] |= FIELD_PREP(WORD4_CIPHER_DO,
(config & HW_KEY_MASK_CIPHER_DO));
}
#endif/*__CC_HW_QUEUE_DEFS_H__*/
Messung V0.5
¤ Dauer der Verarbeitung: 0.12 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.