cvmx-fau.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619
  1. /***********************license start***************
  2. * Author: Cavium Networks
  3. *
  4. * Contact: [email protected]
  5. * This file is part of the OCTEON SDK
  6. *
  7. * Copyright (c) 2003-2008 Cavium Networks
  8. *
  9. * This file is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License, Version 2, as
  11. * published by the Free Software Foundation.
  12. *
  13. * This file is distributed in the hope that it will be useful, but
  14. * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
  15. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
  16. * NONINFRINGEMENT. See the GNU General Public License for more
  17. * details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this file; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  22. * or visit http://www.gnu.org/licenses/.
  23. *
  24. * This file may also be available under a different license from Cavium.
  25. * Contact Cavium Networks for more information
  26. ***********************license end**************************************/
  27. /*
  28. * Interface to the hardware Fetch and Add Unit.
  29. */
  30. #ifndef __CVMX_FAU_H__
  31. #define __CVMX_FAU_H__
  32. /*
  33. * Octeon Fetch and Add Unit (FAU)
  34. */
  35. #define CVMX_FAU_LOAD_IO_ADDRESS cvmx_build_io_address(0x1e, 0)
  36. #define CVMX_FAU_BITS_SCRADDR 63, 56
  37. #define CVMX_FAU_BITS_LEN 55, 48
  38. #define CVMX_FAU_BITS_INEVAL 35, 14
  39. #define CVMX_FAU_BITS_TAGWAIT 13, 13
  40. #define CVMX_FAU_BITS_NOADD 13, 13
  41. #define CVMX_FAU_BITS_SIZE 12, 11
  42. #define CVMX_FAU_BITS_REGISTER 10, 0
  43. typedef enum {
  44. CVMX_FAU_OP_SIZE_8 = 0,
  45. CVMX_FAU_OP_SIZE_16 = 1,
  46. CVMX_FAU_OP_SIZE_32 = 2,
  47. CVMX_FAU_OP_SIZE_64 = 3
  48. } cvmx_fau_op_size_t;
  49. /**
  50. * Tagwait return definition. If a timeout occurs, the error
  51. * bit will be set. Otherwise the value of the register before
  52. * the update will be returned.
  53. */
  54. typedef struct {
  55. uint64_t error:1;
  56. int64_t value:63;
  57. } cvmx_fau_tagwait64_t;
  58. /**
  59. * Tagwait return definition. If a timeout occurs, the error
  60. * bit will be set. Otherwise the value of the register before
  61. * the update will be returned.
  62. */
  63. typedef struct {
  64. uint64_t error:1;
  65. int32_t value:31;
  66. } cvmx_fau_tagwait32_t;
  67. /**
  68. * Tagwait return definition. If a timeout occurs, the error
  69. * bit will be set. Otherwise the value of the register before
  70. * the update will be returned.
  71. */
  72. typedef struct {
  73. uint64_t error:1;
  74. int16_t value:15;
  75. } cvmx_fau_tagwait16_t;
  76. /**
  77. * Tagwait return definition. If a timeout occurs, the error
  78. * bit will be set. Otherwise the value of the register before
  79. * the update will be returned.
  80. */
  81. typedef struct {
  82. uint64_t error:1;
  83. int8_t value:7;
  84. } cvmx_fau_tagwait8_t;
  85. /**
  86. * Asynchronous tagwait return definition. If a timeout occurs,
  87. * the error bit will be set. Otherwise the value of the
  88. * register before the update will be returned.
  89. */
  90. typedef union {
  91. uint64_t u64;
  92. struct {
  93. uint64_t invalid:1;
  94. uint64_t data:63; /* unpredictable if invalid is set */
  95. } s;
  96. } cvmx_fau_async_tagwait_result_t;
  97. #ifdef __BIG_ENDIAN_BITFIELD
  98. #define SWIZZLE_8 0
  99. #define SWIZZLE_16 0
  100. #define SWIZZLE_32 0
  101. #else
  102. #define SWIZZLE_8 0x7
  103. #define SWIZZLE_16 0x6
  104. #define SWIZZLE_32 0x4
  105. #endif
  106. /**
  107. * Builds a store I/O address for writing to the FAU
  108. *
  109. * @noadd: 0 = Store value is atomically added to the current value
  110. * 1 = Store value is atomically written over the current value
  111. * @reg: FAU atomic register to access. 0 <= reg < 2048.
  112. * - Step by 2 for 16 bit access.
  113. * - Step by 4 for 32 bit access.
  114. * - Step by 8 for 64 bit access.
  115. * Returns Address to store for atomic update
  116. */
  117. static inline uint64_t __cvmx_fau_store_address(uint64_t noadd, uint64_t reg)
  118. {
  119. return CVMX_ADD_IO_SEG(CVMX_FAU_LOAD_IO_ADDRESS) |
  120. cvmx_build_bits(CVMX_FAU_BITS_NOADD, noadd) |
  121. cvmx_build_bits(CVMX_FAU_BITS_REGISTER, reg);
  122. }
  123. /**
  124. * Builds a I/O address for accessing the FAU
  125. *
  126. * @tagwait: Should the atomic add wait for the current tag switch
  127. * operation to complete.
  128. * - 0 = Don't wait
  129. * - 1 = Wait for tag switch to complete
  130. * @reg: FAU atomic register to access. 0 <= reg < 2048.
  131. * - Step by 2 for 16 bit access.
  132. * - Step by 4 for 32 bit access.
  133. * - Step by 8 for 64 bit access.
  134. * @value: Signed value to add.
  135. * Note: When performing 32 and 64 bit access, only the low
  136. * 22 bits are available.
  137. * Returns Address to read from for atomic update
  138. */
  139. static inline uint64_t __cvmx_fau_atomic_address(uint64_t tagwait, uint64_t reg,
  140. int64_t value)
  141. {
  142. return CVMX_ADD_IO_SEG(CVMX_FAU_LOAD_IO_ADDRESS) |
  143. cvmx_build_bits(CVMX_FAU_BITS_INEVAL, value) |
  144. cvmx_build_bits(CVMX_FAU_BITS_TAGWAIT, tagwait) |
  145. cvmx_build_bits(CVMX_FAU_BITS_REGISTER, reg);
  146. }
  147. /**
  148. * Perform an atomic 64 bit add
  149. *
  150. * @reg: FAU atomic register to access. 0 <= reg < 2048.
  151. * - Step by 8 for 64 bit access.
  152. * @value: Signed value to add.
  153. * Note: Only the low 22 bits are available.
  154. * Returns Value of the register before the update
  155. */
  156. static inline int64_t cvmx_fau_fetch_and_add64(cvmx_fau_reg_64_t reg,
  157. int64_t value)
  158. {
  159. return cvmx_read64_int64(__cvmx_fau_atomic_address(0, reg, value));
  160. }
  161. /**
  162. * Perform an atomic 32 bit add
  163. *
  164. * @reg: FAU atomic register to access. 0 <= reg < 2048.
  165. * - Step by 4 for 32 bit access.
  166. * @value: Signed value to add.
  167. * Note: Only the low 22 bits are available.
  168. * Returns Value of the register before the update
  169. */
  170. static inline int32_t cvmx_fau_fetch_and_add32(cvmx_fau_reg_32_t reg,
  171. int32_t value)
  172. {
  173. reg ^= SWIZZLE_32;
  174. return cvmx_read64_int32(__cvmx_fau_atomic_address(0, reg, value));
  175. }
  176. /**
  177. * Perform an atomic 16 bit add
  178. *
  179. * @reg: FAU atomic register to access. 0 <= reg < 2048.
  180. * - Step by 2 for 16 bit access.
  181. * @value: Signed value to add.
  182. * Returns Value of the register before the update
  183. */
  184. static inline int16_t cvmx_fau_fetch_and_add16(cvmx_fau_reg_16_t reg,
  185. int16_t value)
  186. {
  187. reg ^= SWIZZLE_16;
  188. return cvmx_read64_int16(__cvmx_fau_atomic_address(0, reg, value));
  189. }
  190. /**
  191. * Perform an atomic 8 bit add
  192. *
  193. * @reg: FAU atomic register to access. 0 <= reg < 2048.
  194. * @value: Signed value to add.
  195. * Returns Value of the register before the update
  196. */
  197. static inline int8_t cvmx_fau_fetch_and_add8(cvmx_fau_reg_8_t reg, int8_t value)
  198. {
  199. reg ^= SWIZZLE_8;
  200. return cvmx_read64_int8(__cvmx_fau_atomic_address(0, reg, value));
  201. }
  202. /**
  203. * Perform an atomic 64 bit add after the current tag switch
  204. * completes
  205. *
  206. * @reg: FAU atomic register to access. 0 <= reg < 2048.
  207. * - Step by 8 for 64 bit access.
  208. * @value: Signed value to add.
  209. * Note: Only the low 22 bits are available.
  210. * Returns If a timeout occurs, the error bit will be set. Otherwise
  211. * the value of the register before the update will be
  212. * returned
  213. */
  214. static inline cvmx_fau_tagwait64_t
  215. cvmx_fau_tagwait_fetch_and_add64(cvmx_fau_reg_64_t reg, int64_t value)
  216. {
  217. union {
  218. uint64_t i64;
  219. cvmx_fau_tagwait64_t t;
  220. } result;
  221. result.i64 =
  222. cvmx_read64_int64(__cvmx_fau_atomic_address(1, reg, value));
  223. return result.t;
  224. }
  225. /**
  226. * Perform an atomic 32 bit add after the current tag switch
  227. * completes
  228. *
  229. * @reg: FAU atomic register to access. 0 <= reg < 2048.
  230. * - Step by 4 for 32 bit access.
  231. * @value: Signed value to add.
  232. * Note: Only the low 22 bits are available.
  233. * Returns If a timeout occurs, the error bit will be set. Otherwise
  234. * the value of the register before the update will be
  235. * returned
  236. */
  237. static inline cvmx_fau_tagwait32_t
  238. cvmx_fau_tagwait_fetch_and_add32(cvmx_fau_reg_32_t reg, int32_t value)
  239. {
  240. union {
  241. uint64_t i32;
  242. cvmx_fau_tagwait32_t t;
  243. } result;
  244. reg ^= SWIZZLE_32;
  245. result.i32 =
  246. cvmx_read64_int32(__cvmx_fau_atomic_address(1, reg, value));
  247. return result.t;
  248. }
  249. /**
  250. * Perform an atomic 16 bit add after the current tag switch
  251. * completes
  252. *
  253. * @reg: FAU atomic register to access. 0 <= reg < 2048.
  254. * - Step by 2 for 16 bit access.
  255. * @value: Signed value to add.
  256. * Returns If a timeout occurs, the error bit will be set. Otherwise
  257. * the value of the register before the update will be
  258. * returned
  259. */
  260. static inline cvmx_fau_tagwait16_t
  261. cvmx_fau_tagwait_fetch_and_add16(cvmx_fau_reg_16_t reg, int16_t value)
  262. {
  263. union {
  264. uint64_t i16;
  265. cvmx_fau_tagwait16_t t;
  266. } result;
  267. reg ^= SWIZZLE_16;
  268. result.i16 =
  269. cvmx_read64_int16(__cvmx_fau_atomic_address(1, reg, value));
  270. return result.t;
  271. }
  272. /**
  273. * Perform an atomic 8 bit add after the current tag switch
  274. * completes
  275. *
  276. * @reg: FAU atomic register to access. 0 <= reg < 2048.
  277. * @value: Signed value to add.
  278. * Returns If a timeout occurs, the error bit will be set. Otherwise
  279. * the value of the register before the update will be
  280. * returned
  281. */
  282. static inline cvmx_fau_tagwait8_t
  283. cvmx_fau_tagwait_fetch_and_add8(cvmx_fau_reg_8_t reg, int8_t value)
  284. {
  285. union {
  286. uint64_t i8;
  287. cvmx_fau_tagwait8_t t;
  288. } result;
  289. reg ^= SWIZZLE_8;
  290. result.i8 = cvmx_read64_int8(__cvmx_fau_atomic_address(1, reg, value));
  291. return result.t;
  292. }
  293. /**
  294. * Builds I/O data for async operations
  295. *
  296. * @scraddr: Scratch pad byte address to write to. Must be 8 byte aligned
  297. * @value: Signed value to add.
  298. * Note: When performing 32 and 64 bit access, only the low
  299. * 22 bits are available.
  300. * @tagwait: Should the atomic add wait for the current tag switch
  301. * operation to complete.
  302. * - 0 = Don't wait
  303. * - 1 = Wait for tag switch to complete
  304. * @size: The size of the operation:
  305. * - CVMX_FAU_OP_SIZE_8 (0) = 8 bits
  306. * - CVMX_FAU_OP_SIZE_16 (1) = 16 bits
  307. * - CVMX_FAU_OP_SIZE_32 (2) = 32 bits
  308. * - CVMX_FAU_OP_SIZE_64 (3) = 64 bits
  309. * @reg: FAU atomic register to access. 0 <= reg < 2048.
  310. * - Step by 2 for 16 bit access.
  311. * - Step by 4 for 32 bit access.
  312. * - Step by 8 for 64 bit access.
  313. * Returns Data to write using cvmx_send_single
  314. */
  315. static inline uint64_t __cvmx_fau_iobdma_data(uint64_t scraddr, int64_t value,
  316. uint64_t tagwait,
  317. cvmx_fau_op_size_t size,
  318. uint64_t reg)
  319. {
  320. return CVMX_FAU_LOAD_IO_ADDRESS |
  321. cvmx_build_bits(CVMX_FAU_BITS_SCRADDR, scraddr >> 3) |
  322. cvmx_build_bits(CVMX_FAU_BITS_LEN, 1) |
  323. cvmx_build_bits(CVMX_FAU_BITS_INEVAL, value) |
  324. cvmx_build_bits(CVMX_FAU_BITS_TAGWAIT, tagwait) |
  325. cvmx_build_bits(CVMX_FAU_BITS_SIZE, size) |
  326. cvmx_build_bits(CVMX_FAU_BITS_REGISTER, reg);
  327. }
  328. /**
  329. * Perform an async atomic 64 bit add. The old value is
  330. * placed in the scratch memory at byte address scraddr.
  331. *
  332. * @scraddr: Scratch memory byte address to put response in.
  333. * Must be 8 byte aligned.
  334. * @reg: FAU atomic register to access. 0 <= reg < 2048.
  335. * - Step by 8 for 64 bit access.
  336. * @value: Signed value to add.
  337. * Note: Only the low 22 bits are available.
  338. * Returns Placed in the scratch pad register
  339. */
  340. static inline void cvmx_fau_async_fetch_and_add64(uint64_t scraddr,
  341. cvmx_fau_reg_64_t reg,
  342. int64_t value)
  343. {
  344. cvmx_send_single(__cvmx_fau_iobdma_data
  345. (scraddr, value, 0, CVMX_FAU_OP_SIZE_64, reg));
  346. }
  347. /**
  348. * Perform an async atomic 32 bit add. The old value is
  349. * placed in the scratch memory at byte address scraddr.
  350. *
  351. * @scraddr: Scratch memory byte address to put response in.
  352. * Must be 8 byte aligned.
  353. * @reg: FAU atomic register to access. 0 <= reg < 2048.
  354. * - Step by 4 for 32 bit access.
  355. * @value: Signed value to add.
  356. * Note: Only the low 22 bits are available.
  357. * Returns Placed in the scratch pad register
  358. */
  359. static inline void cvmx_fau_async_fetch_and_add32(uint64_t scraddr,
  360. cvmx_fau_reg_32_t reg,
  361. int32_t value)
  362. {
  363. cvmx_send_single(__cvmx_fau_iobdma_data
  364. (scraddr, value, 0, CVMX_FAU_OP_SIZE_32, reg));
  365. }
  366. /**
  367. * Perform an async atomic 16 bit add. The old value is
  368. * placed in the scratch memory at byte address scraddr.
  369. *
  370. * @scraddr: Scratch memory byte address to put response in.
  371. * Must be 8 byte aligned.
  372. * @reg: FAU atomic register to access. 0 <= reg < 2048.
  373. * - Step by 2 for 16 bit access.
  374. * @value: Signed value to add.
  375. * Returns Placed in the scratch pad register
  376. */
  377. static inline void cvmx_fau_async_fetch_and_add16(uint64_t scraddr,
  378. cvmx_fau_reg_16_t reg,
  379. int16_t value)
  380. {
  381. cvmx_send_single(__cvmx_fau_iobdma_data
  382. (scraddr, value, 0, CVMX_FAU_OP_SIZE_16, reg));
  383. }
  384. /**
  385. * Perform an async atomic 8 bit add. The old value is
  386. * placed in the scratch memory at byte address scraddr.
  387. *
  388. * @scraddr: Scratch memory byte address to put response in.
  389. * Must be 8 byte aligned.
  390. * @reg: FAU atomic register to access. 0 <= reg < 2048.
  391. * @value: Signed value to add.
  392. * Returns Placed in the scratch pad register
  393. */
  394. static inline void cvmx_fau_async_fetch_and_add8(uint64_t scraddr,
  395. cvmx_fau_reg_8_t reg,
  396. int8_t value)
  397. {
  398. cvmx_send_single(__cvmx_fau_iobdma_data
  399. (scraddr, value, 0, CVMX_FAU_OP_SIZE_8, reg));
  400. }
  401. /**
  402. * Perform an async atomic 64 bit add after the current tag
  403. * switch completes.
  404. *
  405. * @scraddr: Scratch memory byte address to put response in. Must be
  406. * 8 byte aligned. If a timeout occurs, the error bit (63)
  407. * will be set. Otherwise the value of the register before
  408. * the update will be returned
  409. *
  410. * @reg: FAU atomic register to access. 0 <= reg < 2048.
  411. * - Step by 8 for 64 bit access.
  412. * @value: Signed value to add.
  413. * Note: Only the low 22 bits are available.
  414. * Returns Placed in the scratch pad register
  415. */
  416. static inline void cvmx_fau_async_tagwait_fetch_and_add64(uint64_t scraddr,
  417. cvmx_fau_reg_64_t reg,
  418. int64_t value)
  419. {
  420. cvmx_send_single(__cvmx_fau_iobdma_data
  421. (scraddr, value, 1, CVMX_FAU_OP_SIZE_64, reg));
  422. }
  423. /**
  424. * Perform an async atomic 32 bit add after the current tag
  425. * switch completes.
  426. *
  427. * @scraddr: Scratch memory byte address to put response in. Must be
  428. * 8 byte aligned. If a timeout occurs, the error bit (63)
  429. * will be set. Otherwise the value of the register before
  430. * the update will be returned
  431. *
  432. * @reg: FAU atomic register to access. 0 <= reg < 2048.
  433. * - Step by 4 for 32 bit access.
  434. * @value: Signed value to add.
  435. * Note: Only the low 22 bits are available.
  436. * Returns Placed in the scratch pad register
  437. */
  438. static inline void cvmx_fau_async_tagwait_fetch_and_add32(uint64_t scraddr,
  439. cvmx_fau_reg_32_t reg,
  440. int32_t value)
  441. {
  442. cvmx_send_single(__cvmx_fau_iobdma_data
  443. (scraddr, value, 1, CVMX_FAU_OP_SIZE_32, reg));
  444. }
  445. /**
  446. * Perform an async atomic 16 bit add after the current tag
  447. * switch completes.
  448. *
  449. * @scraddr: Scratch memory byte address to put response in. Must be
  450. * 8 byte aligned. If a timeout occurs, the error bit (63)
  451. * will be set. Otherwise the value of the register before
  452. * the update will be returned
  453. *
  454. * @reg: FAU atomic register to access. 0 <= reg < 2048.
  455. * - Step by 2 for 16 bit access.
  456. * @value: Signed value to add.
  457. *
  458. * Returns Placed in the scratch pad register
  459. */
  460. static inline void cvmx_fau_async_tagwait_fetch_and_add16(uint64_t scraddr,
  461. cvmx_fau_reg_16_t reg,
  462. int16_t value)
  463. {
  464. cvmx_send_single(__cvmx_fau_iobdma_data
  465. (scraddr, value, 1, CVMX_FAU_OP_SIZE_16, reg));
  466. }
  467. /**
  468. * Perform an async atomic 8 bit add after the current tag
  469. * switch completes.
  470. *
  471. * @scraddr: Scratch memory byte address to put response in. Must be
  472. * 8 byte aligned. If a timeout occurs, the error bit (63)
  473. * will be set. Otherwise the value of the register before
  474. * the update will be returned
  475. *
  476. * @reg: FAU atomic register to access. 0 <= reg < 2048.
  477. * @value: Signed value to add.
  478. *
  479. * Returns Placed in the scratch pad register
  480. */
  481. static inline void cvmx_fau_async_tagwait_fetch_and_add8(uint64_t scraddr,
  482. cvmx_fau_reg_8_t reg,
  483. int8_t value)
  484. {
  485. cvmx_send_single(__cvmx_fau_iobdma_data
  486. (scraddr, value, 1, CVMX_FAU_OP_SIZE_8, reg));
  487. }
  488. /**
  489. * Perform an atomic 64 bit add
  490. *
  491. * @reg: FAU atomic register to access. 0 <= reg < 2048.
  492. * - Step by 8 for 64 bit access.
  493. * @value: Signed value to add.
  494. */
  495. static inline void cvmx_fau_atomic_add64(cvmx_fau_reg_64_t reg, int64_t value)
  496. {
  497. cvmx_write64_int64(__cvmx_fau_store_address(0, reg), value);
  498. }
  499. /**
  500. * Perform an atomic 32 bit add
  501. *
  502. * @reg: FAU atomic register to access. 0 <= reg < 2048.
  503. * - Step by 4 for 32 bit access.
  504. * @value: Signed value to add.
  505. */
  506. static inline void cvmx_fau_atomic_add32(cvmx_fau_reg_32_t reg, int32_t value)
  507. {
  508. reg ^= SWIZZLE_32;
  509. cvmx_write64_int32(__cvmx_fau_store_address(0, reg), value);
  510. }
  511. /**
  512. * Perform an atomic 16 bit add
  513. *
  514. * @reg: FAU atomic register to access. 0 <= reg < 2048.
  515. * - Step by 2 for 16 bit access.
  516. * @value: Signed value to add.
  517. */
  518. static inline void cvmx_fau_atomic_add16(cvmx_fau_reg_16_t reg, int16_t value)
  519. {
  520. reg ^= SWIZZLE_16;
  521. cvmx_write64_int16(__cvmx_fau_store_address(0, reg), value);
  522. }
  523. /**
  524. * Perform an atomic 8 bit add
  525. *
  526. * @reg: FAU atomic register to access. 0 <= reg < 2048.
  527. * @value: Signed value to add.
  528. */
  529. static inline void cvmx_fau_atomic_add8(cvmx_fau_reg_8_t reg, int8_t value)
  530. {
  531. reg ^= SWIZZLE_8;
  532. cvmx_write64_int8(__cvmx_fau_store_address(0, reg), value);
  533. }
  534. /**
  535. * Perform an atomic 64 bit write
  536. *
  537. * @reg: FAU atomic register to access. 0 <= reg < 2048.
  538. * - Step by 8 for 64 bit access.
  539. * @value: Signed value to write.
  540. */
  541. static inline void cvmx_fau_atomic_write64(cvmx_fau_reg_64_t reg, int64_t value)
  542. {
  543. cvmx_write64_int64(__cvmx_fau_store_address(1, reg), value);
  544. }
  545. /**
  546. * Perform an atomic 32 bit write
  547. *
  548. * @reg: FAU atomic register to access. 0 <= reg < 2048.
  549. * - Step by 4 for 32 bit access.
  550. * @value: Signed value to write.
  551. */
  552. static inline void cvmx_fau_atomic_write32(cvmx_fau_reg_32_t reg, int32_t value)
  553. {
  554. reg ^= SWIZZLE_32;
  555. cvmx_write64_int32(__cvmx_fau_store_address(1, reg), value);
  556. }
  557. /**
  558. * Perform an atomic 16 bit write
  559. *
  560. * @reg: FAU atomic register to access. 0 <= reg < 2048.
  561. * - Step by 2 for 16 bit access.
  562. * @value: Signed value to write.
  563. */
  564. static inline void cvmx_fau_atomic_write16(cvmx_fau_reg_16_t reg, int16_t value)
  565. {
  566. reg ^= SWIZZLE_16;
  567. cvmx_write64_int16(__cvmx_fau_store_address(1, reg), value);
  568. }
  569. /**
  570. * Perform an atomic 8 bit write
  571. *
  572. * @reg: FAU atomic register to access. 0 <= reg < 2048.
  573. * @value: Signed value to write.
  574. */
  575. static inline void cvmx_fau_atomic_write8(cvmx_fau_reg_8_t reg, int8_t value)
  576. {
  577. reg ^= SWIZZLE_8;
  578. cvmx_write64_int8(__cvmx_fau_store_address(1, reg), value);
  579. }
  580. #endif /* __CVMX_FAU_H__ */