ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.git] / drivers / s390 / crypto / z90common.h
1 /*
2  *  linux/drivers/s390/misc/z90common.h
3  *
4  *  z90crypt 1.3.1
5  *
6  *  Copyright (C)  2001, 2004 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
27 #ifndef _Z90COMMON_
28 #define _Z90COMMON_
29
30 #define VERSION_Z90COMMON_H "$Revision: 1.8 $"
31
32
33 #define RESPBUFFSIZE 256
34 #define PCI_FUNC_KEY_DECRYPT 0x5044
35 #define PCI_FUNC_KEY_ENCRYPT 0x504B
36
37 enum devstat {
38         DEV_GONE,
39         DEV_ONLINE,
40         DEV_QUEUE_FULL,
41         DEV_EMPTY,
42         DEV_NO_WORK,
43         DEV_BAD_MESSAGE,
44         DEV_TSQ_EXCEPTION,
45         DEV_RSQ_EXCEPTION,
46         DEV_SEN_EXCEPTION,
47         DEV_REC_EXCEPTION
48 };
49
50 enum hdstat {
51         HD_NOT_THERE,
52         HD_BUSY,
53         HD_DECONFIGURED,
54         HD_CHECKSTOPPED,
55         HD_ONLINE,
56         HD_TSQ_EXCEPTION
57 };
58
59 #define Z90C_AMBIGUOUS_DOMAIN   2
60 #define Z90C_INCORRECT_DOMAIN   3
61 #define ENOTINIT                4
62
63 #define SEN_BUSY         7
64 #define SEN_USER_ERROR   8
65 #define SEN_QUEUE_FULL  11
66 #define SEN_NOT_AVAIL   16
67 #define SEN_PAD_ERROR   17
68 #define SEN_RETRY       18
69 #define SEN_RELEASED    24
70
71 #define REC_EMPTY        4
72 #define REC_BUSY         6
73 #define REC_OPERAND_INV  8
74 #define REC_OPERAND_SIZE 9
75 #define REC_EVEN_MOD    10
76 #define REC_NO_WORK     11
77 #define REC_HARDWAR_ERR 12
78 #define REC_NO_RESPONSE 13
79 #define REC_RETRY_DEV   14
80 #define REC_USER_GONE   15
81 #define REC_BAD_MESSAGE 16
82 #define REC_INVALID_PAD 17
83 #define REC_RELEASED    28
84
85 #define WRONG_DEVICE_TYPE 20
86
87 #define REC_FATAL_ERROR 32
88 #define SEN_FATAL_ERROR 33
89 #define TSQ_FATAL_ERROR 34
90 #define RSQ_FATAL_ERROR 35
91
92 #define PCICA   0
93 #define PCICC   1
94 #define PCIXCC  2
95 #define NILDEV  -1
96 #define ANYDEV  -1
97
98 enum hdevice_type {
99         PCICC_HW  = 3,
100         PCICA_HW  = 4,
101         PCIXCC_HW = 5,
102         OTHER_HW  = 6,
103         OTHER2_HW = 7
104 };
105
106 #ifndef DEV_NAME
107 #define DEV_NAME        "z90crypt"
108 #endif
109 #define PRINTK(fmt, args...) \
110         printk(KERN_DEBUG DEV_NAME ": %s -> " fmt, __FUNCTION__ , ## args)
111 #define PRINTKN(fmt, args...) \
112         printk(KERN_DEBUG DEV_NAME ": " fmt, ## args)
113 #define PRINTKW(fmt, args...) \
114         printk(KERN_WARNING DEV_NAME ": %s -> " fmt, __FUNCTION__ , ## args)
115 #define PRINTKC(fmt, args...) \
116         printk(KERN_CRIT DEV_NAME ": %s -> " fmt, __FUNCTION__ , ## args)
117
118 #ifdef Z90CRYPT_DEBUG
119 #define PDEBUG(fmt, args...) \
120         printk(KERN_DEBUG DEV_NAME ": %s -> " fmt, __FUNCTION__ , ## args)
121 #else
122 #define PDEBUG(fmt, args...) do {} while (0)
123 #endif
124
125 #define UMIN(a,b) ((a) < (b) ? (a) : (b))
126 #define IS_EVEN(x) ((x) == (2 * ((x) / 2)))
127
128
129 #endif