diff options
Diffstat (limited to 'drivers/s390/crypto/zcrypt_pcicc.h')
-rw-r--r-- | drivers/s390/crypto/zcrypt_pcicc.h | 176 |
1 files changed, 176 insertions, 0 deletions
diff --git a/drivers/s390/crypto/zcrypt_pcicc.h b/drivers/s390/crypto/zcrypt_pcicc.h new file mode 100644 index 000000000000..6d4454846c8f --- /dev/null +++ b/drivers/s390/crypto/zcrypt_pcicc.h | |||
@@ -0,0 +1,176 @@ | |||
1 | /* | ||
2 | * linux/drivers/s390/crypto/zcrypt_pcicc.h | ||
3 | * | ||
4 | * zcrypt 2.1.0 | ||
5 | * | ||
6 | * Copyright (C) 2001, 2006 IBM Corporation | ||
7 | * Author(s): Robert Burroughs | ||
8 | * Eric Rossman (edrossma@us.ibm.com) | ||
9 | * | ||
10 | * Hotplug & misc device support: Jochen Roehrig (roehrig@de.ibm.com) | ||
11 | * Major cleanup & driver split: Martin Schwidefsky <schwidefsky@de.ibm.com> | ||
12 | * | ||
13 | * This program is free software; you can redistribute it and/or modify | ||
14 | * it under the terms of the GNU General Public License as published by | ||
15 | * the Free Software Foundation; either version 2, or (at your option) | ||
16 | * any later version. | ||
17 | * | ||
18 | * This program is distributed in the hope that it will be useful, | ||
19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
21 | * GNU General Public License for more details. | ||
22 | * | ||
23 | * You should have received a copy of the GNU General Public License | ||
24 | * along with this program; if not, write to the Free Software | ||
25 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
26 | */ | ||
27 | |||
28 | #ifndef _ZCRYPT_PCICC_H_ | ||
29 | #define _ZCRYPT_PCICC_H_ | ||
30 | |||
31 | /** | ||
32 | * The type 6 message family is associated with PCICC or PCIXCC cards. | ||
33 | * | ||
34 | * It contains a message header followed by a CPRB, both of which | ||
35 | * are described below. | ||
36 | * | ||
37 | * Note that all reserved fields must be zeroes. | ||
38 | */ | ||
39 | struct type6_hdr { | ||
40 | unsigned char reserved1; /* 0x00 */ | ||
41 | unsigned char type; /* 0x06 */ | ||
42 | unsigned char reserved2[2]; /* 0x0000 */ | ||
43 | unsigned char right[4]; /* 0x00000000 */ | ||
44 | unsigned char reserved3[2]; /* 0x0000 */ | ||
45 | unsigned char reserved4[2]; /* 0x0000 */ | ||
46 | unsigned char apfs[4]; /* 0x00000000 */ | ||
47 | unsigned int offset1; /* 0x00000058 (offset to CPRB) */ | ||
48 | unsigned int offset2; /* 0x00000000 */ | ||
49 | unsigned int offset3; /* 0x00000000 */ | ||
50 | unsigned int offset4; /* 0x00000000 */ | ||
51 | unsigned char agent_id[16]; /* PCICC: */ | ||
52 | /* 0x0100 */ | ||
53 | /* 0x4343412d4150504c202020 */ | ||
54 | /* 0x010101 */ | ||
55 | /* PCIXCC: */ | ||
56 | /* 0x4341000000000000 */ | ||
57 | /* 0x0000000000000000 */ | ||
58 | unsigned char rqid[2]; /* rqid. internal to 603 */ | ||
59 | unsigned char reserved5[2]; /* 0x0000 */ | ||
60 | unsigned char function_code[2]; /* for PKD, 0x5044 (ascii 'PD') */ | ||
61 | unsigned char reserved6[2]; /* 0x0000 */ | ||
62 | unsigned int ToCardLen1; /* (request CPRB len + 3) & -4 */ | ||
63 | unsigned int ToCardLen2; /* db len 0x00000000 for PKD */ | ||
64 | unsigned int ToCardLen3; /* 0x00000000 */ | ||
65 | unsigned int ToCardLen4; /* 0x00000000 */ | ||
66 | unsigned int FromCardLen1; /* response buffer length */ | ||
67 | unsigned int FromCardLen2; /* db len 0x00000000 for PKD */ | ||
68 | unsigned int FromCardLen3; /* 0x00000000 */ | ||
69 | unsigned int FromCardLen4; /* 0x00000000 */ | ||
70 | } __attribute__((packed)); | ||
71 | |||
72 | /** | ||
73 | * CPRB | ||
74 | * Note that all shorts, ints and longs are little-endian. | ||
75 | * All pointer fields are 32-bits long, and mean nothing | ||
76 | * | ||
77 | * A request CPRB is followed by a request_parameter_block. | ||
78 | * | ||
79 | * The request (or reply) parameter block is organized thus: | ||
80 | * function code | ||
81 | * VUD block | ||
82 | * key block | ||
83 | */ | ||
84 | struct CPRB { | ||
85 | unsigned short cprb_len; /* CPRB length */ | ||
86 | unsigned char cprb_ver_id; /* CPRB version id. */ | ||
87 | unsigned char pad_000; /* Alignment pad byte. */ | ||
88 | unsigned char srpi_rtcode[4]; /* SRPI return code LELONG */ | ||
89 | unsigned char srpi_verb; /* SRPI verb type */ | ||
90 | unsigned char flags; /* flags */ | ||
91 | unsigned char func_id[2]; /* function id */ | ||
92 | unsigned char checkpoint_flag; /* */ | ||
93 | unsigned char resv2; /* reserved */ | ||
94 | unsigned short req_parml; /* request parameter buffer */ | ||
95 | /* length 16-bit little endian */ | ||
96 | unsigned char req_parmp[4]; /* request parameter buffer * | ||
97 | * pointer (means nothing: the * | ||
98 | * parameter buffer follows * | ||
99 | * the CPRB). */ | ||
100 | unsigned char req_datal[4]; /* request data buffer */ | ||
101 | /* length ULELONG */ | ||
102 | unsigned char req_datap[4]; /* request data buffer */ | ||
103 | /* pointer */ | ||
104 | unsigned short rpl_parml; /* reply parameter buffer */ | ||
105 | /* length 16-bit little endian */ | ||
106 | unsigned char pad_001[2]; /* Alignment pad bytes. ULESHORT */ | ||
107 | unsigned char rpl_parmp[4]; /* reply parameter buffer * | ||
108 | * pointer (means nothing: the * | ||
109 | * parameter buffer follows * | ||
110 | * the CPRB). */ | ||
111 | unsigned char rpl_datal[4]; /* reply data buffer len ULELONG */ | ||
112 | unsigned char rpl_datap[4]; /* reply data buffer */ | ||
113 | /* pointer */ | ||
114 | unsigned short ccp_rscode; /* server reason code ULESHORT */ | ||
115 | unsigned short ccp_rtcode; /* server return code ULESHORT */ | ||
116 | unsigned char repd_parml[2]; /* replied parameter len ULESHORT*/ | ||
117 | unsigned char mac_data_len[2]; /* Mac Data Length ULESHORT */ | ||
118 | unsigned char repd_datal[4]; /* replied data length ULELONG */ | ||
119 | unsigned char req_pc[2]; /* PC identifier */ | ||
120 | unsigned char res_origin[8]; /* resource origin */ | ||
121 | unsigned char mac_value[8]; /* Mac Value */ | ||
122 | unsigned char logon_id[8]; /* Logon Identifier */ | ||
123 | unsigned char usage_domain[2]; /* cdx */ | ||
124 | unsigned char resv3[18]; /* reserved for requestor */ | ||
125 | unsigned short svr_namel; /* server name length ULESHORT */ | ||
126 | unsigned char svr_name[8]; /* server name */ | ||
127 | } __attribute__((packed)); | ||
128 | |||
129 | /** | ||
130 | * The type 86 message family is associated with PCICC and PCIXCC cards. | ||
131 | * | ||
132 | * It contains a message header followed by a CPRB. The CPRB is | ||
133 | * the same as the request CPRB, which is described above. | ||
134 | * | ||
135 | * If format is 1, an error condition exists and no data beyond | ||
136 | * the 8-byte message header is of interest. | ||
137 | * | ||
138 | * The non-error message is shown below. | ||
139 | * | ||
140 | * Note that all reserved fields must be zeroes. | ||
141 | */ | ||
142 | struct type86_hdr { | ||
143 | unsigned char reserved1; /* 0x00 */ | ||
144 | unsigned char type; /* 0x86 */ | ||
145 | unsigned char format; /* 0x01 (error) or 0x02 (ok) */ | ||
146 | unsigned char reserved2; /* 0x00 */ | ||
147 | unsigned char reply_code; /* reply code (see above) */ | ||
148 | unsigned char reserved3[3]; /* 0x000000 */ | ||
149 | } __attribute__((packed)); | ||
150 | |||
151 | #define TYPE86_RSP_CODE 0x86 | ||
152 | #define TYPE86_FMT2 0x02 | ||
153 | |||
154 | struct type86_fmt2_ext { | ||
155 | unsigned char reserved[4]; /* 0x00000000 */ | ||
156 | unsigned char apfs[4]; /* final status */ | ||
157 | unsigned int count1; /* length of CPRB + parameters */ | ||
158 | unsigned int offset1; /* offset to CPRB */ | ||
159 | unsigned int count2; /* 0x00000000 */ | ||
160 | unsigned int offset2; /* db offset 0x00000000 for PKD */ | ||
161 | unsigned int count3; /* 0x00000000 */ | ||
162 | unsigned int offset3; /* 0x00000000 */ | ||
163 | unsigned int count4; /* 0x00000000 */ | ||
164 | unsigned int offset4; /* 0x00000000 */ | ||
165 | } __attribute__((packed)); | ||
166 | |||
167 | struct function_and_rules_block { | ||
168 | unsigned char function_code[2]; | ||
169 | unsigned short ulen; | ||
170 | unsigned char only_rule[8]; | ||
171 | } __attribute__((packed)); | ||
172 | |||
173 | int zcrypt_pcicc_init(void); | ||
174 | void zcrypt_pcicc_exit(void); | ||
175 | |||
176 | #endif /* _ZCRYPT_PCICC_H_ */ | ||