Lines Matching +full:x +full:- +full:rc

1 // SPDX-License-Identifier: GPL-2.0
49 int rc; in sclp_sync_request_timeout() local
53 return -ENOMEM; in sclp_sync_request_timeout()
55 request->queue_timeout = timeout; in sclp_sync_request_timeout()
56 request->command = cmd; in sclp_sync_request_timeout()
57 request->sccb = sccb; in sclp_sync_request_timeout()
58 request->status = SCLP_REQ_FILLED; in sclp_sync_request_timeout()
59 request->callback = sclp_sync_callback; in sclp_sync_request_timeout()
60 request->callback_data = &completion; in sclp_sync_request_timeout()
64 rc = sclp_add_request(request); in sclp_sync_request_timeout()
65 if (rc) in sclp_sync_request_timeout()
70 if (request->status != SCLP_REQ_DONE) { in sclp_sync_request_timeout()
71 pr_warn("sync request failed (cmd=0x%08x, status=0x%02x)\n", in sclp_sync_request_timeout()
72 cmd, request->status); in sclp_sync_request_timeout()
73 rc = -EIO; in sclp_sync_request_timeout()
77 return rc; in sclp_sync_request_timeout()
89 int rc; in _sclp_get_core_info() local
94 return -EOPNOTSUPP; in _sclp_get_core_info()
98 return -ENOMEM; in _sclp_get_core_info()
99 sccb->header.length = length; in _sclp_get_core_info()
100 sccb->header.control_mask[2] = 0x80; in _sclp_get_core_info()
101 rc = sclp_sync_request_timeout(SCLP_CMDW_READ_CPU_INFO, sccb, in _sclp_get_core_info()
103 if (rc) in _sclp_get_core_info()
105 if (sccb->header.response_code != 0x0010) { in _sclp_get_core_info()
106 pr_warn("readcpuinfo failed (response=0x%04x)\n", in _sclp_get_core_info()
107 sccb->header.response_code); in _sclp_get_core_info()
108 rc = -EIO; in _sclp_get_core_info()
114 return rc; in _sclp_get_core_info()
124 int rc; in do_core_configure() local
127 return -EOPNOTSUPP; in do_core_configure()
134 return -ENOMEM; in do_core_configure()
135 sccb->header.length = sizeof(*sccb); in do_core_configure()
136 rc = sclp_sync_request_timeout(cmd, sccb, SCLP_QUEUE_INTERVAL); in do_core_configure()
137 if (rc) in do_core_configure()
139 switch (sccb->header.response_code) { in do_core_configure()
144 pr_warn("configure cpu failed (cmd=0x%08x, response=0x%04x)\n", in do_core_configure()
145 cmd, sccb->header.response_code); in do_core_configure()
146 rc = -EIO; in do_core_configure()
151 return rc; in do_core_configure()
191 return (unsigned long long) (rn - 1) * sclp.rzm; in rn2addr()
197 int rc; in do_assign_storage() local
201 return -ENOMEM; in do_assign_storage()
202 sccb->header.length = PAGE_SIZE; in do_assign_storage()
203 sccb->rn = rn; in do_assign_storage()
204 rc = sclp_sync_request_timeout(cmd, sccb, SCLP_QUEUE_INTERVAL); in do_assign_storage()
205 if (rc) in do_assign_storage()
207 switch (sccb->header.response_code) { in do_assign_storage()
212 pr_warn("assign storage failed (cmd=0x%08x, response=0x%04x, rn=0x%04x)\n", in do_assign_storage()
213 cmd, sccb->header.response_code, rn); in do_assign_storage()
214 rc = -EIO; in do_assign_storage()
219 return rc; in do_assign_storage()
225 int rc; in sclp_assign_storage() local
227 rc = do_assign_storage(0x000d0001, rn); in sclp_assign_storage()
228 if (rc) in sclp_assign_storage()
229 return rc; in sclp_assign_storage()
251 int rc; in sclp_attach_storage() local
256 return -ENOMEM; in sclp_attach_storage()
257 sccb->header.length = PAGE_SIZE; in sclp_attach_storage()
258 sccb->header.function_code = 0x40; in sclp_attach_storage()
259 rc = sclp_sync_request_timeout(0x00080001 | id << 8, sccb, in sclp_attach_storage()
261 if (rc) in sclp_attach_storage()
263 switch (sccb->header.response_code) { in sclp_attach_storage()
266 for (i = 0; i < sccb->assigned; i++) { in sclp_attach_storage()
267 if (sccb->entries[i]) in sclp_attach_storage()
268 sclp_unassign_storage(sccb->entries[i] >> 16); in sclp_attach_storage()
272 rc = -EIO; in sclp_attach_storage()
277 return rc; in sclp_attach_storage()
285 int rc = 0; in sclp_mem_change_state() local
288 istart = rn2addr(incr->rn); in sclp_mem_change_state()
289 if (start + size - 1 < istart) in sclp_mem_change_state()
291 if (start > istart + sclp.rzm - 1) in sclp_mem_change_state()
294 rc |= sclp_assign_storage(incr->rn); in sclp_mem_change_state()
296 sclp_unassign_storage(incr->rn); in sclp_mem_change_state()
297 if (rc == 0) in sclp_mem_change_state()
298 incr->standby = online ? 0 : 1; in sclp_mem_change_state()
300 return rc ? -EIO : 0; in sclp_mem_change_state()
309 istart = rn2addr(incr->rn); in contains_standby_increment()
310 if (end - 1 < istart) in contains_standby_increment()
312 if (start > istart + sclp.rzm - 1) in contains_standby_increment()
314 if (incr->standby) in contains_standby_increment()
326 int rc = 0; in sclp_mem_notifier() local
329 start = arg->start_pfn << PAGE_SHIFT; in sclp_mem_notifier()
330 size = arg->nr_pages << PAGE_SHIFT; in sclp_mem_notifier()
342 rc = -EPERM; in sclp_mem_notifier()
348 rc = sclp_mem_change_state(start, size, 1); in sclp_mem_notifier()
357 rc = -EINVAL; in sclp_mem_notifier()
361 return rc ? NOTIFY_BAD : NOTIFY_OK; in sclp_mem_notifier()
375 size_align = rounddown(*start + *size, alignment) - start_align; in align_to_block_size()
377 pr_info("Standby memory at 0x%llx (%lluM of %lluM usable)\n", in align_to_block_size()
399 size = VMEM_MAX_PHYS - start; in add_memory_merged()
403 size = ident_map_size - start; in add_memory_merged()
420 if (incr->standby) in sclp_add_standby_memory()
421 add_memory_merged(incr->rn); in sclp_add_standby_memory()
434 new_incr->rn = rn; in insert_increment()
435 new_incr->standby = standby; in insert_increment()
439 if (assigned && incr->rn > rn) in insert_increment()
441 if (!assigned && incr->rn - last_rn > 1) in insert_increment()
443 last_rn = incr->rn; in insert_increment()
444 prev = &incr->list; in insert_increment()
447 new_incr->rn = last_rn + 1; in insert_increment()
448 if (new_incr->rn > sclp.rnmax) { in insert_increment()
452 list_add(&new_incr->list, prev); in insert_increment()
458 int i, id, assigned, rc; in sclp_detect_standby_memory() local
464 rc = -ENOMEM; in sclp_detect_standby_memory()
471 sccb->header.length = PAGE_SIZE; in sclp_detect_standby_memory()
472 rc = sclp_sync_request(SCLP_CMDW_READ_STORAGE_INFO | id << 8, sccb); in sclp_detect_standby_memory()
473 if (rc) in sclp_detect_standby_memory()
475 switch (sccb->header.response_code) { in sclp_detect_standby_memory()
478 for (i = 0; i < sccb->assigned; i++) { in sclp_detect_standby_memory()
479 if (!sccb->entries[i]) in sclp_detect_standby_memory()
482 insert_increment(sccb->entries[i] >> 16, 0, 1); in sclp_detect_standby_memory()
488 for (i = 0; i < sccb->assigned; i++) { in sclp_detect_standby_memory()
489 if (!sccb->entries[i]) in sclp_detect_standby_memory()
492 insert_increment(sccb->entries[i] >> 16, 1, 1); in sclp_detect_standby_memory()
496 rc = -EIO; in sclp_detect_standby_memory()
499 if (!rc) in sclp_detect_standby_memory()
500 sclp_max_storage_id = sccb->max_id; in sclp_detect_standby_memory()
502 if (rc || list_empty(&sclp_mem_list)) in sclp_detect_standby_memory()
504 for (i = 1; i <= sclp.rnmax - assigned; i++) in sclp_detect_standby_memory()
506 rc = register_memory_notifier(&sclp_mem_nb); in sclp_detect_standby_memory()
507 if (rc) in sclp_detect_standby_memory()
512 return rc; in sclp_detect_standby_memory()
536 int rc; in do_chp_configure() local
539 return -EOPNOTSUPP; in do_chp_configure()
543 return -ENOMEM; in do_chp_configure()
544 sccb->header.length = sizeof(*sccb); in do_chp_configure()
545 rc = sclp_sync_request(cmd, sccb); in do_chp_configure()
546 if (rc) in do_chp_configure()
548 switch (sccb->header.response_code) { in do_chp_configure()
555 pr_warn("configure channel-path failed (cmd=0x%08x, response=0x%04x)\n", in do_chp_configure()
556 cmd, sccb->header.response_code); in do_chp_configure()
557 rc = -EIO; in do_chp_configure()
562 return rc; in do_chp_configure()
566 * sclp_chp_configure - perform configure channel-path sclp command
567 * @chpid: channel-path ID
569 * Perform configure channel-path command sclp command for specified chpid.
570 * Return 0 after command successfully finished, non-zero otherwise.
578 * sclp_chp_deconfigure - perform deconfigure channel-path sclp command
579 * @chpid: channel-path ID
581 * Perform deconfigure channel-path command sclp command for specified chpid
582 * and wait for completion. On success return 0. Return non-zero otherwise.
600 * sclp_chp_read_info - perform read channel-path information sclp command
601 * @info: resulting channel-path information data
603 * Perform read channel-path information sclp command and wait for completion.
604 * On success, store channel-path information in @info and return 0. Return
605 * non-zero otherwise.
610 int rc; in sclp_chp_read_info() local
613 return -EOPNOTSUPP; in sclp_chp_read_info()
617 return -ENOMEM; in sclp_chp_read_info()
618 sccb->header.length = sizeof(*sccb); in sclp_chp_read_info()
619 rc = sclp_sync_request(SCLP_CMDW_READ_CHPATH_INFORMATION, sccb); in sclp_chp_read_info()
620 if (rc) in sclp_chp_read_info()
622 if (sccb->header.response_code != 0x0010) { in sclp_chp_read_info()
623 pr_warn("read channel-path info failed (response=0x%04x)\n", in sclp_chp_read_info()
624 sccb->header.response_code); in sclp_chp_read_info()
625 rc = -EIO; in sclp_chp_read_info()
628 memcpy(info->recognized, sccb->recognized, SCLP_CHP_INFO_MASK_SIZE); in sclp_chp_read_info()
629 memcpy(info->standby, sccb->standby, SCLP_CHP_INFO_MASK_SIZE); in sclp_chp_read_info()
630 memcpy(info->configured, sccb->configured, SCLP_CHP_INFO_MASK_SIZE); in sclp_chp_read_info()
633 return rc; in sclp_chp_read_info()