/*1* CAAM hardware register-level view2*3* Copyright 2008-2011 Freescale Semiconductor, Inc.4*/56#ifndef REGS_H7#define REGS_H89#include <linux/types.h>10#include <linux/io.h>1112/*13* Architecture-specific register access methods14*15* CAAM's bus-addressable registers are 64 bits internally.16* They have been wired to be safely accessible on 32-bit17* architectures, however. Registers were organized such18* that (a) they can be contained in 32 bits, (b) if not, then they19* can be treated as two 32-bit entities, or finally (c) if they20* must be treated as a single 64-bit value, then this can safely21* be done with two 32-bit cycles.22*23* For 32-bit operations on 64-bit values, CAAM follows the same24* 64-bit register access conventions as it's predecessors, in that25* writes are "triggered" by a write to the register at the numerically26* higher address, thus, a full 64-bit write cycle requires a write27* to the lower address, followed by a write to the higher address,28* which will latch/execute the write cycle.29*30* For example, let's assume a SW reset of CAAM through the master31* configuration register.32* - SWRST is in bit 31 of MCFG.33* - MCFG begins at base+0x0000.34* - Bits 63-32 are a 32-bit word at base+0x0000 (numerically-lower)35* - Bits 31-0 are a 32-bit word at base+0x0004 (numerically-higher)36*37* (and on Power, the convention is 0-31, 32-63, I know...)38*39* Assuming a 64-bit write to this MCFG to perform a software reset40* would then require a write of 0 to base+0x0000, followed by a41* write of 0x80000000 to base+0x0004, which would "execute" the42* reset.43*44* Of course, since MCFG 63-32 is all zero, we could cheat and simply45* write 0x8000000 to base+0x0004, and the reset would work fine.46* However, since CAAM does contain some write-and-read-intended47* 64-bit registers, this code defines 64-bit access methods for48* the sake of internal consistency and simplicity, and so that a49* clean transition to 64-bit is possible when it becomes necessary.50*51* There are limitations to this that the developer must recognize.52* 32-bit architectures cannot enforce an atomic-64 operation,53* Therefore:54*55* - On writes, since the HW is assumed to latch the cycle on the56* write of the higher-numeric-address word, then ordered57* writes work OK.58*59* - For reads, where a register contains a relevant value of more60* that 32 bits, the hardware employs logic to latch the other61* "half" of the data until read, ensuring an accurate value.62* This is of particular relevance when dealing with CAAM's63* performance counters.64*65*/6667#ifdef __BIG_ENDIAN68#define wr_reg32(reg, data) out_be32(reg, data)69#define rd_reg32(reg) in_be32(reg)70#ifdef CONFIG_64BIT71#define wr_reg64(reg, data) out_be64(reg, data)72#define rd_reg64(reg) in_be64(reg)73#endif74#else75#ifdef __LITTLE_ENDIAN76#define wr_reg32(reg, data) __raw_writel(reg, data)77#define rd_reg32(reg) __raw_readl(reg)78#ifdef CONFIG_64BIT79#define wr_reg64(reg, data) __raw_writeq(reg, data)80#define rd_reg64(reg) __raw_readq(reg)81#endif82#endif83#endif8485#ifndef CONFIG_64BIT86static inline void wr_reg64(u64 __iomem *reg, u64 data)87{88wr_reg32((u32 __iomem *)reg, (data & 0xffffffff00000000ull) >> 32);89wr_reg32((u32 __iomem *)reg + 1, data & 0x00000000ffffffffull);90}9192static inline u64 rd_reg64(u64 __iomem *reg)93{94return (((u64)rd_reg32((u32 __iomem *)reg)) << 32) |95((u64)rd_reg32((u32 __iomem *)reg + 1));96}97#endif9899/*100* jr_outentry101* Represents each entry in a JobR output ring102*/103struct jr_outentry {104dma_addr_t desc;/* Pointer to completed descriptor */105u32 jrstatus; /* Status for completed descriptor */106} __packed;107108/*109* caam_perfmon - Performance Monitor/Secure Memory Status/110* CAAM Global Status/Component Version IDs111*112* Spans f00-fff wherever instantiated113*/114115/* Number of DECOs */116#define CHA_NUM_DECONUM_SHIFT 56117#define CHA_NUM_DECONUM_MASK (0xfull << CHA_NUM_DECONUM_SHIFT)118119struct caam_perfmon {120/* Performance Monitor Registers f00-f9f */121u64 req_dequeued; /* PC_REQ_DEQ - Dequeued Requests */122u64 ob_enc_req; /* PC_OB_ENC_REQ - Outbound Encrypt Requests */123u64 ib_dec_req; /* PC_IB_DEC_REQ - Inbound Decrypt Requests */124u64 ob_enc_bytes; /* PC_OB_ENCRYPT - Outbound Bytes Encrypted */125u64 ob_prot_bytes; /* PC_OB_PROTECT - Outbound Bytes Protected */126u64 ib_dec_bytes; /* PC_IB_DECRYPT - Inbound Bytes Decrypted */127u64 ib_valid_bytes; /* PC_IB_VALIDATED Inbound Bytes Validated */128u64 rsvd[13];129130/* CAAM Hardware Instantiation Parameters fa0-fbf */131u64 cha_rev; /* CRNR - CHA Revision Number */132#define CTPR_QI_SHIFT 57133#define CTPR_QI_MASK (0x1ull << CTPR_QI_SHIFT)134u64 comp_parms; /* CTPR - Compile Parameters Register */135u64 rsvd1[2];136137/* CAAM Global Status fc0-fdf */138u64 faultaddr; /* FAR - Fault Address */139u32 faultliodn; /* FALR - Fault Address LIODN */140u32 faultdetail; /* FADR - Fault Addr Detail */141u32 rsvd2;142u32 status; /* CSTA - CAAM Status */143u64 rsvd3;144145/* Component Instantiation Parameters fe0-fff */146u32 rtic_id; /* RVID - RTIC Version ID */147u32 ccb_id; /* CCBVID - CCB Version ID */148u64 cha_id; /* CHAVID - CHA Version ID */149u64 cha_num; /* CHANUM - CHA Number */150u64 caam_id; /* CAAMVID - CAAM Version ID */151};152153/* LIODN programming for DMA configuration */154#define MSTRID_LOCK_LIODN 0x80000000155#define MSTRID_LOCK_MAKETRUSTED 0x00010000 /* only for JR masterid */156157#define MSTRID_LIODN_MASK 0x0fff158struct masterid {159u32 liodn_ms; /* lock and make-trusted control bits */160u32 liodn_ls; /* LIODN for non-sequence and seq access */161};162163/* Partition ID for DMA configuration */164struct partid {165u32 rsvd1;166u32 pidr; /* partition ID, DECO */167};168169/* RNG test mode (replicated twice in some configurations) */170/* Padded out to 0x100 */171struct rngtst {172u32 mode; /* RTSTMODEx - Test mode */173u32 rsvd1[3];174u32 reset; /* RTSTRESETx - Test reset control */175u32 rsvd2[3];176u32 status; /* RTSTSSTATUSx - Test status */177u32 rsvd3;178u32 errstat; /* RTSTERRSTATx - Test error status */179u32 rsvd4;180u32 errctl; /* RTSTERRCTLx - Test error control */181u32 rsvd5;182u32 entropy; /* RTSTENTROPYx - Test entropy */183u32 rsvd6[15];184u32 verifctl; /* RTSTVERIFCTLx - Test verification control */185u32 rsvd7;186u32 verifstat; /* RTSTVERIFSTATx - Test verification status */187u32 rsvd8;188u32 verifdata; /* RTSTVERIFDx - Test verification data */189u32 rsvd9;190u32 xkey; /* RTSTXKEYx - Test XKEY */191u32 rsvd10;192u32 oscctctl; /* RTSTOSCCTCTLx - Test osc. counter control */193u32 rsvd11;194u32 oscct; /* RTSTOSCCTx - Test oscillator counter */195u32 rsvd12;196u32 oscctstat; /* RTSTODCCTSTATx - Test osc counter status */197u32 rsvd13[2];198u32 ofifo[4]; /* RTSTOFIFOx - Test output FIFO */199u32 rsvd14[15];200};201202/*203* caam_ctrl - basic core configuration204* starts base + 0x0000 padded out to 0x1000205*/206207#define KEK_KEY_SIZE 8208#define TKEK_KEY_SIZE 8209#define TDSK_KEY_SIZE 8210211#define DECO_RESET 1 /* Use with DECO reset/availability regs */212#define DECO_RESET_0 (DECO_RESET << 0)213#define DECO_RESET_1 (DECO_RESET << 1)214#define DECO_RESET_2 (DECO_RESET << 2)215#define DECO_RESET_3 (DECO_RESET << 3)216#define DECO_RESET_4 (DECO_RESET << 4)217218struct caam_ctrl {219/* Basic Configuration Section 000-01f */220/* Read/Writable */221u32 rsvd1;222u32 mcr; /* MCFG Master Config Register */223u32 rsvd2[2];224225/* Bus Access Configuration Section 010-11f */226/* Read/Writable */227struct masterid jr_mid[4]; /* JRxLIODNR - JobR LIODN setup */228u32 rsvd3[12];229struct masterid rtic_mid[4]; /* RTICxLIODNR - RTIC LIODN setup */230u32 rsvd4[7];231u32 deco_rq; /* DECORR - DECO Request */232struct partid deco_mid[5]; /* DECOxLIODNR - 1 per DECO */233u32 rsvd5[22];234235/* DECO Availability/Reset Section 120-3ff */236u32 deco_avail; /* DAR - DECO availability */237u32 deco_reset; /* DRR - DECO reset */238u32 rsvd6[182];239240/* Key Encryption/Decryption Configuration 400-5ff */241/* Read/Writable only while in Non-secure mode */242u32 kek[KEK_KEY_SIZE]; /* JDKEKR - Key Encryption Key */243u32 tkek[TKEK_KEY_SIZE]; /* TDKEKR - Trusted Desc KEK */244u32 tdsk[TDSK_KEY_SIZE]; /* TDSKR - Trusted Desc Signing Key */245u32 rsvd7[32];246u64 sknonce; /* SKNR - Secure Key Nonce */247u32 rsvd8[70];248249/* RNG Test/Verification/Debug Access 600-7ff */250/* (Useful in Test/Debug modes only...) */251struct rngtst rtst[2];252253u32 rsvd9[448];254255/* Performance Monitor f00-fff */256struct caam_perfmon perfmon;257};258259/*260* Controller master config register defs261*/262#define MCFGR_SWRESET 0x80000000 /* software reset */263#define MCFGR_WDENABLE 0x40000000 /* DECO watchdog enable */264#define MCFGR_WDFAIL 0x20000000 /* DECO watchdog force-fail */265#define MCFGR_DMA_RESET 0x10000000266#define MCFGR_LONG_PTR 0x00010000 /* Use >32-bit desc addressing */267268/* AXI read cache control */269#define MCFGR_ARCACHE_SHIFT 12270#define MCFGR_ARCACHE_MASK (0xf << MCFGR_ARCACHE_SHIFT)271272/* AXI write cache control */273#define MCFGR_AWCACHE_SHIFT 8274#define MCFGR_AWCACHE_MASK (0xf << MCFGR_AWCACHE_SHIFT)275276/* AXI pipeline depth */277#define MCFGR_AXIPIPE_SHIFT 4278#define MCFGR_AXIPIPE_MASK (0xf << MCFGR_AXIPIPE_SHIFT)279280#define MCFGR_AXIPRI 0x00000008 /* Assert AXI priority sideband */281#define MCFGR_BURST_64 0x00000001 /* Max burst size */282283/*284* caam_job_ring - direct job ring setup285* 1-4 possible per instantiation, base + 1000/2000/3000/4000286* Padded out to 0x1000287*/288struct caam_job_ring {289/* Input ring */290u64 inpring_base; /* IRBAx - Input desc ring baseaddr */291u32 rsvd1;292u32 inpring_size; /* IRSx - Input ring size */293u32 rsvd2;294u32 inpring_avail; /* IRSAx - Input ring room remaining */295u32 rsvd3;296u32 inpring_jobadd; /* IRJAx - Input ring jobs added */297298/* Output Ring */299u64 outring_base; /* ORBAx - Output status ring base addr */300u32 rsvd4;301u32 outring_size; /* ORSx - Output ring size */302u32 rsvd5;303u32 outring_rmvd; /* ORJRx - Output ring jobs removed */304u32 rsvd6;305u32 outring_used; /* ORSFx - Output ring slots full */306307/* Status/Configuration */308u32 rsvd7;309u32 jroutstatus; /* JRSTAx - JobR output status */310u32 rsvd8;311u32 jrintstatus; /* JRINTx - JobR interrupt status */312u32 rconfig_hi; /* JRxCFG - Ring configuration */313u32 rconfig_lo;314315/* Indices. CAAM maintains as "heads" of each queue */316u32 rsvd9;317u32 inp_rdidx; /* IRRIx - Input ring read index */318u32 rsvd10;319u32 out_wtidx; /* ORWIx - Output ring write index */320321/* Command/control */322u32 rsvd11;323u32 jrcommand; /* JRCRx - JobR command */324325u32 rsvd12[932];326327/* Performance Monitor f00-fff */328struct caam_perfmon perfmon;329};330331#define JR_RINGSIZE_MASK 0x03ff332/*333* jrstatus - Job Ring Output Status334* All values in lo word335* Also note, same values written out as status through QI336* in the command/status field of a frame descriptor337*/338#define JRSTA_SSRC_SHIFT 28339#define JRSTA_SSRC_MASK 0xf0000000340341#define JRSTA_SSRC_NONE 0x00000000342#define JRSTA_SSRC_CCB_ERROR 0x20000000343#define JRSTA_SSRC_JUMP_HALT_USER 0x30000000344#define JRSTA_SSRC_DECO 0x40000000345#define JRSTA_SSRC_JRERROR 0x60000000346#define JRSTA_SSRC_JUMP_HALT_CC 0x70000000347348#define JRSTA_DECOERR_JUMP 0x08000000349#define JRSTA_DECOERR_INDEX_SHIFT 8350#define JRSTA_DECOERR_INDEX_MASK 0xff00351#define JRSTA_DECOERR_ERROR_MASK 0x00ff352353#define JRSTA_DECOERR_NONE 0x00354#define JRSTA_DECOERR_LINKLEN 0x01355#define JRSTA_DECOERR_LINKPTR 0x02356#define JRSTA_DECOERR_JRCTRL 0x03357#define JRSTA_DECOERR_DESCCMD 0x04358#define JRSTA_DECOERR_ORDER 0x05359#define JRSTA_DECOERR_KEYCMD 0x06360#define JRSTA_DECOERR_LOADCMD 0x07361#define JRSTA_DECOERR_STORECMD 0x08362#define JRSTA_DECOERR_OPCMD 0x09363#define JRSTA_DECOERR_FIFOLDCMD 0x0a364#define JRSTA_DECOERR_FIFOSTCMD 0x0b365#define JRSTA_DECOERR_MOVECMD 0x0c366#define JRSTA_DECOERR_JUMPCMD 0x0d367#define JRSTA_DECOERR_MATHCMD 0x0e368#define JRSTA_DECOERR_SHASHCMD 0x0f369#define JRSTA_DECOERR_SEQCMD 0x10370#define JRSTA_DECOERR_DECOINTERNAL 0x11371#define JRSTA_DECOERR_SHDESCHDR 0x12372#define JRSTA_DECOERR_HDRLEN 0x13373#define JRSTA_DECOERR_BURSTER 0x14374#define JRSTA_DECOERR_DESCSIGNATURE 0x15375#define JRSTA_DECOERR_DMA 0x16376#define JRSTA_DECOERR_BURSTFIFO 0x17377#define JRSTA_DECOERR_JRRESET 0x1a378#define JRSTA_DECOERR_JOBFAIL 0x1b379#define JRSTA_DECOERR_DNRERR 0x80380#define JRSTA_DECOERR_UNDEFPCL 0x81381#define JRSTA_DECOERR_PDBERR 0x82382#define JRSTA_DECOERR_ANRPLY_LATE 0x83383#define JRSTA_DECOERR_ANRPLY_REPLAY 0x84384#define JRSTA_DECOERR_SEQOVF 0x85385#define JRSTA_DECOERR_INVSIGN 0x86386#define JRSTA_DECOERR_DSASIGN 0x87387388#define JRSTA_CCBERR_JUMP 0x08000000389#define JRSTA_CCBERR_INDEX_MASK 0xff00390#define JRSTA_CCBERR_INDEX_SHIFT 8391#define JRSTA_CCBERR_CHAID_MASK 0x00f0392#define JRSTA_CCBERR_CHAID_SHIFT 4393#define JRSTA_CCBERR_ERRID_MASK 0x000f394395#define JRSTA_CCBERR_CHAID_AES (0x01 << JRSTA_CCBERR_CHAID_SHIFT)396#define JRSTA_CCBERR_CHAID_DES (0x02 << JRSTA_CCBERR_CHAID_SHIFT)397#define JRSTA_CCBERR_CHAID_ARC4 (0x03 << JRSTA_CCBERR_CHAID_SHIFT)398#define JRSTA_CCBERR_CHAID_MD (0x04 << JRSTA_CCBERR_CHAID_SHIFT)399#define JRSTA_CCBERR_CHAID_RNG (0x05 << JRSTA_CCBERR_CHAID_SHIFT)400#define JRSTA_CCBERR_CHAID_SNOW (0x06 << JRSTA_CCBERR_CHAID_SHIFT)401#define JRSTA_CCBERR_CHAID_KASUMI (0x07 << JRSTA_CCBERR_CHAID_SHIFT)402#define JRSTA_CCBERR_CHAID_PK (0x08 << JRSTA_CCBERR_CHAID_SHIFT)403#define JRSTA_CCBERR_CHAID_CRC (0x09 << JRSTA_CCBERR_CHAID_SHIFT)404405#define JRSTA_CCBERR_ERRID_NONE 0x00406#define JRSTA_CCBERR_ERRID_MODE 0x01407#define JRSTA_CCBERR_ERRID_DATASIZ 0x02408#define JRSTA_CCBERR_ERRID_KEYSIZ 0x03409#define JRSTA_CCBERR_ERRID_PKAMEMSZ 0x04410#define JRSTA_CCBERR_ERRID_PKBMEMSZ 0x05411#define JRSTA_CCBERR_ERRID_SEQUENCE 0x06412#define JRSTA_CCBERR_ERRID_PKDIVZRO 0x07413#define JRSTA_CCBERR_ERRID_PKMODEVN 0x08414#define JRSTA_CCBERR_ERRID_KEYPARIT 0x09415#define JRSTA_CCBERR_ERRID_ICVCHK 0x0a416#define JRSTA_CCBERR_ERRID_HARDWARE 0x0b417#define JRSTA_CCBERR_ERRID_CCMAAD 0x0c418#define JRSTA_CCBERR_ERRID_INVCHA 0x0f419420#define JRINT_ERR_INDEX_MASK 0x3fff0000421#define JRINT_ERR_INDEX_SHIFT 16422#define JRINT_ERR_TYPE_MASK 0xf00423#define JRINT_ERR_TYPE_SHIFT 8424#define JRINT_ERR_HALT_MASK 0xc425#define JRINT_ERR_HALT_SHIFT 2426#define JRINT_ERR_HALT_INPROGRESS 0x4427#define JRINT_ERR_HALT_COMPLETE 0x8428#define JRINT_JR_ERROR 0x02429#define JRINT_JR_INT 0x01430431#define JRINT_ERR_TYPE_WRITE 1432#define JRINT_ERR_TYPE_BAD_INPADDR 3433#define JRINT_ERR_TYPE_BAD_OUTADDR 4434#define JRINT_ERR_TYPE_INV_INPWRT 5435#define JRINT_ERR_TYPE_INV_OUTWRT 6436#define JRINT_ERR_TYPE_RESET 7437#define JRINT_ERR_TYPE_REMOVE_OFL 8438#define JRINT_ERR_TYPE_ADD_OFL 9439440#define JRCFG_SOE 0x04441#define JRCFG_ICEN 0x02442#define JRCFG_IMSK 0x01443#define JRCFG_ICDCT_SHIFT 8444#define JRCFG_ICTT_SHIFT 16445446#define JRCR_RESET 0x01447448/*449* caam_assurance - Assurance Controller View450* base + 0x6000 padded out to 0x1000451*/452453struct rtic_element {454u64 address;455u32 rsvd;456u32 length;457};458459struct rtic_block {460struct rtic_element element[2];461};462463struct rtic_memhash {464u32 memhash_be[32];465u32 memhash_le[32];466};467468struct caam_assurance {469/* Status/Command/Watchdog */470u32 rsvd1;471u32 status; /* RSTA - Status */472u32 rsvd2;473u32 cmd; /* RCMD - Command */474u32 rsvd3;475u32 ctrl; /* RCTL - Control */476u32 rsvd4;477u32 throttle; /* RTHR - Throttle */478u32 rsvd5[2];479u64 watchdog; /* RWDOG - Watchdog Timer */480u32 rsvd6;481u32 rend; /* REND - Endian corrections */482u32 rsvd7[50];483484/* Block access/configuration @ 100/110/120/130 */485struct rtic_block memblk[4]; /* Memory Blocks A-D */486u32 rsvd8[32];487488/* Block hashes @ 200/300/400/500 */489struct rtic_memhash hash[4]; /* Block hash values A-D */490u32 rsvd_3[640];491};492493/*494* caam_queue_if - QI configuration and control495* starts base + 0x7000, padded out to 0x1000 long496*/497498struct caam_queue_if {499u32 qi_control_hi; /* QICTL - QI Control */500u32 qi_control_lo;501u32 rsvd1;502u32 qi_status; /* QISTA - QI Status */503u32 qi_deq_cfg_hi; /* QIDQC - QI Dequeue Configuration */504u32 qi_deq_cfg_lo;505u32 qi_enq_cfg_hi; /* QISEQC - QI Enqueue Command */506u32 qi_enq_cfg_lo;507u32 rsvd2[1016];508};509510/* QI control bits - low word */511#define QICTL_DQEN 0x01 /* Enable frame pop */512#define QICTL_STOP 0x02 /* Stop dequeue/enqueue */513#define QICTL_SOE 0x04 /* Stop on error */514515/* QI control bits - high word */516#define QICTL_MBSI 0x01517#define QICTL_MHWSI 0x02518#define QICTL_MWSI 0x04519#define QICTL_MDWSI 0x08520#define QICTL_CBSI 0x10 /* CtrlDataByteSwapInput */521#define QICTL_CHWSI 0x20 /* CtrlDataHalfSwapInput */522#define QICTL_CWSI 0x40 /* CtrlDataWordSwapInput */523#define QICTL_CDWSI 0x80 /* CtrlDataDWordSwapInput */524#define QICTL_MBSO 0x0100525#define QICTL_MHWSO 0x0200526#define QICTL_MWSO 0x0400527#define QICTL_MDWSO 0x0800528#define QICTL_CBSO 0x1000 /* CtrlDataByteSwapOutput */529#define QICTL_CHWSO 0x2000 /* CtrlDataHalfSwapOutput */530#define QICTL_CWSO 0x4000 /* CtrlDataWordSwapOutput */531#define QICTL_CDWSO 0x8000 /* CtrlDataDWordSwapOutput */532#define QICTL_DMBS 0x010000533#define QICTL_EPO 0x020000534535/* QI status bits */536#define QISTA_PHRDERR 0x01 /* PreHeader Read Error */537#define QISTA_CFRDERR 0x02 /* Compound Frame Read Error */538#define QISTA_OFWRERR 0x04 /* Output Frame Read Error */539#define QISTA_BPDERR 0x08 /* Buffer Pool Depleted */540#define QISTA_BTSERR 0x10 /* Buffer Undersize */541#define QISTA_CFWRERR 0x20 /* Compound Frame Write Err */542#define QISTA_STOPD 0x80000000 /* QI Stopped (see QICTL) */543544/* deco_sg_table - DECO view of scatter/gather table */545struct deco_sg_table {546u64 addr; /* Segment Address */547u32 elen; /* E, F bits + 30-bit length */548u32 bpid_offset; /* Buffer Pool ID + 16-bit length */549};550551/*552* caam_deco - descriptor controller - CHA cluster block553*554* Only accessible when direct DECO access is turned on555* (done in DECORR, via MID programmed in DECOxMID556*557* 5 typical, base + 0x8000/9000/a000/b000558* Padded out to 0x1000 long559*/560struct caam_deco {561u32 rsvd1;562u32 cls1_mode; /* CxC1MR - Class 1 Mode */563u32 rsvd2;564u32 cls1_keysize; /* CxC1KSR - Class 1 Key Size */565u32 cls1_datasize_hi; /* CxC1DSR - Class 1 Data Size */566u32 cls1_datasize_lo;567u32 rsvd3;568u32 cls1_icvsize; /* CxC1ICVSR - Class 1 ICV size */569u32 rsvd4[5];570u32 cha_ctrl; /* CCTLR - CHA control */571u32 rsvd5;572u32 irq_crtl; /* CxCIRQ - CCB interrupt done/error/clear */573u32 rsvd6;574u32 clr_written; /* CxCWR - Clear-Written */575u32 ccb_status_hi; /* CxCSTA - CCB Status/Error */576u32 ccb_status_lo;577u32 rsvd7[3];578u32 aad_size; /* CxAADSZR - Current AAD Size */579u32 rsvd8;580u32 cls1_iv_size; /* CxC1IVSZR - Current Class 1 IV Size */581u32 rsvd9[7];582u32 pkha_a_size; /* PKASZRx - Size of PKHA A */583u32 rsvd10;584u32 pkha_b_size; /* PKBSZRx - Size of PKHA B */585u32 rsvd11;586u32 pkha_n_size; /* PKNSZRx - Size of PKHA N */587u32 rsvd12;588u32 pkha_e_size; /* PKESZRx - Size of PKHA E */589u32 rsvd13[24];590u32 cls1_ctx[16]; /* CxC1CTXR - Class 1 Context @100 */591u32 rsvd14[48];592u32 cls1_key[8]; /* CxC1KEYR - Class 1 Key @200 */593u32 rsvd15[121];594u32 cls2_mode; /* CxC2MR - Class 2 Mode */595u32 rsvd16;596u32 cls2_keysize; /* CxX2KSR - Class 2 Key Size */597u32 cls2_datasize_hi; /* CxC2DSR - Class 2 Data Size */598u32 cls2_datasize_lo;599u32 rsvd17;600u32 cls2_icvsize; /* CxC2ICVSZR - Class 2 ICV Size */601u32 rsvd18[56];602u32 cls2_ctx[18]; /* CxC2CTXR - Class 2 Context @500 */603u32 rsvd19[46];604u32 cls2_key[32]; /* CxC2KEYR - Class2 Key @600 */605u32 rsvd20[84];606u32 inp_infofifo_hi; /* CxIFIFO - Input Info FIFO @7d0 */607u32 inp_infofifo_lo;608u32 rsvd21[2];609u64 inp_datafifo; /* CxDFIFO - Input Data FIFO */610u32 rsvd22[2];611u64 out_datafifo; /* CxOFIFO - Output Data FIFO */612u32 rsvd23[2];613u32 jr_ctl_hi; /* CxJRR - JobR Control Register @800 */614u32 jr_ctl_lo;615u64 jr_descaddr; /* CxDADR - JobR Descriptor Address */616u32 op_status_hi; /* DxOPSTA - DECO Operation Status */617u32 op_status_lo;618u32 rsvd24[2];619u32 liodn; /* DxLSR - DECO LIODN Status - non-seq */620u32 td_liodn; /* DxLSR - DECO LIODN Status - trustdesc */621u32 rsvd26[6];622u64 math[4]; /* DxMTH - Math register */623u32 rsvd27[8];624struct deco_sg_table gthr_tbl[4]; /* DxGTR - Gather Tables */625u32 rsvd28[16];626struct deco_sg_table sctr_tbl[4]; /* DxSTR - Scatter Tables */627u32 rsvd29[48];628u32 descbuf[64]; /* DxDESB - Descriptor buffer */629u32 rsvd30[320];630};631632/*633* Current top-level view of memory map is:634*635* 0x0000 - 0x0fff - CAAM Top-Level Control636* 0x1000 - 0x1fff - Job Ring 0637* 0x2000 - 0x2fff - Job Ring 1638* 0x3000 - 0x3fff - Job Ring 2639* 0x4000 - 0x4fff - Job Ring 3640* 0x5000 - 0x5fff - (unused)641* 0x6000 - 0x6fff - Assurance Controller642* 0x7000 - 0x7fff - Queue Interface643* 0x8000 - 0x8fff - DECO-CCB 0644* 0x9000 - 0x9fff - DECO-CCB 1645* 0xa000 - 0xafff - DECO-CCB 2646* 0xb000 - 0xbfff - DECO-CCB 3647* 0xc000 - 0xcfff - DECO-CCB 4648*649* caam_full describes the full register view of CAAM if useful,650* although many configurations may choose to implement parts of651* the register map separately, in differing privilege regions652*/653struct caam_full {654struct caam_ctrl __iomem ctrl;655struct caam_job_ring jr[4];656u64 rsvd[512];657struct caam_assurance assure;658struct caam_queue_if qi;659struct caam_deco *deco;660};661662#endif /* REGS_H */663664665