/* * Architecture-specific register access methods * * CAAM's bus-addressable registers are 64 bits internally. * They have been wired to be safely accessible on 32-bit * architectures, however. Registers were organized such * that (a) they can be contained in 32 bits, (b) if not, then they * can be treated as two 32-bit entities, or finally (c) if they * must be treated as a single 64-bit value, then this can safely * be done with two 32-bit cycles. * * For 32-bit operations on 64-bit values, CAAM follows the same * 64-bit register access conventions as it's predecessors, in that * writes are "triggered" by a write to the register at the numerically * higher address, thus, a full 64-bit write cycle requires a write * to the lower address, followed by a write to the higher address, * which will latch/execute the write cycle. * * For example, let's assume a SW reset of CAAM through the master * configuration register. * - SWRST is in bit 31 of MCFG. * - MCFG begins at base+0x0000. * - Bits 63-32 are a 32-bit word at base+0x0000 (numerically-lower) * - Bits 31-0 are a 32-bit word at base+0x0004 (numerically-higher) * * (and on Power, the convention is 0-31, 32-63, I know...) * * Assuming a 64-bit write to this MCFG to perform a software reset * would then require a write of 0 to base+0x0000, followed by a * write of 0x80000000 to base+0x0004, which would "execute" the * reset. * * Of course, since MCFG 63-32 is all zero, we could cheat and simply * write 0x8000000 to base+0x0004, and the reset would work fine. * However, since CAAM does contain some write-and-read-intended * 64-bit registers, this code defines 64-bit access methods for * the sake of internal consistency and simplicity, and so that a * clean transition to 64-bit is possible when it becomes necessary. * * There are limitations to this that the developer must recognize. * 32-bit architectures cannot enforce an atomic-64 operation, * Therefore: * * - On writes, since the HW is assumed to latch the cycle on the * write of the higher-numeric-address word, then ordered * writes work OK. * * - For reads, where a register contains a relevant value of more * that 32 bits, the hardware employs logic to latch the other * "half" of the data until read, ensuring an accurate value. * This is of particular relevance when dealing with CAAM's * performance counters. *
*/
/* * The only users of these wr/rd_reg64 functions is the Job Ring (JR). * The DMA address registers in the JR are handled differently depending on * platform: * * 1. All BE CAAM platforms and i.MX platforms (LE CAAM): * * base + 0x0000 : most-significant 32 bits * base + 0x0004 : least-significant 32 bits * * The 32-bit version of this core therefore has to write to base + 0x0004 * to set the 32-bit wide DMA address. * * 2. All other LE CAAM platforms (LS1021A etc.) * base + 0x0000 : least-significant 32 bits * base + 0x0004 : most-significant 32 bits
*/ staticinlinevoid wr_reg64(void __iomem *reg, u64 data)
{ if (caam_little_end) { if (caam_imx) {
iowrite32(data >> 32, (u32 __iomem *)(reg));
iowrite32(data, (u32 __iomem *)(reg) + 1);
} else {
iowrite64(data, reg);
}
} else {
iowrite64be(data, reg);
}
}
staticinline u64 rd_reg64(void __iomem *reg)
{ if (caam_little_end) { if (caam_imx) {
u32 low, high;
high = ioread32(reg);
low = ioread32(reg + sizeof(u32));
/* Number of DECOs */ #define CHA_NUM_MS_DECONUM_SHIFT 24 #define CHA_NUM_MS_DECONUM_MASK (0xfull << CHA_NUM_MS_DECONUM_SHIFT)
/* * CHA version IDs / instantiation bitfields (< Era 10) * Defined for use with the cha_id fields in perfmon, but the same shift/mask * selectors can be used to pull out the number of instantiated blocks within * cha_num fields in perfmon because the locations are the same.
*/ #define CHA_ID_LS_AES_SHIFT 0 #define CHA_ID_LS_AES_MASK (0xfull << CHA_ID_LS_AES_SHIFT)
/* Component Instantiation Parameters fe0-fff */
u32 rtic_id; /* RVID - RTIC Version ID */ #define CCBVID_ERA_MASK 0xff000000 #define CCBVID_ERA_SHIFT 24
u32 ccb_id; /* CCBVID - CCB Version ID */
u32 cha_id_ms; /* CHAVID - CHA Version ID Most Significant*/
u32 cha_id_ls; /* CHAVID - CHA Version ID Least Significant*/
u32 cha_num_ms; /* CHANUM - CHA Number Most Significant */
u32 cha_num_ls; /* CHANUM - CHA Number Least Significant*/ #define SECVID_MS_IPID_MASK 0xffff0000 #define SECVID_MS_IPID_SHIFT 16 #define SECVID_MS_MAJ_REV_MASK 0x0000ff00 #define SECVID_MS_MAJ_REV_SHIFT 8
u32 caam_id_ms; /* CAAMVID - CAAM Version ID MS */
u32 caam_id_ls; /* CAAMVID - CAAM Version ID LS */
};
/* LIODN programming for DMA configuration */ #define MSTRID_LOCK_LIODN 0x80000000 #define MSTRID_LOCK_MAKETRUSTED 0x00010000 /* only for JR masterid */
#define MSTRID_LIODN_MASK 0x0fff struct masterid {
u32 liodn_ms; /* lock and make-trusted control bits */
u32 liodn_ls; /* LIODN for non-sequence and seq access */
};
/* RNGB test mode (replicated twice in some configurations) */ /* Padded out to 0x100 */ struct rngtst {
u32 mode; /* RTSTMODEx - Test mode */
u32 rsvd1[3];
u32 reset; /* RTSTRESETx - Test reset control */
u32 rsvd2[3];
u32 status; /* RTSTSSTATUSx - Test status */
u32 rsvd3;
u32 errstat; /* RTSTERRSTATx - Test error status */
u32 rsvd4;
u32 errctl; /* RTSTERRCTLx - Test error control */
u32 rsvd5;
u32 entropy; /* RTSTENTROPYx - Test entropy */
u32 rsvd6[15];
u32 verifctl; /* RTSTVERIFCTLx - Test verification control */
u32 rsvd7;
u32 verifstat; /* RTSTVERIFSTATx - Test verification status */
u32 rsvd8;
u32 verifdata; /* RTSTVERIFDx - Test verification data */
u32 rsvd9;
u32 xkey; /* RTSTXKEYx - Test XKEY */
u32 rsvd10;
u32 oscctctl; /* RTSTOSCCTCTLx - Test osc. counter control */
u32 rsvd11;
u32 oscct; /* RTSTOSCCTx - Test oscillator counter */
u32 rsvd12;
u32 oscctstat; /* RTSTODCCTSTATx - Test osc counter status */
u32 rsvd13[2];
u32 ofifo[4]; /* RTSTOFIFOx - Test output FIFO */
u32 rsvd14[15];
};
/* RNG4 TRNG test registers */ struct rng4tst { #define RTMCTL_ACC BIT(5) /* TRNG access mode */ #define RTMCTL_PRGM BIT(16) /* 1 -> program mode, 0 -> run mode */ #define RTMCTL_SAMP_MODE_VON_NEUMANN_ES_SC 0 /* use von Neumann data in both entropy shifter and
statistical checker */ #define RTMCTL_SAMP_MODE_RAW_ES_SC 1 /* use raw data in both entropy shifter and
statistical checker */ #define RTMCTL_SAMP_MODE_VON_NEUMANN_ES_RAW_SC 2 /* use von Neumann data in entropy shifter, raw data
in statistical checker */ #define RTMCTL_SAMP_MODE_INVALID 3 /* invalid combination */
u32 rtmctl; /* misc. control register */
u32 rtscmisc; /* statistical check misc. register */
u32 rtpkrrng; /* poker range register */ union {
u32 rtpkrmax; /* PRGM=1: poker max. limit register */
u32 rtpkrsq; /* PRGM=0: poker square calc. result register */
}; #define RTSDCTL_ENT_DLY_SHIFT 16 #define RTSDCTL_ENT_DLY_MASK (0xffff << RTSDCTL_ENT_DLY_SHIFT) #define RTSDCTL_ENT_DLY_MIN 3200 #define RTSDCTL_ENT_DLY_MAX 12800 #define RTSDCTL_SAMP_SIZE_MASK 0xffff #define RTSDCTL_SAMP_SIZE_VAL 512
u32 rtsdctl; /* seed control register */ union {
u32 rtsblim; /* PRGM=1: sparse bit limit register */
u32 rttotsam; /* PRGM=0: total samples register */
};
u32 rtfrqmin; /* frequency count min. limit register */ #define RTFRQMAX_DISABLE (1 << 20) union {
u32 rtfrqmax; /* PRGM=1: freq. count max. limit register */
u32 rtfrqcnt; /* PRGM=0: freq. count register */
}; union {
u32 rtscmc; /* statistical check run monobit count */
u32 rtscml; /* statistical check run monobit limit */
}; union {
u32 rtscrc[6]; /* statistical check run length count */
u32 rtscrl[6]; /* statistical check run length limit */
};
u32 rsvd1[33]; #define RDSTA_SKVT 0x80000000 #define RDSTA_SKVN 0x40000000 #define RDSTA_PR0 BIT(4) #define RDSTA_PR1 BIT(5) #define RDSTA_IF0 0x00000001 #define RDSTA_IF1 0x00000002 #define RDSTA_MASK (RDSTA_PR1 | RDSTA_PR0 | RDSTA_IF1 | RDSTA_IF0)
u32 rdsta;
u32 rsvd2[15];
};
/* * caam_ctrl - basic core configuration * starts base + 0x0000 padded out to 0x1000
*/
/* Indices. CAAM maintains as "heads" of each queue */
u32 rsvd9;
u32 inp_rdidx; /* IRRIx - Input ring read index */
u32 rsvd10;
u32 out_wtidx; /* ORWIx - Output ring write index */
/* Version registers - introduced with era 10 e80-eff */ struct version_regs vreg; /* Performance Monitor f00-fff */ struct caam_perfmon perfmon;
};
#define JR_RINGSIZE_MASK 0x03ff /* * jrstatus - Job Ring Output Status * All values in lo word * Also note, same values written out as status through QI * in the command/status field of a frame descriptor
*/ #define JRSTA_SSRC_SHIFT 28 #define JRSTA_SSRC_MASK 0xf0000000
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.