css.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757
  1. /*
  2. * drivers/s390/cio/css.c
  3. * driver for channel subsystem
  4. *
  5. * Copyright (C) 2002 IBM Deutschland Entwicklung GmbH,
  6. * IBM Corporation
  7. * Author(s): Arnd Bergmann (arndb@de.ibm.com)
  8. * Cornelia Huck (cornelia.huck@de.ibm.com)
  9. */
  10. #include <linux/module.h>
  11. #include <linux/init.h>
  12. #include <linux/device.h>
  13. #include <linux/slab.h>
  14. #include <linux/errno.h>
  15. #include <linux/list.h>
  16. #include "css.h"
  17. #include "cio.h"
  18. #include "cio_debug.h"
  19. #include "ioasm.h"
  20. #include "chsc.h"
  21. #include "device.h"
  22. int need_rescan = 0;
  23. int css_init_done = 0;
  24. static int need_reprobe = 0;
  25. static int max_ssid = 0;
  26. struct channel_subsystem *css[__MAX_CSSID + 1];
  27. int css_characteristics_avail = 0;
  28. inline int
  29. for_each_subchannel(int(*fn)(struct subchannel_id, void *), void *data)
  30. {
  31. struct subchannel_id schid;
  32. int ret;
  33. init_subchannel_id(&schid);
  34. ret = -ENODEV;
  35. do {
  36. do {
  37. ret = fn(schid, data);
  38. if (ret)
  39. break;
  40. } while (schid.sch_no++ < __MAX_SUBCHANNEL);
  41. schid.sch_no = 0;
  42. } while (schid.ssid++ < max_ssid);
  43. return ret;
  44. }
  45. static struct subchannel *
  46. css_alloc_subchannel(struct subchannel_id schid)
  47. {
  48. struct subchannel *sch;
  49. int ret;
  50. sch = kmalloc (sizeof (*sch), GFP_KERNEL | GFP_DMA);
  51. if (sch == NULL)
  52. return ERR_PTR(-ENOMEM);
  53. ret = cio_validate_subchannel (sch, schid);
  54. if (ret < 0) {
  55. kfree(sch);
  56. return ERR_PTR(ret);
  57. }
  58. if (sch->st != SUBCHANNEL_TYPE_IO) {
  59. /* For now we ignore all non-io subchannels. */
  60. kfree(sch);
  61. return ERR_PTR(-EINVAL);
  62. }
  63. /*
  64. * Set intparm to subchannel address.
  65. * This is fine even on 64bit since the subchannel is always located
  66. * under 2G.
  67. */
  68. sch->schib.pmcw.intparm = (__u32)(unsigned long)sch;
  69. ret = cio_modify(sch);
  70. if (ret) {
  71. kfree(sch);
  72. return ERR_PTR(ret);
  73. }
  74. return sch;
  75. }
  76. static void
  77. css_free_subchannel(struct subchannel *sch)
  78. {
  79. if (sch) {
  80. /* Reset intparm to zeroes. */
  81. sch->schib.pmcw.intparm = 0;
  82. cio_modify(sch);
  83. kfree(sch);
  84. }
  85. }
  86. static void
  87. css_subchannel_release(struct device *dev)
  88. {
  89. struct subchannel *sch;
  90. sch = to_subchannel(dev);
  91. if (!cio_is_console(sch->schid))
  92. kfree(sch);
  93. }
  94. extern int css_get_ssd_info(struct subchannel *sch);
  95. int css_sch_device_register(struct subchannel *sch)
  96. {
  97. int ret;
  98. mutex_lock(&sch->reg_mutex);
  99. ret = device_register(&sch->dev);
  100. mutex_unlock(&sch->reg_mutex);
  101. return ret;
  102. }
  103. void css_sch_device_unregister(struct subchannel *sch)
  104. {
  105. mutex_lock(&sch->reg_mutex);
  106. device_unregister(&sch->dev);
  107. mutex_unlock(&sch->reg_mutex);
  108. }
  109. static int
  110. css_register_subchannel(struct subchannel *sch)
  111. {
  112. int ret;
  113. /* Initialize the subchannel structure */
  114. sch->dev.parent = &css[0]->device;
  115. sch->dev.bus = &css_bus_type;
  116. sch->dev.release = &css_subchannel_release;
  117. /* make it known to the system */
  118. ret = css_sch_device_register(sch);
  119. if (ret)
  120. printk (KERN_WARNING "%s: could not register %s\n",
  121. __func__, sch->dev.bus_id);
  122. else
  123. css_get_ssd_info(sch);
  124. return ret;
  125. }
  126. int
  127. css_probe_device(struct subchannel_id schid)
  128. {
  129. int ret;
  130. struct subchannel *sch;
  131. sch = css_alloc_subchannel(schid);
  132. if (IS_ERR(sch))
  133. return PTR_ERR(sch);
  134. ret = css_register_subchannel(sch);
  135. if (ret)
  136. css_free_subchannel(sch);
  137. return ret;
  138. }
  139. static int
  140. check_subchannel(struct device * dev, void * data)
  141. {
  142. struct subchannel *sch;
  143. struct subchannel_id *schid = data;
  144. sch = to_subchannel(dev);
  145. return schid_equal(&sch->schid, schid);
  146. }
  147. struct subchannel *
  148. get_subchannel_by_schid(struct subchannel_id schid)
  149. {
  150. struct device *dev;
  151. dev = bus_find_device(&css_bus_type, NULL,
  152. (void *)&schid, check_subchannel);
  153. return dev ? to_subchannel(dev) : NULL;
  154. }
  155. static inline int
  156. css_get_subchannel_status(struct subchannel *sch, struct subchannel_id schid)
  157. {
  158. struct schib schib;
  159. int cc;
  160. cc = stsch(schid, &schib);
  161. if (cc)
  162. return CIO_GONE;
  163. if (!schib.pmcw.dnv)
  164. return CIO_GONE;
  165. if (sch && sch->schib.pmcw.dnv &&
  166. (schib.pmcw.dev != sch->schib.pmcw.dev))
  167. return CIO_REVALIDATE;
  168. if (sch && !sch->lpm)
  169. return CIO_NO_PATH;
  170. return CIO_OPER;
  171. }
  172. static int
  173. css_evaluate_subchannel(struct subchannel_id schid, int slow)
  174. {
  175. int event, ret, disc;
  176. struct subchannel *sch;
  177. unsigned long flags;
  178. sch = get_subchannel_by_schid(schid);
  179. disc = sch ? device_is_disconnected(sch) : 0;
  180. if (disc && slow) {
  181. if (sch)
  182. put_device(&sch->dev);
  183. return 0; /* Already processed. */
  184. }
  185. /*
  186. * We've got a machine check, so running I/O won't get an interrupt.
  187. * Kill any pending timers.
  188. */
  189. if (sch)
  190. device_kill_pending_timer(sch);
  191. if (!disc && !slow) {
  192. if (sch)
  193. put_device(&sch->dev);
  194. return -EAGAIN; /* Will be done on the slow path. */
  195. }
  196. event = css_get_subchannel_status(sch, schid);
  197. CIO_MSG_EVENT(4, "Evaluating schid 0.%x.%04x, event %d, %s, %s path.\n",
  198. schid.ssid, schid.sch_no, event,
  199. sch?(disc?"disconnected":"normal"):"unknown",
  200. slow?"slow":"fast");
  201. switch (event) {
  202. case CIO_NO_PATH:
  203. case CIO_GONE:
  204. if (!sch) {
  205. /* Never used this subchannel. Ignore. */
  206. ret = 0;
  207. break;
  208. }
  209. if (disc && (event == CIO_NO_PATH)) {
  210. /*
  211. * Uargh, hack again. Because we don't get a machine
  212. * check on configure on, our path bookkeeping can
  213. * be out of date here (it's fine while we only do
  214. * logical varying or get chsc machine checks). We
  215. * need to force reprobing or we might miss devices
  216. * coming operational again. It won't do harm in real
  217. * no path situations.
  218. */
  219. spin_lock_irqsave(&sch->lock, flags);
  220. device_trigger_reprobe(sch);
  221. spin_unlock_irqrestore(&sch->lock, flags);
  222. ret = 0;
  223. break;
  224. }
  225. if (sch->driver && sch->driver->notify &&
  226. sch->driver->notify(&sch->dev, event)) {
  227. cio_disable_subchannel(sch);
  228. device_set_disconnected(sch);
  229. ret = 0;
  230. break;
  231. }
  232. /*
  233. * Unregister subchannel.
  234. * The device will be killed automatically.
  235. */
  236. cio_disable_subchannel(sch);
  237. css_sch_device_unregister(sch);
  238. /* Reset intparm to zeroes. */
  239. sch->schib.pmcw.intparm = 0;
  240. cio_modify(sch);
  241. put_device(&sch->dev);
  242. ret = 0;
  243. break;
  244. case CIO_REVALIDATE:
  245. /*
  246. * Revalidation machine check. Sick.
  247. * We don't notify the driver since we have to throw the device
  248. * away in any case.
  249. */
  250. if (!disc) {
  251. css_sch_device_unregister(sch);
  252. /* Reset intparm to zeroes. */
  253. sch->schib.pmcw.intparm = 0;
  254. cio_modify(sch);
  255. put_device(&sch->dev);
  256. ret = css_probe_device(schid);
  257. } else {
  258. /*
  259. * We can't immediately deregister the disconnected
  260. * device since it might block.
  261. */
  262. spin_lock_irqsave(&sch->lock, flags);
  263. device_trigger_reprobe(sch);
  264. spin_unlock_irqrestore(&sch->lock, flags);
  265. ret = 0;
  266. }
  267. break;
  268. case CIO_OPER:
  269. if (disc) {
  270. spin_lock_irqsave(&sch->lock, flags);
  271. /* Get device operational again. */
  272. device_trigger_reprobe(sch);
  273. spin_unlock_irqrestore(&sch->lock, flags);
  274. }
  275. ret = sch ? 0 : css_probe_device(schid);
  276. break;
  277. default:
  278. BUG();
  279. ret = 0;
  280. }
  281. return ret;
  282. }
  283. static int
  284. css_rescan_devices(struct subchannel_id schid, void *data)
  285. {
  286. return css_evaluate_subchannel(schid, 1);
  287. }
  288. struct slow_subchannel {
  289. struct list_head slow_list;
  290. struct subchannel_id schid;
  291. };
  292. static LIST_HEAD(slow_subchannels_head);
  293. static DEFINE_SPINLOCK(slow_subchannel_lock);
  294. static void
  295. css_trigger_slow_path(void)
  296. {
  297. CIO_TRACE_EVENT(4, "slowpath");
  298. if (need_rescan) {
  299. need_rescan = 0;
  300. for_each_subchannel(css_rescan_devices, NULL);
  301. return;
  302. }
  303. spin_lock_irq(&slow_subchannel_lock);
  304. while (!list_empty(&slow_subchannels_head)) {
  305. struct slow_subchannel *slow_sch =
  306. list_entry(slow_subchannels_head.next,
  307. struct slow_subchannel, slow_list);
  308. list_del_init(slow_subchannels_head.next);
  309. spin_unlock_irq(&slow_subchannel_lock);
  310. css_evaluate_subchannel(slow_sch->schid, 1);
  311. spin_lock_irq(&slow_subchannel_lock);
  312. kfree(slow_sch);
  313. }
  314. spin_unlock_irq(&slow_subchannel_lock);
  315. }
  316. typedef void (*workfunc)(void *);
  317. DECLARE_WORK(slow_path_work, (workfunc)css_trigger_slow_path, NULL);
  318. struct workqueue_struct *slow_path_wq;
  319. /* Reprobe subchannel if unregistered. */
  320. static int reprobe_subchannel(struct subchannel_id schid, void *data)
  321. {
  322. struct subchannel *sch;
  323. int ret;
  324. CIO_DEBUG(KERN_INFO, 6, "cio: reprobe 0.%x.%04x\n",
  325. schid.ssid, schid.sch_no);
  326. if (need_reprobe)
  327. return -EAGAIN;
  328. sch = get_subchannel_by_schid(schid);
  329. if (sch) {
  330. /* Already known. */
  331. put_device(&sch->dev);
  332. return 0;
  333. }
  334. ret = css_probe_device(schid);
  335. switch (ret) {
  336. case 0:
  337. break;
  338. case -ENXIO:
  339. case -ENOMEM:
  340. /* These should abort looping */
  341. break;
  342. default:
  343. ret = 0;
  344. }
  345. return ret;
  346. }
  347. /* Work function used to reprobe all unregistered subchannels. */
  348. static void reprobe_all(void *data)
  349. {
  350. int ret;
  351. CIO_MSG_EVENT(2, "reprobe start\n");
  352. need_reprobe = 0;
  353. /* Make sure initial subchannel scan is done. */
  354. wait_event(ccw_device_init_wq,
  355. atomic_read(&ccw_device_init_count) == 0);
  356. ret = for_each_subchannel(reprobe_subchannel, NULL);
  357. CIO_MSG_EVENT(2, "reprobe done (rc=%d, need_reprobe=%d)\n", ret,
  358. need_reprobe);
  359. }
  360. DECLARE_WORK(css_reprobe_work, reprobe_all, NULL);
  361. /* Schedule reprobing of all unregistered subchannels. */
  362. void css_schedule_reprobe(void)
  363. {
  364. need_reprobe = 1;
  365. queue_work(ccw_device_work, &css_reprobe_work);
  366. }
  367. EXPORT_SYMBOL_GPL(css_schedule_reprobe);
  368. /*
  369. * Rescan for new devices. FIXME: This is slow.
  370. * This function is called when we have lost CRWs due to overflows and we have
  371. * to do subchannel housekeeping.
  372. */
  373. void
  374. css_reiterate_subchannels(void)
  375. {
  376. css_clear_subchannel_slow_list();
  377. need_rescan = 1;
  378. }
  379. /*
  380. * Called from the machine check handler for subchannel report words.
  381. */
  382. int
  383. css_process_crw(int rsid1, int rsid2)
  384. {
  385. int ret;
  386. struct subchannel_id mchk_schid;
  387. CIO_CRW_EVENT(2, "source is subchannel %04X, subsystem id %x\n",
  388. rsid1, rsid2);
  389. if (need_rescan)
  390. /* We need to iterate all subchannels anyway. */
  391. return -EAGAIN;
  392. init_subchannel_id(&mchk_schid);
  393. mchk_schid.sch_no = rsid1;
  394. if (rsid2 != 0)
  395. mchk_schid.ssid = (rsid2 >> 8) & 3;
  396. /*
  397. * Since we are always presented with IPI in the CRW, we have to
  398. * use stsch() to find out if the subchannel in question has come
  399. * or gone.
  400. */
  401. ret = css_evaluate_subchannel(mchk_schid, 0);
  402. if (ret == -EAGAIN) {
  403. if (css_enqueue_subchannel_slow(mchk_schid)) {
  404. css_clear_subchannel_slow_list();
  405. need_rescan = 1;
  406. }
  407. }
  408. return ret;
  409. }
  410. static int __init
  411. __init_channel_subsystem(struct subchannel_id schid, void *data)
  412. {
  413. struct subchannel *sch;
  414. int ret;
  415. if (cio_is_console(schid))
  416. sch = cio_get_console_subchannel();
  417. else {
  418. sch = css_alloc_subchannel(schid);
  419. if (IS_ERR(sch))
  420. ret = PTR_ERR(sch);
  421. else
  422. ret = 0;
  423. switch (ret) {
  424. case 0:
  425. break;
  426. case -ENOMEM:
  427. panic("Out of memory in init_channel_subsystem\n");
  428. /* -ENXIO: no more subchannels. */
  429. case -ENXIO:
  430. return ret;
  431. /* -EIO: this subchannel set not supported. */
  432. case -EIO:
  433. return ret;
  434. default:
  435. return 0;
  436. }
  437. }
  438. /*
  439. * We register ALL valid subchannels in ioinfo, even those
  440. * that have been present before init_channel_subsystem.
  441. * These subchannels can't have been registered yet (kmalloc
  442. * not working) so we do it now. This is true e.g. for the
  443. * console subchannel.
  444. */
  445. css_register_subchannel(sch);
  446. return 0;
  447. }
  448. static void __init
  449. css_generate_pgid(struct channel_subsystem *css, u32 tod_high)
  450. {
  451. if (css_characteristics_avail && css_general_characteristics.mcss) {
  452. css->global_pgid.pgid_high.ext_cssid.version = 0x80;
  453. css->global_pgid.pgid_high.ext_cssid.cssid = css->cssid;
  454. } else {
  455. #ifdef CONFIG_SMP
  456. css->global_pgid.pgid_high.cpu_addr = hard_smp_processor_id();
  457. #else
  458. css->global_pgid.pgid_high.cpu_addr = 0;
  459. #endif
  460. }
  461. css->global_pgid.cpu_id = ((cpuid_t *) __LC_CPUID)->ident;
  462. css->global_pgid.cpu_model = ((cpuid_t *) __LC_CPUID)->machine;
  463. css->global_pgid.tod_high = tod_high;
  464. }
  465. static void
  466. channel_subsystem_release(struct device *dev)
  467. {
  468. struct channel_subsystem *css;
  469. css = to_css(dev);
  470. mutex_destroy(&css->mutex);
  471. kfree(css);
  472. }
  473. static ssize_t
  474. css_cm_enable_show(struct device *dev, struct device_attribute *attr,
  475. char *buf)
  476. {
  477. struct channel_subsystem *css = to_css(dev);
  478. if (!css)
  479. return 0;
  480. return sprintf(buf, "%x\n", css->cm_enabled);
  481. }
  482. static ssize_t
  483. css_cm_enable_store(struct device *dev, struct device_attribute *attr,
  484. const char *buf, size_t count)
  485. {
  486. struct channel_subsystem *css = to_css(dev);
  487. int ret;
  488. switch (buf[0]) {
  489. case '0':
  490. ret = css->cm_enabled ? chsc_secm(css, 0) : 0;
  491. break;
  492. case '1':
  493. ret = css->cm_enabled ? 0 : chsc_secm(css, 1);
  494. break;
  495. default:
  496. ret = -EINVAL;
  497. }
  498. return ret < 0 ? ret : count;
  499. }
  500. static DEVICE_ATTR(cm_enable, 0644, css_cm_enable_show, css_cm_enable_store);
  501. static inline void __init
  502. setup_css(int nr)
  503. {
  504. u32 tod_high;
  505. memset(css[nr], 0, sizeof(struct channel_subsystem));
  506. mutex_init(&css[nr]->mutex);
  507. css[nr]->valid = 1;
  508. css[nr]->cssid = nr;
  509. sprintf(css[nr]->device.bus_id, "css%x", nr);
  510. css[nr]->device.release = channel_subsystem_release;
  511. tod_high = (u32) (get_clock() >> 32);
  512. css_generate_pgid(css[nr], tod_high);
  513. }
  514. /*
  515. * Now that the driver core is running, we can setup our channel subsystem.
  516. * The struct subchannel's are created during probing (except for the
  517. * static console subchannel).
  518. */
  519. static int __init
  520. init_channel_subsystem (void)
  521. {
  522. int ret, i;
  523. if (chsc_determine_css_characteristics() == 0)
  524. css_characteristics_avail = 1;
  525. if ((ret = bus_register(&css_bus_type)))
  526. goto out;
  527. /* Try to enable MSS. */
  528. ret = chsc_enable_facility(CHSC_SDA_OC_MSS);
  529. switch (ret) {
  530. case 0: /* Success. */
  531. max_ssid = __MAX_SSID;
  532. break;
  533. case -ENOMEM:
  534. goto out_bus;
  535. default:
  536. max_ssid = 0;
  537. }
  538. /* Setup css structure. */
  539. for (i = 0; i <= __MAX_CSSID; i++) {
  540. css[i] = kmalloc(sizeof(struct channel_subsystem), GFP_KERNEL);
  541. if (!css[i]) {
  542. ret = -ENOMEM;
  543. goto out_unregister;
  544. }
  545. setup_css(i);
  546. ret = device_register(&css[i]->device);
  547. if (ret)
  548. goto out_free;
  549. if (css_characteristics_avail &&
  550. css_chsc_characteristics.secm) {
  551. ret = device_create_file(&css[i]->device,
  552. &dev_attr_cm_enable);
  553. if (ret)
  554. goto out_device;
  555. }
  556. }
  557. css_init_done = 1;
  558. ctl_set_bit(6, 28);
  559. for_each_subchannel(__init_channel_subsystem, NULL);
  560. return 0;
  561. out_device:
  562. device_unregister(&css[i]->device);
  563. out_free:
  564. kfree(css[i]);
  565. out_unregister:
  566. while (i > 0) {
  567. i--;
  568. if (css_characteristics_avail && css_chsc_characteristics.secm)
  569. device_remove_file(&css[i]->device,
  570. &dev_attr_cm_enable);
  571. device_unregister(&css[i]->device);
  572. }
  573. out_bus:
  574. bus_unregister(&css_bus_type);
  575. out:
  576. return ret;
  577. }
  578. /*
  579. * find a driver for a subchannel. They identify by the subchannel
  580. * type with the exception that the console subchannel driver has its own
  581. * subchannel type although the device is an i/o subchannel
  582. */
  583. static int
  584. css_bus_match (struct device *dev, struct device_driver *drv)
  585. {
  586. struct subchannel *sch = container_of (dev, struct subchannel, dev);
  587. struct css_driver *driver = container_of (drv, struct css_driver, drv);
  588. if (sch->st == driver->subchannel_type)
  589. return 1;
  590. return 0;
  591. }
  592. static int
  593. css_probe (struct device *dev)
  594. {
  595. struct subchannel *sch;
  596. sch = to_subchannel(dev);
  597. sch->driver = container_of (dev->driver, struct css_driver, drv);
  598. return (sch->driver->probe ? sch->driver->probe(sch) : 0);
  599. }
  600. static int
  601. css_remove (struct device *dev)
  602. {
  603. struct subchannel *sch;
  604. sch = to_subchannel(dev);
  605. return (sch->driver->remove ? sch->driver->remove(sch) : 0);
  606. }
  607. static void
  608. css_shutdown (struct device *dev)
  609. {
  610. struct subchannel *sch;
  611. sch = to_subchannel(dev);
  612. if (sch->driver->shutdown)
  613. sch->driver->shutdown(sch);
  614. }
  615. struct bus_type css_bus_type = {
  616. .name = "css",
  617. .match = css_bus_match,
  618. .probe = css_probe,
  619. .remove = css_remove,
  620. .shutdown = css_shutdown,
  621. };
  622. subsys_initcall(init_channel_subsystem);
  623. int
  624. css_enqueue_subchannel_slow(struct subchannel_id schid)
  625. {
  626. struct slow_subchannel *new_slow_sch;
  627. unsigned long flags;
  628. new_slow_sch = kzalloc(sizeof(struct slow_subchannel), GFP_ATOMIC);
  629. if (!new_slow_sch)
  630. return -ENOMEM;
  631. new_slow_sch->schid = schid;
  632. spin_lock_irqsave(&slow_subchannel_lock, flags);
  633. list_add_tail(&new_slow_sch->slow_list, &slow_subchannels_head);
  634. spin_unlock_irqrestore(&slow_subchannel_lock, flags);
  635. return 0;
  636. }
  637. void
  638. css_clear_subchannel_slow_list(void)
  639. {
  640. unsigned long flags;
  641. spin_lock_irqsave(&slow_subchannel_lock, flags);
  642. while (!list_empty(&slow_subchannels_head)) {
  643. struct slow_subchannel *slow_sch =
  644. list_entry(slow_subchannels_head.next,
  645. struct slow_subchannel, slow_list);
  646. list_del_init(slow_subchannels_head.next);
  647. kfree(slow_sch);
  648. }
  649. spin_unlock_irqrestore(&slow_subchannel_lock, flags);
  650. }
  651. int
  652. css_slow_subchannels_exist(void)
  653. {
  654. return (!list_empty(&slow_subchannels_head));
  655. }
  656. MODULE_LICENSE("GPL");
  657. EXPORT_SYMBOL(css_bus_type);
  658. EXPORT_SYMBOL_GPL(css_characteristics_avail);