dasd_int.h 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693
  1. /*
  2. * File...........: linux/drivers/s390/block/dasd_int.h
  3. * Author(s)......: Holger Smolinski <Holger.Smolinski@de.ibm.com>
  4. * Horst Hummel <Horst.Hummel@de.ibm.com>
  5. * Martin Schwidefsky <schwidefsky@de.ibm.com>
  6. * Bugreports.to..: <Linux390@de.ibm.com>
  7. * Copyright IBM Corp. 1999, 2009
  8. */
  9. #ifndef DASD_INT_H
  10. #define DASD_INT_H
  11. #ifdef __KERNEL__
  12. /* we keep old device allocation scheme; IOW, minors are still in 0..255 */
  13. #define DASD_PER_MAJOR (1U << (MINORBITS - DASD_PARTN_BITS))
  14. #define DASD_PARTN_MASK ((1 << DASD_PARTN_BITS) - 1)
  15. /*
  16. * States a dasd device can have:
  17. * new: the dasd_device structure is allocated.
  18. * known: the discipline for the device is identified.
  19. * basic: the device can do basic i/o.
  20. * unfmt: the device could not be analyzed (format is unknown).
  21. * ready: partition detection is done and the device is can do block io.
  22. * online: the device accepts requests from the block device queue.
  23. *
  24. * Things to do for startup state transitions:
  25. * new -> known: find discipline for the device and create devfs entries.
  26. * known -> basic: request irq line for the device.
  27. * basic -> ready: do the initial analysis, e.g. format detection,
  28. * do block device setup and detect partitions.
  29. * ready -> online: schedule the device tasklet.
  30. * Things to do for shutdown state transitions:
  31. * online -> ready: just set the new device state.
  32. * ready -> basic: flush requests from the block device layer, clear
  33. * partition information and reset format information.
  34. * basic -> known: terminate all requests and free irq.
  35. * known -> new: remove devfs entries and forget discipline.
  36. */
  37. #define DASD_STATE_NEW 0
  38. #define DASD_STATE_KNOWN 1
  39. #define DASD_STATE_BASIC 2
  40. #define DASD_STATE_UNFMT 3
  41. #define DASD_STATE_READY 4
  42. #define DASD_STATE_ONLINE 5
  43. #include <linux/module.h>
  44. #include <linux/wait.h>
  45. #include <linux/blkdev.h>
  46. #include <linux/genhd.h>
  47. #include <linux/hdreg.h>
  48. #include <linux/interrupt.h>
  49. #include <linux/log2.h>
  50. #include <asm/ccwdev.h>
  51. #include <linux/workqueue.h>
  52. #include <asm/debug.h>
  53. #include <asm/dasd.h>
  54. #include <asm/idals.h>
  55. /* DASD discipline magic */
  56. #define DASD_ECKD_MAGIC 0xC5C3D2C4
  57. #define DASD_DIAG_MAGIC 0xC4C9C1C7
  58. #define DASD_FBA_MAGIC 0xC6C2C140
  59. /*
  60. * SECTION: Type definitions
  61. */
  62. struct dasd_device;
  63. struct dasd_block;
  64. /* BIT DEFINITIONS FOR SENSE DATA */
  65. #define DASD_SENSE_BIT_0 0x80
  66. #define DASD_SENSE_BIT_1 0x40
  67. #define DASD_SENSE_BIT_2 0x20
  68. #define DASD_SENSE_BIT_3 0x10
  69. /* BIT DEFINITIONS FOR SIM SENSE */
  70. #define DASD_SIM_SENSE 0x0F
  71. #define DASD_SIM_MSG_TO_OP 0x03
  72. #define DASD_SIM_LOG 0x0C
  73. /*
  74. * SECTION: MACROs for klogd and s390 debug feature (dbf)
  75. */
  76. #define DBF_DEV_EVENT(d_level, d_device, d_str, d_data...) \
  77. do { \
  78. debug_sprintf_event(d_device->debug_area, \
  79. d_level, \
  80. d_str "\n", \
  81. d_data); \
  82. } while(0)
  83. #define DBF_DEV_EXC(d_level, d_device, d_str, d_data...) \
  84. do { \
  85. debug_sprintf_exception(d_device->debug_area, \
  86. d_level, \
  87. d_str "\n", \
  88. d_data); \
  89. } while(0)
  90. #define DBF_EVENT(d_level, d_str, d_data...)\
  91. do { \
  92. debug_sprintf_event(dasd_debug_area, \
  93. d_level,\
  94. d_str "\n", \
  95. d_data); \
  96. } while(0)
  97. #define DBF_EVENT_DEVID(d_level, d_cdev, d_str, d_data...) \
  98. do { \
  99. struct ccw_dev_id __dev_id; \
  100. ccw_device_get_id(d_cdev, &__dev_id); \
  101. debug_sprintf_event(dasd_debug_area, \
  102. d_level, \
  103. "0.%x.%04x " d_str "\n", \
  104. __dev_id.ssid, __dev_id.devno, d_data); \
  105. } while (0)
  106. #define DBF_EXC(d_level, d_str, d_data...)\
  107. do { \
  108. debug_sprintf_exception(dasd_debug_area, \
  109. d_level,\
  110. d_str "\n", \
  111. d_data); \
  112. } while(0)
  113. /* limit size for an errorstring */
  114. #define ERRORLENGTH 30
  115. /* definition of dbf debug levels */
  116. #define DBF_EMERG 0 /* system is unusable */
  117. #define DBF_ALERT 1 /* action must be taken immediately */
  118. #define DBF_CRIT 2 /* critical conditions */
  119. #define DBF_ERR 3 /* error conditions */
  120. #define DBF_WARNING 4 /* warning conditions */
  121. #define DBF_NOTICE 5 /* normal but significant condition */
  122. #define DBF_INFO 6 /* informational */
  123. #define DBF_DEBUG 6 /* debug-level messages */
  124. /* messages to be written via klogd and dbf */
  125. #define DEV_MESSAGE(d_loglevel,d_device,d_string,d_args...)\
  126. do { \
  127. printk(d_loglevel PRINTK_HEADER " %s: " d_string "\n", \
  128. dev_name(&d_device->cdev->dev), d_args); \
  129. DBF_DEV_EVENT(DBF_ALERT, d_device, d_string, d_args); \
  130. } while(0)
  131. #define MESSAGE(d_loglevel,d_string,d_args...)\
  132. do { \
  133. printk(d_loglevel PRINTK_HEADER " " d_string "\n", d_args); \
  134. DBF_EVENT(DBF_ALERT, d_string, d_args); \
  135. } while(0)
  136. /* messages to be written via klogd only */
  137. #define DEV_MESSAGE_LOG(d_loglevel,d_device,d_string,d_args...)\
  138. do { \
  139. printk(d_loglevel PRINTK_HEADER " %s: " d_string "\n", \
  140. dev_name(&d_device->cdev->dev), d_args); \
  141. } while(0)
  142. #define MESSAGE_LOG(d_loglevel,d_string,d_args...)\
  143. do { \
  144. printk(d_loglevel PRINTK_HEADER " " d_string "\n", d_args); \
  145. } while(0)
  146. struct dasd_ccw_req {
  147. unsigned int magic; /* Eye catcher */
  148. struct list_head devlist; /* for dasd_device request queue */
  149. struct list_head blocklist; /* for dasd_block request queue */
  150. /* Where to execute what... */
  151. struct dasd_block *block; /* the originating block device */
  152. struct dasd_device *memdev; /* the device used to allocate this */
  153. struct dasd_device *startdev; /* device the request is started on */
  154. void *cpaddr; /* address of ccw or tcw */
  155. unsigned char cpmode; /* 0 = cmd mode, 1 = itcw */
  156. char status; /* status of this request */
  157. short retries; /* A retry counter */
  158. unsigned long flags; /* flags of this request */
  159. /* ... and how */
  160. unsigned long starttime; /* jiffies time of request start */
  161. int expires; /* expiration period in jiffies */
  162. char lpm; /* logical path mask */
  163. void *data; /* pointer to data area */
  164. /* these are important for recovering erroneous requests */
  165. int intrc; /* internal error, e.g. from start_IO */
  166. struct irb irb; /* device status in case of an error */
  167. struct dasd_ccw_req *refers; /* ERP-chain queueing. */
  168. void *function; /* originating ERP action */
  169. /* these are for statistics only */
  170. unsigned long long buildclk; /* TOD-clock of request generation */
  171. unsigned long long startclk; /* TOD-clock of request start */
  172. unsigned long long stopclk; /* TOD-clock of request interrupt */
  173. unsigned long long endclk; /* TOD-clock of request termination */
  174. /* Callback that is called after reaching final status. */
  175. void (*callback)(struct dasd_ccw_req *, void *data);
  176. void *callback_data;
  177. };
  178. /*
  179. * dasd_ccw_req -> status can be:
  180. */
  181. #define DASD_CQR_FILLED 0x00 /* request is ready to be processed */
  182. #define DASD_CQR_DONE 0x01 /* request is completed successfully */
  183. #define DASD_CQR_NEED_ERP 0x02 /* request needs recovery action */
  184. #define DASD_CQR_IN_ERP 0x03 /* request is in recovery */
  185. #define DASD_CQR_FAILED 0x04 /* request is finally failed */
  186. #define DASD_CQR_TERMINATED 0x05 /* request was stopped by driver */
  187. #define DASD_CQR_QUEUED 0x80 /* request is queued to be processed */
  188. #define DASD_CQR_IN_IO 0x81 /* request is currently in IO */
  189. #define DASD_CQR_ERROR 0x82 /* request is completed with error */
  190. #define DASD_CQR_CLEAR_PENDING 0x83 /* request is clear pending */
  191. #define DASD_CQR_CLEARED 0x84 /* request was cleared */
  192. #define DASD_CQR_SUCCESS 0x85 /* request was successful */
  193. /* per dasd_ccw_req flags */
  194. #define DASD_CQR_FLAGS_USE_ERP 0 /* use ERP for this request */
  195. #define DASD_CQR_FLAGS_FAILFAST 1 /* FAILFAST */
  196. /* Signature for error recovery functions. */
  197. typedef struct dasd_ccw_req *(*dasd_erp_fn_t) (struct dasd_ccw_req *);
  198. /*
  199. * the struct dasd_discipline is
  200. * sth like a table of virtual functions, if you think of dasd_eckd
  201. * inheriting dasd...
  202. * no, currently we are not planning to reimplement the driver in C++
  203. */
  204. struct dasd_discipline {
  205. struct module *owner;
  206. char ebcname[8]; /* a name used for tagging and printks */
  207. char name[8]; /* a name used for tagging and printks */
  208. int max_blocks; /* maximum number of blocks to be chained */
  209. struct list_head list; /* used for list of disciplines */
  210. /*
  211. * Device recognition functions. check_device is used to verify
  212. * the sense data and the information returned by read device
  213. * characteristics. It returns 0 if the discipline can be used
  214. * for the device in question. uncheck_device is called during
  215. * device shutdown to deregister a device from its discipline.
  216. */
  217. int (*check_device) (struct dasd_device *);
  218. void (*uncheck_device) (struct dasd_device *);
  219. /*
  220. * do_analysis is used in the step from device state "basic" to
  221. * state "accept". It returns 0 if the device can be made ready,
  222. * it returns -EMEDIUMTYPE if the device can't be made ready or
  223. * -EAGAIN if do_analysis started a ccw that needs to complete
  224. * before the analysis may be repeated.
  225. */
  226. int (*do_analysis) (struct dasd_block *);
  227. /*
  228. * Last things to do when a device is set online, and first things
  229. * when it is set offline.
  230. */
  231. int (*ready_to_online) (struct dasd_device *);
  232. int (*online_to_ready) (struct dasd_device *);
  233. /*
  234. * Device operation functions. build_cp creates a ccw chain for
  235. * a block device request, start_io starts the request and
  236. * term_IO cancels it (e.g. in case of a timeout). format_device
  237. * returns a ccw chain to be used to format the device.
  238. * handle_terminated_request allows to examine a cqr and prepare
  239. * it for retry.
  240. */
  241. struct dasd_ccw_req *(*build_cp) (struct dasd_device *,
  242. struct dasd_block *,
  243. struct request *);
  244. int (*start_IO) (struct dasd_ccw_req *);
  245. int (*term_IO) (struct dasd_ccw_req *);
  246. void (*handle_terminated_request) (struct dasd_ccw_req *);
  247. struct dasd_ccw_req *(*format_device) (struct dasd_device *,
  248. struct format_data_t *);
  249. int (*free_cp) (struct dasd_ccw_req *, struct request *);
  250. /*
  251. * Error recovery functions. examine_error() returns a value that
  252. * indicates what to do for an error condition. If examine_error()
  253. * returns 'dasd_era_recover' erp_action() is called to create a
  254. * special error recovery ccw. erp_postaction() is called after
  255. * an error recovery ccw has finished its execution. dump_sense
  256. * is called for every error condition to print the sense data
  257. * to the console.
  258. */
  259. dasd_erp_fn_t(*erp_action) (struct dasd_ccw_req *);
  260. dasd_erp_fn_t(*erp_postaction) (struct dasd_ccw_req *);
  261. void (*dump_sense) (struct dasd_device *, struct dasd_ccw_req *,
  262. struct irb *);
  263. void (*dump_sense_dbf) (struct dasd_device *, struct irb *, char *);
  264. void (*handle_unsolicited_interrupt) (struct dasd_device *,
  265. struct irb *);
  266. /* i/o control functions. */
  267. int (*fill_geometry) (struct dasd_block *, struct hd_geometry *);
  268. int (*fill_info) (struct dasd_device *, struct dasd_information2_t *);
  269. int (*ioctl) (struct dasd_block *, unsigned int, void __user *);
  270. /* suspend/resume functions */
  271. int (*freeze) (struct dasd_device *);
  272. int (*restore) (struct dasd_device *);
  273. };
  274. extern struct dasd_discipline *dasd_diag_discipline_pointer;
  275. /*
  276. * Unique identifier for dasd device.
  277. */
  278. #define UA_NOT_CONFIGURED 0x00
  279. #define UA_BASE_DEVICE 0x01
  280. #define UA_BASE_PAV_ALIAS 0x02
  281. #define UA_HYPER_PAV_ALIAS 0x03
  282. struct dasd_uid {
  283. __u8 type;
  284. char vendor[4];
  285. char serial[15];
  286. __u16 ssid;
  287. __u8 real_unit_addr;
  288. __u8 base_unit_addr;
  289. char vduit[33];
  290. };
  291. /*
  292. * Notification numbers for extended error reporting notifications:
  293. * The DASD_EER_DISABLE notification is sent before a dasd_device (and it's
  294. * eer pointer) is freed. The error reporting module needs to do all necessary
  295. * cleanup steps.
  296. * The DASD_EER_TRIGGER notification sends the actual error reports (triggers).
  297. */
  298. #define DASD_EER_DISABLE 0
  299. #define DASD_EER_TRIGGER 1
  300. /* Trigger IDs for extended error reporting DASD_EER_TRIGGER notification */
  301. #define DASD_EER_FATALERROR 1
  302. #define DASD_EER_NOPATH 2
  303. #define DASD_EER_STATECHANGE 3
  304. #define DASD_EER_PPRCSUSPEND 4
  305. struct dasd_device {
  306. /* Block device stuff. */
  307. struct dasd_block *block;
  308. unsigned int devindex;
  309. unsigned long flags; /* per device flags */
  310. unsigned short features; /* copy of devmap-features (read-only!) */
  311. /* extended error reporting stuff (eer) */
  312. struct dasd_ccw_req *eer_cqr;
  313. /* Device discipline stuff. */
  314. struct dasd_discipline *discipline;
  315. struct dasd_discipline *base_discipline;
  316. char *private;
  317. /* Device state and target state. */
  318. int state, target;
  319. int stopped; /* device (ccw_device_start) was stopped */
  320. /* reference count. */
  321. atomic_t ref_count;
  322. /* ccw queue and memory for static ccw/erp buffers. */
  323. struct list_head ccw_queue;
  324. spinlock_t mem_lock;
  325. void *ccw_mem;
  326. void *erp_mem;
  327. struct list_head ccw_chunks;
  328. struct list_head erp_chunks;
  329. atomic_t tasklet_scheduled;
  330. struct tasklet_struct tasklet;
  331. struct work_struct kick_work;
  332. struct work_struct restore_device;
  333. struct timer_list timer;
  334. debug_info_t *debug_area;
  335. struct ccw_device *cdev;
  336. /* hook for alias management */
  337. struct list_head alias_list;
  338. };
  339. struct dasd_block {
  340. /* Block device stuff. */
  341. struct gendisk *gdp;
  342. struct request_queue *request_queue;
  343. spinlock_t request_queue_lock;
  344. struct block_device *bdev;
  345. atomic_t open_count;
  346. unsigned long long blocks; /* size of volume in blocks */
  347. unsigned int bp_block; /* bytes per block */
  348. unsigned int s2b_shift; /* log2 (bp_block/512) */
  349. struct dasd_device *base;
  350. struct list_head ccw_queue;
  351. spinlock_t queue_lock;
  352. atomic_t tasklet_scheduled;
  353. struct tasklet_struct tasklet;
  354. struct timer_list timer;
  355. #ifdef CONFIG_DASD_PROFILE
  356. struct dasd_profile_info_t profile;
  357. #endif
  358. };
  359. /* reasons why device (ccw_device_start) was stopped */
  360. #define DASD_STOPPED_NOT_ACC 1 /* not accessible */
  361. #define DASD_STOPPED_QUIESCE 2 /* Quiesced */
  362. #define DASD_STOPPED_PENDING 4 /* long busy */
  363. #define DASD_STOPPED_DC_WAIT 8 /* disconnected, wait */
  364. #define DASD_STOPPED_SU 16 /* summary unit check handling */
  365. #define DASD_STOPPED_PM 32 /* pm state transition */
  366. #define DASD_UNRESUMED_PM 64 /* pm resume failed state */
  367. /* per device flags */
  368. #define DASD_FLAG_OFFLINE 3 /* device is in offline processing */
  369. #define DASD_FLAG_EER_SNSS 4 /* A SNSS is required */
  370. #define DASD_FLAG_EER_IN_USE 5 /* A SNSS request is running */
  371. void dasd_put_device_wake(struct dasd_device *);
  372. /*
  373. * Reference count inliners
  374. */
  375. static inline void
  376. dasd_get_device(struct dasd_device *device)
  377. {
  378. atomic_inc(&device->ref_count);
  379. }
  380. static inline void
  381. dasd_put_device(struct dasd_device *device)
  382. {
  383. if (atomic_dec_return(&device->ref_count) == 0)
  384. dasd_put_device_wake(device);
  385. }
  386. /*
  387. * The static memory in ccw_mem and erp_mem is managed by a sorted
  388. * list of free memory chunks.
  389. */
  390. struct dasd_mchunk
  391. {
  392. struct list_head list;
  393. unsigned long size;
  394. } __attribute__ ((aligned(8)));
  395. static inline void
  396. dasd_init_chunklist(struct list_head *chunk_list, void *mem,
  397. unsigned long size)
  398. {
  399. struct dasd_mchunk *chunk;
  400. INIT_LIST_HEAD(chunk_list);
  401. chunk = (struct dasd_mchunk *) mem;
  402. chunk->size = size - sizeof(struct dasd_mchunk);
  403. list_add(&chunk->list, chunk_list);
  404. }
  405. static inline void *
  406. dasd_alloc_chunk(struct list_head *chunk_list, unsigned long size)
  407. {
  408. struct dasd_mchunk *chunk, *tmp;
  409. size = (size + 7L) & -8L;
  410. list_for_each_entry(chunk, chunk_list, list) {
  411. if (chunk->size < size)
  412. continue;
  413. if (chunk->size > size + sizeof(struct dasd_mchunk)) {
  414. char *endaddr = (char *) (chunk + 1) + chunk->size;
  415. tmp = (struct dasd_mchunk *) (endaddr - size) - 1;
  416. tmp->size = size;
  417. chunk->size -= size + sizeof(struct dasd_mchunk);
  418. chunk = tmp;
  419. } else
  420. list_del(&chunk->list);
  421. return (void *) (chunk + 1);
  422. }
  423. return NULL;
  424. }
  425. static inline void
  426. dasd_free_chunk(struct list_head *chunk_list, void *mem)
  427. {
  428. struct dasd_mchunk *chunk, *tmp;
  429. struct list_head *p, *left;
  430. chunk = (struct dasd_mchunk *)
  431. ((char *) mem - sizeof(struct dasd_mchunk));
  432. /* Find out the left neighbour in chunk_list. */
  433. left = chunk_list;
  434. list_for_each(p, chunk_list) {
  435. if (list_entry(p, struct dasd_mchunk, list) > chunk)
  436. break;
  437. left = p;
  438. }
  439. /* Try to merge with right neighbour = next element from left. */
  440. if (left->next != chunk_list) {
  441. tmp = list_entry(left->next, struct dasd_mchunk, list);
  442. if ((char *) (chunk + 1) + chunk->size == (char *) tmp) {
  443. list_del(&tmp->list);
  444. chunk->size += tmp->size + sizeof(struct dasd_mchunk);
  445. }
  446. }
  447. /* Try to merge with left neighbour. */
  448. if (left != chunk_list) {
  449. tmp = list_entry(left, struct dasd_mchunk, list);
  450. if ((char *) (tmp + 1) + tmp->size == (char *) chunk) {
  451. tmp->size += chunk->size + sizeof(struct dasd_mchunk);
  452. return;
  453. }
  454. }
  455. __list_add(&chunk->list, left, left->next);
  456. }
  457. /*
  458. * Check if bsize is in { 512, 1024, 2048, 4096 }
  459. */
  460. static inline int
  461. dasd_check_blocksize(int bsize)
  462. {
  463. if (bsize < 512 || bsize > 4096 || !is_power_of_2(bsize))
  464. return -EMEDIUMTYPE;
  465. return 0;
  466. }
  467. /* externals in dasd.c */
  468. #define DASD_PROFILE_ON 1
  469. #define DASD_PROFILE_OFF 0
  470. extern debug_info_t *dasd_debug_area;
  471. extern struct dasd_profile_info_t dasd_global_profile;
  472. extern unsigned int dasd_profile_level;
  473. extern const struct block_device_operations dasd_device_operations;
  474. extern struct kmem_cache *dasd_page_cache;
  475. struct dasd_ccw_req *
  476. dasd_kmalloc_request(int , int, int, struct dasd_device *);
  477. struct dasd_ccw_req *
  478. dasd_smalloc_request(int , int, int, struct dasd_device *);
  479. void dasd_kfree_request(struct dasd_ccw_req *, struct dasd_device *);
  480. void dasd_sfree_request(struct dasd_ccw_req *, struct dasd_device *);
  481. static inline int
  482. dasd_kmalloc_set_cda(struct ccw1 *ccw, void *cda, struct dasd_device *device)
  483. {
  484. return set_normalized_cda(ccw, cda);
  485. }
  486. struct dasd_device *dasd_alloc_device(void);
  487. void dasd_free_device(struct dasd_device *);
  488. struct dasd_block *dasd_alloc_block(void);
  489. void dasd_free_block(struct dasd_block *);
  490. void dasd_enable_device(struct dasd_device *);
  491. void dasd_set_target_state(struct dasd_device *, int);
  492. void dasd_kick_device(struct dasd_device *);
  493. void dasd_restore_device(struct dasd_device *);
  494. void dasd_add_request_head(struct dasd_ccw_req *);
  495. void dasd_add_request_tail(struct dasd_ccw_req *);
  496. int dasd_start_IO(struct dasd_ccw_req *);
  497. int dasd_term_IO(struct dasd_ccw_req *);
  498. void dasd_schedule_device_bh(struct dasd_device *);
  499. void dasd_schedule_block_bh(struct dasd_block *);
  500. int dasd_sleep_on(struct dasd_ccw_req *);
  501. int dasd_sleep_on_immediatly(struct dasd_ccw_req *);
  502. int dasd_sleep_on_interruptible(struct dasd_ccw_req *);
  503. void dasd_device_set_timer(struct dasd_device *, int);
  504. void dasd_device_clear_timer(struct dasd_device *);
  505. void dasd_block_set_timer(struct dasd_block *, int);
  506. void dasd_block_clear_timer(struct dasd_block *);
  507. int dasd_cancel_req(struct dasd_ccw_req *);
  508. int dasd_flush_device_queue(struct dasd_device *);
  509. int dasd_generic_probe (struct ccw_device *, struct dasd_discipline *);
  510. void dasd_generic_remove (struct ccw_device *cdev);
  511. int dasd_generic_set_online(struct ccw_device *, struct dasd_discipline *);
  512. int dasd_generic_set_offline (struct ccw_device *cdev);
  513. int dasd_generic_notify(struct ccw_device *, int);
  514. void dasd_generic_handle_state_change(struct dasd_device *);
  515. int dasd_generic_pm_freeze(struct ccw_device *);
  516. int dasd_generic_restore_device(struct ccw_device *);
  517. int dasd_generic_read_dev_chars(struct dasd_device *, int, void *, int);
  518. char *dasd_get_sense(struct irb *);
  519. void dasd_device_set_stop_bits(struct dasd_device *, int);
  520. void dasd_device_remove_stop_bits(struct dasd_device *, int);
  521. /* externals in dasd_devmap.c */
  522. extern int dasd_max_devindex;
  523. extern int dasd_probeonly;
  524. extern int dasd_autodetect;
  525. extern int dasd_nopav;
  526. extern int dasd_nofcx;
  527. int dasd_devmap_init(void);
  528. void dasd_devmap_exit(void);
  529. struct dasd_device *dasd_create_device(struct ccw_device *);
  530. void dasd_delete_device(struct dasd_device *);
  531. int dasd_get_uid(struct ccw_device *, struct dasd_uid *);
  532. int dasd_set_uid(struct ccw_device *, struct dasd_uid *);
  533. int dasd_get_feature(struct ccw_device *, int);
  534. int dasd_set_feature(struct ccw_device *, int, int);
  535. int dasd_add_sysfs_files(struct ccw_device *);
  536. void dasd_remove_sysfs_files(struct ccw_device *);
  537. struct dasd_device *dasd_device_from_cdev(struct ccw_device *);
  538. struct dasd_device *dasd_device_from_cdev_locked(struct ccw_device *);
  539. struct dasd_device *dasd_device_from_devindex(int);
  540. int dasd_parse(void);
  541. int dasd_busid_known(const char *);
  542. /* externals in dasd_gendisk.c */
  543. int dasd_gendisk_init(void);
  544. void dasd_gendisk_exit(void);
  545. int dasd_gendisk_alloc(struct dasd_block *);
  546. void dasd_gendisk_free(struct dasd_block *);
  547. int dasd_scan_partitions(struct dasd_block *);
  548. void dasd_destroy_partitions(struct dasd_block *);
  549. /* externals in dasd_ioctl.c */
  550. int dasd_ioctl(struct block_device *, fmode_t, unsigned int, unsigned long);
  551. /* externals in dasd_proc.c */
  552. int dasd_proc_init(void);
  553. void dasd_proc_exit(void);
  554. /* externals in dasd_erp.c */
  555. struct dasd_ccw_req *dasd_default_erp_action(struct dasd_ccw_req *);
  556. struct dasd_ccw_req *dasd_default_erp_postaction(struct dasd_ccw_req *);
  557. struct dasd_ccw_req *dasd_alloc_erp_request(char *, int, int,
  558. struct dasd_device *);
  559. void dasd_free_erp_request(struct dasd_ccw_req *, struct dasd_device *);
  560. void dasd_log_sense(struct dasd_ccw_req *, struct irb *);
  561. void dasd_log_sense_dbf(struct dasd_ccw_req *cqr, struct irb *irb);
  562. /* externals in dasd_3990_erp.c */
  563. struct dasd_ccw_req *dasd_3990_erp_action(struct dasd_ccw_req *);
  564. void dasd_3990_erp_handle_sim(struct dasd_device *, char *);
  565. /* externals in dasd_eer.c */
  566. #ifdef CONFIG_DASD_EER
  567. int dasd_eer_init(void);
  568. void dasd_eer_exit(void);
  569. int dasd_eer_enable(struct dasd_device *);
  570. void dasd_eer_disable(struct dasd_device *);
  571. void dasd_eer_write(struct dasd_device *, struct dasd_ccw_req *cqr,
  572. unsigned int id);
  573. void dasd_eer_snss(struct dasd_device *);
  574. static inline int dasd_eer_enabled(struct dasd_device *device)
  575. {
  576. return device->eer_cqr != NULL;
  577. }
  578. #else
  579. #define dasd_eer_init() (0)
  580. #define dasd_eer_exit() do { } while (0)
  581. #define dasd_eer_enable(d) (0)
  582. #define dasd_eer_disable(d) do { } while (0)
  583. #define dasd_eer_write(d,c,i) do { } while (0)
  584. #define dasd_eer_snss(d) do { } while (0)
  585. #define dasd_eer_enabled(d) (0)
  586. #endif /* CONFIG_DASD_ERR */
  587. #endif /* __KERNEL__ */
  588. #endif /* DASD_H */