adf_cfg_common.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /*
  2. This file is provided under a dual BSD/GPLv2 license. When using or
  3. redistributing this file, you may do so under either license.
  4. GPL LICENSE SUMMARY
  5. Copyright(c) 2014 Intel Corporation.
  6. This program is free software; you can redistribute it and/or modify
  7. it under the terms of version 2 of the GNU General Public License as
  8. published by the Free Software Foundation.
  9. This program is distributed in the hope that it will be useful, but
  10. WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. General Public License for more details.
  13. Contact Information:
  14. qat-linux@intel.com
  15. BSD LICENSE
  16. Copyright(c) 2014 Intel Corporation.
  17. Redistribution and use in source and binary forms, with or without
  18. modification, are permitted provided that the following conditions
  19. are met:
  20. * Redistributions of source code must retain the above copyright
  21. notice, this list of conditions and the following disclaimer.
  22. * Redistributions in binary form must reproduce the above copyright
  23. notice, this list of conditions and the following disclaimer in
  24. the documentation and/or other materials provided with the
  25. distribution.
  26. * Neither the name of Intel Corporation nor the names of its
  27. contributors may be used to endorse or promote products derived
  28. from this software without specific prior written permission.
  29. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  30. "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  31. LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  32. A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  33. OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  34. SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  35. LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  36. DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  37. THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  38. (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  39. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  40. */
  41. #ifndef ADF_CFG_COMMON_H_
  42. #define ADF_CFG_COMMON_H_
  43. #include <linux/types.h>
  44. #include <linux/ioctl.h>
  45. #define ADF_CFG_MAX_STR_LEN 64
  46. #define ADF_CFG_MAX_KEY_LEN_IN_BYTES ADF_CFG_MAX_STR_LEN
  47. #define ADF_CFG_MAX_VAL_LEN_IN_BYTES ADF_CFG_MAX_STR_LEN
  48. #define ADF_CFG_MAX_SECTION_LEN_IN_BYTES ADF_CFG_MAX_STR_LEN
  49. #define ADF_CFG_BASE_DEC 10
  50. #define ADF_CFG_BASE_HEX 16
  51. #define ADF_CFG_ALL_DEVICES 0xFE
  52. #define ADF_CFG_NO_DEVICE 0xFF
  53. #define ADF_CFG_AFFINITY_WHATEVER 0xFF
  54. #define MAX_DEVICE_NAME_SIZE 32
  55. #define ADF_MAX_DEVICES (32 * 32)
  56. enum adf_cfg_val_type {
  57. ADF_DEC,
  58. ADF_HEX,
  59. ADF_STR
  60. };
  61. enum adf_device_type {
  62. DEV_UNKNOWN = 0,
  63. DEV_DH895XCC,
  64. DEV_DH895XCCVF,
  65. };
  66. struct adf_dev_status_info {
  67. enum adf_device_type type;
  68. uint8_t accel_id;
  69. uint8_t instance_id;
  70. uint8_t num_ae;
  71. uint8_t num_accel;
  72. uint8_t num_logical_accel;
  73. uint8_t banks_per_accel;
  74. uint8_t state;
  75. uint8_t bus;
  76. uint8_t dev;
  77. uint8_t fun;
  78. char name[MAX_DEVICE_NAME_SIZE];
  79. };
  80. #define ADF_CTL_IOC_MAGIC 'a'
  81. #define IOCTL_CONFIG_SYS_RESOURCE_PARAMETERS _IOW(ADF_CTL_IOC_MAGIC, 0, \
  82. struct adf_user_cfg_ctl_data)
  83. #define IOCTL_STOP_ACCEL_DEV _IOW(ADF_CTL_IOC_MAGIC, 1, \
  84. struct adf_user_cfg_ctl_data)
  85. #define IOCTL_START_ACCEL_DEV _IOW(ADF_CTL_IOC_MAGIC, 2, \
  86. struct adf_user_cfg_ctl_data)
  87. #define IOCTL_STATUS_ACCEL_DEV _IOW(ADF_CTL_IOC_MAGIC, 3, uint32_t)
  88. #define IOCTL_GET_NUM_DEVICES _IOW(ADF_CTL_IOC_MAGIC, 4, int32_t)
  89. #endif