📄 dasd_int.h
字号:
/* * File...........: linux/drivers/s390/block/dasd_int.h * Author(s)......: Holger Smolinski <Holger.Smolinski@de.ibm.com> * Horst Hummel <Horst.Hummel@de.ibm.com> * Martin Schwidefsky <schwidefsky@de.ibm.com> * Bugreports.to..: <Linux390@de.ibm.com> * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999,2000 * * $Revision: 1.65 $ */#ifndef DASD_INT_H#define DASD_INT_H#ifdef __KERNEL__/* erp debugging in dasd.c and dasd_3990_erp.c */#define ERP_DEBUG/* we keep old device allocation scheme; IOW, minors are still in 0..255 */#define DASD_PER_MAJOR (1U << (MINORBITS - DASD_PARTN_BITS))#define DASD_PARTN_MASK ((1 << DASD_PARTN_BITS) - 1)/* * States a dasd device can have: * new: the dasd_device structure is allocated. * known: the discipline for the device is identified. * basic: the device can do basic i/o. * accept: the device is analysed (format is known). * ready: partition detection is done and the device is can do block io. * online: the device accepts requests from the block device queue. * * Things to do for startup state transitions: * new -> known: find discipline for the device and create devfs entries. * known -> basic: request irq line for the device. * basic -> ready: do the initial analysis, e.g. format detection, * do block device setup and detect partitions. * ready -> online: schedule the device tasklet. * Things to do for shutdown state transitions: * online -> ready: just set the new device state. * ready -> basic: flush requests from the block device layer, clear * partition information and reset format information. * basic -> known: terminate all requests and free irq. * known -> new: remove devfs entries and forget discipline. */#define DASD_STATE_NEW 0#define DASD_STATE_KNOWN 1#define DASD_STATE_BASIC 2#define DASD_STATE_READY 3#define DASD_STATE_ONLINE 4#include <linux/module.h>#include <linux/wait.h>#include <linux/blkdev.h>#include <linux/devfs_fs_kernel.h>#include <linux/genhd.h>#include <linux/hdreg.h>#include <linux/interrupt.h>#include <asm/ccwdev.h>#include <linux/workqueue.h>#include <asm/debug.h>#include <asm/dasd.h>#include <asm/idals.h>/* * SECTION: Type definitions */struct dasd_device;typedef int (*dasd_ioctl_fn_t) (struct block_device *bdev, int no, long args);struct dasd_ioctl { struct list_head list; struct module *owner; int no; dasd_ioctl_fn_t handler;};typedef enum { dasd_era_fatal = -1, /* no chance to recover */ dasd_era_none = 0, /* don't recover, everything alright */ dasd_era_msg = 1, /* don't recover, just report... */ dasd_era_recover = 2 /* recovery action recommended */} dasd_era_t;/* BIT DEFINITIONS FOR SENSE DATA */#define DASD_SENSE_BIT_0 0x80#define DASD_SENSE_BIT_1 0x40#define DASD_SENSE_BIT_2 0x20#define DASD_SENSE_BIT_3 0x10/* * SECTION: MACROs for klogd and s390 debug feature (dbf) */#define DBF_DEV_EVENT(d_level, d_device, d_str, d_data...) \do { \ 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 { \ 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 { \ 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 { \ debug_sprintf_exception(dasd_debug_area, \ d_level,\ d_str "\n", \ d_data); \} while(0)/* 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 { \ printk(d_loglevel PRINTK_HEADER " %s: " d_string "\n", \ d_device->cdev->dev.bus_id, d_args); \ DBF_DEV_EVENT(DBF_ALERT, d_device, d_string, d_args); \} while(0)#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)/* messages to be written via klogd only */#define DEV_MESSAGE_LOG(d_loglevel,d_device,d_string,d_args...)\do { \ printk(d_loglevel PRINTK_HEADER " %s: " d_string "\n", \ d_device->cdev->dev.bus_id, d_args); \} while(0)#define MESSAGE_LOG(d_loglevel,d_string,d_args...)\do { \ printk(d_loglevel PRINTK_HEADER " " d_string "\n", d_args); \} while(0)struct dasd_ccw_req { unsigned int magic; /* Eye catcher */ struct list_head list; /* list_head for request queueing. */ /* Where to execute what... */ struct dasd_device *device; /* device the request is for */ struct ccw1 *cpaddr; /* address of channel program */ char status; /* status of this request */ short retries; /* A retry counter */ unsigned long flags; /* flags of this request */ /* ... and how */ unsigned long starttime; /* jiffies time of request start */ int expires; /* expiration period in jiffies */ char lpm; /* logical path mask */ void *data; /* pointer to data area */ /* these are important for recovering erroneous requests */ struct irb irb; /* device status in case of an error */ struct dasd_ccw_req *refers; /* ERP-chain queueing. */ void *function; /* originating ERP action */ /* these are for statistics only */ unsigned long long buildclk; /* TOD-clock of request generation */ unsigned long long startclk; /* TOD-clock of request start */ unsigned long long stopclk; /* TOD-clock of request interrupt */ unsigned long long endclk; /* TOD-clock of request termination */ /* Callback that is called after reaching final status. */ void (*callback)(struct dasd_ccw_req *, void *data); void *callback_data;};/* * dasd_ccw_req -> status can be: */#define DASD_CQR_FILLED 0x00 /* request is ready to be processed */#define DASD_CQR_QUEUED 0x01 /* request is queued to be processed */#define DASD_CQR_IN_IO 0x02 /* request is currently in IO */#define DASD_CQR_DONE 0x03 /* request is completed successfully */#define DASD_CQR_ERROR 0x04 /* request is completed with error */#define DASD_CQR_FAILED 0x05 /* request is finally failed */#define DASD_CQR_CLEAR 0x06 /* request is clear pending *//* per dasd_ccw_req flags */#define DASD_CQR_FLAGS_USE_ERP 0 /* use ERP for this request *//* Signature for error recovery functions. */typedef struct dasd_ccw_req *(*dasd_erp_fn_t) (struct dasd_ccw_req *);/* * the struct dasd_discipline is * sth like a table of virtual functions, if you think of dasd_eckd * inheriting dasd... * no, currently we are not planning to reimplement the driver in C++ */struct dasd_discipline { struct module *owner; 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 */ struct list_head list; /* used for list of disciplines */ /* * Device recognition functions. check_device is used to verify * the sense data and the information returned by read device * characteristics. It returns 0 if the discipline can be used * for the device in question. * do_analysis is used in the step from device state "basic" to * state "accept". It returns 0 if the device can be made ready, * it returns -EMEDIUMTYPE if the device can't be made ready or * -EAGAIN if do_analysis started a ccw that needs to complete * before the analysis may be repeated. */ int (*check_device)(struct dasd_device *); int (*do_analysis) (struct dasd_device *); /* * Device operation functions. build_cp creates a ccw chain for * a block device request, start_io starts the request and * term_IO cancels it (e.g. in case of a timeout). format_device * returns a ccw chain to be used to format the device. */ struct dasd_ccw_req *(*build_cp) (struct dasd_device *, struct request *); int (*start_IO) (struct dasd_ccw_req *); int (*term_IO) (struct dasd_ccw_req *); struct dasd_ccw_req *(*format_device) (struct dasd_device *, struct format_data_t *); int (*free_cp) (struct dasd_ccw_req *, struct request *); /* * Error recovery functions. examine_error() returns a value that * indicates what to do for an error condition. If examine_error() * returns 'dasd_era_recover' erp_action() is called to create a * special error recovery ccw. erp_postaction() is called after * an error recovery ccw has finished its execution. dump_sense * is called for every error condition to print the sense data * to the console. */ dasd_era_t(*examine_error) (struct dasd_ccw_req *, struct irb *); dasd_erp_fn_t(*erp_action) (struct dasd_ccw_req *); dasd_erp_fn_t(*erp_postaction) (struct dasd_ccw_req *); void (*dump_sense) (struct dasd_device *, struct dasd_ccw_req *, struct irb *); /* i/o control functions. */ int (*fill_geometry) (struct dasd_device *, struct hd_geometry *); int (*fill_info) (struct dasd_device *, struct dasd_information2_t *);};extern struct dasd_discipline *dasd_diag_discipline_pointer;struct dasd_device { /* Block device stuff. */ struct gendisk *gdp; request_queue_t *request_queue; spinlock_t request_queue_lock; struct block_device *bdev; unsigned int devindex; unsigned long blocks; /* size of volume in blocks */ unsigned int bp_block; /* bytes per block */ unsigned int s2b_shift; /* log2 (bp_block/512) */ unsigned long flags; /* per device flags */ unsigned short features; /* copy of devmap-features (read-only!) */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -