1/* 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 6 */ 7#ifndef CCWCACHE_H 8#define CCWCACHE_H 9#include <linux/slab.h> 10#include <asm/irq.h> 11 12#ifndef __KERNEL__ 13#define kmem_cache_t void 14#endif /* __KERNEL__ */ 15 16typedef struct ccw_req_t { 17 /* eye catcher plus queueing information */ 18 unsigned int magic; 19 struct ccw_req_t *next; /* pointer to next ccw_req_t in queue */ 20 struct ccw_req_t *int_next; /* for internal queueing */ 21 struct ccw_req_t *int_prev; /* for internal queueing */ 22 23 /* Where to execute what... */ 24 void *device; /* index of the device the req is for */ 25 void *req; /* pointer to originating request */ 26 ccw1_t *cpaddr; /* address of channel program */ 27 char status; /* reflecting the status of this request */ 28 char flags; /* see below */ 29 short retries; /* A retry counter to be set when filling */ 30 31 /* ... and how */ 32 int options; /* options for execution */ 33 char lpm; /* logical path mask */ 34 void *data; /* pointer to data area */ 35 devstat_t *dstat; /* The device status in case of an error */ 36 37 /* these are important for recovering erroneous requests */ 38 struct ccw_req_t *refers; /* Does this request refer to another one? */ 39 void *function; /* refers to the originating ERP action */ ; 40 41 unsigned long long expires; /* expiratioj period */ 42 /* these are for profiling purposes */ 43 unsigned long long buildclk; /* TOD-clock of request generation */ 44 unsigned long long startclk; /* TOD-clock of request start */ 45 unsigned long long stopclk; /* TOD-clock of request interrupt */ 46 unsigned long long endclk; /* TOD-clock of request termination */ 47 48 /* these are for internal use */ 49 int cplength; /* length of the channel program in CCWs */ 50 int datasize; /* amount of additional data in bytes */ 51 kmem_cache_t *cache; /* the cache this data comes from */ 52 53} __attribute__ ((aligned(4))) ccw_req_t; 54 55/* 56 * ccw_req_t -> status can be: 57 */ 58#define CQR_STATUS_EMPTY 0x00 /* request is empty */ 59#define CQR_STATUS_FILLED 0x01 /* request is ready to be preocessed */ 60#define CQR_STATUS_QUEUED 0x02 /* request is queued to be processed */ 61#define CQR_STATUS_IN_IO 0x03 /* request is currently in IO */ 62#define CQR_STATUS_DONE 0x04 /* request is completed successfully */ 63#define CQR_STATUS_ERROR 0x05 /* request is completed with error */ 64#define CQR_STATUS_FAILED 0x06 /* request is finally failed */ 65#define CQR_STATUS_PENDING 0x07 /* request is waiting for interrupt - ERP only */ 66 67#define CQR_FLAGS_CHAINED 0x01 /* request is chained by another (last CCW is TIC) */ 68 69#ifdef __KERNEL__ 70#define SMALLEST_SLAB (sizeof(struct ccw_req_t) <= 128 ? 128 :\ 71 sizeof(struct ccw_req_t) <= 256 ? 256 : 512 ) 72 73/* SMALLEST_SLAB(1),... PAGE_SIZE(CCW_NUMBER_CACHES) */ 74#define CCW_NUMBER_CACHES (sizeof(struct ccw_req_t) <= 128 ? 6 :\ 75 sizeof(struct ccw_req_t) <= 256 ? 5 : 4 ) 76 77int ccwcache_init (void); 78 79ccw_req_t *ccw_alloc_request (char *magic, int cplength, int additional_data); 80void ccw_free_request (ccw_req_t * request); 81#endif /* __KERNEL__ */ 82#endif /* CCWCACHE_H */ 83 84 85 86