patch-2.4.22 linux-2.4.22/drivers/s390/block/dasd_int.h

Next file: linux-2.4.22/drivers/s390/char/con3215.c
Previous file: linux-2.4.22/drivers/s390/block/dasd_fba.h
Back to the patch index
Back to the overall index

diff -urN linux-2.4.21/drivers/s390/block/dasd_int.h linux-2.4.22/drivers/s390/block/dasd_int.h
@@ -1,9 +1,12 @@
 /* 
- * File...........: linux/drivers/s390/block/dasd.c
+ * File...........: linux/drivers/s390/block/dasd_int.h
  * Author(s)......: Holger Smolinski <Holger.Smolinski@de.ibm.com>
+ *                  Horst Hummel <Horst.Hummel@de.ibm.com> 
  * Bugreports.to..: <Linux390@de.ibm.com>
  * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999,2000
  *
+ * $Revision: 1.26 $
+ *
  * History of changes (starts July 2000)
  * 02/01/01 added dynamic registration of ioctls
  */
@@ -11,8 +14,6 @@
 #ifndef DASD_INT_H
 #define DASD_INT_H
 
-#define DASD_API_VERSION 0
-
 #include <asm/dasd.h>
 
 #define CONFIG_DASD_DYNAMIC
@@ -28,14 +29,19 @@
 #define DASD_FORMAT_INTENS_WRITE_RECZERO 0x01
 #define DASD_FORMAT_INTENS_WRITE_HOMEADR 0x02
 
-#define DASD_STATE_DEL   -1
-#define DASD_STATE_NEW    0
-#define DASD_STATE_KNOWN  1
-#define DASD_STATE_ACCEPT 2
-#define DASD_STATE_INIT   3
-#define DASD_STATE_READY  4
-#define DASD_STATE_ONLINE 5
-
+#define DASD_STATE_DEL   -1     /* "unknown" */
+#define DASD_STATE_NEW    0     /* memory for dasd_device_t and lowmem ccw/idals allocated */  
+#define DASD_STATE_BOXED  1     /* boxed dasd could not be analysed "plugged" */
+#define DASD_STATE_KNOWN  2     /* major_info/devinfo/discipline/devfs-'device'/gendisk - "detected" */
+#define DASD_STATE_ACCEPT 3     /* irq requested - "accepted" */
+#define DASD_STATE_INIT   4     /* init_cqr started - "busy" */
+#define DASD_STATE_READY  5     /* init finished  - "fenced(plugged)" */
+#define DASD_STATE_ONLINE 6     /* unplugged "active" */
+
+#define DASD_HOTPLUG_EVENT_ADD        0
+#define DASD_HOTPLUG_EVENT_REMOVE     1
+#define DASD_HOTPLUG_EVENT_PARTCHK    2
+#define DASD_HOTPLUG_EVENT_PARTREMOVE 3
 
 #define DASD_FORMAT_INTENS_WRITE_RECZERO 0x01
 #define DASD_FORMAT_INTENS_WRITE_HOMEADR 0x02
@@ -61,7 +67,9 @@
 #include <asm/todclk.h>
 #include <asm/debug.h>
 
-/* Kernel Version Compatibility section */
+/********************************************************************************
+ * SECTION: Kernel Version Compatibility section 
+ ********************************************************************************/
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,98))
 typedef struct request *request_queue_t;
 #define block_device_operations file_operations
@@ -102,6 +110,7 @@
         *q = req->next;
         req->next = NULL;
 }
+
 #else
 #define INIT_BLK_DEV(d_major,d_request_fn,d_queue_fn,d_current) \
 do { \
@@ -124,9 +133,12 @@
 {
         blkdev_dequeue_request (req);
 }
-#endif
+#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,98)) */
+
+/********************************************************************************
+ * SECTION: Type definitions
+ ********************************************************************************/
 
-/* dasd_range_t are used for dynamic device att-/detachment */
 typedef struct dasd_devreg_t {
         devreg_t devreg; /* the devreg itself */
         /* build a linked list of devregs, needed for cleanup */
@@ -153,27 +165,6 @@
 #define DASD_SENSE_BIT_2 0x20
 #define DASD_SENSE_BIT_3 0x10
 
-#define check_then_set(where,from,to) \
-do { \
-        if ((*(where)) != (from) ) { \
-                printk (KERN_ERR PRINTK_HEADER "was %d\n", *(where)); \
-                BUG(); \
-        } \
-        (*(where)) = (to); \
-} while (0)
-
-#define DASD_MESSAGE(d_loglevel,d_device,d_string,d_args...)\
-do { \
-        int d_devno = d_device->devinfo.devno; \
-        int d_irq = d_device->devinfo.irq; \
-        char *d_name = d_device->name; \
-        int d_major = MAJOR(d_device->kdev); \
-        int d_minor = MINOR(d_device->kdev); \
-        printk(d_loglevel PRINTK_HEADER \
-               "/dev/%s(%d:%d),%04x@0x%x:" \
-               d_string "\n",d_name,d_major,d_minor,d_devno,d_irq,d_args ); \
-} while(0)
-
 /* 
  * struct dasd_sizes_t
  * represents all data needed to access dasd with properly set up sectors
@@ -196,68 +187,164 @@
 	ccw_req_t *tail;
 } dasd_chanq_t;
 
-#define DASD_DEVICE_FORMAT_STRING "Device: %p"
-#define DASD_DEVICE_DEBUG_EVENT(d_level, d_device, d_str, d_data...)\
-do {\
-        if ( d_device->debug_area != NULL )\
-        debug_sprintf_event(d_device->debug_area,d_level,\
-                    DASD_DEVICE_FORMAT_STRING d_str "\n",\
-                    d_device, d_data);\
+/* 
+ * struct dasd_lowmem_t 
+ * represents a queue of pages for lowmem request
+ */
+typedef struct {
+        struct list_head list;
+} dasd_lowmem_t;
+
+#define DASD_LOWMEM_PAGES 2     /* # of lowmem pages per device (min 2) */
+
+/********************************************************************************
+ * SECTION: MACROS
+ ********************************************************************************/
+
+/*
+ * CHECK_THEN_SET
+ *
+ * Change 'where' value from 'from' to 'to'.
+ ' BUG if the 'from' value doesn't match.
+ */
+#define check_then_set(where,from,to) \
+do { \
+        if ((*(where)) != (from) ) { \
+                printk (KERN_ERR PRINTK_HEADER "was %d\n", *(where)); \
+                BUG(); \
+        } \
+        (*(where)) = (to); \
 } while(0)
-#define DASD_DEVICE_DEBUG_EXCEPTION(d_level, d_device, d_str, d_data...)\
-do {\
-        if ( d_device->debug_area != NULL )\
-        debug_sprintf_exception(d_device->debug_area,d_level,\
-                        DASD_DEVICE_FORMAT_STRING d_str "\n",\
-                        d_device, d_data);\
+
+
+/********************************************************************************
+ * SECION: MACROs for klogd and s390 debug feature (dbf)
+ ********************************************************************************/
+
+#define DBF_DEV_EVENT(d_level, d_device, d_str, d_data...) \
+do { \
+        if (d_device->debug_area != NULL) \
+                debug_sprintf_event(d_device->debug_area, \
+                                    d_level, \
+                                    d_str "\n", \
+                                    d_data); \
+} while(0)
+
+#define DBF_DEV_EXC(d_level, d_device, d_str, d_data...) \
+do { \
+        if (d_device->debug_area != NULL) \
+                debug_sprintf_exception(d_device->debug_area, \
+                                        d_level, \
+                                        d_str "\n", \
+                                        d_data); \
+} while(0)
+
+#define DBF_EVENT(d_level, d_str, d_data...)\
+do { \
+        if (dasd_debug_area != NULL) \
+                debug_sprintf_event(dasd_debug_area, \
+                                    d_level,\
+                                    d_str "\n", \
+                                    d_data); \
+} while(0)
+
+#define DBF_EXC(d_level, d_str, d_data...)\
+do { \
+        if (dasd_debug_area != NULL) \
+                debug_sprintf_exception(dasd_debug_area, \
+                                        d_level,\
+                                        d_str "\n", \
+                                        d_data); \
 } while(0)
 
-#define DASD_DRIVER_FORMAT_STRING "Driver: <[%p]>"
-#define DASD_DRIVER_DEBUG_EVENT(d_level, d_fn, d_str, d_data...)\
-do {\
-        if ( dasd_debug_area != NULL )\
-        debug_sprintf_event(dasd_debug_area, d_level,\
-                    DASD_DRIVER_FORMAT_STRING #d_fn ":" d_str "\n",\
-                    d_fn, d_data);\
+/* definition of dbf debug levels */
+#define	DBF_EMERG	0	/* system is unusable		*/
+#define	DBF_ALERT	1	/* action must be taken immediately	*/
+#define	DBF_CRIT	2	/* critical conditions		*/
+#define	DBF_ERR  	3	/* error conditions			*/
+#define	DBF_WARNING	4	/* warning conditions		*/
+#define	DBF_NOTICE	5	/* normal but significant condition	*/
+#define	DBF_INFO	6	/* informational			*/
+#define	DBF_DEBUG	6	/* debug-level messages		*/
+
+/* messages to be written via klogd and dbf */
+#define DEV_MESSAGE(d_loglevel,d_device,d_string,d_args...)\
+do { \
+        int d_devno = d_device->devinfo.devno; \
+        int d_irq = d_device->devinfo.irq; \
+        char *d_name = d_device->name; \
+        int d_major = MAJOR(d_device->kdev); \
+        int d_minor = MINOR(d_device->kdev); \
+\
+        printk(d_loglevel PRINTK_HEADER \
+               " /dev/%-7s(%3d:%3d),%04x@%02x: " \
+               d_string "\n", \
+               d_name, \
+               d_major, \
+               d_minor, \
+               d_devno, \
+               d_irq, \
+               d_args); \
+\
+        DBF_DEV_EVENT(DBF_ALERT, \
+                      d_device, \
+                      d_string, \
+                      d_args); \
 } while(0)
-#define DASD_DRIVER_DEBUG_EXCEPTION(d_level, d_fn, d_str, d_data...)\
-do {\
-        if ( dasd_debug_area != NULL )\
-        debug_sprintf_exception(dasd_debug_area, d_level,\
-                        DASD_DRIVER_FORMAT_STRING #d_fn ":" d_str "\n",\
-                        d_fn, d_data);\
+
+#define MESSAGE(d_loglevel,d_string,d_args...)\
+do { \
+        printk(d_loglevel PRINTK_HEADER \
+               " " d_string "\n", \
+               d_args); \
+\
+        DBF_EVENT(DBF_ALERT, \
+                  d_string, \
+                  d_args); \
 } while(0)
 
 struct dasd_device_t;
 struct request;
 
-/* 
- * signatures for the functions of dasd_discipline_t 
+/********************************************************************************
+ * SECTION: signatures for the functions of dasd_discipline_t 
  * make typecasts much easier
- */
-typedef ccw_req_t *(*dasd_erp_action_fn_t) (ccw_req_t * cqr);
+ ********************************************************************************/
+
+typedef int    (*dasd_ck_id_fn_t)              (s390_dev_info_t *);
+typedef int    (*dasd_ck_characteristics_fn_t) (struct dasd_device_t *);
+typedef int    (*dasd_fill_geometry_fn_t)      (struct dasd_device_t *, 
+                                                struct hd_geometry *);
+typedef int    (*dasd_do_analysis_fn_t)        (struct dasd_device_t *);
+typedef int    (*dasd_io_starter_fn_t)         (ccw_req_t *);
+typedef int    (*dasd_io_stopper_fn_t)         (ccw_req_t *);
+typedef int    (*dasd_info_fn_t)               (struct dasd_device_t *, 
+                                                dasd_information2_t *);
+typedef int    (*dasd_use_count_fn_t)          (int);
+typedef int    (*dasd_set_attrib_fn_t)         (struct dasd_device_t *, 
+                                                struct attrib_data_t *);
+typedef void   (*dasd_int_handler_fn_t)        (int irq, void *, 
+                                                struct pt_regs *);
+typedef char * (*dasd_dump_sense_fn_t)         (struct dasd_device_t *,
+                                                ccw_req_t *);
+typedef ccw_req_t *(*dasd_format_fn_t)         (struct dasd_device_t *, 
+                                                struct format_data_t *);
+typedef ccw_req_t *(*dasd_init_analysis_fn_t ) (struct dasd_device_t *);
+typedef ccw_req_t *(*dasd_cp_builder_fn_t)     (struct dasd_device_t *,
+                                                struct request *);
+typedef ccw_req_t *(*dasd_reserve_fn_t)        (struct dasd_device_t *);
+typedef ccw_req_t *(*dasd_release_fn_t)        (struct dasd_device_t *);
+typedef ccw_req_t *(*dasd_steal_lock_fn_t)     (struct dasd_device_t *);
+typedef ccw_req_t *(*dasd_merge_cp_fn_t)       (struct dasd_device_t *);
+typedef ccw_req_t *(*dasd_erp_action_fn_t)     (ccw_req_t * cqr);
 typedef ccw_req_t *(*dasd_erp_postaction_fn_t) (ccw_req_t * cqr);
+typedef ccw_req_t *(*dasd_read_stats_fn_t)     (struct dasd_device_t *);
 
-typedef int (*dasd_ck_id_fn_t) (s390_dev_info_t *);
-typedef int (*dasd_ck_characteristics_fn_t) (struct dasd_device_t *);
-typedef int (*dasd_fill_geometry_fn_t) (struct dasd_device_t *, struct hd_geometry *);
-typedef ccw_req_t *(*dasd_format_fn_t) (struct dasd_device_t *, struct format_data_t *);
-typedef ccw_req_t *(*dasd_init_analysis_fn_t) (struct dasd_device_t *);
-typedef int (*dasd_do_analysis_fn_t) (struct dasd_device_t *);
-typedef int (*dasd_io_starter_fn_t) (ccw_req_t *);
-typedef int (*dasd_io_stopper_fn_t) (ccw_req_t *);
-typedef void (*dasd_int_handler_fn_t)(int irq, void *, struct pt_regs *);
-typedef dasd_era_t (*dasd_error_examine_fn_t) (ccw_req_t *, devstat_t * stat);
-typedef dasd_erp_action_fn_t (*dasd_error_analyse_fn_t) (ccw_req_t *);
-typedef dasd_erp_postaction_fn_t (*dasd_erp_analyse_fn_t) (ccw_req_t *);
-typedef ccw_req_t *(*dasd_cp_builder_fn_t)(struct dasd_device_t *,struct request *);
-typedef char *(*dasd_dump_sense_fn_t)(struct dasd_device_t *,ccw_req_t *);
-typedef ccw_req_t *(*dasd_reserve_fn_t)(struct dasd_device_t *);
-typedef ccw_req_t *(*dasd_release_fn_t)(struct dasd_device_t *);
-typedef ccw_req_t *(*dasd_steal_lock_fn_t)(struct dasd_device_t *);
-typedef ccw_req_t *(*dasd_merge_cp_fn_t)(struct dasd_device_t *);
-typedef int (*dasd_info_fn_t) (struct dasd_device_t *, dasd_information_t *);
-typedef int (*dasd_use_count_fn_t) (int);
+typedef dasd_rssd_perf_stats_t * (*dasd_ret_stats_fn_t)     (ccw_req_t *);
+typedef dasd_era_t               (*dasd_error_examine_fn_t) (ccw_req_t *, 
+                                                             devstat_t * stat);
+typedef dasd_erp_action_fn_t     (*dasd_error_analyse_fn_t) (ccw_req_t *);
+typedef dasd_erp_postaction_fn_t (*dasd_erp_analyse_fn_t)   (ccw_req_t *);
 
 /*
  * the dasd_discipline_t is
@@ -270,31 +357,31 @@
 	char ebcname[8]; /* a name used for tagging and printks */
         char name[8];		/* a name used for tagging and printks */
 	int max_blocks;	/* maximum number of blocks to be chained */
-	dasd_ck_id_fn_t id_check;	/* to check sense data */
-	dasd_ck_characteristics_fn_t check_characteristics;	/* to check the characteristics */
-	dasd_init_analysis_fn_t init_analysis;	/* to start the analysis of the volume */
-	dasd_do_analysis_fn_t do_analysis;	/* to complete the analysis of the volume */
-	dasd_fill_geometry_fn_t fill_geometry;	/* to set up hd_geometry */
-	dasd_io_starter_fn_t start_IO;
-	dasd_io_stopper_fn_t term_IO;
-        dasd_format_fn_t format_device;		/* to format the device */
-	dasd_error_examine_fn_t examine_error;
-	dasd_error_analyse_fn_t erp_action;
-	dasd_erp_analyse_fn_t erp_postaction;
-        dasd_cp_builder_fn_t build_cp_from_req;
-        dasd_dump_sense_fn_t dump_sense;
-        dasd_int_handler_fn_t int_handler;
-        dasd_reserve_fn_t reserve;
-        dasd_release_fn_t release;
-        dasd_steal_lock_fn_t steal_lock;
-        dasd_merge_cp_fn_t merge_cp;
-        dasd_info_fn_t fill_info;
+	dasd_ck_id_fn_t              id_check;	            /* check sense data */
+	dasd_ck_characteristics_fn_t check_characteristics; /* check the characteristics */
+	dasd_init_analysis_fn_t      init_analysis;	    /* start the analysis of the volume */
+	dasd_do_analysis_fn_t        do_analysis;	    /* complete the analysis of the volume */
+	dasd_fill_geometry_fn_t      fill_geometry;	    /* set up hd_geometry */
+	dasd_io_starter_fn_t         start_IO;                 
+	dasd_io_stopper_fn_t         term_IO;                  
+        dasd_format_fn_t             format_device;	    /* format the device */
+	dasd_error_examine_fn_t      examine_error;
+	dasd_error_analyse_fn_t      erp_action;
+	dasd_erp_analyse_fn_t        erp_postaction;
+        dasd_cp_builder_fn_t         build_cp_from_req;
+        dasd_dump_sense_fn_t         dump_sense;
+        dasd_int_handler_fn_t        int_handler;
+        dasd_reserve_fn_t            reserve;
+        dasd_release_fn_t            release;
+        dasd_steal_lock_fn_t         steal_lock;
+        dasd_merge_cp_fn_t           merge_cp;
+        dasd_info_fn_t               fill_info;
+        dasd_read_stats_fn_t         read_stats;
+        dasd_ret_stats_fn_t          ret_stats;             /* return performance statistics */
+        dasd_set_attrib_fn_t         set_attrib;            /* set attributes (cache operations */ 
 	struct list_head list;	/* used for list of disciplines */
 } dasd_discipline_t;
 
-#define DASD_DEFAULT_FEATURES 0
-#define DASD_FEATURE_READONLY 1
-
 /* dasd_range_t are used for ordering the DASD devices */
 typedef struct dasd_range_t {
 	unsigned int from;	/* first DASD in range */
@@ -326,7 +413,9 @@
 	struct dasd_chanq_t queue;
         wait_queue_head_t wait_q;
         request_queue_t *request_queue;
-        struct timer_list timer;      
+        struct timer_list timer;             /* used for start_IO */
+        struct timer_list late_timer;        /* to get late devices online */  
+        struct timer_list blocking_timer;    /* used for ERP */
 	devstat_t dev_status; /* needed ONLY!! for request_irq */
         dasd_sizes_t sizes;
         char name[16]; /* The name of the device in /dev */
@@ -340,35 +429,37 @@
         dasd_profile_info_t profile;
         ccw_req_t *init_cqr;
         atomic_t plugged;
-        void* lowmem_cqr;
-        void* lowmem_ccws;
-        void* lowmem_idals;
-        void* lowmem_idal_ptr;
+        int accessible; /* set to !=0 if doing IO is permitted */
+        struct list_head lowmem_pool;
 }  dasd_device_t;
 
-int dasd_init (void);
-void dasd_discipline_add(dasd_discipline_t *);
-void dasd_discipline_del(dasd_discipline_t *);
-int dasd_start_IO (ccw_req_t *);
-int dasd_term_IO (ccw_req_t *);
-void dasd_int_handler (int , void *, struct pt_regs *);
-ccw_req_t *dasd_default_erp_action (ccw_req_t *);
-ccw_req_t *dasd_default_erp_postaction (ccw_req_t *);
-inline void dasd_chanq_deq (dasd_chanq_t *, ccw_req_t *);
-inline void dasd_chanq_enq (dasd_chanq_t *, ccw_req_t *);
-inline void dasd_chanq_enq_head (dasd_chanq_t *, ccw_req_t *);
-ccw_req_t *dasd_alloc_request (char *, int, int, dasd_device_t *);
-void dasd_free_request (ccw_req_t *, dasd_device_t *);
-int dasd_oper_handler (int irq, devreg_t * devreg);
-void dasd_schedule_bh (dasd_device_t *);
-int dasd_sleep_on_req(ccw_req_t*);
-int  dasd_set_normalized_cda ( ccw1_t * cp, unsigned long address, ccw_req_t* request, dasd_device_t* device );
-dasd_device_t * dasd_device_from_kdev (kdev_t kdev);
+
+int  dasd_init               (void);
+void dasd_discipline_add     (dasd_discipline_t *);
+void dasd_discipline_del     (dasd_discipline_t *);
+int  dasd_start_IO           (ccw_req_t *);
+int  dasd_term_IO            (ccw_req_t *);
+void dasd_int_handler        (int , void *, struct pt_regs *);
+void dasd_free_request       (ccw_req_t *, dasd_device_t *);
+int  dasd_oper_handler       (int irq, devreg_t * devreg);
+void dasd_schedule_bh        (dasd_device_t *);
+void dasd_schedule_bh_timed  (unsigned long);
+int  dasd_sleep_on_req       (ccw_req_t*);
+int  dasd_set_normalized_cda (ccw1_t * cp, unsigned long address, 
+                              ccw_req_t* request, 
+                              dasd_device_t* device );
+ccw_req_t *     dasd_default_erp_action     (ccw_req_t *);
+ccw_req_t *     dasd_default_erp_postaction (ccw_req_t *);
+inline void     dasd_chanq_deq              (dasd_chanq_t *, ccw_req_t *);
+inline void     dasd_chanq_enq              (dasd_chanq_t *, ccw_req_t *);
+inline void     dasd_chanq_enq_head         (dasd_chanq_t *, ccw_req_t *);
+ccw_req_t *     dasd_alloc_request          (char *, int, int, dasd_device_t *);
+dasd_device_t * dasd_device_from_kdev       (kdev_t kdev);
 
 extern debug_info_t *dasd_debug_area;
 extern int (*genhd_dasd_name) (char *, int, int, struct gendisk *);
 extern int (*genhd_dasd_ioctl) (struct inode *inp, struct file *filp,
-                            unsigned int no, unsigned long data);
+                                unsigned int no, unsigned long data);
 
 #endif /* __KERNEL__ */
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)