dasd_int.h 21 KB

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