sclp_cmd.c 16 KB

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