dasd_int.h 23 KB

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