/* IBM_PROLOG_BEGIN_TAG */ /* This is an automatically generated prolog. */ /* */ /* bos72L src/bos/kernel/sys/nx.h 1.6 */ /* */ /* Licensed Materials - Property of IBM */ /* */ /* Restricted Materials of IBM */ /* */ /* COPYRIGHT International Business Machines Corp. 2017,2018 */ /* All Rights Reserved */ /* */ /* US Government Users Restricted Rights - Use, duplication or */ /* disclosure restricted by GSA ADP Schedule Contract with IBM Corp. */ /* */ /* IBM_PROLOG_END_TAG */ /* @(#)16 1.6 src/bos/kernel/sys/nx.h, sysios, bos72L, l2018_09A7 2/13/18 18:32:21 */ /* * This file contains constants, functions, data structures, * etc related to the coherent nest accelerators (NX). */ #ifndef _H_NX #define _H_NX #ifdef __cplusplus extern "C" { #endif #include /* * Types of NX accelerators accessible to applications. */ typedef enum { NX_GZIP_TYPE, /* GZIP accelerator type */ NX_MAX_ACCEL_TYPES } nx_accel_type_t; /* * Definition for NX Accelerator Unit ID */ typedef uint64_t nx_unit_id_t; /* NX Unit ID */ /******* * * In order to preserve application's compatibility with future versions * of AIX the reserved fields in the data structures below must: * - be set to 0 by the application prior to calling a library routine * or system call for which the data is an input parameter. * - ignored when these fields are part of data returned by a * library routine or system call. * *******/ /* * Per accelerator unit configuration data */ typedef struct nx_accel_unit { nx_unit_id_t na_id; /* HW accelerator unit ID */ uint32_t na_sradid; /* Accelerator unit's SRAD ID */ uint32_t na_avail_for_use_credits; /* Total number of credits the * * caller can potentially access * * to send work to the accel unit */ uint32_t na_avail_for_res_credits; /* Max number of credits the * * caller can reserve for * * exclusive use on this unit * * (0 for non-privileged callers) */ uint32_t na_res1[3]; /* reserved */ } nx_accel_unit_t; #define NX_MAX_UNITS_PER_TYPE 512 /* * Configuration structure common to all accelerator types */ struct nx_config_com { uint32_t ncc_version; /* version number */ uint32_t ncc_res1; /* Reserved - padding */ uint64_t ncc_gencount; /* Generation count */ #ifdef __64BIT__ nx_accel_unit_t *ncc_accel_buf_addr; /* unit info array address */ #else uint32_t ncc_res2; /* Not used - must be 0 */ nx_accel_unit_t *ncc_accel_buf_addr; /* unit info array address */ #endif uint32_t ncc_accel_buf_size; /* unit info array size in bytes */ uint32_t ncc_avail_for_use_credits; /* Total number of credits the * * caller can potentially access * * to send work to the accel. */ uint32_t ncc_avail_for_res_credits; /* Max number of credits the * * caller can reserve for * * exclusive use. * * (0 for non-privileged callers)*/ uint32_t ncc_total_num_units; /* Total number of accelerator units */ uint32_t ncc_num_units_in_buf; /* # of units described in buffer */ uint32_t ncc_res3[17]; /* Reserved for future extension */ }; /* * Note: Input fields ncc_accel_buf_addr and ncc_accel_buf_size contain * respectively the address and size in bytes of a buffer where the per * accelerator unit information (nx_accel_unit_t[]) is to be returned. * If the caller does not want/use the per accelerator information, these * two fields must be set to 0. * When the per unit information is requested, the ncc_num_units_in_buf * field indicates how many nx_accel_unit_t structures have been returned * in the buffer as the information may have been truncated if the buffer * is too small. * Using NX_MAX_UNITS_PER_TYPE to size the per accelerator unit information * buffer guarantees that the information will not be truncated. ******** * ALL reserved fields in the various structures described here MUST be * set to 0 before calling nx_config_query(). ******** */ /* * Per accelerator configuration generation count. * Incremented any time there is an operation which changes the number of * credits available for applications, i.e reservation/release of credits, * LPM or credit DR, etc. * * Fast access is provided to applications by making these (32 bit) generation * counts directly accessible from user space (Read Only). * The intent is that applications can check gen_count from time to time * and call nx_config_query only when there is a change in the configuration. */ extern uint32_t nx_gen_count[]; #define nx_gzip_gen_count nx_gen_count[NX_GZIP_TYPE] /* * Configuration structure for GZIP accelerator * Macros are defined to facilitate access to the ngc_com fields. */ typedef struct nx_gzip_config { struct nx_config_com ngc_com; /* Common with other accel types */ #define NX_GZIP_CONFIG_VER0 0x455A0000 #define NX_GZIP_CONFIG_VER NX_GZIP_CONFIG_VER0 uint64_t ngc_max_processed_bytes; /* Max number of bytes processed * * per request */ uint64_t ngc_comp_rec_min_bytes; /* Compress Recommanded Min Bytes */ uint64_t ngc_decomp_rec_min_bytes; /* Decompress Recomm. Min Bytes */ uint64_t ngc_res1[8]; /* Reserved for future extensions */ } nx_gzip_config_t; /* * GZIP definitions to facilitate manipulation of the nx_gzip_config structure */ #define ngc_version ngc_com.ncc_version #define ngc_gencount ngc_com.ncc_gencount #define ngc_accel_buf_addr ngc_com.ncc_accel_buf_addr #define ngc_accel_buf_size ngc_com.ncc_accel_buf_size #define ngc_total_num_units ngc_com.ncc_total_num_units #define ngc_num_units_in_buf ngc_com.ncc_num_units_in_buf #define ngc_avail_for_use_credits ngc_com.ncc_avail_for_use_credits #define ngc_avail_for_res_credits ngc_com.ncc_avail_for_res_credits /* Definitions for nx_get/rel_exclusive_access */ #define NX_ANY_UNIT -1ULL #define NX_ALL_CREDITS -1 int nx_get_excl_access(nx_accel_type_t /* accelerator type */, uint32_t /* flags (must be 0) */, int /* Number of credits */, nx_unit_id_t /* NX Unit ID */); int nx_rel_excl_access(nx_accel_type_t /* accelerator type */, uint32_t /* flags (must be 0) */, int /* # of credits or NX_ALL_CREDITS */, nx_unit_id_t /* NX Unit ID or NX_ANY_UNIT */); int nx_config_query(nx_accel_type_t /* accelerator type */, uint32_t /* flags (must be 0) */, void * /* config structure addr */, uint32_t /* config structure size */); #ifdef __cplusplus } #endif #endif /* _H_NX */