]> git.proxmox.com Git - ceph.git/blame - ceph/src/isa-l/igzip/aarch64/data_struct_aarch64.h
Import ceph 15.2.8
[ceph.git] / ceph / src / isa-l / igzip / aarch64 / data_struct_aarch64.h
CommitLineData
f91f0fd5
TL
1/**********************************************************************
2 Copyright(c) 2019 Arm Corporation All rights reserved.
3
4 Redistribution and use in source and binary forms, with or without
5 modification, are permitted provided that the following conditions
6 are met:
7 * Redistributions of source code must retain the above copyright
8 notice, this list of conditions and the following disclaimer.
9 * Redistributions in binary form must reproduce the above copyright
10 notice, this list of conditions and the following disclaimer in
11 the documentation and/or other materials provided with the
12 distribution.
13 * Neither the name of Arm Corporation nor the names of its
14 contributors may be used to endorse or promote products derived
15 from this software without specific prior written permission.
16
17 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28**********************************************************************/
29#ifndef __AARCH64_DATA_STRUCT_H__
30#define __AARCH64_DATA_STRUCT_H__
31#ifdef __ASSEMBLY__
32
33#define FIELD(name,size,align) \
34 .set _FIELD_OFFSET,(_FIELD_OFFSET + (align) - 1) & (~ ((align)-1)); \
35 .equ name,_FIELD_OFFSET ; \
36 .set _FIELD_OFFSET,_FIELD_OFFSET + size; \
37 .if align > _STRUCT_ALIGN; \
38 .set _STRUCT_ALIGN, align; \
39 .endif;
40
41#define START_STRUCT(name) .set _FIELD_OFFSET,0;.set _STRUCT_ALIGN,0;
42
43#define END_STRUCT(name) .set _##name##_size,_FIELD_OFFSET;\
44 .set _##name##_align,_STRUCT_ALIGN
45
46#define CONST(name,value) .equ name,value
47
48
49/// BitBuf2
50START_STRUCT(BitBuf2)
51 /// name size align
52 FIELD ( _m_bits, 8, 8 )
53 FIELD ( _m_bit_count, 4, 4 )
54 FIELD ( _m_out_buf, 8, 8 )
55 FIELD ( _m_out_end, 8, 8 )
56 FIELD ( _m_out_start, 8, 8 )
57END_STRUCT(BitBuf2)
58
59
60/// isal_mod_hist
61#define HIST_ELEM_SIZE 4
62START_STRUCT(isal_mod_hist)
63 /// name size align
64 FIELD ( _d_hist, 30*HIST_ELEM_SIZE, HIST_ELEM_SIZE )
65 FIELD ( _ll_hist, 513*HIST_ELEM_SIZE, HIST_ELEM_SIZE )
66END_STRUCT(isal_mod_hist)
67
68
69/// hufftables_icf
70#define HUFF_CODE_SIZE 4
71START_STRUCT(hufftables_icf)
72 /// name size align
73 FIELD ( _dist_table, 31 * HUFF_CODE_SIZE, HUFF_CODE_SIZE )
74 FIELD ( _lit_len_table, 513 * HUFF_CODE_SIZE, HUFF_CODE_SIZE )
75END_STRUCT(hufftables_icf)
76
77
78/// hash8k_buf
79START_STRUCT(hash8k_buf)
80 /// name size align
81 FIELD ( _hash8k_table, 2 * IGZIP_HASH8K_HASH_SIZE, 2 )
82END_STRUCT(hash8k_buf)
83
84
85/// hash_map_buf
86START_STRUCT(hash_map_buf)
87 /// name size align
88 FIELD ( _hash_table, 2 * IGZIP_HASH_MAP_HASH_SIZE, 2 )
89 FIELD ( _matches_next, 8, 8 )
90 FIELD ( _matches_end, 8, 8 )
91 FIELD ( _matches, 4*4*1024, 4 )
92 FIELD ( _overflow, 4*LA, 4 )
93END_STRUCT(hash_map_buf)
94
95
96/// level_buf
97#define DEF_MAX_HDR_SIZE 328
98START_STRUCT(level_buf)
99 /// name size align
100 FIELD ( _encode_tables, _hufftables_icf_size, _hufftables_icf_align )
101 FIELD ( _hist, _isal_mod_hist_size, _isal_mod_hist_align )
102 FIELD ( _deflate_hdr_count, 4, 4 )
103 FIELD ( _deflate_hdr_extra_bits,4, 4 )
104 FIELD ( _deflate_hdr, DEF_MAX_HDR_SIZE, 1 )
105 FIELD ( _icf_buf_next, 8, 8 )
106 FIELD ( _icf_buf_avail_out, 8, 8 )
107 FIELD ( _icf_buf_start, 8, 8 )
108 FIELD ( _lvl_extra, _hash_map_buf_size, _hash_map_buf_align )
109END_STRUCT(level_buf)
110
111
112CONST( _hash8k_hash_table , _lvl_extra + _hash8k_table )
113CONST( _hash_map_hash_table , _lvl_extra + _hash_table )
114CONST( _hash_map_matches_next , _lvl_extra + _matches_next )
115CONST( _hash_map_matches_end , _lvl_extra + _matches_end )
116CONST( _hash_map_matches , _lvl_extra + _matches )
117CONST( _hist_lit_len , _hist+_ll_hist )
118CONST( _hist_dist , _hist+_d_hist )
119
120
121/// isal_zstate
122START_STRUCT(isal_zstate)
123 /// name size align
124 FIELD ( _total_in_start,4, 4 )
125 FIELD ( _block_next, 4, 4 )
126 FIELD ( _block_end, 4, 4 )
127 FIELD ( _dist_mask, 4, 4 )
128 FIELD ( _hash_mask, 4, 4 )
129 FIELD ( _state, 4, 4 )
130 FIELD ( _bitbuf, _BitBuf2_size, _BitBuf2_align )
131 FIELD ( _crc, 4, 4 )
132 FIELD ( _has_wrap_hdr, 1, 1 )
133 FIELD ( _has_eob_hdr, 1, 1 )
134 FIELD ( _has_eob, 1, 1 )
135 FIELD ( _has_hist, 1, 1 )
136 FIELD ( _has_level_buf_init, 2, 2 )
137 FIELD ( _count, 4, 4 )
138 FIELD ( _tmp_out_buff, 16, 1 )
139 FIELD ( _tmp_out_start, 4, 4 )
140 FIELD ( _tmp_out_end, 4, 4 )
141 FIELD ( _b_bytes_valid, 4, 4 )
142 FIELD ( _b_bytes_processed, 4, 4 )
143 FIELD ( _buffer, BSIZE, 1 )
144 FIELD ( _head, IGZIP_LVL0_HASH_SIZE*2, 2 )
145END_STRUCT(isal_zstate)
146
147
148
149CONST( _bitbuf_m_bits , _bitbuf+_m_bits )
150CONST( _bitbuf_m_bit_count , _bitbuf+_m_bit_count )
151CONST( _bitbuf_m_out_buf , _bitbuf+_m_out_buf )
152CONST( _bitbuf_m_out_end , _bitbuf+_m_out_end )
153CONST( _bitbuf_m_out_start , _bitbuf+_m_out_start )
154
155
156/// isal_zstream
157START_STRUCT(isal_zstream)
158 /// name size align
159 FIELD ( _next_in, 8, 8 )
160 FIELD ( _avail_in, 4, 4 )
161 FIELD ( _total_in, 4, 4 )
162 FIELD ( _next_out, 8, 8 )
163 FIELD ( _avail_out, 4, 4 )
164 FIELD ( _total_out, 4, 4 )
165 FIELD ( _hufftables, 8, 8 )
166 FIELD ( _level, 4, 4 )
167 FIELD ( _level_buf_size, 4, 4 )
168 FIELD ( _level_buf, 8, 8 )
169 FIELD ( _end_of_stream, 2, 2 )
170 FIELD ( _flush, 2, 2 )
171 FIELD ( _gzip_flag, 2, 2 )
172 FIELD ( _hist_bits, 2, 2 )
173 FIELD ( _internal_state, _isal_zstate_size, _isal_zstate_align )
174END_STRUCT(isal_zstream)
175
176
177
178CONST( _internal_state_total_in_start , _internal_state+_total_in_start )
179CONST( _internal_state_block_next , _internal_state+_block_next )
180CONST( _internal_state_block_end , _internal_state+_block_end )
181CONST( _internal_state_b_bytes_valid , _internal_state+_b_bytes_valid )
182CONST( _internal_state_b_bytes_processed , _internal_state+_b_bytes_processed )
183CONST( _internal_state_crc , _internal_state+_crc )
184CONST( _internal_state_dist_mask , _internal_state+_dist_mask )
185CONST( _internal_state_hash_mask , _internal_state+_hash_mask )
186CONST( _internal_state_bitbuf , _internal_state+_bitbuf )
187CONST( _internal_state_state , _internal_state+_state )
188CONST( _internal_state_count , _internal_state+_count )
189CONST( _internal_state_tmp_out_buff , _internal_state+_tmp_out_buff )
190CONST( _internal_state_tmp_out_start , _internal_state+_tmp_out_start )
191CONST( _internal_state_tmp_out_end , _internal_state+_tmp_out_end )
192CONST( _internal_state_has_wrap_hdr , _internal_state+_has_wrap_hdr )
193CONST( _internal_state_has_eob , _internal_state+_has_eob )
194CONST( _internal_state_has_eob_hdr , _internal_state+_has_eob_hdr )
195CONST( _internal_state_has_hist , _internal_state+_has_hist )
196CONST( _internal_state_has_level_buf_init , _internal_state+_has_level_buf_init )
197CONST( _internal_state_buffer , _internal_state+_buffer )
198CONST( _internal_state_head , _internal_state+_head )
199CONST( _internal_state_bitbuf_m_bits , _internal_state+_bitbuf_m_bits )
200CONST( _internal_state_bitbuf_m_bit_count , _internal_state+_bitbuf_m_bit_count )
201CONST( _internal_state_bitbuf_m_out_buf , _internal_state+_bitbuf_m_out_buf )
202CONST( _internal_state_bitbuf_m_out_end , _internal_state+_bitbuf_m_out_end )
203CONST( _internal_state_bitbuf_m_out_start , _internal_state+_bitbuf_m_out_start )
204
205/// Internal States
206CONST( ZSTATE_NEW_HDR , 0 )
207CONST( ZSTATE_HDR , (ZSTATE_NEW_HDR + 1) )
208CONST( ZSTATE_CREATE_HDR , (ZSTATE_HDR + 1) )
209CONST( ZSTATE_BODY , (ZSTATE_CREATE_HDR + 1) )
210CONST( ZSTATE_FLUSH_READ_BUFFER , (ZSTATE_BODY + 1) )
211CONST( ZSTATE_FLUSH_ICF_BUFFER , (ZSTATE_FLUSH_READ_BUFFER + 1) )
212CONST( ZSTATE_TYPE0_HDR , (ZSTATE_FLUSH_ICF_BUFFER + 1) )
213CONST( ZSTATE_TYPE0_BODY , (ZSTATE_TYPE0_HDR + 1) )
214CONST( ZSTATE_SYNC_FLUSH , (ZSTATE_TYPE0_BODY + 1) )
215CONST( ZSTATE_FLUSH_WRITE_BUFFER , (ZSTATE_SYNC_FLUSH + 1) )
216CONST( ZSTATE_TRL , (ZSTATE_FLUSH_WRITE_BUFFER + 1) )
217
218CONST( _NO_FLUSH , 0 )
219CONST( _SYNC_FLUSH , 1 )
220CONST( _FULL_FLUSH , 2 )
221CONST( _STORED_BLK , 0 )
222CONST( IGZIP_NO_HIST , 0 )
223CONST( IGZIP_HIST , 1 )
224CONST( IGZIP_DICT_HIST , 2 )
225#endif
226#endif