sclp_cmd.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694
  1. /*
  2. * Copyright IBM Corp. 2007,2012
  3. *
  4. * Author(s): Heiko Carstens <heiko.carstens@de.ibm.com>,
  5. * Peter Oberparleiter <peter.oberparleiter@de.ibm.com>
  6. */
  7. #define KMSG_COMPONENT "sclp_cmd"
  8. #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
  9. #include <linux/completion.h>
  10. #include <linux/init.h>
  11. #include <linux/errno.h>
  12. #include <linux/err.h>
  13. #include <linux/export.h>
  14. #include <linux/slab.h>
  15. #include <linux/string.h>
  16. #include <linux/mm.h>
  17. #include <linux/mmzone.h>
  18. #include <linux/memory.h>
  19. #include <linux/module.h>
  20. #include <linux/platform_device.h>
  21. #include <asm/ctl_reg.h>
  22. #include <asm/chpid.h>
  23. #include <asm/setup.h>
  24. #include <asm/page.h>
  25. #include <asm/sclp.h>
  26. #include <asm/numa.h>
  27. #include "sclp.h"
  28. static void sclp_sync_callback(struct sclp_req *req, void *data)
  29. {
  30. struct completion *completion = data;
  31. complete(completion);
  32. }
  33. int sclp_sync_request(sclp_cmdw_t cmd, void *sccb)
  34. {
  35. return sclp_sync_request_timeout(cmd, sccb, 0);
  36. }
  37. int sclp_sync_request_timeout(sclp_cmdw_t cmd, void *sccb, int timeout)
  38. {
  39. struct completion completion;
  40. struct sclp_req *request;
  41. int rc;
  42. request = kzalloc(sizeof(*request), GFP_KERNEL);
  43. if (!request)
  44. return -ENOMEM;
  45. if (timeout)
  46. request->queue_timeout = timeout;
  47. request->command = cmd;
  48. request->sccb = sccb;
  49. request->status = SCLP_REQ_FILLED;
  50. request->callback = sclp_sync_callback;
  51. request->callback_data = &completion;
  52. init_completion(&completion);
  53. /* Perform sclp request. */
  54. rc = sclp_add_request(request);
  55. if (rc)
  56. goto out;
  57. wait_for_completion(&completion);
  58. /* Check response. */
  59. if (request->status != SCLP_REQ_DONE) {
  60. pr_warn("sync request failed (cmd=0x%08x, status=0x%02x)\n",
  61. cmd, request->status);
  62. rc = -EIO;
  63. }
  64. out:
  65. kfree(request);
  66. return rc;
  67. }
  68. /*
  69. * CPU configuration related functions.
  70. */
  71. #define SCLP_CMDW_READ_CPU_INFO 0x00010001
  72. #define SCLP_CMDW_CONFIGURE_CPU 0x00110001
  73. #define SCLP_CMDW_DECONFIGURE_CPU 0x00100001
  74. struct read_cpu_info_sccb {
  75. struct sccb_header header;
  76. u16 nr_configured;
  77. u16 offset_configured;
  78. u16 nr_standby;
  79. u16 offset_standby;
  80. u8 reserved[4096 - 16];
  81. } __attribute__((packed, aligned(PAGE_SIZE)));
  82. static void sclp_fill_core_info(struct sclp_core_info *info,
  83. struct read_cpu_info_sccb *sccb)
  84. {
  85. char *page = (char *) sccb;
  86. memset(info, 0, sizeof(*info));
  87. info->configured = sccb->nr_configured;
  88. info->standby = sccb->nr_standby;
  89. info->combined = sccb->nr_configured + sccb->nr_standby;
  90. memcpy(&info->core, page + sccb->offset_configured,
  91. info->combined * sizeof(struct sclp_core_entry));
  92. }
  93. int sclp_get_core_info(struct sclp_core_info *info)
  94. {
  95. int rc;
  96. struct read_cpu_info_sccb *sccb;
  97. if (!SCLP_HAS_CPU_INFO)
  98. return -EOPNOTSUPP;
  99. sccb = (void *) get_zeroed_page(GFP_KERNEL | GFP_DMA);
  100. if (!sccb)
  101. return -ENOMEM;
  102. sccb->header.length = sizeof(*sccb);
  103. rc = sclp_sync_request_timeout(SCLP_CMDW_READ_CPU_INFO, sccb,
  104. SCLP_QUEUE_INTERVAL);
  105. if (rc)
  106. goto out;
  107. if (sccb->header.response_code != 0x0010) {
  108. pr_warn("readcpuinfo failed (response=0x%04x)\n",
  109. sccb->header.response_code);
  110. rc = -EIO;
  111. goto out;
  112. }
  113. sclp_fill_core_info(info, sccb);
  114. out:
  115. free_page((unsigned long) sccb);
  116. return rc;
  117. }
  118. struct cpu_configure_sccb {
  119. struct sccb_header header;
  120. } __attribute__((packed, aligned(8)));
  121. static int do_core_configure(sclp_cmdw_t cmd)
  122. {
  123. struct cpu_configure_sccb *sccb;
  124. int rc;
  125. if (!SCLP_HAS_CPU_RECONFIG)
  126. return -EOPNOTSUPP;
  127. /*
  128. * This is not going to cross a page boundary since we force
  129. * kmalloc to have a minimum alignment of 8 bytes on s390.
  130. */
  131. sccb = kzalloc(sizeof(*sccb), GFP_KERNEL | GFP_DMA);
  132. if (!sccb)
  133. return -ENOMEM;
  134. sccb->header.length = sizeof(*sccb);
  135. rc = sclp_sync_request_timeout(cmd, sccb, SCLP_QUEUE_INTERVAL);
  136. if (rc)
  137. goto out;
  138. switch (sccb->header.response_code) {
  139. case 0x0020:
  140. case 0x0120:
  141. break;
  142. default:
  143. pr_warn("configure cpu failed (cmd=0x%08x, response=0x%04x)\n",
  144. cmd, sccb->header.response_code);
  145. rc = -EIO;
  146. break;
  147. }
  148. out:
  149. kfree(sccb);
  150. return rc;
  151. }
  152. int sclp_core_configure(u8 core)
  153. {
  154. return do_core_configure(SCLP_CMDW_CONFIGURE_CPU | core << 8);
  155. }
  156. int sclp_core_deconfigure(u8 core)
  157. {
  158. return do_core_configure(SCLP_CMDW_DECONFIGURE_CPU | core << 8);
  159. }
  160. #ifdef CONFIG_MEMORY_HOTPLUG
  161. static DEFINE_MUTEX(sclp_mem_mutex);
  162. static LIST_HEAD(sclp_mem_list);
  163. static u8 sclp_max_storage_id;
  164. static DECLARE_BITMAP(sclp_storage_ids, 256);
  165. static int sclp_mem_state_changed;
  166. struct memory_increment {
  167. struct list_head list;
  168. u16 rn;
  169. int standby;
  170. };
  171. struct assign_storage_sccb {
  172. struct sccb_header header;
  173. u16 rn;
  174. } __packed;
  175. int arch_get_memory_phys_device(unsigned long start_pfn)
  176. {
  177. if (!sclp.rzm)
  178. return 0;
  179. return PFN_PHYS(start_pfn) >> ilog2(sclp.rzm);
  180. }
  181. static unsigned long long rn2addr(u16 rn)
  182. {
  183. return (unsigned long long) (rn - 1) * sclp.rzm;
  184. }
  185. static int do_assign_storage(sclp_cmdw_t cmd, u16 rn)
  186. {
  187. struct assign_storage_sccb *sccb;
  188. int rc;
  189. sccb = (void *) get_zeroed_page(GFP_KERNEL | GFP_DMA);
  190. if (!sccb)
  191. return -ENOMEM;
  192. sccb->header.length = PAGE_SIZE;
  193. sccb->rn = rn;
  194. rc = sclp_sync_request_timeout(cmd, sccb, SCLP_QUEUE_INTERVAL);
  195. if (rc)
  196. goto out;
  197. switch (sccb->header.response_code) {
  198. case 0x0020:
  199. case 0x0120:
  200. break;
  201. default:
  202. pr_warn("assign storage failed (cmd=0x%08x, response=0x%04x, rn=0x%04x)\n",
  203. cmd, sccb->header.response_code, rn);
  204. rc = -EIO;
  205. break;
  206. }
  207. out:
  208. free_page((unsigned long) sccb);
  209. return rc;
  210. }
  211. static int sclp_assign_storage(u16 rn)
  212. {
  213. unsigned long long start;
  214. int rc;
  215. rc = do_assign_storage(0x000d0001, rn);
  216. if (rc)
  217. return rc;
  218. start = rn2addr(rn);
  219. storage_key_init_range(start, start + sclp.rzm);
  220. return 0;
  221. }
  222. static int sclp_unassign_storage(u16 rn)
  223. {
  224. return do_assign_storage(0x000c0001, rn);
  225. }
  226. struct attach_storage_sccb {
  227. struct sccb_header header;
  228. u16 :16;
  229. u16 assigned;
  230. u32 :32;
  231. u32 entries[0];
  232. } __packed;
  233. static int sclp_attach_storage(u8 id)
  234. {
  235. struct attach_storage_sccb *sccb;
  236. int rc;
  237. int i;
  238. sccb = (void *) get_zeroed_page(GFP_KERNEL | GFP_DMA);
  239. if (!sccb)
  240. return -ENOMEM;
  241. sccb->header.length = PAGE_SIZE;
  242. rc = sclp_sync_request_timeout(0x00080001 | id << 8, sccb,
  243. SCLP_QUEUE_INTERVAL);
  244. if (rc)
  245. goto out;
  246. switch (sccb->header.response_code) {
  247. case 0x0020:
  248. set_bit(id, sclp_storage_ids);
  249. for (i = 0; i < sccb->assigned; i++) {
  250. if (sccb->entries[i])
  251. sclp_unassign_storage(sccb->entries[i] >> 16);
  252. }
  253. break;
  254. default:
  255. rc = -EIO;
  256. break;
  257. }
  258. out:
  259. free_page((unsigned long) sccb);
  260. return rc;
  261. }
  262. static int sclp_mem_change_state(unsigned long start, unsigned long size,
  263. int online)
  264. {
  265. struct memory_increment *incr;
  266. unsigned long long istart;
  267. int rc = 0;
  268. list_for_each_entry(incr, &sclp_mem_list, list) {
  269. istart = rn2addr(incr->rn);
  270. if (start + size - 1 < istart)
  271. break;
  272. if (start > istart + sclp.rzm - 1)
  273. continue;
  274. if (online)
  275. rc |= sclp_assign_storage(incr->rn);
  276. else
  277. sclp_unassign_storage(incr->rn);
  278. if (rc == 0)
  279. incr->standby = online ? 0 : 1;
  280. }
  281. return rc ? -EIO : 0;
  282. }
  283. static bool contains_standby_increment(unsigned long start, unsigned long end)
  284. {
  285. struct memory_increment *incr;
  286. unsigned long istart;
  287. list_for_each_entry(incr, &sclp_mem_list, list) {
  288. istart = rn2addr(incr->rn);
  289. if (end - 1 < istart)
  290. continue;
  291. if (start > istart + sclp.rzm - 1)
  292. continue;
  293. if (incr->standby)
  294. return true;
  295. }
  296. return false;
  297. }
  298. static int sclp_mem_notifier(struct notifier_block *nb,
  299. unsigned long action, void *data)
  300. {
  301. unsigned long start, size;
  302. struct memory_notify *arg;
  303. unsigned char id;
  304. int rc = 0;
  305. arg = data;
  306. start = arg->start_pfn << PAGE_SHIFT;
  307. size = arg->nr_pages << PAGE_SHIFT;
  308. mutex_lock(&sclp_mem_mutex);
  309. for_each_clear_bit(id, sclp_storage_ids, sclp_max_storage_id + 1)
  310. sclp_attach_storage(id);
  311. switch (action) {
  312. case MEM_GOING_OFFLINE:
  313. /*
  314. * We do not allow to set memory blocks offline that contain
  315. * standby memory. This is done to simplify the "memory online"
  316. * case.
  317. */
  318. if (contains_standby_increment(start, start + size))
  319. rc = -EPERM;
  320. break;
  321. case MEM_ONLINE:
  322. case MEM_CANCEL_OFFLINE:
  323. break;
  324. case MEM_GOING_ONLINE:
  325. rc = sclp_mem_change_state(start, size, 1);
  326. break;
  327. case MEM_CANCEL_ONLINE:
  328. sclp_mem_change_state(start, size, 0);
  329. break;
  330. case MEM_OFFLINE:
  331. sclp_mem_change_state(start, size, 0);
  332. break;
  333. default:
  334. rc = -EINVAL;
  335. break;
  336. }
  337. if (!rc)
  338. sclp_mem_state_changed = 1;
  339. mutex_unlock(&sclp_mem_mutex);
  340. return rc ? NOTIFY_BAD : NOTIFY_OK;
  341. }
  342. static struct notifier_block sclp_mem_nb = {
  343. .notifier_call = sclp_mem_notifier,
  344. };
  345. static void __init align_to_block_size(unsigned long long *start,
  346. unsigned long long *size,
  347. unsigned long long alignment)
  348. {
  349. unsigned long long start_align, size_align;
  350. start_align = roundup(*start, alignment);
  351. size_align = rounddown(*start + *size, alignment) - start_align;
  352. pr_info("Standby memory at 0x%llx (%lluM of %lluM usable)\n",
  353. *start, size_align >> 20, *size >> 20);
  354. *start = start_align;
  355. *size = size_align;
  356. }
  357. static void __init add_memory_merged(u16 rn)
  358. {
  359. unsigned long long start, size, addr, block_size;
  360. static u16 first_rn, num;
  361. if (rn && first_rn && (first_rn + num == rn)) {
  362. num++;
  363. return;
  364. }
  365. if (!first_rn)
  366. goto skip_add;
  367. start = rn2addr(first_rn);
  368. size = (unsigned long long) num * sclp.rzm;
  369. if (start >= VMEM_MAX_PHYS)
  370. goto skip_add;
  371. if (start + size > VMEM_MAX_PHYS)
  372. size = VMEM_MAX_PHYS - start;
  373. if (memory_end_set && (start >= memory_end))
  374. goto skip_add;
  375. if (memory_end_set && (start + size > memory_end))
  376. size = memory_end - start;
  377. block_size = memory_block_size_bytes();
  378. align_to_block_size(&start, &size, block_size);
  379. if (!size)
  380. goto skip_add;
  381. for (addr = start; addr < start + size; addr += block_size)
  382. add_memory(numa_pfn_to_nid(PFN_DOWN(addr)), addr, block_size);
  383. skip_add:
  384. first_rn = rn;
  385. num = 1;
  386. }
  387. static void __init sclp_add_standby_memory(void)
  388. {
  389. struct memory_increment *incr;
  390. list_for_each_entry(incr, &sclp_mem_list, list)
  391. if (incr->standby)
  392. add_memory_merged(incr->rn);
  393. add_memory_merged(0);
  394. }
  395. static void __init insert_increment(u16 rn, int standby, int assigned)
  396. {
  397. struct memory_increment *incr, *new_incr;
  398. struct list_head *prev;
  399. u16 last_rn;
  400. new_incr = kzalloc(sizeof(*new_incr), GFP_KERNEL);
  401. if (!new_incr)
  402. return;
  403. new_incr->rn = rn;
  404. new_incr->standby = standby;
  405. last_rn = 0;
  406. prev = &sclp_mem_list;
  407. list_for_each_entry(incr, &sclp_mem_list, list) {
  408. if (assigned && incr->rn > rn)
  409. break;
  410. if (!assigned && incr->rn - last_rn > 1)
  411. break;
  412. last_rn = incr->rn;
  413. prev = &incr->list;
  414. }
  415. if (!assigned)
  416. new_incr->rn = last_rn + 1;
  417. if (new_incr->rn > sclp.rnmax) {
  418. kfree(new_incr);
  419. return;
  420. }
  421. list_add(&new_incr->list, prev);
  422. }
  423. static int sclp_mem_freeze(struct device *dev)
  424. {
  425. if (!sclp_mem_state_changed)
  426. return 0;
  427. pr_err("Memory hotplug state changed, suspend refused.\n");
  428. return -EPERM;
  429. }
  430. struct read_storage_sccb {
  431. struct sccb_header header;
  432. u16 max_id;
  433. u16 assigned;
  434. u16 standby;
  435. u16 :16;
  436. u32 entries[0];
  437. } __packed;
  438. static const struct dev_pm_ops sclp_mem_pm_ops = {
  439. .freeze = sclp_mem_freeze,
  440. };
  441. static struct platform_driver sclp_mem_pdrv = {
  442. .driver = {
  443. .name = "sclp_mem",
  444. .pm = &sclp_mem_pm_ops,
  445. },
  446. };
  447. static int __init sclp_detect_standby_memory(void)
  448. {
  449. struct platform_device *sclp_pdev;
  450. struct read_storage_sccb *sccb;
  451. int i, id, assigned, rc;
  452. if (OLDMEM_BASE) /* No standby memory in kdump mode */
  453. return 0;
  454. if ((sclp.facilities & 0xe00000000000ULL) != 0xe00000000000ULL)
  455. return 0;
  456. rc = -ENOMEM;
  457. sccb = (void *) __get_free_page(GFP_KERNEL | GFP_DMA);
  458. if (!sccb)
  459. goto out;
  460. assigned = 0;
  461. for (id = 0; id <= sclp_max_storage_id; id++) {
  462. memset(sccb, 0, PAGE_SIZE);
  463. sccb->header.length = PAGE_SIZE;
  464. rc = sclp_sync_request(0x00040001 | id << 8, sccb);
  465. if (rc)
  466. goto out;
  467. switch (sccb->header.response_code) {
  468. case 0x0010:
  469. set_bit(id, sclp_storage_ids);
  470. for (i = 0; i < sccb->assigned; i++) {
  471. if (!sccb->entries[i])
  472. continue;
  473. assigned++;
  474. insert_increment(sccb->entries[i] >> 16, 0, 1);
  475. }
  476. break;
  477. case 0x0310:
  478. break;
  479. case 0x0410:
  480. for (i = 0; i < sccb->assigned; i++) {
  481. if (!sccb->entries[i])
  482. continue;
  483. assigned++;
  484. insert_increment(sccb->entries[i] >> 16, 1, 1);
  485. }
  486. break;
  487. default:
  488. rc = -EIO;
  489. break;
  490. }
  491. if (!rc)
  492. sclp_max_storage_id = sccb->max_id;
  493. }
  494. if (rc || list_empty(&sclp_mem_list))
  495. goto out;
  496. for (i = 1; i <= sclp.rnmax - assigned; i++)
  497. insert_increment(0, 1, 0);
  498. rc = register_memory_notifier(&sclp_mem_nb);
  499. if (rc)
  500. goto out;
  501. rc = platform_driver_register(&sclp_mem_pdrv);
  502. if (rc)
  503. goto out;
  504. sclp_pdev = platform_device_register_simple("sclp_mem", -1, NULL, 0);
  505. rc = PTR_ERR_OR_ZERO(sclp_pdev);
  506. if (rc)
  507. goto out_driver;
  508. sclp_add_standby_memory();
  509. goto out;
  510. out_driver:
  511. platform_driver_unregister(&sclp_mem_pdrv);
  512. out:
  513. free_page((unsigned long) sccb);
  514. return rc;
  515. }
  516. __initcall(sclp_detect_standby_memory);
  517. #endif /* CONFIG_MEMORY_HOTPLUG */
  518. /*
  519. * Channel path configuration related functions.
  520. */
  521. #define SCLP_CMDW_CONFIGURE_CHPATH 0x000f0001
  522. #define SCLP_CMDW_DECONFIGURE_CHPATH 0x000e0001
  523. #define SCLP_CMDW_READ_CHPATH_INFORMATION 0x00030001
  524. struct chp_cfg_sccb {
  525. struct sccb_header header;
  526. u8 ccm;
  527. u8 reserved[6];
  528. u8 cssid;
  529. } __attribute__((packed));
  530. static int do_chp_configure(sclp_cmdw_t cmd)
  531. {
  532. struct chp_cfg_sccb *sccb;
  533. int rc;
  534. if (!SCLP_HAS_CHP_RECONFIG)
  535. return -EOPNOTSUPP;
  536. /* Prepare sccb. */
  537. sccb = (struct chp_cfg_sccb *) get_zeroed_page(GFP_KERNEL | GFP_DMA);
  538. if (!sccb)
  539. return -ENOMEM;
  540. sccb->header.length = sizeof(*sccb);
  541. rc = sclp_sync_request(cmd, sccb);
  542. if (rc)
  543. goto out;
  544. switch (sccb->header.response_code) {
  545. case 0x0020:
  546. case 0x0120:
  547. case 0x0440:
  548. case 0x0450:
  549. break;
  550. default:
  551. pr_warn("configure channel-path failed (cmd=0x%08x, response=0x%04x)\n",
  552. cmd, sccb->header.response_code);
  553. rc = -EIO;
  554. break;
  555. }
  556. out:
  557. free_page((unsigned long) sccb);
  558. return rc;
  559. }
  560. /**
  561. * sclp_chp_configure - perform configure channel-path sclp command
  562. * @chpid: channel-path ID
  563. *
  564. * Perform configure channel-path command sclp command for specified chpid.
  565. * Return 0 after command successfully finished, non-zero otherwise.
  566. */
  567. int sclp_chp_configure(struct chp_id chpid)
  568. {
  569. return do_chp_configure(SCLP_CMDW_CONFIGURE_CHPATH | chpid.id << 8);
  570. }
  571. /**
  572. * sclp_chp_deconfigure - perform deconfigure channel-path sclp command
  573. * @chpid: channel-path ID
  574. *
  575. * Perform deconfigure channel-path command sclp command for specified chpid
  576. * and wait for completion. On success return 0. Return non-zero otherwise.
  577. */
  578. int sclp_chp_deconfigure(struct chp_id chpid)
  579. {
  580. return do_chp_configure(SCLP_CMDW_DECONFIGURE_CHPATH | chpid.id << 8);
  581. }
  582. struct chp_info_sccb {
  583. struct sccb_header header;
  584. u8 recognized[SCLP_CHP_INFO_MASK_SIZE];
  585. u8 standby[SCLP_CHP_INFO_MASK_SIZE];
  586. u8 configured[SCLP_CHP_INFO_MASK_SIZE];
  587. u8 ccm;
  588. u8 reserved[6];
  589. u8 cssid;
  590. } __attribute__((packed));
  591. /**
  592. * sclp_chp_read_info - perform read channel-path information sclp command
  593. * @info: resulting channel-path information data
  594. *
  595. * Perform read channel-path information sclp command and wait for completion.
  596. * On success, store channel-path information in @info and return 0. Return
  597. * non-zero otherwise.
  598. */
  599. int sclp_chp_read_info(struct sclp_chp_info *info)
  600. {
  601. struct chp_info_sccb *sccb;
  602. int rc;
  603. if (!SCLP_HAS_CHP_INFO)
  604. return -EOPNOTSUPP;
  605. /* Prepare sccb. */
  606. sccb = (struct chp_info_sccb *) get_zeroed_page(GFP_KERNEL | GFP_DMA);
  607. if (!sccb)
  608. return -ENOMEM;
  609. sccb->header.length = sizeof(*sccb);
  610. rc = sclp_sync_request(SCLP_CMDW_READ_CHPATH_INFORMATION, sccb);
  611. if (rc)
  612. goto out;
  613. if (sccb->header.response_code != 0x0010) {
  614. pr_warn("read channel-path info failed (response=0x%04x)\n",
  615. sccb->header.response_code);
  616. rc = -EIO;
  617. goto out;
  618. }
  619. memcpy(info->recognized, sccb->recognized, SCLP_CHP_INFO_MASK_SIZE);
  620. memcpy(info->standby, sccb->standby, SCLP_CHP_INFO_MASK_SIZE);
  621. memcpy(info->configured, sccb->configured, SCLP_CHP_INFO_MASK_SIZE);
  622. out:
  623. free_page((unsigned long) sccb);
  624. return rc;
  625. }