2 * File...........: linux/include/asm-s390/ccwcache.h
3 * Author(s)......: Holger Smolinski <Holger.Smolinski@de.ibm.com>
4 * Bugreports.to..: <Linux390@de.ibm.com>
5 * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 2000
12 #include <linux/slab.h>
16 #define kmem_cache_t void
17 #endif /* __KERNEL__ */
19 typedef struct ccw_req_t {
20 /* eye catcher plus queueing information */
22 struct ccw_req_t *next; /* pointer to next ccw_req_t in queue */
23 struct ccw_req_t *int_next; /* for internal queueing */
24 struct ccw_req_t *int_prev; /* for internal queueing */
26 /* Where to execute what... */
27 void *device; /* index of the device the req is for */
28 void *req; /* pointer to originating request */
29 ccw1_t *cpaddr; /* address of channel program */
30 char status; /* reflecting the status of this request */
31 char flags; /* see below */
32 short retries; /* A retry counter to be set when filling */
35 int options; /* options for execution */
36 char lpm; /* logical path mask */
37 void *data; /* pointer to data area */
38 devstat_t *dstat; /* The device status in case of an error */
40 /* these are important for recovering erroneous requests */
41 struct ccw_req_t *refers; /* Does this request refer to another one? */
42 void *function; /* refers to the originating ERP action */ ;
44 unsigned long long expires; /* expiration period */
45 /* these are for profiling purposes */
46 unsigned long long buildclk; /* TOD-clock of request generation */
47 unsigned long long startclk; /* TOD-clock of request start */
48 unsigned long long stopclk; /* TOD-clock of request interrupt */
49 unsigned long long endclk; /* TOD-clock of request termination */
51 /* these are for internal use */
52 int cplength; /* length of the channel program in CCWs */
53 int datasize; /* amount of additional data in bytes */
54 void *lowmem_idal; /* lowmem page for idals (if in use) */
55 void *lowmem_idal_ptr; /* ptr to the actual idal word in the idals page */
56 kmem_cache_t *cache; /* the cache this data comes from */
58 } __attribute__ ((aligned(4))) ccw_req_t;
61 * ccw_req_t -> status can be:
63 #define CQR_STATUS_EMPTY 0x00 /* cqr is empty */
64 #define CQR_STATUS_FILLED 0x01 /* cqr is ready to be preocessed */
65 #define CQR_STATUS_QUEUED 0x02 /* cqr is queued to be processed */
66 #define CQR_STATUS_IN_IO 0x03 /* cqr is currently in IO */
67 #define CQR_STATUS_DONE 0x04 /* cqr is completed successfully */
68 #define CQR_STATUS_ERROR 0x05 /* cqr is completed with error */
69 #define CQR_STATUS_FAILED 0x06 /* cqr is finally failed */
71 #define CQR_FLAGS_CHAINED 0x01 /* cqr is chained by another (last CCW is TIC) */
72 #define CQR_FLAGS_FINALIZED 0x02
73 #define CQR_FLAGS_LM_CQR 0x04 /* cqr uses page from lowmem_pool */
74 #define CQR_FLAGS_LM_IDAL 0x08 /* IDALs uses page from lowmem_pool */
77 #define SMALLEST_SLAB (sizeof(struct ccw_req_t) <= 128 ? 128 :\
78 sizeof(struct ccw_req_t) <= 256 ? 256 : 512 )
80 /* SMALLEST_SLAB(1),... PAGE_SIZE(CCW_NUMBER_CACHES) */
81 #define CCW_NUMBER_CACHES (sizeof(struct ccw_req_t) <= 128 ? 6 :\
82 sizeof(struct ccw_req_t) <= 256 ? 5 : 4 )
84 int ccwcache_init (void);
86 ccw_req_t *ccw_alloc_request (char *magic, int cplength, int additional_data);
87 void ccw_free_request (ccw_req_t * request);
88 #endif /* __KERNEL__ */
89 #endif /* CCWCACHE_H */