Lines Matching +full:secure +full:- +full:reg +full:- +full:access
1 /* SPDX-License-Identifier: GPL-2.0 */
3 * CAAM hardware register-level view
5 * Copyright 2008-2011 Freescale Semiconductor, Inc.
15 #include <linux/io-64-nonatomic-hi-lo.h>
18 * Architecture-specific register access methods
20 * CAAM's bus-addressable registers are 64 bits internally.
21 * They have been wired to be safely accessible on 32-bit
24 * can be treated as two 32-bit entities, or finally (c) if they
25 * must be treated as a single 64-bit value, then this can safely
26 * be done with two 32-bit cycles.
28 * For 32-bit operations on 64-bit values, CAAM follows the same
29 * 64-bit register access conventions as it's predecessors, in that
31 * higher address, thus, a full 64-bit write cycle requires a write
37 * - SWRST is in bit 31 of MCFG.
38 * - MCFG begins at base+0x0000.
39 * - Bits 63-32 are a 32-bit word at base+0x0000 (numerically-lower)
40 * - Bits 31-0 are a 32-bit word at base+0x0004 (numerically-higher)
42 * (and on Power, the convention is 0-31, 32-63, I know...)
44 * Assuming a 64-bit write to this MCFG to perform a software reset
49 * Of course, since MCFG 63-32 is all zero, we could cheat and simply
51 * However, since CAAM does contain some write-and-read-intended
52 * 64-bit registers, this code defines 64-bit access methods for
54 * clean transition to 64-bit is possible when it becomes necessary.
57 * 32-bit architectures cannot enforce an atomic-64 operation,
60 * - On writes, since the HW is assumed to latch the cycle on the
61 * write of the higher-numeric-address word, then ordered
64 * - For reads, where a register contains a relevant value of more
101 static inline void wr_reg32(void __iomem *reg, u32 data) in wr_reg32() argument
104 iowrite32(data, reg); in wr_reg32()
106 iowrite32be(data, reg); in wr_reg32()
109 static inline u32 rd_reg32(void __iomem *reg) in rd_reg32() argument
112 return ioread32(reg); in rd_reg32()
114 return ioread32be(reg); in rd_reg32()
117 static inline void clrsetbits_32(void __iomem *reg, u32 clear, u32 set) in clrsetbits_32() argument
120 iowrite32((ioread32(reg) & ~clear) | set, reg); in clrsetbits_32()
122 iowrite32be((ioread32be(reg) & ~clear) | set, reg); in clrsetbits_32()
132 * base + 0x0000 : most-significant 32 bits
133 * base + 0x0004 : least-significant 32 bits
135 * The 32-bit version of this core therefore has to write to base + 0x0004
136 * to set the 32-bit wide DMA address.
139 * base + 0x0000 : least-significant 32 bits
140 * base + 0x0004 : most-significant 32 bits
142 static inline void wr_reg64(void __iomem *reg, u64 data) in wr_reg64() argument
146 iowrite32(data >> 32, (u32 __iomem *)(reg)); in wr_reg64()
147 iowrite32(data, (u32 __iomem *)(reg) + 1); in wr_reg64()
149 iowrite64(data, reg); in wr_reg64()
152 iowrite64be(data, reg); in wr_reg64()
156 static inline u64 rd_reg64(void __iomem *reg) in rd_reg64() argument
162 high = ioread32(reg); in rd_reg64()
163 low = ioread32(reg + sizeof(u32)); in rd_reg64()
167 return ioread64(reg); in rd_reg64()
170 return ioread64be(reg); in rd_reg64()
281 /* Version registers (Era 10+) e80-eff */
322 /* CHA Miscellaneous Information - AESA_MISC specific */
326 * caam_perfmon - Performance Monitor/Secure Memory Status/
329 * Spans f00-fff wherever instantiated
392 /* Performance Monitor Registers f00-f9f */
393 u64 req_dequeued; /* PC_REQ_DEQ - Dequeued Requests */
394 u64 ob_enc_req; /* PC_OB_ENC_REQ - Outbound Encrypt Requests */
395 u64 ib_dec_req; /* PC_IB_DEC_REQ - Inbound Decrypt Requests */
396 u64 ob_enc_bytes; /* PC_OB_ENCRYPT - Outbound Bytes Encrypted */
397 u64 ob_prot_bytes; /* PC_OB_PROTECT - Outbound Bytes Protected */
398 u64 ib_dec_bytes; /* PC_IB_DECRYPT - Inbound Bytes Decrypted */
402 /* CAAM Hardware Instantiation Parameters fa0-fbf */
403 u32 cha_rev_ms; /* CRNR - CHA Rev No. Most significant half*/
404 u32 cha_rev_ls; /* CRNR - CHA Rev No. Least significant half*/
413 u32 comp_parms_ms; /* CTPR - Compile Parameters Register */
414 u32 comp_parms_ls; /* CTPR - Compile Parameters Register */
417 /* CAAM Global Status fc0-fdf */
418 u64 faultaddr; /* FAR - Fault Address */
419 u32 faultliodn; /* FALR - Fault Address LIODN */
420 u32 faultdetail; /* FADR - Fault Addr Detail */
424 u32 status; /* CSTA - CAAM Status */
427 /* Component Instantiation Parameters fe0-fff */
428 u32 rtic_id; /* RVID - RTIC Version ID */
431 u32 ccb_id; /* CCBVID - CCB Version ID */
432 u32 cha_id_ms; /* CHAVID - CHA Version ID Most Significant*/
433 u32 cha_id_ls; /* CHAVID - CHA Version ID Least Significant*/
434 u32 cha_num_ms; /* CHANUM - CHA Number Most Significant */
435 u32 cha_num_ls; /* CHANUM - CHA Number Least Significant*/
440 u32 caam_id_ms; /* CAAMVID - CAAM Version ID MS */
441 u32 caam_id_ls; /* CAAMVID - CAAM Version ID LS */
450 u32 liodn_ms; /* lock and make-trusted control bits */
451 u32 liodn_ls; /* LIODN for non-sequence and seq access */
463 u32 mode; /* RTSTMODEx - Test mode */
465 u32 reset; /* RTSTRESETx - Test reset control */
467 u32 status; /* RTSTSSTATUSx - Test status */
469 u32 errstat; /* RTSTERRSTATx - Test error status */
471 u32 errctl; /* RTSTERRCTLx - Test error control */
473 u32 entropy; /* RTSTENTROPYx - Test entropy */
475 u32 verifctl; /* RTSTVERIFCTLx - Test verification control */
477 u32 verifstat; /* RTSTVERIFSTATx - Test verification status */
479 u32 verifdata; /* RTSTVERIFDx - Test verification data */
481 u32 xkey; /* RTSTXKEYx - Test XKEY */
483 u32 oscctctl; /* RTSTOSCCTCTLx - Test osc. counter control */
485 u32 oscct; /* RTSTOSCCTx - Test oscillator counter */
487 u32 oscctstat; /* RTSTODCCTSTATx - Test osc counter status */
489 u32 ofifo[4]; /* RTSTOFIFOx - Test output FIFO */
495 #define RTMCTL_ACC BIT(5) /* TRNG access mode */
496 #define RTMCTL_PRGM BIT(16) /* 1 -> program mode, 0 -> run mode */
542 * caam_ctrl - basic core configuration
558 /* Basic Configuration Section 000-01f */
565 /* Bus Access Configuration Section 010-11f */
567 struct masterid jr_mid[4]; /* JRxLIODNR - JobR LIODN setup */
569 u32 jrstart; /* JRSTART - Job Ring Start Register */
570 struct masterid rtic_mid[4]; /* RTICxLIODNR - RTIC LIODN setup */
572 u32 deco_rsr; /* DECORSR - Deco Request Source */
574 u32 deco_rq; /* DECORR - DECO Request */
575 struct partid deco_mid[5]; /* DECOxLIODNR - 1 per DECO */
578 /* DECO Availability/Reset Section 120-3ff */
579 u32 deco_avail; /* DAR - DECO availability */
580 u32 deco_reset; /* DRR - DECO reset */
583 /* Key Encryption/Decryption Configuration 400-5ff */
584 /* Read/Writable only while in Non-secure mode */
585 u32 kek[KEK_KEY_SIZE]; /* JDKEKR - Key Encryption Key */
586 u32 tkek[TKEK_KEY_SIZE]; /* TDKEKR - Trusted Desc KEK */
587 u32 tdsk[TDSK_KEY_SIZE]; /* TDSKR - Trusted Desc Signing Key */
589 u64 sknonce; /* SKNR - Secure Key Nonce */
592 /* RNG Test/Verification/Debug Access 600-7ff */
601 /* Version registers - introduced with era 10 e80-eff */
603 /* Performance Monitor f00-fff */
612 #define MCFGR_WDFAIL 0x20000000 /* DECO watchdog force-fail */
614 #define MCFGR_LONG_PTR 0x00010000 /* Use >32-bit desc addressing */
617 #define DECORR_RQD0ENABLE 0x00000001 /* Enable DECO0 for direct access */
620 #define DECORR_DEN0 0x00010000 /* DECO0 available for access*/
641 #define MCFGR_LARGE_BURST 0x00000004 /* 128/256-byte burst size */
642 #define MCFGR_BURST_64 0x00000001 /* 64-byte burst size */
651 * caam_job_ring - direct job ring setup
652 * 1-4 possible per instantiation, base + 1000/2000/3000/4000
657 u64 inpring_base; /* IRBAx - Input desc ring baseaddr */
659 u32 inpring_size; /* IRSx - Input ring size */
661 u32 inpring_avail; /* IRSAx - Input ring room remaining */
663 u32 inpring_jobadd; /* IRJAx - Input ring jobs added */
666 u64 outring_base; /* ORBAx - Output status ring base addr */
668 u32 outring_size; /* ORSx - Output ring size */
670 u32 outring_rmvd; /* ORJRx - Output ring jobs removed */
672 u32 outring_used; /* ORSFx - Output ring slots full */
676 u32 jroutstatus; /* JRSTAx - JobR output status */
678 u32 jrintstatus; /* JRINTx - JobR interrupt status */
679 u32 rconfig_hi; /* JRxCFG - Ring configuration */
684 u32 inp_rdidx; /* IRRIx - Input ring read index */
686 u32 out_wtidx; /* ORWIx - Output ring write index */
690 u32 jrcommand; /* JRCRx - JobR command */
694 /* Version registers - introduced with era 10 e80-eff */
696 /* Performance Monitor f00-fff */
702 * jrstatus - Job Ring Output Status
821 * caam_assurance - Assurance Controller View
843 u32 status; /* RSTA - Status */
845 u32 cmd; /* RCMD - Command */
847 u32 ctrl; /* RCTL - Control */
849 u32 throttle; /* RTHR - Throttle */
851 u64 watchdog; /* RWDOG - Watchdog Timer */
853 u32 rend; /* REND - Endian corrections */
856 /* Block access/configuration @ 100/110/120/130 */
857 struct rtic_block memblk[4]; /* Memory Blocks A-D */
861 struct rtic_memhash hash[4]; /* Block hash values A-D */
866 * caam_queue_if - QI configuration and control
871 u32 qi_control_hi; /* QICTL - QI Control */
874 u32 qi_status; /* QISTA - QI Status */
875 u32 qi_deq_cfg_hi; /* QIDQC - QI Dequeue Configuration */
877 u32 qi_enq_cfg_hi; /* QISEQC - QI Enqueue Command */
882 /* QI control bits - low word */
887 /* QI control bits - high word */
916 /* deco_sg_table - DECO view of scatter/gather table */
919 u32 elen; /* E, F bits + 30-bit length */
920 u32 bpid_offset; /* Buffer Pool ID + 16-bit length */
924 * caam_deco - descriptor controller - CHA cluster block
926 * Only accessible when direct DECO access is turned on
934 u32 cls1_mode; /* CxC1MR - Class 1 Mode */
936 u32 cls1_keysize; /* CxC1KSR - Class 1 Key Size */
937 u32 cls1_datasize_hi; /* CxC1DSR - Class 1 Data Size */
940 u32 cls1_icvsize; /* CxC1ICVSR - Class 1 ICV size */
942 u32 cha_ctrl; /* CCTLR - CHA control */
944 u32 irq_crtl; /* CxCIRQ - CCB interrupt done/error/clear */
946 u32 clr_written; /* CxCWR - Clear-Written */
947 u32 ccb_status_hi; /* CxCSTA - CCB Status/Error */
950 u32 aad_size; /* CxAADSZR - Current AAD Size */
952 u32 cls1_iv_size; /* CxC1IVSZR - Current Class 1 IV Size */
954 u32 pkha_a_size; /* PKASZRx - Size of PKHA A */
956 u32 pkha_b_size; /* PKBSZRx - Size of PKHA B */
958 u32 pkha_n_size; /* PKNSZRx - Size of PKHA N */
960 u32 pkha_e_size; /* PKESZRx - Size of PKHA E */
962 u32 cls1_ctx[16]; /* CxC1CTXR - Class 1 Context @100 */
964 u32 cls1_key[8]; /* CxC1KEYR - Class 1 Key @200 */
966 u32 cls2_mode; /* CxC2MR - Class 2 Mode */
968 u32 cls2_keysize; /* CxX2KSR - Class 2 Key Size */
969 u32 cls2_datasize_hi; /* CxC2DSR - Class 2 Data Size */
972 u32 cls2_icvsize; /* CxC2ICVSZR - Class 2 ICV Size */
974 u32 cls2_ctx[18]; /* CxC2CTXR - Class 2 Context @500 */
976 u32 cls2_key[32]; /* CxC2KEYR - Class2 Key @600 */
978 u32 inp_infofifo_hi; /* CxIFIFO - Input Info FIFO @7d0 */
981 u64 inp_datafifo; /* CxDFIFO - Input Data FIFO */
983 u64 out_datafifo; /* CxOFIFO - Output Data FIFO */
985 u32 jr_ctl_hi; /* CxJRR - JobR Control Register @800 */
987 u64 jr_descaddr; /* CxDADR - JobR Descriptor Address */
989 u32 op_status_hi; /* DxOPSTA - DECO Operation Status */
992 u32 liodn; /* DxLSR - DECO LIODN Status - non-seq */
993 u32 td_liodn; /* DxLSR - DECO LIODN Status - trustdesc */
995 u64 math[4]; /* DxMTH - Math register */
997 struct deco_sg_table gthr_tbl[4]; /* DxGTR - Gather Tables */
999 struct deco_sg_table sctr_tbl[4]; /* DxSTR - Scatter Tables */
1001 u32 descbuf[64]; /* DxDESB - Descriptor buffer */
1006 u32 desc_dbg; /* DxDDR - DECO Debug Register */
1010 u32 dbg_exec; /* DxDER - DECO Debug Exec Register */