OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [linux-2.4/] [include/] [asm-s390/] [qdio.h] - Blame information for rev 1774

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1276 phoenix
/*
2
 * linux/include/asm/qdio.h
3
 *
4
 * Linux for S/390 QDIO base support, Hipersocket base support
5
 * version 2
6
 *
7
 * Copyright 2000,2002 IBM Corporation
8
 * Author(s): Utz Bacher <utz.bacher@de.ibm.com>
9
 *
10
 */
11
#ifndef __QDIO_H__
12
#define __QDIO_H__
13
 
14
#define VERSION_QDIO_H "$Revision: 1.1.1.1 $"
15
 
16
/* note, that most of the typedef's are from ingo. */
17
 
18
#include <linux/interrupt.h>
19
#include <asm/irq.h>
20
 
21
//#define QDIO_DBF_LIKE_HELL
22
 
23
#define QDIO_NAME "qdio "
24
 
25
#define QDIO_VERBOSE_LEVEL 9
26
 
27
#ifndef CONFIG_ARCH_S390X
28
#define QDIO_32_BIT
29
#endif /* CONFIG_ARCH_S390X */
30
 
31
#define QDIO_USE_PROCESSING_STATE
32
 
33
#ifdef CONFIG_QDIO_PERF_STATS
34
#define QDIO_PERFORMANCE_STATS
35
#endif /* CONFIG_QDIO_PERF_STATS */
36
 
37
/**** CONSTANTS, that are relied on without using these symbols *****/
38
#define QDIO_MAX_QUEUES_PER_IRQ 32 /* used in width of unsigned int */
39
/************************ END of CONSTANTS **************************/
40
#define QDIO_MAX_BUFFERS_PER_Q 128 /* must be a power of 2 (%x=&(x-1)*/
41
#define QDIO_BUF_ORDER 7 /* 2**this == number of pages used for sbals in 1 q */
42
#define QDIO_MAX_ELEMENTS_PER_BUFFER 16
43
#define SBAL_SIZE 256
44
 
45
#define IQDIO_FILL_LEVEL_TO_POLL (QDIO_MAX_BUFFERS_PER_Q*4/3)
46
 
47
#define TIQDIO_THININT_ISC 3
48
#define TIQDIO_DELAY_TARGET 0
49
#define QDIO_BUSY_BIT_PATIENCE 2000 /* in microsecs */
50
#define IQDIO_GLOBAL_LAPS 2 /* GLOBAL_LAPS are not used as we */
51
#define IQDIO_GLOBAL_LAPS_INT 1 /* dont global summary */
52
#define IQDIO_LOCAL_LAPS 4
53
#define IQDIO_LOCAL_LAPS_INT 1
54
#define IQDIO_GLOBAL_SUMMARY_CC_MASK 2
55
/*#define IQDIO_IQDC_INT_PARM 0x1234*/
56
 
57
#define QDIO_Q_LAPS 5
58
 
59
#define QDIO_STORAGE_ACC_KEY get_storage_key()
60
 
61
#define L2_CACHELINE_SIZE 256
62
#define INDICATORS_PER_CACHELINE (L2_CACHELINE_SIZE/sizeof(__u32))
63
 
64
#define QDIO_PERF "qdio_perf"
65
 
66
/* must be a power of 2 */
67
/*#define QDIO_STATS_NUMBER 4
68
 
69
#define QDIO_STATS_CLASSES 2
70
#define QDIO_STATS_COUNT_NEEDED 2*/
71
 
72
#define QDIO_ACTIVATE_DELAY 5 /* according to brenton belmar and paul
73
                                 gioquindo it can take up to 5ms before
74
                                 queues are really active */
75
 
76
#define QDIO_NO_USE_COUNT_TIME 10
77
#define QDIO_NO_USE_COUNT_TIMEOUT 1000 /* wait for 1 sec on each q before
78
                                          exiting without having use_count
79
                                          of the queue to 0 */
80
 
81
#define QDIO_ESTABLISH_TIMEOUT 1000
82
#define QDIO_ACTIVATE_TIMEOUT 100
83
#define QDIO_CLEANUP_CLEAR_TIMEOUT 20000
84
#define QDIO_CLEANUP_HALT_TIMEOUT 10000
85
 
86
#define QDIO_BH AURORA_BH
87
 
88
#define QDIO_IRQ_BUCKETS 256 /* heavy..., but does only use a few bytes, but
89
                              be rather faster in cases of collisions
90
                              (if there really is a collision, it is
91
                              on every (traditional) interrupt and every
92
                              do_QDIO, so we rather are generous */
93
#define QDIO_QETH_QFMT 0
94
#define QDIO_ZFCP_QFMT 1
95
#define QDIO_IQDIO_QFMT 2
96
 
97
#define QDIO_IRQ_STATE_FRESH 0 /* must be 0 -> memset has set it to 0 */
98
#define QDIO_IRQ_STATE_INACTIVE 1
99
#define QDIO_IRQ_STATE_ESTABLISHED 2
100
#define QDIO_IRQ_STATE_ACTIVE 3
101
#define QDIO_IRQ_STATE_STOPPED 4
102
 
103
/* used as intparm in do_IO: */
104
#define QDIO_DOING_SENSEID 0
105
#define QDIO_DOING_ESTABLISH 1
106
#define QDIO_DOING_ACTIVATE 2
107
#define QDIO_DOING_CLEANUP 3
108
 
109
/************************* DEBUG FACILITY STUFF *********************/
110
/* #define QDIO_DBF_LIKE_HELL */
111
 
112
#define QDIO_DBF_HEX(ex,name,level,addr,len) \
113
        do { \
114
        if (ex) \
115
                debug_exception(qdio_dbf_##name,level,(void*)(addr),len); \
116
        else \
117
                debug_event(qdio_dbf_##name,level,(void*)(addr),len); \
118
        } while (0)
119
#define QDIO_DBF_TEXT(ex,name,level,text) \
120
        do { \
121
        if (ex) \
122
                debug_text_exception(qdio_dbf_##name,level,text); \
123
        else \
124
                debug_text_event(qdio_dbf_##name,level,text); \
125
        } while (0)
126
 
127
#define QDIO_DBF_HEX0(ex,name,addr,len) QDIO_DBF_HEX(ex,name,0,addr,len)
128
#define QDIO_DBF_HEX1(ex,name,addr,len) QDIO_DBF_HEX(ex,name,1,addr,len)
129
#define QDIO_DBF_HEX2(ex,name,addr,len) QDIO_DBF_HEX(ex,name,2,addr,len)
130
#define QDIO_DBF_HEX3(ex,name,addr,len) QDIO_DBF_HEX(ex,name,3,addr,len)
131
#define QDIO_DBF_HEX4(ex,name,addr,len) QDIO_DBF_HEX(ex,name,4,addr,len)
132
#define QDIO_DBF_HEX5(ex,name,addr,len) QDIO_DBF_HEX(ex,name,5,addr,len)
133
#define QDIO_DBF_HEX6(ex,name,addr,len) QDIO_DBF_HEX(ex,name,6,addr,len)
134
#ifdef QDIO_DBF_LIKE_HELL
135
#endif /* QDIO_DBF_LIKE_HELL */
136
#if 0
137
#define QDIO_DBF_HEX0(ex,name,addr,len) do {} while (0)
138
#define QDIO_DBF_HEX1(ex,name,addr,len) do {} while (0)
139
#define QDIO_DBF_HEX2(ex,name,addr,len) do {} while (0)
140
#ifndef QDIO_DBF_LIKE_HELL
141
#define QDIO_DBF_HEX3(ex,name,addr,len) do {} while (0)
142
#define QDIO_DBF_HEX4(ex,name,addr,len) do {} while (0)
143
#define QDIO_DBF_HEX5(ex,name,addr,len) do {} while (0)
144
#define QDIO_DBF_HEX6(ex,name,addr,len) do {} while (0)
145
#endif /* QDIO_DBF_LIKE_HELL */
146
#endif /* 0 */
147
 
148
#define QDIO_DBF_TEXT0(ex,name,text) QDIO_DBF_TEXT(ex,name,0,text)
149
#define QDIO_DBF_TEXT1(ex,name,text) QDIO_DBF_TEXT(ex,name,1,text)
150
#define QDIO_DBF_TEXT2(ex,name,text) QDIO_DBF_TEXT(ex,name,2,text)
151
#define QDIO_DBF_TEXT3(ex,name,text) QDIO_DBF_TEXT(ex,name,3,text)
152
#define QDIO_DBF_TEXT4(ex,name,text) QDIO_DBF_TEXT(ex,name,4,text)
153
#define QDIO_DBF_TEXT5(ex,name,text) QDIO_DBF_TEXT(ex,name,5,text)
154
#define QDIO_DBF_TEXT6(ex,name,text) QDIO_DBF_TEXT(ex,name,6,text)
155
#ifdef QDIO_DBF_LIKE_HELL
156
#endif /* QDIO_DBF_LIKE_HELL */
157
#if 0
158
#define QDIO_DBF_TEXT0(ex,name,text) do {} while (0)
159
#define QDIO_DBF_TEXT1(ex,name,text) do {} while (0)
160
#define QDIO_DBF_TEXT2(ex,name,text) do {} while (0)
161
#ifndef QDIO_DBF_LIKE_HELL
162
#define QDIO_DBF_TEXT3(ex,name,text) do {} while (0)
163
#define QDIO_DBF_TEXT4(ex,name,text) do {} while (0)
164
#define QDIO_DBF_TEXT5(ex,name,text) do {} while (0)
165
#define QDIO_DBF_TEXT6(ex,name,text) do {} while (0)
166
#endif /* QDIO_DBF_LIKE_HELL */
167
#endif /* 0 */
168
 
169
#define QDIO_DBF_SETUP_NAME "qdio_setup"
170
#define QDIO_DBF_SETUP_LEN 8
171
#define QDIO_DBF_SETUP_INDEX 2
172
#define QDIO_DBF_SETUP_NR_AREAS 1
173
#ifdef QDIO_DBF_LIKE_HELL
174
#define QDIO_DBF_SETUP_LEVEL 6
175
#else /* QDIO_DBF_LIKE_HELL */
176
#define QDIO_DBF_SETUP_LEVEL 2
177
#endif /* QDIO_DBF_LIKE_HELL */
178
 
179
#define QDIO_DBF_SBAL_NAME "qdio_labs" /* sbal */
180
#define QDIO_DBF_SBAL_LEN 256
181
#define QDIO_DBF_SBAL_INDEX 2
182
#define QDIO_DBF_SBAL_NR_AREAS 2
183
#ifdef QDIO_DBF_LIKE_HELL
184
#define QDIO_DBF_SBAL_LEVEL 6
185
#else /* QDIO_DBF_LIKE_HELL */
186
#define QDIO_DBF_SBAL_LEVEL 2
187
#endif /* QDIO_DBF_LIKE_HELL */
188
 
189
#define QDIO_DBF_TRACE_NAME "qdio_trace"
190
#define QDIO_DBF_TRACE_LEN 8
191
#define QDIO_DBF_TRACE_NR_AREAS 2
192
#ifdef QDIO_DBF_LIKE_HELL
193
#define QDIO_DBF_TRACE_INDEX 4
194
#define QDIO_DBF_TRACE_LEVEL 4 /* -------- could be even more verbose here */
195
#else /* QDIO_DBF_LIKE_HELL */
196
#define QDIO_DBF_TRACE_INDEX 2
197
#define QDIO_DBF_TRACE_LEVEL 2
198
#endif /* QDIO_DBF_LIKE_HELL */
199
 
200
#define QDIO_DBF_SENSE_NAME "qdio_sense"
201
#define QDIO_DBF_SENSE_LEN 64
202
#define QDIO_DBF_SENSE_INDEX 1
203
#define QDIO_DBF_SENSE_NR_AREAS 1
204
#ifdef QDIO_DBF_LIKE_HELL
205
#define QDIO_DBF_SENSE_LEVEL 6
206
#else /* QDIO_DBF_LIKE_HELL */
207
#define QDIO_DBF_SENSE_LEVEL 2
208
#endif /* QDIO_DBF_LIKE_HELL */
209
 
210
#ifdef QDIO_DBF_LIKE_HELL
211
#define QDIO_TRACE_QTYPE QDIO_ZFCP_QFMT
212
 
213
#define QDIO_DBF_SLSB_OUT_NAME "qdio_slsb_out"
214
#define QDIO_DBF_SLSB_OUT_LEN QDIO_MAX_BUFFERS_PER_Q
215
#define QDIO_DBF_SLSB_OUT_INDEX 8
216
#define QDIO_DBF_SLSB_OUT_NR_AREAS 1
217
#define QDIO_DBF_SLSB_OUT_LEVEL 6
218
 
219
#define QDIO_DBF_SLSB_IN_NAME "qdio_slsb_in"
220
#define QDIO_DBF_SLSB_IN_LEN QDIO_MAX_BUFFERS_PER_Q
221
#define QDIO_DBF_SLSB_IN_INDEX 8
222
#define QDIO_DBF_SLSB_IN_NR_AREAS 1
223
#define QDIO_DBF_SLSB_IN_LEVEL 6
224
#endif /* QDIO_DBF_LIKE_HELL */
225
 
226
/****************** END OF DEBUG FACILITY STUFF *********************/
227
 
228
typedef struct qdio_buffer_element_t {
229
        unsigned int flags;
230
        unsigned int length;
231
#ifdef QDIO_32_BIT
232
        void *reserved;
233
#endif /* QDIO_32_BIT */
234
        void *addr;
235
} __attribute__ ((packed,aligned(16))) qdio_buffer_element_t;
236
 
237
typedef struct qdio_buffer_t {
238
        volatile qdio_buffer_element_t element[16];
239
} __attribute__ ((packed,aligned(256))) qdio_buffer_t;
240
 
241
 
242
/* params are: irq, status, qdio_error, siga_error,
243
   queue_number, first element processed, number of elements processed,
244
   int_parm */
245
typedef void qdio_handler_t(int,unsigned int,unsigned int,unsigned int,
246
                            unsigned int,int,int,unsigned long);
247
 
248
 
249
#define QDIO_STATUS_INBOUND_INT 0x01
250
#define QDIO_STATUS_OUTBOUND_INT 0x02
251
#define QDIO_STATUS_LOOK_FOR_ERROR 0x04
252
#define QDIO_STATUS_MORE_THAN_ONE_QDIO_ERROR 0x08
253
#define QDIO_STATUS_MORE_THAN_ONE_SIGA_ERROR 0x10
254
#define QDIO_STATUS_ACTIVATE_CHECK_CONDITION 0x20
255
 
256
#define QDIO_SIGA_ERROR_ACCESS_EXCEPTION 0x10
257
#define QDIO_SIGA_ERROR_B_BIT_SET 0x20
258
 
259
/* for qdio_initialize */
260
#define QDIO_INBOUND_0COPY_SBALS 0x01
261
#define QDIO_OUTBOUND_0COPY_SBALS 0x02
262
#define QDIO_USE_OUTBOUND_PCIS 0x04
263
#define QDIO_PFIX 0x08
264
 
265
/* for qdio_cleanup */
266
#define QDIO_FLAG_CLEANUP_USING_CLEAR 0x01
267
#define QDIO_FLAG_CLEANUP_USING_HALT 0x02
268
 
269
typedef struct qdio_initialize_t {
270
        int irq;
271
        unsigned char q_format;
272
        unsigned char adapter_name[8];
273
        unsigned int qib_param_field_format; /*adapter dependent*/
274
        /* pointer to 128 bytes or NULL, if no param field */
275
        unsigned char *qib_param_field; /* adapter dependent */
276
        /* pointer to no_queues*128 words of data or NULL */
277
        unsigned long *input_slib_elements;
278
        unsigned long *output_slib_elements;
279
        unsigned int min_input_threshold;
280
        unsigned int max_input_threshold;
281
        unsigned int min_output_threshold;
282
        unsigned int max_output_threshold;
283
        unsigned int no_input_qs;
284
        unsigned int no_output_qs;
285
        qdio_handler_t *input_handler;
286
        qdio_handler_t *output_handler;
287
        unsigned long int_parm;
288
        unsigned long flags;
289
        void **input_sbal_addr_array; /* addr of n*128 void ptrs */
290
        void **output_sbal_addr_array; /* addr of n*128 void ptrs */
291
} qdio_initialize_t;
292
extern int qdio_initialize(qdio_initialize_t *init_data);
293
 
294
extern int qdio_activate(int irq,int flags);
295
 
296
#define QDIO_STATE_MUST_USE_OUTB_PCI    0x00000001
297
#define QDIO_STATE_INACTIVE             0x00000002 /* after qdio_cleanup */
298
#define QDIO_STATE_ESTABLISHED          0x00000004 /* after qdio_initialize */
299
#define QDIO_STATE_ACTIVE               0x00000008 /* after qdio_activate */
300
#define QDIO_STATE_STOPPED              0x00000010 /* after queues went down */
301
extern unsigned long qdio_get_status(int irq);
302
 
303
 
304
#define QDIO_FLAG_SYNC_INPUT     0x01
305
#define QDIO_FLAG_SYNC_OUTPUT    0x02
306
#define QDIO_FLAG_UNDER_INTERRUPT 0x04
307
#define QDIO_FLAG_NO_INPUT_INTERRUPT_CONTEXT 0x08 /* no effect on
308
                                                     adapter interrupts */
309
#define QDIO_FLAG_DONT_SIGA 0x10
310
 
311
extern int do_QDIO(int irq,unsigned int flags, unsigned int queue_number,
312
                   unsigned int qidx,unsigned int count,
313
                   qdio_buffer_t *buffers);
314
 
315
extern int qdio_synchronize(int irq,unsigned int flags,
316
                            unsigned int queue_number);
317
 
318
extern int qdio_cleanup(int irq,int how);
319
 
320
extern unsigned char qdio_get_slsb_state(int irq,unsigned int flag,
321
                                  unsigned int queue_number,
322
                                  unsigned int qidx);
323
 
324
/*
325
 * QDIO device commands returned by extended Sense-ID
326
 */
327
#define DEFAULT_ESTABLISH_QS_CMD 0x1b
328
#define DEFAULT_ESTABLISH_QS_COUNT 0x1000
329
#define DEFAULT_ACTIVATE_QS_CMD 0x1f
330
#define DEFAULT_ACTIVATE_QS_COUNT 0
331
typedef struct _qdio_cmds {
332
        unsigned char rcd;            /* read configuration data */
333
        unsigned short count_rcd;
334
        unsigned char sii;            /* set interface identifier */
335
        unsigned short count_sii;
336
        unsigned char rni;            /* read node identifier */
337
        unsigned short count_rni;
338
        unsigned char eq;             /* establish QDIO queues */
339
        unsigned short count_eq;
340
        unsigned char aq;             /* activate QDIO queues */
341
        unsigned short count_aq;
342
} qdio_cmds_t;
343
 
344
/*
345
 * additional CIWs returned by extended Sense-ID
346
 */
347
#define CIW_TYPE_EQUEUE 0x3       /* establish QDIO queues */
348
#define CIW_TYPE_AQUEUE 0x4       /* activate QDIO queues */
349
 
350
typedef struct _qdesfmt0 {
351
#ifdef QDIO_32_BIT
352
        unsigned long res1;             /* reserved */
353
#endif /* QDIO_32_BIT */
354
        unsigned long sliba;            /* storage-list-information-block
355
                                           address */
356
#ifdef QDIO_32_BIT
357
        unsigned long res2;             /* reserved */
358
#endif /* QDIO_32_BIT */
359
        unsigned long sla;              /* storage-list address */
360
#ifdef QDIO_32_BIT
361
        unsigned long res3;             /* reserved */
362
#endif /* QDIO_32_BIT */
363
        unsigned long slsba;            /* storage-list-state-block address */
364
        unsigned int  res4;             /* reserved */
365
        unsigned int  akey  :  4;       /* access key for DLIB */
366
        unsigned int  bkey  :  4;       /* access key for SL */
367
        unsigned int  ckey  :  4;       /* access key for SBALs */
368
        unsigned int  dkey  :  4;       /* access key for SLSB */
369
        unsigned int  res5  : 16;       /* reserved */
370
} __attribute__ ((packed)) qdesfmt0_t;
371
 
372
/*
373
 * Queue-Description record (QDR)
374
 */
375
typedef struct _qdr {
376
        unsigned int  qfmt    :  8;     /* queue format */
377
        unsigned int  pfmt    :  8;     /* impl. dep. parameter format */
378
        unsigned int  res1    :  8;     /* reserved */
379
        unsigned int  ac      :  8;     /* adapter characteristics */
380
        unsigned int  res2    :  8;     /* reserved */
381
        unsigned int  iqdcnt  :  8;     /* input-queue-descriptor count */
382
        unsigned int  res3    :  8;     /* reserved */
383
        unsigned int  oqdcnt  :  8;     /* output-queue-descriptor count */
384
        unsigned int  res4    :  8;     /* reserved */
385
        unsigned int  iqdsz   :  8;     /* input-queue-descriptor size */
386
        unsigned int  res5    :  8;     /* reserved */
387
        unsigned int  oqdsz   :  8;     /* output-queue-descriptor size */
388
        unsigned int  res6[9];          /* reserved */
389
#ifdef QDIO_32_BIT
390
        unsigned long res7;             /* reserved */
391
#endif /* QDIO_32_BIT */
392
        unsigned long qiba;             /* queue-information-block address */
393
        unsigned int  res8;             /* reserved */
394
        unsigned int  qkey    :  4;     /* queue-informatio-block key */
395
        unsigned int  res9    : 28;     /* reserved */
396
/*      union _qd {*/ /* why this? */
397
                qdesfmt0_t qdf0[126];
398
/*      } qd;*/
399
} __attribute__ ((packed,aligned(4096))) qdr_t;
400
 
401
 
402
/*
403
 * queue information block (QIB)
404
 */
405
#define QIB_AC_INBOUND_PCI_SUPPORTED 0x80
406
#define QIB_AC_OUTBOUND_PCI_SUPPORTED 0x40
407
typedef struct _qib {
408
        unsigned int  qfmt    :  8;     /* queue format */
409
        unsigned int  pfmt    :  8;     /* impl. dep. parameter format */
410
        unsigned int  res1    :  8;     /* reserved */
411
        unsigned int  ac      :  8;     /* adapter characteristics */
412
        unsigned int  res2;             /* reserved */
413
#ifdef QDIO_32_BIT
414
        unsigned long res3;             /* reserved */
415
#endif /* QDIO_32_BIT */
416
        unsigned long isliba;           /* absolute address of 1st
417
                                           input SLIB */
418
#ifdef QDIO_32_BIT
419
        unsigned long res4;             /* reserved */
420
#endif /* QDIO_32_BIT */
421
        unsigned long osliba;           /* absolute address of 1st
422
                                           output SLIB */
423
        unsigned int  res5;             /* reserved */
424
        unsigned int  res6;             /* reserved */
425
        unsigned char ebcnam[8];        /* adapter identifier in EBCDIC */
426
        unsigned char res7[88];         /* reserved */
427
        unsigned char parm[QDIO_MAX_BUFFERS_PER_Q];
428
                                        /* implementation dependent
429
                                           parameters */
430
} __attribute__ ((packed,aligned(256))) qib_t;
431
 
432
 
433
/*
434
 * storage-list-information block element (SLIBE)
435
 */
436
typedef struct _slibe {
437
#ifdef QDIO_32_BIT
438
        unsigned long res;              /* reserved */
439
#endif /* QDIO_32_BIT */
440
        unsigned long parms;            /* implementation dependent
441
                                           parameters */
442
} slibe_t;
443
 
444
/*
445
 * storage-list-information block (SLIB)
446
 */
447
typedef struct _slib {
448
#ifdef QDIO_32_BIT
449
        unsigned long res1;             /* reserved */
450
#endif /* QDIO_32_BIT */
451
        unsigned long nsliba;           /* next SLIB address (if any) */
452
#ifdef QDIO_32_BIT
453
        unsigned long res2;             /* reserved */
454
#endif /* QDIO_32_BIT */
455
        unsigned long sla;              /* SL address */
456
#ifdef QDIO_32_BIT
457
        unsigned long res3;             /* reserved */
458
#endif /* QDIO_32_BIT */
459
        unsigned long slsba;            /* SLSB address */
460
        unsigned char res4[1000];       /* reserved */
461
        slibe_t       slibe[QDIO_MAX_BUFFERS_PER_Q];    /* SLIB elements */
462
} __attribute__ ((packed,aligned(2048))) slib_t;
463
 
464
typedef struct _sbal_flags {
465
        unsigned char res1  : 1;   /* reserved */
466
        unsigned char last  : 1;   /* last entry */
467
        unsigned char cont  : 1;   /* contiguous storage */
468
        unsigned char res2  : 1;   /* reserved */
469
        unsigned char frag  : 2;   /* fragmentation (s.below) */
470
        unsigned char res3  : 2;   /* reserved */
471
} __attribute__ ((packed)) sbal_flags_t;
472
 
473
#define SBAL_FLAGS_FIRST_FRAG        0x04000000UL
474
#define SBAL_FLAGS_MIDDLE_FRAG       0x08000000UL
475
#define SBAL_FLAGS_LAST_FRAG         0x0c000000UL
476
#define SBAL_FLAGS_LAST_ENTRY        0x40000000UL
477
#define SBAL_FLAGS_CONTIGUOUS        0x20000000UL
478
 
479
#define SBAL_FLAGS0_DATA_CONTINUATION 0x20UL
480
 
481
/* Awesome FCP extensions */
482
#define SBAL_FLAGS0_TYPE_STATUS       0x00UL
483
#define SBAL_FLAGS0_TYPE_WRITE        0x08UL
484
#define SBAL_FLAGS0_TYPE_READ         0x10UL
485
#define SBAL_FLAGS0_TYPE_WRITE_READ   0x18UL
486
#define SBAL_FLAGS0_MORE_SBALS        0x04UL
487
#define SBAL_FLAGS0_COMMAND           0x02UL
488
#define SBAL_FLAGS0_LAST_SBAL         0x00UL
489
#define SBAL_FLAGS0_ONLY_SBAL         SBAL_FLAGS0_COMMAND
490
#define SBAL_FLAGS0_MIDDLE_SBAL       SBAL_FLAGS0_MORE_SBALS
491
#define SBAL_FLAGS0_FIRST_SBAL        SBAL_FLAGS0_MORE_SBALS | SBAL_FLAGS0_COMMAND
492
/* Naught of interest beyond this point */
493
 
494
#define SBAL_FLAGS0_PCI         0x40
495
typedef struct _sbal_sbalf_0 {
496
        unsigned char res1  : 1;   /* reserved */
497
        unsigned char pci   : 1;   /* PCI indicator */
498
        unsigned char cont  : 1;   /* data continuation */
499
        unsigned char sbtype: 2;   /* storage-block type (FCP) */
500
        unsigned char res2  : 3;   /* reserved */
501
} __attribute__ ((packed)) sbal_sbalf_0_t;
502
 
503
typedef struct _sbal_sbalf_1 {
504
        unsigned char res1  : 4;   /* reserved */
505
        unsigned char key   : 4;   /* storage key */
506
} __attribute__ ((packed)) sbal_sbalf_1_t;
507
 
508
typedef struct _sbal_sbalf_14 {
509
        unsigned char res1   : 4;  /* reserved */
510
        unsigned char erridx : 4;  /* error index */
511
} __attribute__ ((packed)) sbal_sbalf_14_t;
512
 
513
typedef struct _sbal_sbalf_15 {
514
        unsigned char reason;      /* reserved */
515
} __attribute__ ((packed)) sbal_sbalf_15_t;
516
 
517
typedef union _sbal_sbalf {
518
        sbal_sbalf_0_t  i0;
519
        sbal_sbalf_1_t  i1;
520
        sbal_sbalf_14_t i14;
521
        sbal_sbalf_15_t i15;
522
        unsigned char value;
523
} sbal_sbalf_t;
524
 
525
typedef struct _sbale {
526
        union {
527
                sbal_flags_t  bits;       /* flags */
528
                unsigned char value;
529
        } flags;
530
        unsigned int  res1  : 16;   /* reserved */
531
        sbal_sbalf_t  sbalf;       /* SBAL flags */
532
        unsigned int  res2  : 16;  /* reserved */
533
        unsigned int  count : 16;  /* data count */
534
#ifdef QDIO_32_BIT
535
        unsigned long res3;        /* reserved */
536
#endif /* QDIO_32_BIT */
537
        unsigned long addr;        /* absolute data address */
538
} __attribute__ ((packed,aligned(16))) sbal_element_t;
539
 
540
/*
541
 * strorage-block access-list (SBAL)
542
 */
543
typedef struct _sbal {
544
        sbal_element_t element[QDIO_MAX_ELEMENTS_PER_BUFFER];
545
} __attribute__ ((packed,aligned(256))) sbal_t;
546
 
547
/*
548
 * storage-list (SL)
549
 */
550
typedef struct _sl_element {
551
#ifdef QDIO_32_BIT
552
        unsigned long res;     /* reserved */
553
#endif /* QDIO_32_BIT */
554
        unsigned long sbal;    /* absolute SBAL address */
555
} __attribute__ ((packed)) sl_element_t;
556
 
557
typedef struct _sl {
558
        sl_element_t element[QDIO_MAX_BUFFERS_PER_Q];
559
} __attribute__ ((packed,aligned(1024))) sl_t;
560
 
561
/*
562
 * storage-list-state block (SLSB)
563
 */
564
/*typedef struct _slsb_val {*/
565
/*      unsigned char value;       */ /* SLSB entry as a single byte value */
566
/*} __attribute__ ((packed)) slsb_val_t;*/
567
 
568
typedef struct _slsb_flags {
569
        unsigned char owner  : 2;   /* SBAL owner */
570
        unsigned char type   : 1;   /* buffer type */
571
        unsigned char state  : 5;   /* processing state */
572
} __attribute__ ((packed)) slsb_flags_t;
573
 
574
 
575
typedef struct _slsb {
576
        union _acc {
577
                unsigned char val[QDIO_MAX_BUFFERS_PER_Q];
578
                slsb_flags_t flags[QDIO_MAX_BUFFERS_PER_Q];
579
        } acc;
580
} __attribute__ ((packed,aligned(256))) slsb_t;
581
 
582
/*
583
 * SLSB values
584
 */
585
#define SLSB_OWNER_PROG              1
586
#define SLSB_OWNER_CU                2
587
 
588
#define SLSB_TYPE_INPUT              0
589
#define SLSB_TYPE_OUTPUT             1
590
 
591
#define SLSB_STATE_NOT_INIT          0
592
#define SLSB_STATE_EMPTY             1
593
#define SLSB_STATE_PRIMED            2
594
#define SLSB_STATE_HALTED          0xe
595
#define SLSB_STATE_ERROR           0xf
596
 
597
#define SLSB_P_INPUT_NOT_INIT     0x80
598
#define SLSB_P_INPUT_PROCESSING   0x81
599
#define SLSB_CU_INPUT_EMPTY       0x41
600
#define SLSB_P_INPUT_PRIMED       0x82
601
#define SLSB_P_INPUT_HALTED       0x8E
602
#define SLSB_P_INPUT_ERROR        0x8F
603
 
604
#define SLSB_P_OUTPUT_NOT_INIT    0xA0
605
#define SLSB_P_OUTPUT_EMPTY       0xA1
606
#define SLSB_CU_OUTPUT_PRIMED     0x62
607
#define SLSB_P_OUTPUT_HALTED      0xAE
608
#define SLSB_P_OUTPUT_ERROR       0xAF
609
 
610
#define SLSB_ERROR_DURING_LOOKUP  0xFF
611
 
612
typedef struct qdio_q_t {
613
        volatile slsb_t slsb;
614
 
615
        __u32 * volatile dev_st_chg_ind;
616
 
617
        int is_input_q;
618
        int is_0copy_sbals_q;
619
 
620
        unsigned int is_iqdio_q;
621
        unsigned int is_thinint_q;
622
 
623
        /* bit 0 means queue 0, bit 1 means queue 1, ... */
624
        unsigned int mask;
625
        unsigned int q_no;
626
 
627
        qdio_handler_t (*handler);
628
 
629
        /* points to the next buffer to be checked for having
630
         * been processed by the card (outbound)
631
         * or to the next buffer the program should check for (inbound) */
632
        volatile int first_to_check;
633
        /* and the last time it was: */
634
        volatile int last_move_ftc;
635
 
636
        atomic_t number_of_buffers_used;
637
        atomic_t polling;
638
 
639
        unsigned int siga_in;
640
        unsigned int siga_out;
641
        unsigned int siga_sync;
642
        unsigned int siga_sync_done_on_thinints;
643
        unsigned int siga_sync_done_on_outb_tis;
644
        unsigned int hydra_gives_outbound_pcis;
645
 
646
        /* used to save beginning position when calling dd_handlers */
647
        int first_element_to_kick;
648
 
649
        atomic_t use_count;
650
        atomic_t is_in_shutdown;
651
 
652
        int irq;
653
        void *irq_ptr;
654
 
655
#ifdef QDIO_USE_TIMERS_FOR_POLLING
656
        struct timer_list timer;
657
        atomic_t timer_already_set;
658
        spinlock_t timer_lock;
659
#else /* QDIO_USE_TIMERS_FOR_POLLING */
660
        struct tasklet_struct tasklet;
661
#endif /* QDIO_USE_TIMERS_FOR_POLLING */
662
 
663
        unsigned int state;
664
 
665
        /* used to store the error condition during a data transfer */
666
        unsigned int qdio_error;
667
        unsigned int siga_error;
668
        unsigned int error_status_flags;
669
 
670
        /* list of interesting queues */
671
        volatile struct qdio_q_t *list_next;
672
        volatile struct qdio_q_t *list_prev;
673
 
674
        slib_t *slib; /* a page is allocated under this pointer,
675
                         sl points into this page, offset PAGE_SIZE/2
676
                         (after slib) */
677
        sl_t *sl;
678
        volatile sbal_t *sbal[QDIO_MAX_BUFFERS_PER_Q];
679
 
680
        qdio_buffer_t *qdio_buffers[QDIO_MAX_BUFFERS_PER_Q];
681
 
682
        unsigned long int_parm;
683
 
684
        /*struct {
685
                int in_bh_check_limit;
686
                int threshold;
687
        } threshold_classes[QDIO_STATS_CLASSES];*/
688
 
689
        struct {
690
                /* inbound: the time to stop polling
691
                   outbound: the time to kick peer */
692
                int threshold; /* the real value */
693
 
694
                /* outbound: last time of do_QDIO
695
                   inbound: last time of noticing incoming data */
696
                /*__u64 last_transfer_times[QDIO_STATS_NUMBER];
697
                int last_transfer_index; */
698
 
699
                __u64 last_transfer_time;
700
        } timing;
701
        unsigned int queue_type;
702
} __attribute__ ((aligned(256))) qdio_q_t;
703
 
704
typedef struct qdio_irq_t {
705
        __u32 * volatile dev_st_chg_ind;
706
 
707
        unsigned long int_parm;
708
        int irq;
709
 
710
        unsigned int is_iqdio_irq;
711
        unsigned int is_thinint_irq;
712
        unsigned int hydra_gives_outbound_pcis;
713
        unsigned int sync_done_on_outb_pcis;
714
 
715
        unsigned int state;
716
        spinlock_t setting_up_lock;
717
 
718
        unsigned int no_input_qs;
719
        unsigned int no_output_qs;
720
 
721
        unsigned char qdioac;
722
 
723
        qdio_q_t *input_qs[QDIO_MAX_QUEUES_PER_IRQ];
724
        qdio_q_t *output_qs[QDIO_MAX_QUEUES_PER_IRQ];
725
 
726
        ccw1_t ccw;
727
        int io_result_cstat;
728
        int io_result_dstat;
729
        int io_result_flags;
730
        atomic_t interrupt_has_arrived;
731
        atomic_t interrupt_has_been_cleaned;
732
        wait_queue_head_t wait_q;
733
 
734
        qdr_t *qdr;
735
 
736
        qdio_cmds_t commands;
737
 
738
        qib_t qib;
739
 
740
        io_handler_func_t original_int_handler;
741
 
742
        unsigned long other_flags; /* e.g. QDIO_PFIX */
743
 
744
        struct qdio_irq_t *next;
745
} qdio_irq_t;
746
 
747
#define QDIO_CHSC_RESPONSE_CODE_OK 1
748
/* flags for st qdio sch data */
749
#define CHSC_FLAG_QDIO_CAPABILITY 0x80
750
#define CHSC_FLAG_VALIDITY 0x40
751
 
752
#define CHSC_FLAG_SIGA_INPUT_NECESSARY 0x40
753
#define CHSC_FLAG_SIGA_OUTPUT_NECESSARY 0x20
754
#define CHSC_FLAG_SIGA_SYNC_NECESSARY 0x10
755
#define CHSC_FLAG_SIGA_SYNC_DONE_ON_THININTS 0x08
756
#define CHSC_FLAG_SIGA_SYNC_DONE_ON_OUTB_PCIS 0x04
757
 
758
typedef struct qdio_chsc_area_t {
759
        struct {
760
                /* word 0 */
761
                __u16 command_code1;
762
                __u16 command_code2;
763
                /* word 1 */
764
                __u16 operation_code;
765
                __u16 first_sch;
766
                /* word 2 */
767
                __u8 reserved1;
768
                __u8 image_id;
769
                __u16 last_sch;
770
                /* word 3 */
771
                __u32 reserved2;
772
 
773
                /* word 4 */
774
                union {
775
                        struct {
776
                                /* word 4&5 */
777
                                __u64 summary_indicator_addr;
778
                                /* word 6&7 */
779
                                __u64 subchannel_indicator_addr;
780
                                /* word 8 */
781
                                int ks:4;
782
                                int kc:4;
783
                                int reserved1:21;
784
                                int isc:3;
785
                                /* word 9&10 */
786
                                __u32 reserved2[2];
787
                                /* word 11 */
788
                                __u32 subsystem_id;
789
                                /* word 12-1015 */
790
                                __u32 reserved3[1004];
791
                        } __attribute__ ((packed,aligned(4))) set_chsc;
792
                        struct {
793
                                /* word 4&5 */
794
                                __u32 reserved1[2];
795
                                /* word 6 */
796
                                __u32 delay_target;
797
                                /* word 7-1015 */
798
                                __u32 reserved4[1009];
799
                        } __attribute__ ((packed,aligned(4))) set_chsc_fast;
800
                        struct {
801
                                /* word 0 */
802
                                __u16 length;
803
                                __u16 response_code;
804
                                /* word 1 */
805
                                __u32 reserved1;
806
                                /* words 2 to 9 for st sch qdio data */
807
                                __u8 flags;
808
                                __u8 reserved2;
809
                                __u16 sch;
810
                                __u8 qfmt;
811
                                __u8 reserved3;
812
                                __u8 qdioac;
813
                                __u8 sch_class;
814
                                __u8 reserved4;
815
                                __u8 icnt;
816
                                __u8 reserved5;
817
                                __u8 ocnt;
818
                                /* plus 5 words of reserved fields */
819
                        } __attribute__ ((packed,aligned(8)))
820
                        store_qdio_data_response;
821
                } operation_data_area;
822
        } __attribute__ ((packed,aligned(8))) request_block;
823
        struct {
824
                /* word 0 */
825
                __u16 length;
826
                __u16 response_code;
827
                /* word 1 */
828
                __u32 reserved1;
829
        } __attribute__ ((packed,aligned(8))) response_block;
830
} __attribute__ ((packed,aligned(PAGE_SIZE))) qdio_chsc_area_t;
831
 
832
 
833
#define QDIO_PRINTK_HEADER QDIO_NAME ": "
834
 
835
#if QDIO_VERBOSE_LEVEL>8
836
#define QDIO_PRINT_STUPID(x...) printk( KERN_DEBUG QDIO_PRINTK_HEADER x)
837
#else
838
#define QDIO_PRINT_STUPID(x...)
839
#endif
840
 
841
#if QDIO_VERBOSE_LEVEL>7
842
#define QDIO_PRINT_ALL(x...) printk( QDIO_PRINTK_HEADER x)
843
#else
844
#define QDIO_PRINT_ALL(x...)
845
#endif
846
 
847
#if QDIO_VERBOSE_LEVEL>6
848
#define QDIO_PRINT_INFO(x...) printk( QDIO_PRINTK_HEADER x)
849
#else
850
#define QDIO_PRINT_INFO(x...)
851
#endif
852
 
853
#if QDIO_VERBOSE_LEVEL>5
854
#define QDIO_PRINT_WARN(x...) printk( QDIO_PRINTK_HEADER x)
855
#else
856
#define QDIO_PRINT_WARN(x...)
857
#endif
858
 
859
#if QDIO_VERBOSE_LEVEL>4
860
#define QDIO_PRINT_ERR(x...) printk( QDIO_PRINTK_HEADER x)
861
#else
862
#define QDIO_PRINT_ERR(x...)
863
#endif
864
 
865
#if QDIO_VERBOSE_LEVEL>3
866
#define QDIO_PRINT_CRIT(x...) printk( QDIO_PRINTK_HEADER x)
867
#else
868
#define QDIO_PRINT_CRIT(x...)
869
#endif
870
 
871
#if QDIO_VERBOSE_LEVEL>2
872
#define QDIO_PRINT_ALERT(x...) printk( QDIO_PRINTK_HEADER x)
873
#else
874
#define QDIO_PRINT_ALERT(x...)
875
#endif
876
 
877
#if QDIO_VERBOSE_LEVEL>1
878
#define QDIO_PRINT_EMERG(x...) printk( QDIO_PRINTK_HEADER x)
879
#else
880
#define QDIO_PRINT_EMERG(x...)
881
#endif
882
 
883
#endif /* __QDIO_H__ */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.