18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Hardware interface of the NX-GZIP compression accelerator
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright (C) IBM Corporation, 2020
68c2ecf20Sopenharmony_ci *
78c2ecf20Sopenharmony_ci * Author: Bulent Abali <abali@us.ibm.com>
88c2ecf20Sopenharmony_ci *
98c2ecf20Sopenharmony_ci */
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#ifndef _NXU_H
128c2ecf20Sopenharmony_ci#define _NXU_H
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci#include <stdint.h>
158c2ecf20Sopenharmony_ci#include <endian.h>
168c2ecf20Sopenharmony_ci#include "nx.h"
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci/* deflate */
198c2ecf20Sopenharmony_ci#define LLSZ   286
208c2ecf20Sopenharmony_ci#define DSZ    30
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ci/* nx */
238c2ecf20Sopenharmony_ci#define DHTSZ  18
248c2ecf20Sopenharmony_ci#define DHT_MAXSZ 288
258c2ecf20Sopenharmony_ci#define MAX_DDE_COUNT 256
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_ci/* util */
288c2ecf20Sopenharmony_ci#ifdef NXDBG
298c2ecf20Sopenharmony_ci#define NXPRT(X)	X
308c2ecf20Sopenharmony_ci#else
318c2ecf20Sopenharmony_ci#define NXPRT(X)
328c2ecf20Sopenharmony_ci#endif
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ci#ifdef NXTIMER
358c2ecf20Sopenharmony_ci#include <sys/platform/ppc.h>
368c2ecf20Sopenharmony_ci#define NX_CLK(X)	X
378c2ecf20Sopenharmony_ci#define nx_get_time()	__ppc_get_timebase()
388c2ecf20Sopenharmony_ci#define nx_get_freq()	__ppc_get_timebase_freq()
398c2ecf20Sopenharmony_ci#else
408c2ecf20Sopenharmony_ci#define NX_CLK(X)
418c2ecf20Sopenharmony_ci#define nx_get_time()  (-1)
428c2ecf20Sopenharmony_ci#define nx_get_freq()  (-1)
438c2ecf20Sopenharmony_ci#endif
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_ci#define NX_MAX_FAULTS  500
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_ci/*
488c2ecf20Sopenharmony_ci * Definitions of acronyms used here. See
498c2ecf20Sopenharmony_ci * P9 NX Gzip Accelerator User's Manual for details:
508c2ecf20Sopenharmony_ci * https://github.com/libnxz/power-gzip/blob/develop/doc/power_nx_gzip_um.pdf
518c2ecf20Sopenharmony_ci *
528c2ecf20Sopenharmony_ci * adler/crc: 32 bit checksums appended to stream tail
538c2ecf20Sopenharmony_ci * ce:       completion extension
548c2ecf20Sopenharmony_ci * cpb:      coprocessor parameter block (metadata)
558c2ecf20Sopenharmony_ci * crb:      coprocessor request block (command)
568c2ecf20Sopenharmony_ci * csb:      coprocessor status block (status)
578c2ecf20Sopenharmony_ci * dht:      dynamic huffman table
588c2ecf20Sopenharmony_ci * dde:      data descriptor element (address, length)
598c2ecf20Sopenharmony_ci * ddl:      list of ddes
608c2ecf20Sopenharmony_ci * dh/fh:    dynamic and fixed huffman types
618c2ecf20Sopenharmony_ci * fc:       coprocessor function code
628c2ecf20Sopenharmony_ci * histlen:  history/dictionary length
638c2ecf20Sopenharmony_ci * history:  sliding window of up to 32KB of data
648c2ecf20Sopenharmony_ci * lzcount:  Deflate LZ symbol counts
658c2ecf20Sopenharmony_ci * rembytecnt: remaining byte count
668c2ecf20Sopenharmony_ci * sfbt:     source final block type; last block's type during decomp
678c2ecf20Sopenharmony_ci * spbc:     source processed byte count
688c2ecf20Sopenharmony_ci * subc:     source unprocessed bit count
698c2ecf20Sopenharmony_ci * tebc:     target ending bit count; valid bits in the last byte
708c2ecf20Sopenharmony_ci * tpbc:     target processed byte count
718c2ecf20Sopenharmony_ci * vas:      virtual accelerator switch; the user mode interface
728c2ecf20Sopenharmony_ci */
738c2ecf20Sopenharmony_ci
748c2ecf20Sopenharmony_ciunion nx_qw_t {
758c2ecf20Sopenharmony_ci	uint32_t word[4];
768c2ecf20Sopenharmony_ci	uint64_t dword[2];
778c2ecf20Sopenharmony_ci} __aligned(16);
788c2ecf20Sopenharmony_ci
798c2ecf20Sopenharmony_ci/*
808c2ecf20Sopenharmony_ci * Note: NX registers with fewer than 32 bits are declared by
818c2ecf20Sopenharmony_ci * convention as uint32_t variables in unions. If *_offset and *_mask
828c2ecf20Sopenharmony_ci * are defined for a variable, then use get_ put_ macros to
838c2ecf20Sopenharmony_ci * conveniently access the register fields for endian conversions.
848c2ecf20Sopenharmony_ci */
858c2ecf20Sopenharmony_ci
868c2ecf20Sopenharmony_cistruct nx_dde_t {
878c2ecf20Sopenharmony_ci	/* Data Descriptor Element, Section 6.4 */
888c2ecf20Sopenharmony_ci	union {
898c2ecf20Sopenharmony_ci		uint32_t dde_count;
908c2ecf20Sopenharmony_ci		/* When dde_count == 0 ddead is a pointer to a data buffer;
918c2ecf20Sopenharmony_ci		 * ddebc is the buffer length bytes.
928c2ecf20Sopenharmony_ci		 * When dde_count > 0 dde is an indirect dde; ddead is a
938c2ecf20Sopenharmony_ci		 * pointer to a contiguous list of direct ddes; ddebc is the
948c2ecf20Sopenharmony_ci		 * total length of all data pointed to by the list of direct
958c2ecf20Sopenharmony_ci		 * ddes. Note that only one level of indirection is permitted.
968c2ecf20Sopenharmony_ci		 * See Section 6.4 of the user manual for additional details.
978c2ecf20Sopenharmony_ci		 */
988c2ecf20Sopenharmony_ci	};
998c2ecf20Sopenharmony_ci	uint32_t ddebc; /* dde byte count */
1008c2ecf20Sopenharmony_ci	uint64_t ddead; /* dde address */
1018c2ecf20Sopenharmony_ci} __aligned(16);
1028c2ecf20Sopenharmony_ci
1038c2ecf20Sopenharmony_cistruct nx_csb_t {
1048c2ecf20Sopenharmony_ci	/* Coprocessor Status Block, Section 6.6  */
1058c2ecf20Sopenharmony_ci	union {
1068c2ecf20Sopenharmony_ci		uint32_t csb_v;
1078c2ecf20Sopenharmony_ci		/* Valid bit. v must be set to 0 by the program
1088c2ecf20Sopenharmony_ci		 * before submitting the coprocessor command.
1098c2ecf20Sopenharmony_ci		 * Software can poll for the v bit
1108c2ecf20Sopenharmony_ci		 */
1118c2ecf20Sopenharmony_ci
1128c2ecf20Sopenharmony_ci		uint32_t csb_f;
1138c2ecf20Sopenharmony_ci		/* 16B CSB size. Written to 0 by DMA when it writes the CPB */
1148c2ecf20Sopenharmony_ci
1158c2ecf20Sopenharmony_ci		uint32_t csb_cs;
1168c2ecf20Sopenharmony_ci		/* cs completion sequence; unused */
1178c2ecf20Sopenharmony_ci
1188c2ecf20Sopenharmony_ci		uint32_t csb_cc;
1198c2ecf20Sopenharmony_ci		/* cc completion code; cc != 0 exception occurred */
1208c2ecf20Sopenharmony_ci
1218c2ecf20Sopenharmony_ci		uint32_t csb_ce;
1228c2ecf20Sopenharmony_ci		/* ce completion extension */
1238c2ecf20Sopenharmony_ci
1248c2ecf20Sopenharmony_ci	};
1258c2ecf20Sopenharmony_ci	uint32_t tpbc;
1268c2ecf20Sopenharmony_ci	/* target processed byte count TPBC */
1278c2ecf20Sopenharmony_ci
1288c2ecf20Sopenharmony_ci	uint64_t fsaddr;
1298c2ecf20Sopenharmony_ci	/* Section 6.12.1 CSB NonZero error summary.  FSA Failing storage
1308c2ecf20Sopenharmony_ci	 * address.  Address where error occurred. When available, written
1318c2ecf20Sopenharmony_ci	 * to A field of CSB
1328c2ecf20Sopenharmony_ci	 */
1338c2ecf20Sopenharmony_ci} __aligned(16);
1348c2ecf20Sopenharmony_ci
1358c2ecf20Sopenharmony_cistruct nx_ccb_t {
1368c2ecf20Sopenharmony_ci	/* Coprocessor Completion Block, Section 6.7 */
1378c2ecf20Sopenharmony_ci
1388c2ecf20Sopenharmony_ci	uint32_t reserved[3];
1398c2ecf20Sopenharmony_ci	union {
1408c2ecf20Sopenharmony_ci		/* When crb.c==0 (no ccb defined) it is reserved;
1418c2ecf20Sopenharmony_ci		 * When crb.c==1 (ccb defined) it is cm
1428c2ecf20Sopenharmony_ci		 */
1438c2ecf20Sopenharmony_ci
1448c2ecf20Sopenharmony_ci		uint32_t ccb_cm;
1458c2ecf20Sopenharmony_ci		/* Signal interrupt of crb.c==1 and cm==1 */
1468c2ecf20Sopenharmony_ci
1478c2ecf20Sopenharmony_ci		uint32_t word;
1488c2ecf20Sopenharmony_ci		/* generic access to the 32bit word */
1498c2ecf20Sopenharmony_ci	};
1508c2ecf20Sopenharmony_ci} __aligned(16);
1518c2ecf20Sopenharmony_ci
1528c2ecf20Sopenharmony_cistruct vas_stamped_crb_t {
1538c2ecf20Sopenharmony_ci	/*
1548c2ecf20Sopenharmony_ci	 * CRB operand of the paste coprocessor instruction is stamped
1558c2ecf20Sopenharmony_ci	 * in quadword 4 with the information shown here as its written
1568c2ecf20Sopenharmony_ci	 * in to the receive FIFO of the coprocessor
1578c2ecf20Sopenharmony_ci	 */
1588c2ecf20Sopenharmony_ci
1598c2ecf20Sopenharmony_ci	union {
1608c2ecf20Sopenharmony_ci		uint32_t vas_buf_num;
1618c2ecf20Sopenharmony_ci		/* Verification only vas buffer number which correlates to
1628c2ecf20Sopenharmony_ci		 * the low order bits of the atag in the paste command
1638c2ecf20Sopenharmony_ci		 */
1648c2ecf20Sopenharmony_ci
1658c2ecf20Sopenharmony_ci		uint32_t send_wc_id;
1668c2ecf20Sopenharmony_ci		/* Pointer to Send Window Context that provides for NX address
1678c2ecf20Sopenharmony_ci		 * translation information, such as MSR and LPCR bits, job
1688c2ecf20Sopenharmony_ci		 * completion interrupt RA, PSWID, and job utilization counter.
1698c2ecf20Sopenharmony_ci		 */
1708c2ecf20Sopenharmony_ci
1718c2ecf20Sopenharmony_ci	};
1728c2ecf20Sopenharmony_ci	union {
1738c2ecf20Sopenharmony_ci		uint32_t recv_wc_id;
1748c2ecf20Sopenharmony_ci		/* Pointer to Receive Window Context. NX uses this to return
1758c2ecf20Sopenharmony_ci		 * credits to a Receive FIFO as entries are dequeued.
1768c2ecf20Sopenharmony_ci		 */
1778c2ecf20Sopenharmony_ci
1788c2ecf20Sopenharmony_ci	};
1798c2ecf20Sopenharmony_ci	uint32_t reserved2;
1808c2ecf20Sopenharmony_ci	union {
1818c2ecf20Sopenharmony_ci		uint32_t vas_invalid;
1828c2ecf20Sopenharmony_ci		/* Invalid bit. If this bit is 1 the CRB is discarded by
1838c2ecf20Sopenharmony_ci		 * NX upon fetching from the receive FIFO. If this bit is 0
1848c2ecf20Sopenharmony_ci		 * the CRB is processed normally. The bit is stamped to 0
1858c2ecf20Sopenharmony_ci		 * by VAS and may be written to 1 by hypervisor while
1868c2ecf20Sopenharmony_ci		 * the CRB is in the receive FIFO (in memory).
1878c2ecf20Sopenharmony_ci		 */
1888c2ecf20Sopenharmony_ci
1898c2ecf20Sopenharmony_ci	};
1908c2ecf20Sopenharmony_ci};
1918c2ecf20Sopenharmony_ci
1928c2ecf20Sopenharmony_cistruct nx_stamped_fault_crb_t {
1938c2ecf20Sopenharmony_ci	/*
1948c2ecf20Sopenharmony_ci	 * A CRB that has a translation fault is stamped by NX in quadword 4
1958c2ecf20Sopenharmony_ci	 * and pasted to the Fault Send Window in VAS.
1968c2ecf20Sopenharmony_ci	 */
1978c2ecf20Sopenharmony_ci	uint64_t fsa;
1988c2ecf20Sopenharmony_ci	union {
1998c2ecf20Sopenharmony_ci		uint32_t nxsf_t;
2008c2ecf20Sopenharmony_ci		uint32_t nxsf_fs;
2018c2ecf20Sopenharmony_ci	};
2028c2ecf20Sopenharmony_ci	uint32_t pswid;
2038c2ecf20Sopenharmony_ci};
2048c2ecf20Sopenharmony_ci
2058c2ecf20Sopenharmony_ciunion stamped_crb_t {
2068c2ecf20Sopenharmony_ci	struct vas_stamped_crb_t      vas;
2078c2ecf20Sopenharmony_ci	struct nx_stamped_fault_crb_t nx;
2088c2ecf20Sopenharmony_ci};
2098c2ecf20Sopenharmony_ci
2108c2ecf20Sopenharmony_cistruct nx_gzip_cpb_t {
2118c2ecf20Sopenharmony_ci	/*
2128c2ecf20Sopenharmony_ci	 * Coprocessor Parameter Block In/Out are used to pass metadata
2138c2ecf20Sopenharmony_ci	 * to/from accelerator.  Tables 6.5 and 6.6 of the user manual.
2148c2ecf20Sopenharmony_ci	 */
2158c2ecf20Sopenharmony_ci
2168c2ecf20Sopenharmony_ci	/* CPBInput */
2178c2ecf20Sopenharmony_ci
2188c2ecf20Sopenharmony_ci	struct {
2198c2ecf20Sopenharmony_ci		union {
2208c2ecf20Sopenharmony_ci		union nx_qw_t qw0;
2218c2ecf20Sopenharmony_ci			struct {
2228c2ecf20Sopenharmony_ci				uint32_t in_adler;            /* bits 0:31  */
2238c2ecf20Sopenharmony_ci				uint32_t in_crc;              /* bits 32:63 */
2248c2ecf20Sopenharmony_ci				union {
2258c2ecf20Sopenharmony_ci					uint32_t in_histlen;  /* bits 64:75 */
2268c2ecf20Sopenharmony_ci					uint32_t in_subc;     /* bits 93:95 */
2278c2ecf20Sopenharmony_ci				};
2288c2ecf20Sopenharmony_ci				union {
2298c2ecf20Sopenharmony_ci					/* bits 108:111 */
2308c2ecf20Sopenharmony_ci					uint32_t in_sfbt;
2318c2ecf20Sopenharmony_ci					/* bits 112:127 */
2328c2ecf20Sopenharmony_ci					uint32_t in_rembytecnt;
2338c2ecf20Sopenharmony_ci					/* bits 116:127 */
2348c2ecf20Sopenharmony_ci					uint32_t in_dhtlen;
2358c2ecf20Sopenharmony_ci				};
2368c2ecf20Sopenharmony_ci			};
2378c2ecf20Sopenharmony_ci		};
2388c2ecf20Sopenharmony_ci		union {
2398c2ecf20Sopenharmony_ci			union nx_qw_t  in_dht[DHTSZ];	/* qw[1:18]     */
2408c2ecf20Sopenharmony_ci			char in_dht_char[DHT_MAXSZ];	/* byte access  */
2418c2ecf20Sopenharmony_ci		};
2428c2ecf20Sopenharmony_ci		union nx_qw_t  reserved[5];		/* qw[19:23]    */
2438c2ecf20Sopenharmony_ci	};
2448c2ecf20Sopenharmony_ci
2458c2ecf20Sopenharmony_ci	/* CPBOutput */
2468c2ecf20Sopenharmony_ci
2478c2ecf20Sopenharmony_ci	volatile struct {
2488c2ecf20Sopenharmony_ci		union {
2498c2ecf20Sopenharmony_ci			union nx_qw_t qw24;
2508c2ecf20Sopenharmony_ci			struct {
2518c2ecf20Sopenharmony_ci				uint32_t out_adler;    /* bits 0:31  qw[24] */
2528c2ecf20Sopenharmony_ci				uint32_t out_crc;      /* bits 32:63 qw[24] */
2538c2ecf20Sopenharmony_ci				union {
2548c2ecf20Sopenharmony_ci					/* bits 77:79 qw[24] */
2558c2ecf20Sopenharmony_ci					uint32_t out_tebc;
2568c2ecf20Sopenharmony_ci					/* bits 80:95 qw[24] */
2578c2ecf20Sopenharmony_ci					uint32_t out_subc;
2588c2ecf20Sopenharmony_ci				};
2598c2ecf20Sopenharmony_ci				union {
2608c2ecf20Sopenharmony_ci					/* bits 108:111 qw[24] */
2618c2ecf20Sopenharmony_ci					uint32_t out_sfbt;
2628c2ecf20Sopenharmony_ci					/* bits 112:127 qw[24] */
2638c2ecf20Sopenharmony_ci					uint32_t out_rembytecnt;
2648c2ecf20Sopenharmony_ci					/* bits 116:127 qw[24] */
2658c2ecf20Sopenharmony_ci					uint32_t out_dhtlen;
2668c2ecf20Sopenharmony_ci				};
2678c2ecf20Sopenharmony_ci			};
2688c2ecf20Sopenharmony_ci		};
2698c2ecf20Sopenharmony_ci		union {
2708c2ecf20Sopenharmony_ci			union nx_qw_t  qw25[79];        /* qw[25:103] */
2718c2ecf20Sopenharmony_ci			/* qw[25] compress no lzcounts or wrap */
2728c2ecf20Sopenharmony_ci			uint32_t out_spbc_comp_wrap;
2738c2ecf20Sopenharmony_ci			uint32_t out_spbc_wrap;         /* qw[25] wrap */
2748c2ecf20Sopenharmony_ci			/* qw[25] compress no lzcounts */
2758c2ecf20Sopenharmony_ci			uint32_t out_spbc_comp;
2768c2ecf20Sopenharmony_ci			 /* 286 LL and 30 D symbol counts */
2778c2ecf20Sopenharmony_ci			uint32_t out_lzcount[LLSZ+DSZ];
2788c2ecf20Sopenharmony_ci			struct {
2798c2ecf20Sopenharmony_ci				union nx_qw_t  out_dht[DHTSZ];  /* qw[25:42] */
2808c2ecf20Sopenharmony_ci				/* qw[43] decompress */
2818c2ecf20Sopenharmony_ci				uint32_t out_spbc_decomp;
2828c2ecf20Sopenharmony_ci			};
2838c2ecf20Sopenharmony_ci		};
2848c2ecf20Sopenharmony_ci		/* qw[104] compress with lzcounts */
2858c2ecf20Sopenharmony_ci		uint32_t out_spbc_comp_with_count;
2868c2ecf20Sopenharmony_ci	};
2878c2ecf20Sopenharmony_ci} __aligned(128);
2888c2ecf20Sopenharmony_ci
2898c2ecf20Sopenharmony_cistruct nx_gzip_crb_t {
2908c2ecf20Sopenharmony_ci	union {                   /* byte[0:3]   */
2918c2ecf20Sopenharmony_ci		uint32_t gzip_fc;     /* bits[24-31] */
2928c2ecf20Sopenharmony_ci	};
2938c2ecf20Sopenharmony_ci	uint32_t reserved1;       /* byte[4:7]   */
2948c2ecf20Sopenharmony_ci	union {
2958c2ecf20Sopenharmony_ci		uint64_t csb_address; /* byte[8:15]  */
2968c2ecf20Sopenharmony_ci		struct {
2978c2ecf20Sopenharmony_ci			uint32_t reserved2;
2988c2ecf20Sopenharmony_ci			union {
2998c2ecf20Sopenharmony_ci				uint32_t crb_c;
3008c2ecf20Sopenharmony_ci				/* c==0 no ccb defined */
3018c2ecf20Sopenharmony_ci
3028c2ecf20Sopenharmony_ci				uint32_t crb_at;
3038c2ecf20Sopenharmony_ci				/* at==0 address type is ignored;
3048c2ecf20Sopenharmony_ci				 * all addrs effective assumed.
3058c2ecf20Sopenharmony_ci				 */
3068c2ecf20Sopenharmony_ci
3078c2ecf20Sopenharmony_ci			};
3088c2ecf20Sopenharmony_ci		};
3098c2ecf20Sopenharmony_ci	};
3108c2ecf20Sopenharmony_ci	struct nx_dde_t source_dde;           /* byte[16:31] */
3118c2ecf20Sopenharmony_ci	struct nx_dde_t target_dde;           /* byte[32:47] */
3128c2ecf20Sopenharmony_ci	volatile struct nx_ccb_t ccb;         /* byte[48:63] */
3138c2ecf20Sopenharmony_ci	volatile union {
3148c2ecf20Sopenharmony_ci		/* byte[64:239] shift csb by 128 bytes out of the crb; csb was
3158c2ecf20Sopenharmony_ci		 * in crb earlier; JReilly says csb written with partial inject
3168c2ecf20Sopenharmony_ci		 */
3178c2ecf20Sopenharmony_ci		union nx_qw_t reserved64[11];
3188c2ecf20Sopenharmony_ci		union stamped_crb_t stamp;       /* byte[64:79] */
3198c2ecf20Sopenharmony_ci	};
3208c2ecf20Sopenharmony_ci	volatile struct nx_csb_t csb;
3218c2ecf20Sopenharmony_ci} __aligned(128);
3228c2ecf20Sopenharmony_ci
3238c2ecf20Sopenharmony_cistruct nx_gzip_crb_cpb_t {
3248c2ecf20Sopenharmony_ci	struct nx_gzip_crb_t crb;
3258c2ecf20Sopenharmony_ci	struct nx_gzip_cpb_t cpb;
3268c2ecf20Sopenharmony_ci} __aligned(2048);
3278c2ecf20Sopenharmony_ci
3288c2ecf20Sopenharmony_ci
3298c2ecf20Sopenharmony_ci/*
3308c2ecf20Sopenharmony_ci * NX hardware convention has the msb bit on the left numbered 0.
3318c2ecf20Sopenharmony_ci * The defines below has *_offset defined as the right most bit
3328c2ecf20Sopenharmony_ci * position of a field.  x of size_mask(x) is the field width in bits.
3338c2ecf20Sopenharmony_ci */
3348c2ecf20Sopenharmony_ci
3358c2ecf20Sopenharmony_ci#define size_mask(x)          ((1U<<(x))-1)
3368c2ecf20Sopenharmony_ci
3378c2ecf20Sopenharmony_ci/*
3388c2ecf20Sopenharmony_ci * Offsets and Widths within the containing 32 bits of the various NX
3398c2ecf20Sopenharmony_ci * gzip hardware registers.  Use the getnn/putnn macros to access
3408c2ecf20Sopenharmony_ci * these regs
3418c2ecf20Sopenharmony_ci */
3428c2ecf20Sopenharmony_ci
3438c2ecf20Sopenharmony_ci#define dde_count_mask        size_mask(8)
3448c2ecf20Sopenharmony_ci#define dde_count_offset      23
3458c2ecf20Sopenharmony_ci
3468c2ecf20Sopenharmony_ci/* CSB */
3478c2ecf20Sopenharmony_ci
3488c2ecf20Sopenharmony_ci#define csb_v_mask            size_mask(1)
3498c2ecf20Sopenharmony_ci#define csb_v_offset          0
3508c2ecf20Sopenharmony_ci#define csb_f_mask            size_mask(1)
3518c2ecf20Sopenharmony_ci#define csb_f_offset          6
3528c2ecf20Sopenharmony_ci#define csb_cs_mask           size_mask(8)
3538c2ecf20Sopenharmony_ci#define csb_cs_offset         15
3548c2ecf20Sopenharmony_ci#define csb_cc_mask           size_mask(8)
3558c2ecf20Sopenharmony_ci#define csb_cc_offset         23
3568c2ecf20Sopenharmony_ci#define csb_ce_mask           size_mask(8)
3578c2ecf20Sopenharmony_ci#define csb_ce_offset         31
3588c2ecf20Sopenharmony_ci
3598c2ecf20Sopenharmony_ci/* CCB */
3608c2ecf20Sopenharmony_ci
3618c2ecf20Sopenharmony_ci#define ccb_cm_mask           size_mask(3)
3628c2ecf20Sopenharmony_ci#define ccb_cm_offset         31
3638c2ecf20Sopenharmony_ci
3648c2ecf20Sopenharmony_ci/* VAS stamped CRB fields */
3658c2ecf20Sopenharmony_ci
3668c2ecf20Sopenharmony_ci#define vas_buf_num_mask      size_mask(6)
3678c2ecf20Sopenharmony_ci#define vas_buf_num_offset    5
3688c2ecf20Sopenharmony_ci#define send_wc_id_mask       size_mask(16)
3698c2ecf20Sopenharmony_ci#define send_wc_id_offset     31
3708c2ecf20Sopenharmony_ci#define recv_wc_id_mask       size_mask(16)
3718c2ecf20Sopenharmony_ci#define recv_wc_id_offset     31
3728c2ecf20Sopenharmony_ci#define vas_invalid_mask      size_mask(1)
3738c2ecf20Sopenharmony_ci#define vas_invalid_offset    31
3748c2ecf20Sopenharmony_ci
3758c2ecf20Sopenharmony_ci/* NX stamped fault CRB fields */
3768c2ecf20Sopenharmony_ci
3778c2ecf20Sopenharmony_ci#define nxsf_t_mask           size_mask(1)
3788c2ecf20Sopenharmony_ci#define nxsf_t_offset         23
3798c2ecf20Sopenharmony_ci#define nxsf_fs_mask          size_mask(8)
3808c2ecf20Sopenharmony_ci#define nxsf_fs_offset        31
3818c2ecf20Sopenharmony_ci
3828c2ecf20Sopenharmony_ci/* CPB input */
3838c2ecf20Sopenharmony_ci
3848c2ecf20Sopenharmony_ci#define in_histlen_mask       size_mask(12)
3858c2ecf20Sopenharmony_ci#define in_histlen_offset     11
3868c2ecf20Sopenharmony_ci#define in_dhtlen_mask        size_mask(12)
3878c2ecf20Sopenharmony_ci#define in_dhtlen_offset      31
3888c2ecf20Sopenharmony_ci#define in_subc_mask          size_mask(3)
3898c2ecf20Sopenharmony_ci#define in_subc_offset        31
3908c2ecf20Sopenharmony_ci#define in_sfbt_mask          size_mask(4)
3918c2ecf20Sopenharmony_ci#define in_sfbt_offset        15
3928c2ecf20Sopenharmony_ci#define in_rembytecnt_mask    size_mask(16)
3938c2ecf20Sopenharmony_ci#define in_rembytecnt_offset  31
3948c2ecf20Sopenharmony_ci
3958c2ecf20Sopenharmony_ci/* CPB output */
3968c2ecf20Sopenharmony_ci
3978c2ecf20Sopenharmony_ci#define out_tebc_mask         size_mask(3)
3988c2ecf20Sopenharmony_ci#define out_tebc_offset       15
3998c2ecf20Sopenharmony_ci#define out_subc_mask         size_mask(16)
4008c2ecf20Sopenharmony_ci#define out_subc_offset       31
4018c2ecf20Sopenharmony_ci#define out_sfbt_mask         size_mask(4)
4028c2ecf20Sopenharmony_ci#define out_sfbt_offset       15
4038c2ecf20Sopenharmony_ci#define out_rembytecnt_mask   size_mask(16)
4048c2ecf20Sopenharmony_ci#define out_rembytecnt_offset 31
4058c2ecf20Sopenharmony_ci#define out_dhtlen_mask       size_mask(12)
4068c2ecf20Sopenharmony_ci#define out_dhtlen_offset     31
4078c2ecf20Sopenharmony_ci
4088c2ecf20Sopenharmony_ci/* CRB */
4098c2ecf20Sopenharmony_ci
4108c2ecf20Sopenharmony_ci#define gzip_fc_mask          size_mask(8)
4118c2ecf20Sopenharmony_ci#define gzip_fc_offset        31
4128c2ecf20Sopenharmony_ci#define crb_c_mask            size_mask(1)
4138c2ecf20Sopenharmony_ci#define crb_c_offset          28
4148c2ecf20Sopenharmony_ci#define crb_at_mask           size_mask(1)
4158c2ecf20Sopenharmony_ci#define crb_at_offset         30
4168c2ecf20Sopenharmony_ci#define csb_address_mask      ~(15UL) /* mask off bottom 4b */
4178c2ecf20Sopenharmony_ci
4188c2ecf20Sopenharmony_ci/*
4198c2ecf20Sopenharmony_ci * Access macros for the registers.  Do not access registers directly
4208c2ecf20Sopenharmony_ci * because of the endian conversion.  P9 processor may run either as
4218c2ecf20Sopenharmony_ci * Little or Big endian. However the NX coprocessor regs are always
4228c2ecf20Sopenharmony_ci * big endian.
4238c2ecf20Sopenharmony_ci * Use the 32 and 64b macros to access respective
4248c2ecf20Sopenharmony_ci * register sizes.
4258c2ecf20Sopenharmony_ci * Use nn forms for the register fields shorter than 32 bits.
4268c2ecf20Sopenharmony_ci */
4278c2ecf20Sopenharmony_ci
4288c2ecf20Sopenharmony_ci#define getnn(ST, REG)      ((be32toh(ST.REG) >> (31-REG##_offset)) \
4298c2ecf20Sopenharmony_ci				 & REG##_mask)
4308c2ecf20Sopenharmony_ci#define getpnn(ST, REG)     ((be32toh((ST)->REG) >> (31-REG##_offset)) \
4318c2ecf20Sopenharmony_ci				 & REG##_mask)
4328c2ecf20Sopenharmony_ci#define get32(ST, REG)      (be32toh(ST.REG))
4338c2ecf20Sopenharmony_ci#define getp32(ST, REG)     (be32toh((ST)->REG))
4348c2ecf20Sopenharmony_ci#define get64(ST, REG)      (be64toh(ST.REG))
4358c2ecf20Sopenharmony_ci#define getp64(ST, REG)     (be64toh((ST)->REG))
4368c2ecf20Sopenharmony_ci
4378c2ecf20Sopenharmony_ci#define unget32(ST, REG)    (get32(ST, REG) & ~((REG##_mask) \
4388c2ecf20Sopenharmony_ci				<< (31-REG##_offset)))
4398c2ecf20Sopenharmony_ci/* get 32bits less the REG field */
4408c2ecf20Sopenharmony_ci
4418c2ecf20Sopenharmony_ci#define ungetp32(ST, REG)   (getp32(ST, REG) & ~((REG##_mask) \
4428c2ecf20Sopenharmony_ci				<< (31-REG##_offset)))
4438c2ecf20Sopenharmony_ci/* get 32bits less the REG field */
4448c2ecf20Sopenharmony_ci
4458c2ecf20Sopenharmony_ci#define clear_regs(ST)      memset((void *)(&(ST)), 0, sizeof(ST))
4468c2ecf20Sopenharmony_ci#define clear_dde(ST)       do { ST.dde_count = ST.ddebc = 0; ST.ddead = 0; \
4478c2ecf20Sopenharmony_ci				} while (0)
4488c2ecf20Sopenharmony_ci#define clearp_dde(ST)      do { (ST)->dde_count = (ST)->ddebc = 0; \
4498c2ecf20Sopenharmony_ci				 (ST)->ddead = 0; \
4508c2ecf20Sopenharmony_ci				} while (0)
4518c2ecf20Sopenharmony_ci#define clear_struct(ST)    memset((void *)(&(ST)), 0, sizeof(ST))
4528c2ecf20Sopenharmony_ci#define putnn(ST, REG, X)   (ST.REG = htobe32(unget32(ST, REG) | (((X) \
4538c2ecf20Sopenharmony_ci				 & REG##_mask) << (31-REG##_offset))))
4548c2ecf20Sopenharmony_ci#define putpnn(ST, REG, X)  ((ST)->REG = htobe32(ungetp32(ST, REG) \
4558c2ecf20Sopenharmony_ci				| (((X) & REG##_mask) << (31-REG##_offset))))
4568c2ecf20Sopenharmony_ci
4578c2ecf20Sopenharmony_ci#define put32(ST, REG, X)   (ST.REG = htobe32(X))
4588c2ecf20Sopenharmony_ci#define putp32(ST, REG, X)  ((ST)->REG = htobe32(X))
4598c2ecf20Sopenharmony_ci#define put64(ST, REG, X)   (ST.REG = htobe64(X))
4608c2ecf20Sopenharmony_ci#define putp64(ST, REG, X)  ((ST)->REG = htobe64(X))
4618c2ecf20Sopenharmony_ci
4628c2ecf20Sopenharmony_ci/*
4638c2ecf20Sopenharmony_ci * Completion extension ce(0) ce(1) ce(2).  Bits ce(3-7)
4648c2ecf20Sopenharmony_ci * unused.  Section 6.6 Figure 6.7.
4658c2ecf20Sopenharmony_ci */
4668c2ecf20Sopenharmony_ci
4678c2ecf20Sopenharmony_ci#define get_csb_ce(ST) ((uint32_t)getnn(ST, csb_ce))
4688c2ecf20Sopenharmony_ci#define get_csb_ce_ms3b(ST) (get_csb_ce(ST) >> 5)
4698c2ecf20Sopenharmony_ci#define put_csb_ce_ms3b(ST, X) putnn(ST, csb_ce, ((uint32_t)(X) << 5))
4708c2ecf20Sopenharmony_ci
4718c2ecf20Sopenharmony_ci#define CSB_CE_PARTIAL         0x4
4728c2ecf20Sopenharmony_ci#define CSB_CE_TERMINATE       0x2
4738c2ecf20Sopenharmony_ci#define CSB_CE_TPBC_VALID      0x1
4748c2ecf20Sopenharmony_ci
4758c2ecf20Sopenharmony_ci#define csb_ce_termination(X)         (!!((X) & CSB_CE_TERMINATE))
4768c2ecf20Sopenharmony_ci/* termination, output buffers may be modified, SPBC/TPBC invalid Fig.6-7 */
4778c2ecf20Sopenharmony_ci
4788c2ecf20Sopenharmony_ci#define csb_ce_check_completion(X)    (!csb_ce_termination(X))
4798c2ecf20Sopenharmony_ci/* if not terminated then check full or partial completion */
4808c2ecf20Sopenharmony_ci
4818c2ecf20Sopenharmony_ci#define csb_ce_partial_completion(X)  (!!((X) & CSB_CE_PARTIAL))
4828c2ecf20Sopenharmony_ci#define csb_ce_full_completion(X)     (!csb_ce_partial_completion(X))
4838c2ecf20Sopenharmony_ci#define csb_ce_tpbc_valid(X)          (!!((X) & CSB_CE_TPBC_VALID))
4848c2ecf20Sopenharmony_ci/* TPBC indicates successfully stored data count */
4858c2ecf20Sopenharmony_ci
4868c2ecf20Sopenharmony_ci#define csb_ce_default_err(X)         csb_ce_termination(X)
4878c2ecf20Sopenharmony_ci/* most error CEs have CE(0)=0 and CE(1)=1 */
4888c2ecf20Sopenharmony_ci
4898c2ecf20Sopenharmony_ci#define csb_ce_cc3_partial(X)         csb_ce_partial_completion(X)
4908c2ecf20Sopenharmony_ci/* some CC=3 are partially completed, Table 6-8 */
4918c2ecf20Sopenharmony_ci
4928c2ecf20Sopenharmony_ci#define csb_ce_cc64(X)                ((X)&(CSB_CE_PARTIAL \
4938c2ecf20Sopenharmony_ci					| CSB_CE_TERMINATE) == 0)
4948c2ecf20Sopenharmony_ci/* Compression: when TPBC>SPBC then CC=64 Table 6-8; target didn't
4958c2ecf20Sopenharmony_ci * compress smaller than source.
4968c2ecf20Sopenharmony_ci */
4978c2ecf20Sopenharmony_ci
4988c2ecf20Sopenharmony_ci/* Decompress SFBT combinations Tables 5-3, 6-4, 6-6 */
4998c2ecf20Sopenharmony_ci
5008c2ecf20Sopenharmony_ci#define SFBT_BFINAL 0x1
5018c2ecf20Sopenharmony_ci#define SFBT_LIT    0x4
5028c2ecf20Sopenharmony_ci#define SFBT_FHT    0x5
5038c2ecf20Sopenharmony_ci#define SFBT_DHT    0x6
5048c2ecf20Sopenharmony_ci#define SFBT_HDR    0x7
5058c2ecf20Sopenharmony_ci
5068c2ecf20Sopenharmony_ci/*
5078c2ecf20Sopenharmony_ci * NX gzip function codes. Table 6.2.
5088c2ecf20Sopenharmony_ci * Bits 0:4 are the FC. Bit 5 is used by the DMA controller to
5098c2ecf20Sopenharmony_ci * select one of the two Byte Count Limits.
5108c2ecf20Sopenharmony_ci */
5118c2ecf20Sopenharmony_ci
5128c2ecf20Sopenharmony_ci#define GZIP_FC_LIMIT_MASK                               0x01
5138c2ecf20Sopenharmony_ci#define GZIP_FC_COMPRESS_FHT                             0x00
5148c2ecf20Sopenharmony_ci#define GZIP_FC_COMPRESS_DHT                             0x02
5158c2ecf20Sopenharmony_ci#define GZIP_FC_COMPRESS_FHT_COUNT                       0x04
5168c2ecf20Sopenharmony_ci#define GZIP_FC_COMPRESS_DHT_COUNT                       0x06
5178c2ecf20Sopenharmony_ci#define GZIP_FC_COMPRESS_RESUME_FHT                      0x08
5188c2ecf20Sopenharmony_ci#define GZIP_FC_COMPRESS_RESUME_DHT                      0x0a
5198c2ecf20Sopenharmony_ci#define GZIP_FC_COMPRESS_RESUME_FHT_COUNT                0x0c
5208c2ecf20Sopenharmony_ci#define GZIP_FC_COMPRESS_RESUME_DHT_COUNT                0x0e
5218c2ecf20Sopenharmony_ci#define GZIP_FC_DECOMPRESS                               0x10
5228c2ecf20Sopenharmony_ci#define GZIP_FC_DECOMPRESS_SINGLE_BLK_N_SUSPEND          0x12
5238c2ecf20Sopenharmony_ci#define GZIP_FC_DECOMPRESS_RESUME                        0x14
5248c2ecf20Sopenharmony_ci#define GZIP_FC_DECOMPRESS_RESUME_SINGLE_BLK_N_SUSPEND   0x16
5258c2ecf20Sopenharmony_ci#define GZIP_FC_WRAP                                     0x1e
5268c2ecf20Sopenharmony_ci
5278c2ecf20Sopenharmony_ci#define fc_is_compress(fc)  (((fc) & 0x10) == 0)
5288c2ecf20Sopenharmony_ci#define fc_has_count(fc)    (fc_is_compress(fc) && (((fc) & 0x4) != 0))
5298c2ecf20Sopenharmony_ci
5308c2ecf20Sopenharmony_ci/* CSB.CC Error codes */
5318c2ecf20Sopenharmony_ci
5328c2ecf20Sopenharmony_ci#define ERR_NX_OK             0
5338c2ecf20Sopenharmony_ci#define ERR_NX_ALIGNMENT      1
5348c2ecf20Sopenharmony_ci#define ERR_NX_OPOVERLAP      2
5358c2ecf20Sopenharmony_ci#define ERR_NX_DATA_LENGTH    3
5368c2ecf20Sopenharmony_ci#define ERR_NX_TRANSLATION    5
5378c2ecf20Sopenharmony_ci#define ERR_NX_PROTECTION     6
5388c2ecf20Sopenharmony_ci#define ERR_NX_EXTERNAL_UE7   7
5398c2ecf20Sopenharmony_ci#define ERR_NX_INVALID_OP     8
5408c2ecf20Sopenharmony_ci#define ERR_NX_PRIVILEGE      9
5418c2ecf20Sopenharmony_ci#define ERR_NX_INTERNAL_UE   10
5428c2ecf20Sopenharmony_ci#define ERR_NX_EXTERN_UE_WR  12
5438c2ecf20Sopenharmony_ci#define ERR_NX_TARGET_SPACE  13
5448c2ecf20Sopenharmony_ci#define ERR_NX_EXCESSIVE_DDE 14
5458c2ecf20Sopenharmony_ci#define ERR_NX_TRANSL_WR     15
5468c2ecf20Sopenharmony_ci#define ERR_NX_PROTECT_WR    16
5478c2ecf20Sopenharmony_ci#define ERR_NX_SUBFUNCTION   17
5488c2ecf20Sopenharmony_ci#define ERR_NX_FUNC_ABORT    18
5498c2ecf20Sopenharmony_ci#define ERR_NX_BYTE_MAX      19
5508c2ecf20Sopenharmony_ci#define ERR_NX_CORRUPT_CRB   20
5518c2ecf20Sopenharmony_ci#define ERR_NX_INVALID_CRB   21
5528c2ecf20Sopenharmony_ci#define ERR_NX_INVALID_DDE   30
5538c2ecf20Sopenharmony_ci#define ERR_NX_SEGMENTED_DDL 31
5548c2ecf20Sopenharmony_ci#define ERR_NX_DDE_OVERFLOW  33
5558c2ecf20Sopenharmony_ci#define ERR_NX_TPBC_GT_SPBC  64
5568c2ecf20Sopenharmony_ci#define ERR_NX_MISSING_CODE  66
5578c2ecf20Sopenharmony_ci#define ERR_NX_INVALID_DIST  67
5588c2ecf20Sopenharmony_ci#define ERR_NX_INVALID_DHT   68
5598c2ecf20Sopenharmony_ci#define ERR_NX_EXTERNAL_UE90 90
5608c2ecf20Sopenharmony_ci#define ERR_NX_WDOG_TIMER   224
5618c2ecf20Sopenharmony_ci#define ERR_NX_AT_FAULT     250
5628c2ecf20Sopenharmony_ci#define ERR_NX_INTR_SERVER  252
5638c2ecf20Sopenharmony_ci#define ERR_NX_UE253        253
5648c2ecf20Sopenharmony_ci#define ERR_NX_NO_HW        254
5658c2ecf20Sopenharmony_ci#define ERR_NX_HUNG_OP      255
5668c2ecf20Sopenharmony_ci#define ERR_NX_END          256
5678c2ecf20Sopenharmony_ci
5688c2ecf20Sopenharmony_ci/* initial values for non-resume operations */
5698c2ecf20Sopenharmony_ci#define INIT_CRC   0  /* crc32(0L, Z_NULL, 0) */
5708c2ecf20Sopenharmony_ci#define INIT_ADLER 1  /* adler32(0L, Z_NULL, 0)  adler is initialized to 1 */
5718c2ecf20Sopenharmony_ci
5728c2ecf20Sopenharmony_ci/* prototypes */
5738c2ecf20Sopenharmony_ciint nxu_submit_job(struct nx_gzip_crb_cpb_t *c, void *handle);
5748c2ecf20Sopenharmony_ci
5758c2ecf20Sopenharmony_ciextern void nxu_sigsegv_handler(int sig, siginfo_t *info, void *ctx);
5768c2ecf20Sopenharmony_ciextern int nxu_touch_pages(void *buf, long buf_len, long page_len, int wr);
5778c2ecf20Sopenharmony_ci
5788c2ecf20Sopenharmony_ci/* caller supplies a print buffer 4*sizeof(crb) */
5798c2ecf20Sopenharmony_ci
5808c2ecf20Sopenharmony_cichar *nx_crb_str(struct nx_gzip_crb_t *crb, char *prbuf);
5818c2ecf20Sopenharmony_cichar *nx_cpb_str(struct nx_gzip_cpb_t *cpb, char *prbuf);
5828c2ecf20Sopenharmony_cichar *nx_prt_hex(void *cp, int sz, char *prbuf);
5838c2ecf20Sopenharmony_cichar *nx_lzcount_str(struct nx_gzip_cpb_t *cpb, char *prbuf);
5848c2ecf20Sopenharmony_cichar *nx_strerror(int e);
5858c2ecf20Sopenharmony_ci
5868c2ecf20Sopenharmony_ci#ifdef NX_SIM
5878c2ecf20Sopenharmony_ci#include <stdio.h>
5888c2ecf20Sopenharmony_ciint nx_sim_init(void *ctx);
5898c2ecf20Sopenharmony_ciint nx_sim_end(void *ctx);
5908c2ecf20Sopenharmony_ciint nxu_run_sim_job(struct nx_gzip_crb_cpb_t *c, void *ctx);
5918c2ecf20Sopenharmony_ci#endif /* NX_SIM */
5928c2ecf20Sopenharmony_ci
5938c2ecf20Sopenharmony_ci/* Deflate stream manipulation */
5948c2ecf20Sopenharmony_ci
5958c2ecf20Sopenharmony_ci#define set_final_bit(x)	(x |= (unsigned char)1)
5968c2ecf20Sopenharmony_ci#define clr_final_bit(x)	(x &= ~(unsigned char)1)
5978c2ecf20Sopenharmony_ci
5988c2ecf20Sopenharmony_ci#define append_empty_fh_blk(p, b) do { *(p) = (2 | (1&(b))); *((p)+1) = 0; \
5998c2ecf20Sopenharmony_ci					} while (0)
6008c2ecf20Sopenharmony_ci/* append 10 bits 0000001b 00...... ;
6018c2ecf20Sopenharmony_ci * assumes appending starts on a byte boundary; b is the final bit.
6028c2ecf20Sopenharmony_ci */
6038c2ecf20Sopenharmony_ci
6048c2ecf20Sopenharmony_ci
6058c2ecf20Sopenharmony_ci#ifdef NX_842
6068c2ecf20Sopenharmony_ci
6078c2ecf20Sopenharmony_ci/* 842 Engine */
6088c2ecf20Sopenharmony_ci
6098c2ecf20Sopenharmony_cistruct nx_eft_crb_t {
6108c2ecf20Sopenharmony_ci	union {                   /* byte[0:3]   */
6118c2ecf20Sopenharmony_ci		uint32_t eft_fc;      /* bits[29-31] */
6128c2ecf20Sopenharmony_ci	};
6138c2ecf20Sopenharmony_ci	uint32_t reserved1;       /* byte[4:7]   */
6148c2ecf20Sopenharmony_ci	union {
6158c2ecf20Sopenharmony_ci		uint64_t csb_address; /* byte[8:15]  */
6168c2ecf20Sopenharmony_ci		struct {
6178c2ecf20Sopenharmony_ci			uint32_t reserved2;
6188c2ecf20Sopenharmony_ci			union {
6198c2ecf20Sopenharmony_ci				uint32_t crb_c;
6208c2ecf20Sopenharmony_ci				/* c==0 no ccb defined */
6218c2ecf20Sopenharmony_ci
6228c2ecf20Sopenharmony_ci				uint32_t crb_at;
6238c2ecf20Sopenharmony_ci				/* at==0 address type is ignored;
6248c2ecf20Sopenharmony_ci				 * all addrs effective assumed.
6258c2ecf20Sopenharmony_ci				 */
6268c2ecf20Sopenharmony_ci
6278c2ecf20Sopenharmony_ci			};
6288c2ecf20Sopenharmony_ci		};
6298c2ecf20Sopenharmony_ci	};
6308c2ecf20Sopenharmony_ci	struct nx_dde_t source_dde;           /* byte[16:31] */
6318c2ecf20Sopenharmony_ci	struct nx_dde_t target_dde;           /* byte[32:47] */
6328c2ecf20Sopenharmony_ci	struct nx_ccb_t ccb;                  /* byte[48:63] */
6338c2ecf20Sopenharmony_ci	union {
6348c2ecf20Sopenharmony_ci		union nx_qw_t reserved64[3];     /* byte[64:96] */
6358c2ecf20Sopenharmony_ci	};
6368c2ecf20Sopenharmony_ci	struct nx_csb_t csb;
6378c2ecf20Sopenharmony_ci} __aligned(128);
6388c2ecf20Sopenharmony_ci
6398c2ecf20Sopenharmony_ci/* 842 CRB */
6408c2ecf20Sopenharmony_ci
6418c2ecf20Sopenharmony_ci#define EFT_FC_MASK                 size_mask(3)
6428c2ecf20Sopenharmony_ci#define EFT_FC_OFFSET               31
6438c2ecf20Sopenharmony_ci#define EFT_FC_COMPRESS             0x0
6448c2ecf20Sopenharmony_ci#define EFT_FC_COMPRESS_WITH_CRC    0x1
6458c2ecf20Sopenharmony_ci#define EFT_FC_DECOMPRESS           0x2
6468c2ecf20Sopenharmony_ci#define EFT_FC_DECOMPRESS_WITH_CRC  0x3
6478c2ecf20Sopenharmony_ci#define EFT_FC_BLK_DATA_MOVE        0x4
6488c2ecf20Sopenharmony_ci#endif /* NX_842 */
6498c2ecf20Sopenharmony_ci
6508c2ecf20Sopenharmony_ci#endif /* _NXU_H */
651