1 /***********************license start***************
2 * Copyright (c) 2011 Cavium Inc. (support@cavium.com). All rights
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
10 * * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
13 * * Redistributions in binary form must reproduce the above
14 * copyright notice, this list of conditions and the following
15 * disclaimer in the documentation and/or other materials provided
16 * with the distribution.
18 * * Neither the name of Cavium Inc. nor the names of
19 * its contributors may be used to endorse or promote products
20 * derived from this software without specific prior written
23 * This Software, including technical data, may be subject to U.S. export control
24 * laws, including the U.S. Export Administration Act and its associated
25 * regulations, and may be subject to export or import regulations in other
28 * TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
29 * AND WITH ALL FAULTS AND CAVIUM INC. MAKES NO PROMISES, REPRESENTATIONS OR
30 * WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO
31 * THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY REPRESENTATION OR
32 * DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT DEFECTS, AND CAVIUM
33 * SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES OF TITLE,
34 * MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF
35 * VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR
36 * CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT OF USE OR
37 * PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
38 ***********************license end**************************************/
49 * Interface to the CN63XX, CN68XX hardware HFA engine.
51 * <hr>$Revision: 49448 $<hr>
54 #ifndef __CVMX_HFA_H__
55 #define __CVMX_HFA_H__
57 #ifndef CVMX_BUILD_FOR_LINUX_USER
61 #include "cvmx-bootmem.h"
63 #ifdef CVMX_BUILD_FOR_LINUX_KERNEL
64 #include <asm/octeon/cvmx.h>
65 #include <asm/octeon/cvmx-config.h>
67 #ifdef CVMX_ENABLE_DFA_FUNCTIONS
68 /* DFA queue cmd buffers */
70 #define CVMX_FPA_DFA_POOL (4) /**< DFA command buffers */
71 #define CVMX_FPA_DFA_POOL_SIZE (2 * CVMX_CACHE_LINE_SIZE)
75 #include "executive-config.h"
76 #ifdef CVMX_ENABLE_DFA_FUNCTIONS
77 #include "cvmx-config.h"
82 #define ENABLE_DEPRECATED /* Set to enable the old 18/36 bit names */
88 #define CVMX_DFA_ITYPE_MEMLOAD 0x0
89 #define CVMX_DFA_ITYPE_CACHELOAD 0x1
90 #define CVMX_DFA_ITYPE_GRAPHFREE 0x3
91 #define CVMX_DFA_ITYPE_GRAPHWALK 0x4
96 #ifdef __BIG_ENDIAN_BITFIELD
104 } cvmx_dfa_gather_entry_t;
108 #ifdef __BIG_ENDIAN_BITFIELD
112 uint64_t gather_mode:1;
113 uint64_t little_endian:1;
114 uint64_t store_full:1;
115 uint64_t load_through:1;
125 uint64_t load_through:1;
126 uint64_t store_full:1;
127 uint64_t little_endian:1;
128 uint64_t gather_mode:1;
135 #ifdef __BIG_ENDIAN_BITFIELD
140 uint64_t gather_mode:1;
141 uint64_t little_endian:1;
142 uint64_t store_full:1;
143 uint64_t load_through:1;
157 uint64_t load_through:1;
158 uint64_t store_full:1;
159 uint64_t little_endian:1;
160 uint64_t gather_mode:1;
168 #ifdef __BIG_ENDIAN_BITFIELD
170 uint64_t gather_mode:1;
171 uint64_t little_endian:1;
172 uint64_t store_full:1;
173 uint64_t load_through:1;
183 uint64_t load_through:1;
184 uint64_t store_full:1;
185 uint64_t little_endian:1;
186 uint64_t gather_mode:1;
191 #ifdef __BIG_ENDIAN_BITFIELD
193 uint64_t store_full:1;
201 uint64_t store_full:1;
209 #ifdef __BIG_ENDIAN_BITFIELD
220 #ifdef __BIG_ENDIAN_BITFIELD
233 #ifdef __BIG_ENDIAN_BITFIELD
246 #ifdef __BIG_ENDIAN_BITFIELD
258 #ifdef __BIG_ENDIAN_BITFIELD
273 #ifdef __BIG_ENDIAN_BITFIELD
286 #ifdef __BIG_ENDIAN_BITFIELD
301 #ifdef __BIG_ENDIAN_BITFIELD
315 #ifdef __BIG_ENDIAN_BITFIELD
330 #ifdef __BIG_ENDIAN_BITFIELD
345 #ifdef __BIG_ENDIAN_BITFIELD
360 #ifdef __BIG_ENDIAN_BITFIELD
377 cvmx_dfa_word0_t word0;
378 cvmx_dfa_word1_t word1;
379 cvmx_dfa_word2_t word2;
380 cvmx_dfa_word3_t word3;
382 } cvmx_dfa_command_t;
384 #ifdef CVMX_ENABLE_DFA_FUNCTIONS
386 * Initialize the DFA hardware before use
387 * Returns 0 on success, -1 on failure
389 int cvmx_hfa_initialize(void);
393 * Shutdown and cleanup resources used by the DFA
395 int cvmx_hfa_shutdown(void);
398 * Submit a command to the HFA block
400 * @param command HFA command to submit
402 * @return Zero on success, negative on failure
404 int cvmx_hfa_submit(cvmx_dfa_command_t *command);
407 * Allocate a block of memory from the free list that was passed
408 * to the application by the bootloader.
410 * @param size Size in bytes of block to allocate
411 * @param alignment Alignment required - must be power of 2
413 * @return pointer to block of memory, NULL on error
416 void *hfa_bootmem_alloc (uint64_t size, uint64_t alignment);
419 * Frees a block to the bootmem allocator list.
421 * @param ptr address of block (memory pointer (void*))
422 * @param size size of block in bytes.
424 * @return 1 on success,
429 int hfa_bootmem_free (void *ptr, uint64_t size);
437 #endif /* __CVMX_HFA_H__ */