hw_pka.h 50 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792
  1. /******************************************************************************
  2. * Filename: hw_pka.h
  3. * Revised: $Date: 2013-04-30 17:13:44 +0200 (Tue, 30 Apr 2013) $
  4. * Revision: $Revision: 9943 $
  5. *
  6. * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com/
  7. *
  8. *
  9. * Redistribution and use in source and binary forms, with or without
  10. * modification, are permitted provided that the following conditions
  11. * are met:
  12. *
  13. * Redistributions of source code must retain the above copyright
  14. * notice, this list of conditions and the following disclaimer.
  15. *
  16. * Redistributions in binary form must reproduce the above copyright
  17. * notice, this list of conditions and the following disclaimer in the
  18. * documentation and/or other materials provided with the distribution.
  19. *
  20. * Neither the name of Texas Instruments Incorporated nor the names of
  21. * its contributors may be used to endorse or promote products derived
  22. * from this software without specific prior written permission.
  23. *
  24. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  25. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  26. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  27. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  28. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  29. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  30. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  31. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  32. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  33. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  34. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  35. *
  36. ******************************************************************************/
  37. #ifndef __HW_PKA_H__
  38. #define __HW_PKA_H__
  39. //*****************************************************************************
  40. //
  41. // The following are defines for the PKA register offsets.
  42. //
  43. //*****************************************************************************
  44. #define PKA_APTR 0x44004000 // PKA vector A address During
  45. // execution of basic PKCP
  46. // operations, this register is
  47. // double buffered and can be
  48. // written with a new value for the
  49. // next operation; when not
  50. // written, the value remains
  51. // intact. During the execution of
  52. // sequencer-controlled complex
  53. // operations, this register may
  54. // not be written and its value is
  55. // undefined at the conclusion of
  56. // the operation. The driver
  57. // software cannot rely on the
  58. // written value to remain intact.
  59. #define PKA_BPTR 0x44004004 // PKA vector B address During
  60. // execution of basic PKCP
  61. // operations, this register is
  62. // double buffered and can be
  63. // written with a new value for the
  64. // next operation; when not
  65. // written, the value remains
  66. // intact. During the execution of
  67. // sequencer-controlled complex
  68. // operations, this register may
  69. // not be written and its value is
  70. // undefined at the conclusion of
  71. // the operation. The driver
  72. // software cannot rely on the
  73. // written value to remain intact.
  74. #define PKA_CPTR 0x44004008 // PKA vector C address During
  75. // execution of basic PKCP
  76. // operations, this register is
  77. // double buffered and can be
  78. // written with a new value for the
  79. // next operation; when not
  80. // written, the value remains
  81. // intact. During the execution of
  82. // sequencer-controlled complex
  83. // operations, this register may
  84. // not be written and its value is
  85. // undefined at the conclusion of
  86. // the operation. The driver
  87. // software cannot rely on the
  88. // written value to remain intact.
  89. #define PKA_DPTR 0x4400400C // PKA vector D address During
  90. // execution of basic PKCP
  91. // operations, this register is
  92. // double buffered and can be
  93. // written with a new value for the
  94. // next operation; when not
  95. // written, the value remains
  96. // intact. During the execution of
  97. // sequencer-controlled complex
  98. // operations, this register may
  99. // not be written and its value is
  100. // undefined at the conclusion of
  101. // the operation. The driver
  102. // software cannot rely on the
  103. // written value to remain intact.
  104. #define PKA_ALENGTH 0x44004010 // PKA vector A length During
  105. // execution of basic PKCP
  106. // operations, this register is
  107. // double buffered and can be
  108. // written with a new value for the
  109. // next operation; when not
  110. // written, the value remains
  111. // intact. During the execution of
  112. // sequencer-controlled complex
  113. // operations, this register may
  114. // not be written and its value is
  115. // undefined at the conclusion of
  116. // the operation. The driver
  117. // software cannot rely on the
  118. // written value to remain intact.
  119. #define PKA_BLENGTH 0x44004014 // PKA vector B length During
  120. // execution of basic PKCP
  121. // operations, this register is
  122. // double buffered and can be
  123. // written with a new value for the
  124. // next operation; when not
  125. // written, the value remains
  126. // intact. During the execution of
  127. // sequencer-controlled complex
  128. // operations, this register may
  129. // not be written and its value is
  130. // undefined at the conclusion of
  131. // the operation. The driver
  132. // software cannot rely on the
  133. // written value to remain intact.
  134. #define PKA_SHIFT 0x44004018 // PKA bit shift value For basic
  135. // PKCP operations, modifying the
  136. // contents of this register is
  137. // made impossible while the
  138. // operation is being performed.
  139. // For the ExpMod-variable and
  140. // ExpMod-CRT operations, this
  141. // register is used to indicate the
  142. // number of odd powers to use
  143. // (directly as a value in the
  144. // range 1-16). For the ModInv and
  145. // ECC operations, this register is
  146. // used to hold a completion code.
  147. #define PKA_FUNCTION 0x4400401C // PKA function This register
  148. // contains the control bits to
  149. // start basic PKCP as well as
  150. // complex sequencer operations.
  151. // The run bit can be used to poll
  152. // for the completion of the
  153. // operation. Modifying bits [11:0]
  154. // is made impossible during the
  155. // execution of a basic PKCP
  156. // operation. During the execution
  157. // of sequencer-controlled complex
  158. // operations, this register is
  159. // modified; the run and stall
  160. // result bits are set to zero at
  161. // the conclusion, but other bits
  162. // are undefined. Attention:
  163. // Continuously reading this
  164. // register to poll the run bit is
  165. // not allowed when executing
  166. // complex sequencer operations
  167. // (the sequencer cannot access the
  168. // PKCP when this is done). Leave
  169. // at least one sysclk cycle
  170. // between poll operations.
  171. #define PKA_COMPARE 0x44004020 // PKA compare result This
  172. // register provides the result of
  173. // a basic PKCP compare operation.
  174. // It is updated when the run bit
  175. // in the PKA_FUNCTION register is
  176. // reset at the end of that
  177. // operation. Status after a
  178. // complex sequencer operation is
  179. // unknown
  180. #define PKA_MSW 0x44004024 // PKA most-significant-word of
  181. // result vector This register
  182. // indicates the (word) address in
  183. // the PKA RAM where the most
  184. // significant nonzero 32-bit word
  185. // of the result is stored. Should
  186. // be ignored for modulo
  187. // operations. For basic PKCP
  188. // operations, this register is
  189. // updated when the run bit in the
  190. // PKA_FUNCTION register is reset
  191. // at the end of the operation. For
  192. // the complex-sequencer controlled
  193. // operations, updating of the
  194. // final value matching the actual
  195. // result is done near the end of
  196. // the operation; note that the
  197. // result is only meaningful if no
  198. // errors were detected and that
  199. // for ECC operations, the PKA_MSW
  200. // register will provide
  201. // information for the x-coordinate
  202. // of the result point only.
  203. #define PKA_DIVMSW 0x44004028 // PKA most-significant-word of
  204. // divide remainder This register
  205. // indicates the (32-bit word)
  206. // address in the PKA RAM where the
  207. // most significant nonzero 32-bit
  208. // word of the remainder result for
  209. // the basic divide and modulo
  210. // operations is stored. Bits [4:0]
  211. // are loaded with the bit number
  212. // of the most-significant nonzero
  213. // bit in the most-significant
  214. // nonzero word when MS one control
  215. // bit is set. For divide, modulo,
  216. // and MS one reporting, this
  217. // register is updated when the RUN
  218. // bit in the PKA_FUNCTION register
  219. // is reset at the end of the
  220. // operation. For the complex
  221. // sequencer controlled operations,
  222. // updating of bits [4:0] of this
  223. // register with the
  224. // most-significant bit location of
  225. // the actual result is done near
  226. // the end of the operation. The
  227. // result is meaningful only if no
  228. // errors were detected and that
  229. // for ECC operations; the
  230. // PKA_DIVMSW register provides
  231. // information for the x-coordinate
  232. // of the result point only.
  233. #define PKA_SEQ_CTRL 0x440040C8 // PKA sequencer control and
  234. // status register The sequencer is
  235. // interfaced with the outside
  236. // world through a single control
  237. // and status register. With the
  238. // exception of bit [31], the
  239. // actual use of bits in the
  240. // separate sub-fields of this
  241. // register is determined by the
  242. // sequencer firmware. This
  243. // register need only be accessed
  244. // when the sequencer program is
  245. // stored in RAM. The reset value
  246. // of the RESTE bit depends upon
  247. // the option chosen for sequencer
  248. // program storage.
  249. #define PKA_OPTIONS 0x440040F4 // PKA hardware options register
  250. // This register provides the host
  251. // with a means to determine the
  252. // hardware configuration
  253. // implemented in this PKA engine,
  254. // focused on options that have an
  255. // effect on software interacting
  256. // with the module. Note: (32 x
  257. // (1st LNME nr. of PEs + 1st LNME
  258. // FIFO RAM depth - 10)) equals the
  259. // maximum modulus vector length
  260. // (in bits) that can be handled by
  261. // the modular exponentiation and
  262. // ECC operations executed on a PKA
  263. // engine that includes an LNME.
  264. #define PKA_SW_REV 0x440040F8 // PKA firmware revision and
  265. // capabilities register This
  266. // register allows the host access
  267. // to the internal firmware
  268. // revision number of the PKA
  269. // Engine for software driver
  270. // matching and diagnostic
  271. // purposes. This register also
  272. // contains a field that encodes
  273. // the capabilities of the embedded
  274. // firmware. The PKA_SW_REV
  275. // register is written by the
  276. // firmware within a few clock
  277. // cycles after starting up that
  278. // firmware. The hardware reset
  279. // value is zero, indicating that
  280. // the information has not been
  281. // written yet.
  282. #define PKA_REVISION 0x440040FC // PKA hardware revision register
  283. // This register allows the host
  284. // access to the hardware revision
  285. // number of the PKA engine for
  286. // software driver matching and
  287. // diagnostic purposes. It is
  288. // always located at the highest
  289. // address in the access space of
  290. // the module and contains an
  291. // encoding of the EIP number (with
  292. // its complement as signature) for
  293. // recognition of the hardware
  294. // module.
  295. //*****************************************************************************
  296. //
  297. // The following are defines for the bit fields in the PKA_APTR register.
  298. //
  299. //*****************************************************************************
  300. #define PKA_APTR_APTR_M 0x000007FF // This register specifies the
  301. // location of vector A within the
  302. // PKA RAM. Vectors are identified
  303. // through the location of their
  304. // least-significant 32-bit word.
  305. // Note that bit [0] must be zero
  306. // to ensure that the vector starts
  307. // at an 8-byte boundary.
  308. #define PKA_APTR_APTR_S 0
  309. //*****************************************************************************
  310. //
  311. // The following are defines for the bit fields in the PKA_BPTR register.
  312. //
  313. //*****************************************************************************
  314. #define PKA_BPTR_BPTR_M 0x000007FF // This register specifies the
  315. // location of vector B within the
  316. // PKA RAM. Vectors are identified
  317. // through the location of their
  318. // least-significant 32-bit word.
  319. // Note that bit [0] must be zero
  320. // to ensure that the vector starts
  321. // at an 8-byte boundary.
  322. #define PKA_BPTR_BPTR_S 0
  323. //*****************************************************************************
  324. //
  325. // The following are defines for the bit fields in the PKA_CPTR register.
  326. //
  327. //*****************************************************************************
  328. #define PKA_CPTR_CPTR_M 0x000007FF // This register specifies the
  329. // location of vector C within the
  330. // PKA RAM. Vectors are identified
  331. // through the location of their
  332. // least-significant 32-bit word.
  333. // Note that bit [0] must be zero
  334. // to ensure that the vector starts
  335. // at an 8-byte boundary.
  336. #define PKA_CPTR_CPTR_S 0
  337. //*****************************************************************************
  338. //
  339. // The following are defines for the bit fields in the PKA_DPTR register.
  340. //
  341. //*****************************************************************************
  342. #define PKA_DPTR_DPTR_M 0x000007FF // This register specifies the
  343. // location of vector D within the
  344. // PKA RAM. Vectors are identified
  345. // through the location of their
  346. // least-significant 32-bit word.
  347. // Note that bit [0] must be zero
  348. // to ensure that the vector starts
  349. // at an 8-byte boundary.
  350. #define PKA_DPTR_DPTR_S 0
  351. //*****************************************************************************
  352. //
  353. // The following are defines for the bit fields in the PKA_ALENGTH register.
  354. //
  355. //*****************************************************************************
  356. #define PKA_ALENGTH_ALENGTH_M 0x000001FF // This register specifies the
  357. // length (in 32-bit words) of
  358. // Vector A.
  359. #define PKA_ALENGTH_ALENGTH_S 0
  360. //*****************************************************************************
  361. //
  362. // The following are defines for the bit fields in the PKA_BLENGTH register.
  363. //
  364. //*****************************************************************************
  365. #define PKA_BLENGTH_BLENGTH_M 0x000001FF // This register specifies the
  366. // length (in 32-bit words) of
  367. // Vector B.
  368. #define PKA_BLENGTH_BLENGTH_S 0
  369. //*****************************************************************************
  370. //
  371. // The following are defines for the bit fields in the PKA_SHIFT register.
  372. //
  373. //*****************************************************************************
  374. #define PKA_SHIFT_NUM_BITS_TO_SHIFT_M \
  375. 0x0000001F // This register specifies the
  376. // number of bits to shift the
  377. // input vector (in the range 0-31)
  378. // during a Rshift or Lshift
  379. // operation.
  380. #define PKA_SHIFT_NUM_BITS_TO_SHIFT_S 0
  381. //*****************************************************************************
  382. //
  383. // The following are defines for the bit fields in the PKA_FUNCTION register.
  384. //
  385. //*****************************************************************************
  386. #define PKA_FUNCTION_STALL_RESULT \
  387. 0x01000000 // When written with a 1b,
  388. // updating of the PKA_COMPARE,
  389. // PKA_MSW and PKA_DIVMSW
  390. // registers, as well as resetting
  391. // the run bit is stalled beyond
  392. // the point that a running
  393. // operation is actually finished.
  394. // Use this to allow software
  395. // enough time to read results from
  396. // a previous operation when the
  397. // newly started operation is known
  398. // to take only a short amount of
  399. // time. If a result is waiting,
  400. // the result registers is updated
  401. // and the run bit is reset in the
  402. // clock cycle following writing
  403. // the stall result bit back to 0b.
  404. // The Stall result function may
  405. // only be used for basic PKCP
  406. // operations.
  407. #define PKA_FUNCTION_STALL_RESULT_M \
  408. 0x01000000
  409. #define PKA_FUNCTION_STALL_RESULT_S 24
  410. #define PKA_FUNCTION_RUN 0x00008000 // The host sets this bit to
  411. // instruct the PKA module to begin
  412. // processing the basic PKCP or
  413. // complex sequencer operation.
  414. // This bit is reset low
  415. // automatically when the operation
  416. // is complete. The complement of
  417. // this bit is output as
  418. // interrupts[1]. After a reset,
  419. // the run bit is always set to 1b.
  420. // Depending on the option, program
  421. // ROM or program RAM, the
  422. // following applies: Program ROM -
  423. // The first sequencer instruction
  424. // sets the bit to 0b. This is done
  425. // immediately after the hardware
  426. // reset is released. Program RAM -
  427. // The sequencer must set the bit
  428. // to 0b. As a valid firmware may
  429. // not have been loaded, the
  430. // sequencer is held in software
  431. // reset after the hardware reset
  432. // is released (the reset bit in
  433. // PKA_SEQ_CRTL is set to 1b).
  434. // After the FW image is loaded and
  435. // the Reset bit is cleared, the
  436. // sequencer starts to execute the
  437. // FW. The first instruction clears
  438. // the run bit. In both cases a few
  439. // clock cycles are needed before
  440. // the first instruction is
  441. // executed and the run bit state
  442. // has been propagated.
  443. #define PKA_FUNCTION_RUN_M 0x00008000
  444. #define PKA_FUNCTION_RUN_S 15
  445. #define PKA_FUNCTION_SEQUENCER_OPERATIONS_M \
  446. 0x00007000 // These bits select the complex
  447. // sequencer operation to perform:
  448. // 000b: None 001b: ExpMod-CRT
  449. // 010b: ExpMod-ACT4 (compatible
  450. // with EIP2315) 011b: ECC-ADD (if
  451. // available in firmware, otherwise
  452. // reserved) 100b: ExpMod-ACT2
  453. // (compatible with EIP2316) 101b:
  454. // ECC-MUL (if available in
  455. // firmware, otherwise reserved)
  456. // 110b: ExpMod-variable 111b:
  457. // ModInv (if available in
  458. // firmware, otherwise reserved)
  459. // The encoding of these operations
  460. // is determined by sequencer
  461. // firmware.
  462. #define PKA_FUNCTION_SEQUENCER_OPERATIONS_S 12
  463. #define PKA_FUNCTION_COPY 0x00000800 // Perform copy operation
  464. #define PKA_FUNCTION_COPY_M 0x00000800
  465. #define PKA_FUNCTION_COPY_S 11
  466. #define PKA_FUNCTION_COMPARE 0x00000400 // Perform compare operation
  467. #define PKA_FUNCTION_COMPARE_M 0x00000400
  468. #define PKA_FUNCTION_COMPARE_S 10
  469. #define PKA_FUNCTION_MODULO 0x00000200 // Perform modulo operation
  470. #define PKA_FUNCTION_MODULO_M 0x00000200
  471. #define PKA_FUNCTION_MODULO_S 9
  472. #define PKA_FUNCTION_DIVIDE 0x00000100 // Perform divide operation
  473. #define PKA_FUNCTION_DIVIDE_M 0x00000100
  474. #define PKA_FUNCTION_DIVIDE_S 8
  475. #define PKA_FUNCTION_LSHIFT 0x00000080 // Perform left shift operation
  476. #define PKA_FUNCTION_LSHIFT_M 0x00000080
  477. #define PKA_FUNCTION_LSHIFT_S 7
  478. #define PKA_FUNCTION_RSHIFT 0x00000040 // Perform right shift operation
  479. #define PKA_FUNCTION_RSHIFT_M 0x00000040
  480. #define PKA_FUNCTION_RSHIFT_S 6
  481. #define PKA_FUNCTION_SUBTRACT 0x00000020 // Perform subtract operation
  482. #define PKA_FUNCTION_SUBTRACT_M 0x00000020
  483. #define PKA_FUNCTION_SUBTRACT_S 5
  484. #define PKA_FUNCTION_ADD 0x00000010 // Perform add operation
  485. #define PKA_FUNCTION_ADD_M 0x00000010
  486. #define PKA_FUNCTION_ADD_S 4
  487. #define PKA_FUNCTION_MS_ONE 0x00000008 // Loads the location of the Most
  488. // Significant one bit within the
  489. // result word indicated in the
  490. // PKA_MSW register into bits [4:0]
  491. // of the PKA_DIVMSW register - can
  492. // only be used with basic PKCP
  493. // operations, except for Divide,
  494. // Modulo and Compare.
  495. #define PKA_FUNCTION_MS_ONE_M 0x00000008
  496. #define PKA_FUNCTION_MS_ONE_S 3
  497. #define PKA_FUNCTION_ADDSUB 0x00000002 // Perform combined add/subtract
  498. // operation
  499. #define PKA_FUNCTION_ADDSUB_M 0x00000002
  500. #define PKA_FUNCTION_ADDSUB_S 1
  501. #define PKA_FUNCTION_MULTIPLY 0x00000001 // Perform multiply operation
  502. #define PKA_FUNCTION_MULTIPLY_M 0x00000001
  503. #define PKA_FUNCTION_MULTIPLY_S 0
  504. //*****************************************************************************
  505. //
  506. // The following are defines for the bit fields in the PKA_COMPARE register.
  507. //
  508. //*****************************************************************************
  509. #define PKA_COMPARE_A_GREATER_THAN_B \
  510. 0x00000004 // Vector_A is greater than
  511. // Vector_B
  512. #define PKA_COMPARE_A_GREATER_THAN_B_M \
  513. 0x00000004
  514. #define PKA_COMPARE_A_GREATER_THAN_B_S 2
  515. #define PKA_COMPARE_A_LESS_THAN_B \
  516. 0x00000002 // Vector_A is less than Vector_B
  517. #define PKA_COMPARE_A_LESS_THAN_B_M \
  518. 0x00000002
  519. #define PKA_COMPARE_A_LESS_THAN_B_S 1
  520. #define PKA_COMPARE_A_EQUALS_B 0x00000001 // Vector_A is equal to Vector_B
  521. #define PKA_COMPARE_A_EQUALS_B_M \
  522. 0x00000001
  523. #define PKA_COMPARE_A_EQUALS_B_S 0
  524. //*****************************************************************************
  525. //
  526. // The following are defines for the bit fields in the PKA_MSW register.
  527. //
  528. //*****************************************************************************
  529. #define PKA_MSW_RESULT_IS_ZERO 0x00008000 // The result vector is all
  530. // zeroes, ignore the address
  531. // returned in bits [10:0]
  532. #define PKA_MSW_RESULT_IS_ZERO_M \
  533. 0x00008000
  534. #define PKA_MSW_RESULT_IS_ZERO_S 15
  535. #define PKA_MSW_MSW_ADDRESS_M 0x000007FF // Address of the most-significant
  536. // nonzero 32-bit word of the
  537. // result vector in PKA RAM
  538. #define PKA_MSW_MSW_ADDRESS_S 0
  539. //*****************************************************************************
  540. //
  541. // The following are defines for the bit fields in the PKA_DIVMSW register.
  542. //
  543. //*****************************************************************************
  544. #define PKA_DIVMSW_RESULT_IS_ZERO \
  545. 0x00008000 // The result vector is all
  546. // zeroes, ignore the address
  547. // returned in bits [10:0]
  548. #define PKA_DIVMSW_RESULT_IS_ZERO_M \
  549. 0x00008000
  550. #define PKA_DIVMSW_RESULT_IS_ZERO_S 15
  551. #define PKA_DIVMSW_MSW_ADDRESS_M \
  552. 0x000007FF // Address of the most significant
  553. // nonzero 32-bit word of the
  554. // remainder result vector in PKA
  555. // RAM
  556. #define PKA_DIVMSW_MSW_ADDRESS_S 0
  557. //*****************************************************************************
  558. //
  559. // The following are defines for the bit fields in the PKA_SEQ_CTRL register.
  560. //
  561. //*****************************************************************************
  562. #define PKA_SEQ_CTRL_RESET 0x80000000 // Option program ROM: Reset value
  563. // = 0. Read/Write, reset value 0b
  564. // (ZERO). Writing 1b resets the
  565. // sequencer, write to 0b to
  566. // restart operations again. As the
  567. // reset value is 0b, the sequencer
  568. // will automatically start
  569. // operations executing from
  570. // program ROM. This bit should
  571. // always be written with zero and
  572. // ignored when reading this
  573. // register. Option Program RAM:
  574. // Reset value =1. Read/Write,
  575. // reset value 1b (ONE). When 1b,
  576. // the sequencer is held in a reset
  577. // state and the PKA_PROGRAM area
  578. // is accessible for loading the
  579. // sequencer program (while the
  580. // PKA_DATA_RAM is inaccessible),
  581. // write to 0b to (re)start
  582. // sequencer operations and disable
  583. // PKA_PROGRAM area accessibility
  584. // (also enables the PKA_DATA_RAM
  585. // accesses). Resetting the
  586. // sequencer (in order to load
  587. // other firmware) should only be
  588. // done when the PKA Engine is not
  589. // performing any operations (i.e.
  590. // the run bit in the PKA_FUNCTION
  591. // register should be zero).
  592. #define PKA_SEQ_CTRL_RESET_M 0x80000000
  593. #define PKA_SEQ_CTRL_RESET_S 31
  594. #define PKA_SEQ_CTRL_SEQUENCER_STATUS_M \
  595. 0x0000FF00 // These read-only bits can be
  596. // used by the sequencer to
  597. // communicate status to the
  598. // outside world. Bit [8] is also
  599. // used as sequencer interrupt,
  600. // with the complement of this bit
  601. // ORed into the run bit in
  602. // PKA_FUNCTION. This field should
  603. // always be written with zeroes
  604. // and ignored when reading this
  605. // register.
  606. #define PKA_SEQ_CTRL_SEQUENCER_STATUS_S 8
  607. #define PKA_SEQ_CTRL_SW_CONTROL_STATUS_M \
  608. 0x000000FF // These bits can be used by
  609. // software to trigger sequencer
  610. // operations. External logic can
  611. // set these bits by writing 1b,
  612. // cannot reset them by writing 0b.
  613. // The sequencer can reset these
  614. // bits by writing 0b, cannot set
  615. // them by writing 1b. Setting the
  616. // run bit in PKA_FUNCTION together
  617. // with a nonzero sequencer
  618. // operations field automatically
  619. // sets bit [0] here. This field
  620. // should always be written with
  621. // zeroes and ignored when reading
  622. // this register.
  623. #define PKA_SEQ_CTRL_SW_CONTROL_STATUS_S 0
  624. //*****************************************************************************
  625. //
  626. // The following are defines for the bit fields in the PKA_OPTIONS register.
  627. //
  628. //*****************************************************************************
  629. #define PKA_OPTIONS_FIRST_LNME_FIFO_DEPTH_M \
  630. 0xFF000000 // Number of words in the first
  631. // LNME's FIFO RAM Should be
  632. // ignored if LNME configuration is
  633. // 0. The contents of this field
  634. // indicate the actual depth as
  635. // selected by the LNME FIFO RAM
  636. // size strap input, fifo_size_sel.
  637. // Note: Reset value is undefined
  638. #define PKA_OPTIONS_FIRST_LNME_FIFO_DEPTH_S 24
  639. #define PKA_OPTIONS_FIRST_LNME_NR_OF_PES_M \
  640. 0x003F0000 // Number of processing elements
  641. // in the pipeline of the first
  642. // LNME Should be ignored if LNME
  643. // configuration is 0. Note: Reset
  644. // value is undefined.
  645. #define PKA_OPTIONS_FIRST_LNME_NR_OF_PES_S 16
  646. #define PKA_OPTIONS_MMM3A 0x00001000 // Reserved for a future
  647. // functional extension to the LNME
  648. // Always 0b
  649. #define PKA_OPTIONS_MMM3A_M 0x00001000
  650. #define PKA_OPTIONS_MMM3A_S 12
  651. #define PKA_OPTIONS_INT_MASKING 0x00000800 // Value 0b indicates that the
  652. // main interrupt output (bit [1]
  653. // of the interrupts output bus) is
  654. // the direct complement of the run
  655. // bit in the PKA_CONTROL register,
  656. // value 1b indicates that
  657. // interrupt masking logic is
  658. // present for this output. Note:
  659. // Reset value is undefined
  660. #define PKA_OPTIONS_INT_MASKING_M \
  661. 0x00000800
  662. #define PKA_OPTIONS_INT_MASKING_S 11
  663. #define PKA_OPTIONS_PROTECTION_OPTION_M \
  664. 0x00000700 // Value 0 indicates no additional
  665. // protection against side channel
  666. // attacks, value 1 indicates the
  667. // SCAP option, value 3 indicates
  668. // the PROT option; other values
  669. // are reserved. Note: Reset value
  670. // is undefined
  671. #define PKA_OPTIONS_PROTECTION_OPTION_S 8
  672. #define PKA_OPTIONS_PROGRAM_RAM 0x00000080 // Value 1b indicates sequencer
  673. // program storage in RAM, value 0b
  674. // in ROM. Note: Reset value is
  675. // undefined
  676. #define PKA_OPTIONS_PROGRAM_RAM_M \
  677. 0x00000080
  678. #define PKA_OPTIONS_PROGRAM_RAM_S 7
  679. #define PKA_OPTIONS_SEQUENCER_CONFIGURATION_M \
  680. 0x00000060 // Value 1 indicates a standard
  681. // sequencer; other values are
  682. // reserved.
  683. #define PKA_OPTIONS_SEQUENCER_CONFIGURATION_S 5
  684. #define PKA_OPTIONS_LNME_CONFIGURATION_M \
  685. 0x0000001C // Value 0 indicates NO LNME,
  686. // value 1 indicates one standard
  687. // LNME (with alpha = 32, beta =
  688. // 8); other values reserved. Note:
  689. // Reset value is undefined
  690. #define PKA_OPTIONS_LNME_CONFIGURATION_S 2
  691. #define PKA_OPTIONS_PKCP_CONFIGURATION_M \
  692. 0x00000003 // Value 1 indicates a PKCP with a
  693. // 16x16 multiplier, value 2
  694. // indicates a PKCP with a 32x32
  695. // multiplier, other values
  696. // reserved. Note: Reset value is
  697. // undefined.
  698. #define PKA_OPTIONS_PKCP_CONFIGURATION_S 0
  699. //*****************************************************************************
  700. //
  701. // The following are defines for the bit fields in the PKA_SW_REV register.
  702. //
  703. //*****************************************************************************
  704. #define PKA_SW_REV_FW_CAPABILITIES_M \
  705. 0xF0000000 // 4-bit binary encoding for the
  706. // functionality implemented in the
  707. // firmware. Value 0 indicates
  708. // basic ModExp with/without CRT.
  709. // Value 1 adds Modular Inversion,
  710. // value 2 adds Modular Inversion
  711. // and ECC operations. Values 3-15
  712. // are reserved.
  713. #define PKA_SW_REV_FW_CAPABILITIES_S 28
  714. #define PKA_SW_REV_MAJOR_FW_REVISION_M \
  715. 0x0F000000 // 4-bit binary encoding of the
  716. // major firmware revision number
  717. #define PKA_SW_REV_MAJOR_FW_REVISION_S 24
  718. #define PKA_SW_REV_MINOR_FW_REVISION_M \
  719. 0x00F00000 // 4-bit binary encoding of the
  720. // minor firmware revision number
  721. #define PKA_SW_REV_MINOR_FW_REVISION_S 20
  722. #define PKA_SW_REV_FW_PATCH_LEVEL_M \
  723. 0x000F0000 // 4-bit binary encoding of the
  724. // firmware patch level, initial
  725. // release will carry value zero
  726. // Patches are used to remove bugs
  727. // without changing the
  728. // functionality or interface of a
  729. // module.
  730. #define PKA_SW_REV_FW_PATCH_LEVEL_S 16
  731. //*****************************************************************************
  732. //
  733. // The following are defines for the bit fields in the PKA_REVISION register.
  734. //
  735. //*****************************************************************************
  736. #define PKA_REVISION_MAJOR_HW_REVISION_M \
  737. 0x0F000000 // 4-bit binary encoding of the
  738. // major hardware revision number
  739. #define PKA_REVISION_MAJOR_HW_REVISION_S 24
  740. #define PKA_REVISION_MINOR_HW_REVISION_M \
  741. 0x00F00000 // 4-bit binary encoding of the
  742. // minor hardware revision number
  743. #define PKA_REVISION_MINOR_HW_REVISION_S 20
  744. #define PKA_REVISION_HW_PATCH_LEVEL_M \
  745. 0x000F0000 // 4-bit binary encoding of the
  746. // hardware patch level, initial
  747. // release will carry value zero
  748. // Patches are used to remove bugs
  749. // without changing the
  750. // functionality or interface of a
  751. // module.
  752. #define PKA_REVISION_HW_PATCH_LEVEL_S 16
  753. #define PKA_REVISION_COMPLEMENT_OF_BASIC_EIP_NUMBER_M \
  754. 0x0000FF00 // Bit-by-bit logic complement of
  755. // bits [7:0], EIP-28 gives 0xE3
  756. #define PKA_REVISION_COMPLEMENT_OF_BASIC_EIP_NUMBER_S 8
  757. #define PKA_REVISION_BASIC_EIP_NUMBER_M \
  758. 0x000000FF // 8-bit binary encoding of the
  759. // EIP number, EIP-28 gives 0x1C
  760. #define PKA_REVISION_BASIC_EIP_NUMBER_S 0
  761. #endif // __HW_PKA_H__