z90common.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. /*
  2. * linux/drivers/s390/crypto/z90common.h
  3. *
  4. * z90crypt 1.3.3
  5. *
  6. * Copyright (C) 2001, 2005 IBM Corporation
  7. * Author(s): Robert Burroughs (burrough@us.ibm.com)
  8. * Eric Rossman (edrossma@us.ibm.com)
  9. *
  10. * Hotplug & misc device support: Jochen Roehrig (roehrig@de.ibm.com)
  11. *
  12. * This program is free software; you can redistribute it and/or modify
  13. * it under the terms of the GNU General Public License as published by
  14. * the Free Software Foundation; either version 2, or (at your option)
  15. * any later version.
  16. *
  17. * This program is distributed in the hope that it will be useful,
  18. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. * GNU General Public License for more details.
  21. *
  22. * You should have received a copy of the GNU General Public License
  23. * along with this program; if not, write to the Free Software
  24. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  25. */
  26. #ifndef _Z90COMMON_H_
  27. #define _Z90COMMON_H_
  28. #define RESPBUFFSIZE 256
  29. #define PCI_FUNC_KEY_DECRYPT 0x5044
  30. #define PCI_FUNC_KEY_ENCRYPT 0x504B
  31. extern int ext_bitlens;
  32. enum devstat {
  33. DEV_GONE,
  34. DEV_ONLINE,
  35. DEV_QUEUE_FULL,
  36. DEV_EMPTY,
  37. DEV_NO_WORK,
  38. DEV_BAD_MESSAGE,
  39. DEV_TSQ_EXCEPTION,
  40. DEV_RSQ_EXCEPTION,
  41. DEV_SEN_EXCEPTION,
  42. DEV_REC_EXCEPTION
  43. };
  44. enum hdstat {
  45. HD_NOT_THERE,
  46. HD_BUSY,
  47. HD_DECONFIGURED,
  48. HD_CHECKSTOPPED,
  49. HD_ONLINE,
  50. HD_TSQ_EXCEPTION
  51. };
  52. #define Z90C_NO_DEVICES 1
  53. #define Z90C_AMBIGUOUS_DOMAIN 2
  54. #define Z90C_INCORRECT_DOMAIN 3
  55. #define ENOTINIT 4
  56. #define SEN_BUSY 7
  57. #define SEN_USER_ERROR 8
  58. #define SEN_QUEUE_FULL 11
  59. #define SEN_NOT_AVAIL 16
  60. #define SEN_PAD_ERROR 17
  61. #define SEN_RETRY 18
  62. #define SEN_RELEASED 24
  63. #define REC_EMPTY 4
  64. #define REC_BUSY 6
  65. #define REC_OPERAND_INV 8
  66. #define REC_OPERAND_SIZE 9
  67. #define REC_EVEN_MOD 10
  68. #define REC_NO_WORK 11
  69. #define REC_HARDWAR_ERR 12
  70. #define REC_NO_RESPONSE 13
  71. #define REC_RETRY_DEV 14
  72. #define REC_USER_GONE 15
  73. #define REC_BAD_MESSAGE 16
  74. #define REC_INVALID_PAD 17
  75. #define REC_USE_PCICA 18
  76. #define WRONG_DEVICE_TYPE 20
  77. #define REC_FATAL_ERROR 32
  78. #define SEN_FATAL_ERROR 33
  79. #define TSQ_FATAL_ERROR 34
  80. #define RSQ_FATAL_ERROR 35
  81. #define Z90CRYPT_NUM_TYPES 6
  82. #define PCICA 0
  83. #define PCICC 1
  84. #define PCIXCC_MCL2 2
  85. #define PCIXCC_MCL3 3
  86. #define CEX2C 4
  87. #define CEX2A 5
  88. #define NILDEV -1
  89. #define ANYDEV -1
  90. #define PCIXCC_UNK -2
  91. enum hdevice_type {
  92. PCICC_HW = 3,
  93. PCICA_HW = 4,
  94. PCIXCC_HW = 5,
  95. CEX2A_HW = 6,
  96. CEX2C_HW = 7
  97. };
  98. struct CPRBX {
  99. unsigned short cprb_len;
  100. unsigned char cprb_ver_id;
  101. unsigned char pad_000[3];
  102. unsigned char func_id[2];
  103. unsigned char cprb_flags[4];
  104. unsigned int req_parml;
  105. unsigned int req_datal;
  106. unsigned int rpl_msgbl;
  107. unsigned int rpld_parml;
  108. unsigned int rpl_datal;
  109. unsigned int rpld_datal;
  110. unsigned int req_extbl;
  111. unsigned char pad_001[4];
  112. unsigned int rpld_extbl;
  113. unsigned char req_parmb[16];
  114. unsigned char req_datab[16];
  115. unsigned char rpl_parmb[16];
  116. unsigned char rpl_datab[16];
  117. unsigned char req_extb[16];
  118. unsigned char rpl_extb[16];
  119. unsigned short ccp_rtcode;
  120. unsigned short ccp_rscode;
  121. unsigned int mac_data_len;
  122. unsigned char logon_id[8];
  123. unsigned char mac_value[8];
  124. unsigned char mac_content_flgs;
  125. unsigned char pad_002;
  126. unsigned short domain;
  127. unsigned char pad_003[12];
  128. unsigned char pad_004[36];
  129. };
  130. #ifndef DEV_NAME
  131. #define DEV_NAME "z90crypt"
  132. #endif
  133. #define PRINTK(fmt, args...) \
  134. printk(KERN_DEBUG DEV_NAME ": %s -> " fmt, __FUNCTION__ , ## args)
  135. #define PRINTKN(fmt, args...) \
  136. printk(KERN_DEBUG DEV_NAME ": " fmt, ## args)
  137. #define PRINTKW(fmt, args...) \
  138. printk(KERN_WARNING DEV_NAME ": %s -> " fmt, __FUNCTION__ , ## args)
  139. #define PRINTKC(fmt, args...) \
  140. printk(KERN_CRIT DEV_NAME ": %s -> " fmt, __FUNCTION__ , ## args)
  141. #ifdef Z90CRYPT_DEBUG
  142. #define PDEBUG(fmt, args...) \
  143. printk(KERN_DEBUG DEV_NAME ": %s -> " fmt, __FUNCTION__ , ## args)
  144. #else
  145. #define PDEBUG(fmt, args...) do {} while (0)
  146. #endif
  147. #define UMIN(a,b) ((a) < (b) ? (a) : (b))
  148. #define IS_EVEN(x) ((x) == (2 * ((x) / 2)))
  149. #endif