Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * CAAM hardware register-level view
0004  *
0005  * Copyright 2008-2011 Freescale Semiconductor, Inc.
0006  * Copyright 2018 NXP
0007  */
0008 
0009 #ifndef REGS_H
0010 #define REGS_H
0011 
0012 #include <linux/types.h>
0013 #include <linux/bitops.h>
0014 #include <linux/io.h>
0015 #include <linux/io-64-nonatomic-hi-lo.h>
0016 
0017 /*
0018  * Architecture-specific register access methods
0019  *
0020  * CAAM's bus-addressable registers are 64 bits internally.
0021  * They have been wired to be safely accessible on 32-bit
0022  * architectures, however. Registers were organized such
0023  * that (a) they can be contained in 32 bits, (b) if not, then they
0024  * can be treated as two 32-bit entities, or finally (c) if they
0025  * must be treated as a single 64-bit value, then this can safely
0026  * be done with two 32-bit cycles.
0027  *
0028  * For 32-bit operations on 64-bit values, CAAM follows the same
0029  * 64-bit register access conventions as it's predecessors, in that
0030  * writes are "triggered" by a write to the register at the numerically
0031  * higher address, thus, a full 64-bit write cycle requires a write
0032  * to the lower address, followed by a write to the higher address,
0033  * which will latch/execute the write cycle.
0034  *
0035  * For example, let's assume a SW reset of CAAM through the master
0036  * configuration register.
0037  * - SWRST is in bit 31 of MCFG.
0038  * - MCFG begins at base+0x0000.
0039  * - Bits 63-32 are a 32-bit word at base+0x0000 (numerically-lower)
0040  * - Bits 31-0 are a 32-bit word at base+0x0004 (numerically-higher)
0041  *
0042  * (and on Power, the convention is 0-31, 32-63, I know...)
0043  *
0044  * Assuming a 64-bit write to this MCFG to perform a software reset
0045  * would then require a write of 0 to base+0x0000, followed by a
0046  * write of 0x80000000 to base+0x0004, which would "execute" the
0047  * reset.
0048  *
0049  * Of course, since MCFG 63-32 is all zero, we could cheat and simply
0050  * write 0x8000000 to base+0x0004, and the reset would work fine.
0051  * However, since CAAM does contain some write-and-read-intended
0052  * 64-bit registers, this code defines 64-bit access methods for
0053  * the sake of internal consistency and simplicity, and so that a
0054  * clean transition to 64-bit is possible when it becomes necessary.
0055  *
0056  * There are limitations to this that the developer must recognize.
0057  * 32-bit architectures cannot enforce an atomic-64 operation,
0058  * Therefore:
0059  *
0060  * - On writes, since the HW is assumed to latch the cycle on the
0061  *   write of the higher-numeric-address word, then ordered
0062  *   writes work OK.
0063  *
0064  * - For reads, where a register contains a relevant value of more
0065  *   that 32 bits, the hardware employs logic to latch the other
0066  *   "half" of the data until read, ensuring an accurate value.
0067  *   This is of particular relevance when dealing with CAAM's
0068  *   performance counters.
0069  *
0070  */
0071 
0072 extern bool caam_little_end;
0073 extern bool caam_imx;
0074 extern size_t caam_ptr_sz;
0075 
0076 #define caam_to_cpu(len)                        \
0077 static inline u##len caam##len ## _to_cpu(u##len val)           \
0078 {                                   \
0079     if (caam_little_end)                        \
0080         return le##len ## _to_cpu((__force __le##len)val);  \
0081     else                                \
0082         return be##len ## _to_cpu((__force __be##len)val);  \
0083 }
0084 
0085 #define cpu_to_caam(len)                    \
0086 static inline u##len cpu_to_caam##len(u##len val)       \
0087 {                               \
0088     if (caam_little_end)                    \
0089         return (__force u##len)cpu_to_le##len(val); \
0090     else                            \
0091         return (__force u##len)cpu_to_be##len(val); \
0092 }
0093 
0094 caam_to_cpu(16)
0095 caam_to_cpu(32)
0096 caam_to_cpu(64)
0097 cpu_to_caam(16)
0098 cpu_to_caam(32)
0099 cpu_to_caam(64)
0100 
0101 static inline void wr_reg32(void __iomem *reg, u32 data)
0102 {
0103     if (caam_little_end)
0104         iowrite32(data, reg);
0105     else
0106         iowrite32be(data, reg);
0107 }
0108 
0109 static inline u32 rd_reg32(void __iomem *reg)
0110 {
0111     if (caam_little_end)
0112         return ioread32(reg);
0113 
0114     return ioread32be(reg);
0115 }
0116 
0117 static inline void clrsetbits_32(void __iomem *reg, u32 clear, u32 set)
0118 {
0119     if (caam_little_end)
0120         iowrite32((ioread32(reg) & ~clear) | set, reg);
0121     else
0122         iowrite32be((ioread32be(reg) & ~clear) | set, reg);
0123 }
0124 
0125 /*
0126  * The only users of these wr/rd_reg64 functions is the Job Ring (JR).
0127  * The DMA address registers in the JR are handled differently depending on
0128  * platform:
0129  *
0130  * 1. All BE CAAM platforms and i.MX platforms (LE CAAM):
0131  *
0132  *    base + 0x0000 : most-significant 32 bits
0133  *    base + 0x0004 : least-significant 32 bits
0134  *
0135  * The 32-bit version of this core therefore has to write to base + 0x0004
0136  * to set the 32-bit wide DMA address.
0137  *
0138  * 2. All other LE CAAM platforms (LS1021A etc.)
0139  *    base + 0x0000 : least-significant 32 bits
0140  *    base + 0x0004 : most-significant 32 bits
0141  */
0142 static inline void wr_reg64(void __iomem *reg, u64 data)
0143 {
0144     if (caam_little_end) {
0145         if (caam_imx) {
0146             iowrite32(data >> 32, (u32 __iomem *)(reg));
0147             iowrite32(data, (u32 __iomem *)(reg) + 1);
0148         } else {
0149             iowrite64(data, reg);
0150         }
0151     } else {
0152         iowrite64be(data, reg);
0153     }
0154 }
0155 
0156 static inline u64 rd_reg64(void __iomem *reg)
0157 {
0158     if (caam_little_end) {
0159         if (caam_imx) {
0160             u32 low, high;
0161 
0162             high = ioread32(reg);
0163             low  = ioread32(reg + sizeof(u32));
0164 
0165             return low + ((u64)high << 32);
0166         } else {
0167             return ioread64(reg);
0168         }
0169     } else {
0170         return ioread64be(reg);
0171     }
0172 }
0173 
0174 static inline u64 cpu_to_caam_dma64(dma_addr_t value)
0175 {
0176     if (caam_imx) {
0177         u64 ret_val = (u64)cpu_to_caam32(lower_32_bits(value)) << 32;
0178 
0179         if (IS_ENABLED(CONFIG_ARCH_DMA_ADDR_T_64BIT))
0180             ret_val |= (u64)cpu_to_caam32(upper_32_bits(value));
0181 
0182         return ret_val;
0183     }
0184 
0185     return cpu_to_caam64(value);
0186 }
0187 
0188 static inline u64 caam_dma64_to_cpu(u64 value)
0189 {
0190     if (caam_imx)
0191         return (((u64)caam32_to_cpu(lower_32_bits(value)) << 32) |
0192              (u64)caam32_to_cpu(upper_32_bits(value)));
0193 
0194     return caam64_to_cpu(value);
0195 }
0196 
0197 static inline u64 cpu_to_caam_dma(u64 value)
0198 {
0199     if (IS_ENABLED(CONFIG_ARCH_DMA_ADDR_T_64BIT) &&
0200         caam_ptr_sz == sizeof(u64))
0201         return cpu_to_caam_dma64(value);
0202     else
0203         return cpu_to_caam32(value);
0204 }
0205 
0206 static inline u64 caam_dma_to_cpu(u64 value)
0207 {
0208     if (IS_ENABLED(CONFIG_ARCH_DMA_ADDR_T_64BIT) &&
0209         caam_ptr_sz == sizeof(u64))
0210         return caam_dma64_to_cpu(value);
0211     else
0212         return caam32_to_cpu(value);
0213 }
0214 
0215 /*
0216  * jr_outentry
0217  * Represents each entry in a JobR output ring
0218  */
0219 
0220 static inline void jr_outentry_get(void *outring, int hw_idx, dma_addr_t *desc,
0221                    u32 *jrstatus)
0222 {
0223 
0224     if (caam_ptr_sz == sizeof(u32)) {
0225         struct {
0226             u32 desc;
0227             u32 jrstatus;
0228         } __packed *outentry = outring;
0229 
0230         *desc = outentry[hw_idx].desc;
0231         *jrstatus = outentry[hw_idx].jrstatus;
0232     } else {
0233         struct {
0234             dma_addr_t desc;/* Pointer to completed descriptor */
0235             u32 jrstatus;   /* Status for completed descriptor */
0236         } __packed *outentry = outring;
0237 
0238         *desc = outentry[hw_idx].desc;
0239         *jrstatus = outentry[hw_idx].jrstatus;
0240     }
0241 }
0242 
0243 #define SIZEOF_JR_OUTENTRY  (caam_ptr_sz + sizeof(u32))
0244 
0245 static inline dma_addr_t jr_outentry_desc(void *outring, int hw_idx)
0246 {
0247     dma_addr_t desc;
0248     u32 unused;
0249 
0250     jr_outentry_get(outring, hw_idx, &desc, &unused);
0251 
0252     return desc;
0253 }
0254 
0255 static inline u32 jr_outentry_jrstatus(void *outring, int hw_idx)
0256 {
0257     dma_addr_t unused;
0258     u32 jrstatus;
0259 
0260     jr_outentry_get(outring, hw_idx, &unused, &jrstatus);
0261 
0262     return jrstatus;
0263 }
0264 
0265 static inline void jr_inpentry_set(void *inpring, int hw_idx, dma_addr_t val)
0266 {
0267     if (caam_ptr_sz == sizeof(u32)) {
0268         u32 *inpentry = inpring;
0269 
0270         inpentry[hw_idx] = val;
0271     } else {
0272         dma_addr_t *inpentry = inpring;
0273 
0274         inpentry[hw_idx] = val;
0275     }
0276 }
0277 
0278 #define SIZEOF_JR_INPENTRY  caam_ptr_sz
0279 
0280 
0281 /* Version registers (Era 10+)  e80-eff */
0282 struct version_regs {
0283     u32 crca;   /* CRCA_VERSION */
0284     u32 afha;   /* AFHA_VERSION */
0285     u32 kfha;   /* KFHA_VERSION */
0286     u32 pkha;   /* PKHA_VERSION */
0287     u32 aesa;   /* AESA_VERSION */
0288     u32 mdha;   /* MDHA_VERSION */
0289     u32 desa;   /* DESA_VERSION */
0290     u32 snw8a;  /* SNW8A_VERSION */
0291     u32 snw9a;  /* SNW9A_VERSION */
0292     u32 zuce;   /* ZUCE_VERSION */
0293     u32 zuca;   /* ZUCA_VERSION */
0294     u32 ccha;   /* CCHA_VERSION */
0295     u32 ptha;   /* PTHA_VERSION */
0296     u32 rng;    /* RNG_VERSION */
0297     u32 trng;   /* TRNG_VERSION */
0298     u32 aaha;   /* AAHA_VERSION */
0299     u32 rsvd[10];
0300     u32 sr;     /* SR_VERSION */
0301     u32 dma;    /* DMA_VERSION */
0302     u32 ai;     /* AI_VERSION */
0303     u32 qi;     /* QI_VERSION */
0304     u32 jr;     /* JR_VERSION */
0305     u32 deco;   /* DECO_VERSION */
0306 };
0307 
0308 /* Version registers bitfields */
0309 
0310 /* Number of CHAs instantiated */
0311 #define CHA_VER_NUM_MASK    0xffull
0312 /* CHA Miscellaneous Information */
0313 #define CHA_VER_MISC_SHIFT  8
0314 #define CHA_VER_MISC_MASK   (0xffull << CHA_VER_MISC_SHIFT)
0315 /* CHA Revision Number */
0316 #define CHA_VER_REV_SHIFT   16
0317 #define CHA_VER_REV_MASK    (0xffull << CHA_VER_REV_SHIFT)
0318 /* CHA Version ID */
0319 #define CHA_VER_VID_SHIFT   24
0320 #define CHA_VER_VID_MASK    (0xffull << CHA_VER_VID_SHIFT)
0321 
0322 /* CHA Miscellaneous Information - AESA_MISC specific */
0323 #define CHA_VER_MISC_AES_NUM_MASK   GENMASK(7, 0)
0324 #define CHA_VER_MISC_AES_GCM        BIT(1 + CHA_VER_MISC_SHIFT)
0325 
0326 /* CHA Miscellaneous Information - PKHA_MISC specific */
0327 #define CHA_VER_MISC_PKHA_NO_CRYPT  BIT(7 + CHA_VER_MISC_SHIFT)
0328 
0329 /*
0330  * caam_perfmon - Performance Monitor/Secure Memory Status/
0331  *                CAAM Global Status/Component Version IDs
0332  *
0333  * Spans f00-fff wherever instantiated
0334  */
0335 
0336 /* Number of DECOs */
0337 #define CHA_NUM_MS_DECONUM_SHIFT    24
0338 #define CHA_NUM_MS_DECONUM_MASK (0xfull << CHA_NUM_MS_DECONUM_SHIFT)
0339 
0340 /*
0341  * CHA version IDs / instantiation bitfields (< Era 10)
0342  * Defined for use with the cha_id fields in perfmon, but the same shift/mask
0343  * selectors can be used to pull out the number of instantiated blocks within
0344  * cha_num fields in perfmon because the locations are the same.
0345  */
0346 #define CHA_ID_LS_AES_SHIFT 0
0347 #define CHA_ID_LS_AES_MASK  (0xfull << CHA_ID_LS_AES_SHIFT)
0348 
0349 #define CHA_ID_LS_DES_SHIFT 4
0350 #define CHA_ID_LS_DES_MASK  (0xfull << CHA_ID_LS_DES_SHIFT)
0351 
0352 #define CHA_ID_LS_ARC4_SHIFT    8
0353 #define CHA_ID_LS_ARC4_MASK (0xfull << CHA_ID_LS_ARC4_SHIFT)
0354 
0355 #define CHA_ID_LS_MD_SHIFT  12
0356 #define CHA_ID_LS_MD_MASK   (0xfull << CHA_ID_LS_MD_SHIFT)
0357 
0358 #define CHA_ID_LS_RNG_SHIFT 16
0359 #define CHA_ID_LS_RNG_MASK  (0xfull << CHA_ID_LS_RNG_SHIFT)
0360 
0361 #define CHA_ID_LS_SNW8_SHIFT    20
0362 #define CHA_ID_LS_SNW8_MASK (0xfull << CHA_ID_LS_SNW8_SHIFT)
0363 
0364 #define CHA_ID_LS_KAS_SHIFT 24
0365 #define CHA_ID_LS_KAS_MASK  (0xfull << CHA_ID_LS_KAS_SHIFT)
0366 
0367 #define CHA_ID_LS_PK_SHIFT  28
0368 #define CHA_ID_LS_PK_MASK   (0xfull << CHA_ID_LS_PK_SHIFT)
0369 
0370 #define CHA_ID_MS_CRC_SHIFT 0
0371 #define CHA_ID_MS_CRC_MASK  (0xfull << CHA_ID_MS_CRC_SHIFT)
0372 
0373 #define CHA_ID_MS_SNW9_SHIFT    4
0374 #define CHA_ID_MS_SNW9_MASK (0xfull << CHA_ID_MS_SNW9_SHIFT)
0375 
0376 #define CHA_ID_MS_DECO_SHIFT    24
0377 #define CHA_ID_MS_DECO_MASK (0xfull << CHA_ID_MS_DECO_SHIFT)
0378 
0379 #define CHA_ID_MS_JR_SHIFT  28
0380 #define CHA_ID_MS_JR_MASK   (0xfull << CHA_ID_MS_JR_SHIFT)
0381 
0382 /* Specific CHA version IDs */
0383 #define CHA_VER_VID_AES_LP  0x3ull
0384 #define CHA_VER_VID_AES_HP  0x4ull
0385 #define CHA_VER_VID_MD_LP256    0x0ull
0386 #define CHA_VER_VID_MD_LP512    0x1ull
0387 #define CHA_VER_VID_MD_HP   0x2ull
0388 
0389 struct sec_vid {
0390     u16 ip_id;
0391     u8 maj_rev;
0392     u8 min_rev;
0393 };
0394 
0395 struct caam_perfmon {
0396     /* Performance Monitor Registers            f00-f9f */
0397     u64 req_dequeued;   /* PC_REQ_DEQ - Dequeued Requests        */
0398     u64 ob_enc_req; /* PC_OB_ENC_REQ - Outbound Encrypt Requests */
0399     u64 ib_dec_req; /* PC_IB_DEC_REQ - Inbound Decrypt Requests  */
0400     u64 ob_enc_bytes;   /* PC_OB_ENCRYPT - Outbound Bytes Encrypted  */
0401     u64 ob_prot_bytes;  /* PC_OB_PROTECT - Outbound Bytes Protected  */
0402     u64 ib_dec_bytes;   /* PC_IB_DECRYPT - Inbound Bytes Decrypted   */
0403     u64 ib_valid_bytes; /* PC_IB_VALIDATED Inbound Bytes Validated   */
0404     u64 rsvd[13];
0405 
0406     /* CAAM Hardware Instantiation Parameters       fa0-fbf */
0407     u32 cha_rev_ms;     /* CRNR - CHA Rev No. Most significant half*/
0408     u32 cha_rev_ls;     /* CRNR - CHA Rev No. Least significant half*/
0409 #define CTPR_MS_QI_SHIFT    25
0410 #define CTPR_MS_QI_MASK     (0x1ull << CTPR_MS_QI_SHIFT)
0411 #define CTPR_MS_PS      BIT(17)
0412 #define CTPR_MS_DPAA2       BIT(13)
0413 #define CTPR_MS_VIRT_EN_INCL    0x00000001
0414 #define CTPR_MS_VIRT_EN_POR 0x00000002
0415 #define CTPR_MS_PG_SZ_MASK  0x10
0416 #define CTPR_MS_PG_SZ_SHIFT 4
0417     u32 comp_parms_ms;  /* CTPR - Compile Parameters Register   */
0418 #define CTPR_LS_BLOB           BIT(1)
0419     u32 comp_parms_ls;  /* CTPR - Compile Parameters Register   */
0420     u64 rsvd1[2];
0421 
0422     /* CAAM Global Status                   fc0-fdf */
0423     u64 faultaddr;  /* FAR  - Fault Address     */
0424     u32 faultliodn; /* FALR - Fault Address LIODN   */
0425     u32 faultdetail;    /* FADR - Fault Addr Detail */
0426     u32 rsvd2;
0427 #define CSTA_PLEND      BIT(10)
0428 #define CSTA_ALT_PLEND      BIT(18)
0429     u32 status;     /* CSTA - CAAM Status */
0430     u64 rsvd3;
0431 
0432     /* Component Instantiation Parameters           fe0-fff */
0433     u32 rtic_id;        /* RVID - RTIC Version ID   */
0434 #define CCBVID_ERA_MASK     0xff000000
0435 #define CCBVID_ERA_SHIFT    24
0436     u32 ccb_id;     /* CCBVID - CCB Version ID  */
0437     u32 cha_id_ms;      /* CHAVID - CHA Version ID Most Significant*/
0438     u32 cha_id_ls;      /* CHAVID - CHA Version ID Least Significant*/
0439     u32 cha_num_ms;     /* CHANUM - CHA Number Most Significant */
0440     u32 cha_num_ls;     /* CHANUM - CHA Number Least Significant*/
0441 #define SECVID_MS_IPID_MASK 0xffff0000
0442 #define SECVID_MS_IPID_SHIFT    16
0443 #define SECVID_MS_MAJ_REV_MASK  0x0000ff00
0444 #define SECVID_MS_MAJ_REV_SHIFT 8
0445     u32 caam_id_ms;     /* CAAMVID - CAAM Version ID MS */
0446     u32 caam_id_ls;     /* CAAMVID - CAAM Version ID LS */
0447 };
0448 
0449 /* LIODN programming for DMA configuration */
0450 #define MSTRID_LOCK_LIODN   0x80000000
0451 #define MSTRID_LOCK_MAKETRUSTED 0x00010000  /* only for JR masterid */
0452 
0453 #define MSTRID_LIODN_MASK   0x0fff
0454 struct masterid {
0455     u32 liodn_ms;   /* lock and make-trusted control bits */
0456     u32 liodn_ls;   /* LIODN for non-sequence and seq access */
0457 };
0458 
0459 /* Partition ID for DMA configuration */
0460 struct partid {
0461     u32 rsvd1;
0462     u32 pidr;   /* partition ID, DECO */
0463 };
0464 
0465 /* RNGB test mode (replicated twice in some configurations) */
0466 /* Padded out to 0x100 */
0467 struct rngtst {
0468     u32 mode;       /* RTSTMODEx - Test mode */
0469     u32 rsvd1[3];
0470     u32 reset;      /* RTSTRESETx - Test reset control */
0471     u32 rsvd2[3];
0472     u32 status;     /* RTSTSSTATUSx - Test status */
0473     u32 rsvd3;
0474     u32 errstat;        /* RTSTERRSTATx - Test error status */
0475     u32 rsvd4;
0476     u32 errctl;     /* RTSTERRCTLx - Test error control */
0477     u32 rsvd5;
0478     u32 entropy;        /* RTSTENTROPYx - Test entropy */
0479     u32 rsvd6[15];
0480     u32 verifctl;   /* RTSTVERIFCTLx - Test verification control */
0481     u32 rsvd7;
0482     u32 verifstat;  /* RTSTVERIFSTATx - Test verification status */
0483     u32 rsvd8;
0484     u32 verifdata;  /* RTSTVERIFDx - Test verification data */
0485     u32 rsvd9;
0486     u32 xkey;       /* RTSTXKEYx - Test XKEY */
0487     u32 rsvd10;
0488     u32 oscctctl;   /* RTSTOSCCTCTLx - Test osc. counter control */
0489     u32 rsvd11;
0490     u32 oscct;      /* RTSTOSCCTx - Test oscillator counter */
0491     u32 rsvd12;
0492     u32 oscctstat;  /* RTSTODCCTSTATx - Test osc counter status */
0493     u32 rsvd13[2];
0494     u32 ofifo[4];   /* RTSTOFIFOx - Test output FIFO */
0495     u32 rsvd14[15];
0496 };
0497 
0498 /* RNG4 TRNG test registers */
0499 struct rng4tst {
0500 #define RTMCTL_ACC  BIT(5)  /* TRNG access mode */
0501 #define RTMCTL_PRGM BIT(16) /* 1 -> program mode, 0 -> run mode */
0502 #define RTMCTL_SAMP_MODE_VON_NEUMANN_ES_SC  0 /* use von Neumann data in
0503                              both entropy shifter and
0504                              statistical checker */
0505 #define RTMCTL_SAMP_MODE_RAW_ES_SC      1 /* use raw data in both
0506                              entropy shifter and
0507                              statistical checker */
0508 #define RTMCTL_SAMP_MODE_VON_NEUMANN_ES_RAW_SC  2 /* use von Neumann data in
0509                              entropy shifter, raw data
0510                              in statistical checker */
0511 #define RTMCTL_SAMP_MODE_INVALID        3 /* invalid combination */
0512     u32 rtmctl;     /* misc. control register */
0513     u32 rtscmisc;       /* statistical check misc. register */
0514     u32 rtpkrrng;       /* poker range register */
0515     union {
0516         u32 rtpkrmax;   /* PRGM=1: poker max. limit register */
0517         u32 rtpkrsq;    /* PRGM=0: poker square calc. result register */
0518     };
0519 #define RTSDCTL_ENT_DLY_SHIFT 16
0520 #define RTSDCTL_ENT_DLY_MASK (0xffff << RTSDCTL_ENT_DLY_SHIFT)
0521 #define RTSDCTL_ENT_DLY_MIN 3200
0522 #define RTSDCTL_ENT_DLY_MAX 12800
0523     u32 rtsdctl;        /* seed control register */
0524     union {
0525         u32 rtsblim;    /* PRGM=1: sparse bit limit register */
0526         u32 rttotsam;   /* PRGM=0: total samples register */
0527     };
0528     u32 rtfrqmin;       /* frequency count min. limit register */
0529 #define RTFRQMAX_DISABLE    (1 << 20)
0530     union {
0531         u32 rtfrqmax;   /* PRGM=1: freq. count max. limit register */
0532         u32 rtfrqcnt;   /* PRGM=0: freq. count register */
0533     };
0534     u32 rsvd1[40];
0535 #define RDSTA_SKVT 0x80000000
0536 #define RDSTA_SKVN 0x40000000
0537 #define RDSTA_PR0 BIT(4)
0538 #define RDSTA_PR1 BIT(5)
0539 #define RDSTA_IF0 0x00000001
0540 #define RDSTA_IF1 0x00000002
0541 #define RDSTA_MASK (RDSTA_PR1 | RDSTA_PR0 | RDSTA_IF1 | RDSTA_IF0)
0542     u32 rdsta;
0543     u32 rsvd2[15];
0544 };
0545 
0546 /*
0547  * caam_ctrl - basic core configuration
0548  * starts base + 0x0000 padded out to 0x1000
0549  */
0550 
0551 #define KEK_KEY_SIZE        8
0552 #define TKEK_KEY_SIZE       8
0553 #define TDSK_KEY_SIZE       8
0554 
0555 #define DECO_RESET  1   /* Use with DECO reset/availability regs */
0556 #define DECO_RESET_0    (DECO_RESET << 0)
0557 #define DECO_RESET_1    (DECO_RESET << 1)
0558 #define DECO_RESET_2    (DECO_RESET << 2)
0559 #define DECO_RESET_3    (DECO_RESET << 3)
0560 #define DECO_RESET_4    (DECO_RESET << 4)
0561 
0562 struct caam_ctrl {
0563     /* Basic Configuration Section              000-01f */
0564     /* Read/Writable                            */
0565     u32 rsvd1;
0566     u32 mcr;        /* MCFG      Master Config Register  */
0567     u32 rsvd2;
0568     u32 scfgr;      /* SCFGR, Security Config Register */
0569 
0570     /* Bus Access Configuration Section         010-11f */
0571     /* Read/Writable                                                */
0572     struct masterid jr_mid[4];  /* JRxLIODNR - JobR LIODN setup */
0573     u32 rsvd3[11];
0574     u32 jrstart;            /* JRSTART - Job Ring Start Register */
0575     struct masterid rtic_mid[4];    /* RTICxLIODNR - RTIC LIODN setup */
0576     u32 rsvd4[5];
0577     u32 deco_rsr;           /* DECORSR - Deco Request Source */
0578     u32 rsvd11;
0579     u32 deco_rq;            /* DECORR - DECO Request */
0580     struct partid deco_mid[5];  /* DECOxLIODNR - 1 per DECO */
0581     u32 rsvd5[22];
0582 
0583     /* DECO Availability/Reset Section          120-3ff */
0584     u32 deco_avail;     /* DAR - DECO availability */
0585     u32 deco_reset;     /* DRR - DECO reset */
0586     u32 rsvd6[182];
0587 
0588     /* Key Encryption/Decryption Configuration              400-5ff */
0589     /* Read/Writable only while in Non-secure mode                  */
0590     u32 kek[KEK_KEY_SIZE];  /* JDKEKR - Key Encryption Key */
0591     u32 tkek[TKEK_KEY_SIZE];    /* TDKEKR - Trusted Desc KEK */
0592     u32 tdsk[TDSK_KEY_SIZE];    /* TDSKR - Trusted Desc Signing Key */
0593     u32 rsvd7[32];
0594     u64 sknonce;            /* SKNR - Secure Key Nonce */
0595     u32 rsvd8[70];
0596 
0597     /* RNG Test/Verification/Debug Access                   600-7ff */
0598     /* (Useful in Test/Debug modes only...)                         */
0599     union {
0600         struct rngtst rtst[2];
0601         struct rng4tst r4tst[2];
0602     };
0603 
0604     u32 rsvd9[416];
0605 
0606     /* Version registers - introduced with era 10       e80-eff */
0607     struct version_regs vreg;
0608     /* Performance Monitor                                  f00-fff */
0609     struct caam_perfmon perfmon;
0610 };
0611 
0612 /*
0613  * Controller master config register defs
0614  */
0615 #define MCFGR_SWRESET       0x80000000 /* software reset */
0616 #define MCFGR_WDENABLE      0x40000000 /* DECO watchdog enable */
0617 #define MCFGR_WDFAIL        0x20000000 /* DECO watchdog force-fail */
0618 #define MCFGR_DMA_RESET     0x10000000
0619 #define MCFGR_LONG_PTR      0x00010000 /* Use >32-bit desc addressing */
0620 #define SCFGR_RDBENABLE     0x00000400
0621 #define SCFGR_VIRT_EN       0x00008000
0622 #define DECORR_RQD0ENABLE   0x00000001 /* Enable DECO0 for direct access */
0623 #define DECORSR_JR0     0x00000001 /* JR to supply TZ, SDID, ICID */
0624 #define DECORSR_VALID       0x80000000
0625 #define DECORR_DEN0     0x00010000 /* DECO0 available for access*/
0626 
0627 /* AXI read cache control */
0628 #define MCFGR_ARCACHE_SHIFT 12
0629 #define MCFGR_ARCACHE_MASK  (0xf << MCFGR_ARCACHE_SHIFT)
0630 #define MCFGR_ARCACHE_BUFF  (0x1 << MCFGR_ARCACHE_SHIFT)
0631 #define MCFGR_ARCACHE_CACH  (0x2 << MCFGR_ARCACHE_SHIFT)
0632 #define MCFGR_ARCACHE_RALL  (0x4 << MCFGR_ARCACHE_SHIFT)
0633 
0634 /* AXI write cache control */
0635 #define MCFGR_AWCACHE_SHIFT 8
0636 #define MCFGR_AWCACHE_MASK  (0xf << MCFGR_AWCACHE_SHIFT)
0637 #define MCFGR_AWCACHE_BUFF  (0x1 << MCFGR_AWCACHE_SHIFT)
0638 #define MCFGR_AWCACHE_CACH  (0x2 << MCFGR_AWCACHE_SHIFT)
0639 #define MCFGR_AWCACHE_WALL  (0x8 << MCFGR_AWCACHE_SHIFT)
0640 
0641 /* AXI pipeline depth */
0642 #define MCFGR_AXIPIPE_SHIFT 4
0643 #define MCFGR_AXIPIPE_MASK  (0xf << MCFGR_AXIPIPE_SHIFT)
0644 
0645 #define MCFGR_AXIPRI        0x00000008 /* Assert AXI priority sideband */
0646 #define MCFGR_LARGE_BURST   0x00000004 /* 128/256-byte burst size */
0647 #define MCFGR_BURST_64      0x00000001 /* 64-byte burst size */
0648 
0649 /* JRSTART register offsets */
0650 #define JRSTART_JR0_START       0x00000001 /* Start Job ring 0 */
0651 #define JRSTART_JR1_START       0x00000002 /* Start Job ring 1 */
0652 #define JRSTART_JR2_START       0x00000004 /* Start Job ring 2 */
0653 #define JRSTART_JR3_START       0x00000008 /* Start Job ring 3 */
0654 
0655 /*
0656  * caam_job_ring - direct job ring setup
0657  * 1-4 possible per instantiation, base + 1000/2000/3000/4000
0658  * Padded out to 0x1000
0659  */
0660 struct caam_job_ring {
0661     /* Input ring */
0662     u64 inpring_base;   /* IRBAx -  Input desc ring baseaddr */
0663     u32 rsvd1;
0664     u32 inpring_size;   /* IRSx - Input ring size */
0665     u32 rsvd2;
0666     u32 inpring_avail;  /* IRSAx - Input ring room remaining */
0667     u32 rsvd3;
0668     u32 inpring_jobadd; /* IRJAx - Input ring jobs added */
0669 
0670     /* Output Ring */
0671     u64 outring_base;   /* ORBAx - Output status ring base addr */
0672     u32 rsvd4;
0673     u32 outring_size;   /* ORSx - Output ring size */
0674     u32 rsvd5;
0675     u32 outring_rmvd;   /* ORJRx - Output ring jobs removed */
0676     u32 rsvd6;
0677     u32 outring_used;   /* ORSFx - Output ring slots full */
0678 
0679     /* Status/Configuration */
0680     u32 rsvd7;
0681     u32 jroutstatus;    /* JRSTAx - JobR output status */
0682     u32 rsvd8;
0683     u32 jrintstatus;    /* JRINTx - JobR interrupt status */
0684     u32 rconfig_hi; /* JRxCFG - Ring configuration */
0685     u32 rconfig_lo;
0686 
0687     /* Indices. CAAM maintains as "heads" of each queue */
0688     u32 rsvd9;
0689     u32 inp_rdidx;  /* IRRIx - Input ring read index */
0690     u32 rsvd10;
0691     u32 out_wtidx;  /* ORWIx - Output ring write index */
0692 
0693     /* Command/control */
0694     u32 rsvd11;
0695     u32 jrcommand;  /* JRCRx - JobR command */
0696 
0697     u32 rsvd12[900];
0698 
0699     /* Version registers - introduced with era 10           e80-eff */
0700     struct version_regs vreg;
0701     /* Performance Monitor                                  f00-fff */
0702     struct caam_perfmon perfmon;
0703 };
0704 
0705 #define JR_RINGSIZE_MASK    0x03ff
0706 /*
0707  * jrstatus - Job Ring Output Status
0708  * All values in lo word
0709  * Also note, same values written out as status through QI
0710  * in the command/status field of a frame descriptor
0711  */
0712 #define JRSTA_SSRC_SHIFT            28
0713 #define JRSTA_SSRC_MASK             0xf0000000
0714 
0715 #define JRSTA_SSRC_NONE             0x00000000
0716 #define JRSTA_SSRC_CCB_ERROR        0x20000000
0717 #define JRSTA_SSRC_JUMP_HALT_USER   0x30000000
0718 #define JRSTA_SSRC_DECO             0x40000000
0719 #define JRSTA_SSRC_QI               0x50000000
0720 #define JRSTA_SSRC_JRERROR          0x60000000
0721 #define JRSTA_SSRC_JUMP_HALT_CC     0x70000000
0722 
0723 #define JRSTA_DECOERR_JUMP          0x08000000
0724 #define JRSTA_DECOERR_INDEX_SHIFT   8
0725 #define JRSTA_DECOERR_INDEX_MASK    0xff00
0726 #define JRSTA_DECOERR_ERROR_MASK    0x00ff
0727 
0728 #define JRSTA_DECOERR_NONE          0x00
0729 #define JRSTA_DECOERR_LINKLEN       0x01
0730 #define JRSTA_DECOERR_LINKPTR       0x02
0731 #define JRSTA_DECOERR_JRCTRL        0x03
0732 #define JRSTA_DECOERR_DESCCMD       0x04
0733 #define JRSTA_DECOERR_ORDER         0x05
0734 #define JRSTA_DECOERR_KEYCMD        0x06
0735 #define JRSTA_DECOERR_LOADCMD       0x07
0736 #define JRSTA_DECOERR_STORECMD      0x08
0737 #define JRSTA_DECOERR_OPCMD         0x09
0738 #define JRSTA_DECOERR_FIFOLDCMD     0x0a
0739 #define JRSTA_DECOERR_FIFOSTCMD     0x0b
0740 #define JRSTA_DECOERR_MOVECMD       0x0c
0741 #define JRSTA_DECOERR_JUMPCMD       0x0d
0742 #define JRSTA_DECOERR_MATHCMD       0x0e
0743 #define JRSTA_DECOERR_SHASHCMD      0x0f
0744 #define JRSTA_DECOERR_SEQCMD        0x10
0745 #define JRSTA_DECOERR_DECOINTERNAL  0x11
0746 #define JRSTA_DECOERR_SHDESCHDR     0x12
0747 #define JRSTA_DECOERR_HDRLEN        0x13
0748 #define JRSTA_DECOERR_BURSTER       0x14
0749 #define JRSTA_DECOERR_DESCSIGNATURE 0x15
0750 #define JRSTA_DECOERR_DMA           0x16
0751 #define JRSTA_DECOERR_BURSTFIFO     0x17
0752 #define JRSTA_DECOERR_JRRESET       0x1a
0753 #define JRSTA_DECOERR_JOBFAIL       0x1b
0754 #define JRSTA_DECOERR_DNRERR        0x80
0755 #define JRSTA_DECOERR_UNDEFPCL      0x81
0756 #define JRSTA_DECOERR_PDBERR        0x82
0757 #define JRSTA_DECOERR_ANRPLY_LATE   0x83
0758 #define JRSTA_DECOERR_ANRPLY_REPLAY 0x84
0759 #define JRSTA_DECOERR_SEQOVF        0x85
0760 #define JRSTA_DECOERR_INVSIGN       0x86
0761 #define JRSTA_DECOERR_DSASIGN       0x87
0762 
0763 #define JRSTA_QIERR_ERROR_MASK      0x00ff
0764 
0765 #define JRSTA_CCBERR_JUMP           0x08000000
0766 #define JRSTA_CCBERR_INDEX_MASK     0xff00
0767 #define JRSTA_CCBERR_INDEX_SHIFT    8
0768 #define JRSTA_CCBERR_CHAID_MASK     0x00f0
0769 #define JRSTA_CCBERR_CHAID_SHIFT    4
0770 #define JRSTA_CCBERR_ERRID_MASK     0x000f
0771 
0772 #define JRSTA_CCBERR_CHAID_AES      (0x01 << JRSTA_CCBERR_CHAID_SHIFT)
0773 #define JRSTA_CCBERR_CHAID_DES      (0x02 << JRSTA_CCBERR_CHAID_SHIFT)
0774 #define JRSTA_CCBERR_CHAID_ARC4     (0x03 << JRSTA_CCBERR_CHAID_SHIFT)
0775 #define JRSTA_CCBERR_CHAID_MD       (0x04 << JRSTA_CCBERR_CHAID_SHIFT)
0776 #define JRSTA_CCBERR_CHAID_RNG      (0x05 << JRSTA_CCBERR_CHAID_SHIFT)
0777 #define JRSTA_CCBERR_CHAID_SNOW     (0x06 << JRSTA_CCBERR_CHAID_SHIFT)
0778 #define JRSTA_CCBERR_CHAID_KASUMI   (0x07 << JRSTA_CCBERR_CHAID_SHIFT)
0779 #define JRSTA_CCBERR_CHAID_PK       (0x08 << JRSTA_CCBERR_CHAID_SHIFT)
0780 #define JRSTA_CCBERR_CHAID_CRC      (0x09 << JRSTA_CCBERR_CHAID_SHIFT)
0781 
0782 #define JRSTA_CCBERR_ERRID_NONE     0x00
0783 #define JRSTA_CCBERR_ERRID_MODE     0x01
0784 #define JRSTA_CCBERR_ERRID_DATASIZ  0x02
0785 #define JRSTA_CCBERR_ERRID_KEYSIZ   0x03
0786 #define JRSTA_CCBERR_ERRID_PKAMEMSZ 0x04
0787 #define JRSTA_CCBERR_ERRID_PKBMEMSZ 0x05
0788 #define JRSTA_CCBERR_ERRID_SEQUENCE 0x06
0789 #define JRSTA_CCBERR_ERRID_PKDIVZRO 0x07
0790 #define JRSTA_CCBERR_ERRID_PKMODEVN 0x08
0791 #define JRSTA_CCBERR_ERRID_KEYPARIT 0x09
0792 #define JRSTA_CCBERR_ERRID_ICVCHK   0x0a
0793 #define JRSTA_CCBERR_ERRID_HARDWARE 0x0b
0794 #define JRSTA_CCBERR_ERRID_CCMAAD   0x0c
0795 #define JRSTA_CCBERR_ERRID_INVCHA   0x0f
0796 
0797 #define JRINT_ERR_INDEX_MASK        0x3fff0000
0798 #define JRINT_ERR_INDEX_SHIFT       16
0799 #define JRINT_ERR_TYPE_MASK         0xf00
0800 #define JRINT_ERR_TYPE_SHIFT        8
0801 #define JRINT_ERR_HALT_MASK         0xc
0802 #define JRINT_ERR_HALT_SHIFT        2
0803 #define JRINT_ERR_HALT_INPROGRESS   0x4
0804 #define JRINT_ERR_HALT_COMPLETE     0x8
0805 #define JRINT_JR_ERROR              0x02
0806 #define JRINT_JR_INT                0x01
0807 
0808 #define JRINT_ERR_TYPE_WRITE        1
0809 #define JRINT_ERR_TYPE_BAD_INPADDR  3
0810 #define JRINT_ERR_TYPE_BAD_OUTADDR  4
0811 #define JRINT_ERR_TYPE_INV_INPWRT   5
0812 #define JRINT_ERR_TYPE_INV_OUTWRT   6
0813 #define JRINT_ERR_TYPE_RESET        7
0814 #define JRINT_ERR_TYPE_REMOVE_OFL   8
0815 #define JRINT_ERR_TYPE_ADD_OFL      9
0816 
0817 #define JRCFG_SOE       0x04
0818 #define JRCFG_ICEN      0x02
0819 #define JRCFG_IMSK      0x01
0820 #define JRCFG_ICDCT_SHIFT   8
0821 #define JRCFG_ICTT_SHIFT    16
0822 
0823 #define JRCR_RESET                  0x01
0824 
0825 /*
0826  * caam_assurance - Assurance Controller View
0827  * base + 0x6000 padded out to 0x1000
0828  */
0829 
0830 struct rtic_element {
0831     u64 address;
0832     u32 rsvd;
0833     u32 length;
0834 };
0835 
0836 struct rtic_block {
0837     struct rtic_element element[2];
0838 };
0839 
0840 struct rtic_memhash {
0841     u32 memhash_be[32];
0842     u32 memhash_le[32];
0843 };
0844 
0845 struct caam_assurance {
0846     /* Status/Command/Watchdog */
0847     u32 rsvd1;
0848     u32 status;     /* RSTA - Status */
0849     u32 rsvd2;
0850     u32 cmd;        /* RCMD - Command */
0851     u32 rsvd3;
0852     u32 ctrl;       /* RCTL - Control */
0853     u32 rsvd4;
0854     u32 throttle;   /* RTHR - Throttle */
0855     u32 rsvd5[2];
0856     u64 watchdog;   /* RWDOG - Watchdog Timer */
0857     u32 rsvd6;
0858     u32 rend;       /* REND - Endian corrections */
0859     u32 rsvd7[50];
0860 
0861     /* Block access/configuration @ 100/110/120/130 */
0862     struct rtic_block memblk[4];    /* Memory Blocks A-D */
0863     u32 rsvd8[32];
0864 
0865     /* Block hashes @ 200/300/400/500 */
0866     struct rtic_memhash hash[4];    /* Block hash values A-D */
0867     u32 rsvd_3[640];
0868 };
0869 
0870 /*
0871  * caam_queue_if - QI configuration and control
0872  * starts base + 0x7000, padded out to 0x1000 long
0873  */
0874 
0875 struct caam_queue_if {
0876     u32 qi_control_hi;  /* QICTL  - QI Control */
0877     u32 qi_control_lo;
0878     u32 rsvd1;
0879     u32 qi_status;  /* QISTA  - QI Status */
0880     u32 qi_deq_cfg_hi;  /* QIDQC  - QI Dequeue Configuration */
0881     u32 qi_deq_cfg_lo;
0882     u32 qi_enq_cfg_hi;  /* QISEQC - QI Enqueue Command     */
0883     u32 qi_enq_cfg_lo;
0884     u32 rsvd2[1016];
0885 };
0886 
0887 /* QI control bits - low word */
0888 #define QICTL_DQEN      0x01              /* Enable frame pop          */
0889 #define QICTL_STOP      0x02              /* Stop dequeue/enqueue      */
0890 #define QICTL_SOE       0x04              /* Stop on error             */
0891 
0892 /* QI control bits - high word */
0893 #define QICTL_MBSI  0x01
0894 #define QICTL_MHWSI 0x02
0895 #define QICTL_MWSI  0x04
0896 #define QICTL_MDWSI 0x08
0897 #define QICTL_CBSI  0x10        /* CtrlDataByteSwapInput     */
0898 #define QICTL_CHWSI 0x20        /* CtrlDataHalfSwapInput     */
0899 #define QICTL_CWSI  0x40        /* CtrlDataWordSwapInput     */
0900 #define QICTL_CDWSI 0x80        /* CtrlDataDWordSwapInput    */
0901 #define QICTL_MBSO  0x0100
0902 #define QICTL_MHWSO 0x0200
0903 #define QICTL_MWSO  0x0400
0904 #define QICTL_MDWSO 0x0800
0905 #define QICTL_CBSO  0x1000      /* CtrlDataByteSwapOutput    */
0906 #define QICTL_CHWSO 0x2000      /* CtrlDataHalfSwapOutput    */
0907 #define QICTL_CWSO  0x4000      /* CtrlDataWordSwapOutput    */
0908 #define QICTL_CDWSO     0x8000      /* CtrlDataDWordSwapOutput   */
0909 #define QICTL_DMBS  0x010000
0910 #define QICTL_EPO   0x020000
0911 
0912 /* QI status bits */
0913 #define QISTA_PHRDERR   0x01              /* PreHeader Read Error      */
0914 #define QISTA_CFRDERR   0x02              /* Compound Frame Read Error */
0915 #define QISTA_OFWRERR   0x04              /* Output Frame Read Error   */
0916 #define QISTA_BPDERR    0x08              /* Buffer Pool Depleted      */
0917 #define QISTA_BTSERR    0x10              /* Buffer Undersize          */
0918 #define QISTA_CFWRERR   0x20              /* Compound Frame Write Err  */
0919 #define QISTA_STOPD     0x80000000        /* QI Stopped (see QICTL)    */
0920 
0921 /* deco_sg_table - DECO view of scatter/gather table */
0922 struct deco_sg_table {
0923     u64 addr;       /* Segment Address */
0924     u32 elen;       /* E, F bits + 30-bit length */
0925     u32 bpid_offset;    /* Buffer Pool ID + 16-bit length */
0926 };
0927 
0928 /*
0929  * caam_deco - descriptor controller - CHA cluster block
0930  *
0931  * Only accessible when direct DECO access is turned on
0932  * (done in DECORR, via MID programmed in DECOxMID
0933  *
0934  * 5 typical, base + 0x8000/9000/a000/b000
0935  * Padded out to 0x1000 long
0936  */
0937 struct caam_deco {
0938     u32 rsvd1;
0939     u32 cls1_mode;  /* CxC1MR -  Class 1 Mode */
0940     u32 rsvd2;
0941     u32 cls1_keysize;   /* CxC1KSR - Class 1 Key Size */
0942     u32 cls1_datasize_hi;   /* CxC1DSR - Class 1 Data Size */
0943     u32 cls1_datasize_lo;
0944     u32 rsvd3;
0945     u32 cls1_icvsize;   /* CxC1ICVSR - Class 1 ICV size */
0946     u32 rsvd4[5];
0947     u32 cha_ctrl;   /* CCTLR - CHA control */
0948     u32 rsvd5;
0949     u32 irq_crtl;   /* CxCIRQ - CCB interrupt done/error/clear */
0950     u32 rsvd6;
0951     u32 clr_written;    /* CxCWR - Clear-Written */
0952     u32 ccb_status_hi;  /* CxCSTA - CCB Status/Error */
0953     u32 ccb_status_lo;
0954     u32 rsvd7[3];
0955     u32 aad_size;   /* CxAADSZR - Current AAD Size */
0956     u32 rsvd8;
0957     u32 cls1_iv_size;   /* CxC1IVSZR - Current Class 1 IV Size */
0958     u32 rsvd9[7];
0959     u32 pkha_a_size;    /* PKASZRx - Size of PKHA A */
0960     u32 rsvd10;
0961     u32 pkha_b_size;    /* PKBSZRx - Size of PKHA B */
0962     u32 rsvd11;
0963     u32 pkha_n_size;    /* PKNSZRx - Size of PKHA N */
0964     u32 rsvd12;
0965     u32 pkha_e_size;    /* PKESZRx - Size of PKHA E */
0966     u32 rsvd13[24];
0967     u32 cls1_ctx[16];   /* CxC1CTXR - Class 1 Context @100 */
0968     u32 rsvd14[48];
0969     u32 cls1_key[8];    /* CxC1KEYR - Class 1 Key @200 */
0970     u32 rsvd15[121];
0971     u32 cls2_mode;  /* CxC2MR - Class 2 Mode */
0972     u32 rsvd16;
0973     u32 cls2_keysize;   /* CxX2KSR - Class 2 Key Size */
0974     u32 cls2_datasize_hi;   /* CxC2DSR - Class 2 Data Size */
0975     u32 cls2_datasize_lo;
0976     u32 rsvd17;
0977     u32 cls2_icvsize;   /* CxC2ICVSZR - Class 2 ICV Size */
0978     u32 rsvd18[56];
0979     u32 cls2_ctx[18];   /* CxC2CTXR - Class 2 Context @500 */
0980     u32 rsvd19[46];
0981     u32 cls2_key[32];   /* CxC2KEYR - Class2 Key @600 */
0982     u32 rsvd20[84];
0983     u32 inp_infofifo_hi;    /* CxIFIFO - Input Info FIFO @7d0 */
0984     u32 inp_infofifo_lo;
0985     u32 rsvd21[2];
0986     u64 inp_datafifo;   /* CxDFIFO - Input Data FIFO */
0987     u32 rsvd22[2];
0988     u64 out_datafifo;   /* CxOFIFO - Output Data FIFO */
0989     u32 rsvd23[2];
0990     u32 jr_ctl_hi;  /* CxJRR - JobR Control Register      @800 */
0991     u32 jr_ctl_lo;
0992     u64 jr_descaddr;    /* CxDADR - JobR Descriptor Address */
0993 #define DECO_OP_STATUS_HI_ERR_MASK 0xF00000FF
0994     u32 op_status_hi;   /* DxOPSTA - DECO Operation Status */
0995     u32 op_status_lo;
0996     u32 rsvd24[2];
0997     u32 liodn;      /* DxLSR - DECO LIODN Status - non-seq */
0998     u32 td_liodn;   /* DxLSR - DECO LIODN Status - trustdesc */
0999     u32 rsvd26[6];
1000     u64 math[4];        /* DxMTH - Math register */
1001     u32 rsvd27[8];
1002     struct deco_sg_table gthr_tbl[4];   /* DxGTR - Gather Tables */
1003     u32 rsvd28[16];
1004     struct deco_sg_table sctr_tbl[4];   /* DxSTR - Scatter Tables */
1005     u32 rsvd29[48];
1006     u32 descbuf[64];    /* DxDESB - Descriptor buffer */
1007     u32 rscvd30[193];
1008 #define DESC_DBG_DECO_STAT_VALID    0x80000000
1009 #define DESC_DBG_DECO_STAT_MASK     0x00F00000
1010 #define DESC_DBG_DECO_STAT_SHIFT    20
1011     u32 desc_dbg;       /* DxDDR - DECO Debug Register */
1012     u32 rsvd31[13];
1013 #define DESC_DER_DECO_STAT_MASK     0x000F0000
1014 #define DESC_DER_DECO_STAT_SHIFT    16
1015     u32 dbg_exec;       /* DxDER - DECO Debug Exec Register */
1016     u32 rsvd32[112];
1017 };
1018 
1019 #define DECO_STAT_HOST_ERR  0xD
1020 
1021 #define DECO_JQCR_WHL       0x20000000
1022 #define DECO_JQCR_FOUR      0x10000000
1023 
1024 #define JR_BLOCK_NUMBER     1
1025 #define ASSURE_BLOCK_NUMBER 6
1026 #define QI_BLOCK_NUMBER     7
1027 #define DECO_BLOCK_NUMBER   8
1028 #define PG_SIZE_4K      0x1000
1029 #define PG_SIZE_64K     0x10000
1030 #endif /* REGS_H */