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

1 // SPDX-License-Identifier: GPL-2.0
48 int rc; in sclp_sync_request_timeout() local
52 return -ENOMEM; in sclp_sync_request_timeout()
54 request->queue_timeout = timeout; in sclp_sync_request_timeout()
55 request->command = cmd; in sclp_sync_request_timeout()
56 request->sccb = sccb; in sclp_sync_request_timeout()
57 request->status = SCLP_REQ_FILLED; in sclp_sync_request_timeout()
58 request->callback = sclp_sync_callback; in sclp_sync_request_timeout()
59 request->callback_data = &completion; in sclp_sync_request_timeout()
63 rc = sclp_add_request(request); in sclp_sync_request_timeout()
64 if (rc) in sclp_sync_request_timeout()
69 if (request->status != SCLP_REQ_DONE) { in sclp_sync_request_timeout()
70 pr_warn("sync request failed (cmd=0x%08x, status=0x%02x)\n", in sclp_sync_request_timeout()
71 cmd, request->status); in sclp_sync_request_timeout()
72 rc = -EIO; in sclp_sync_request_timeout()
76 return rc; in sclp_sync_request_timeout()
88 int rc; in _sclp_get_core_info() local
93 return -EOPNOTSUPP; in _sclp_get_core_info()
97 return -ENOMEM; in _sclp_get_core_info()
98 sccb->header.length = length; in _sclp_get_core_info()
99 sccb->header.control_mask[2] = 0x80; in _sclp_get_core_info()
100 rc = sclp_sync_request_timeout(SCLP_CMDW_READ_CPU_INFO, sccb, in _sclp_get_core_info()
102 if (rc) in _sclp_get_core_info()
104 if (sccb->header.response_code != 0x0010) { in _sclp_get_core_info()
105 pr_warn("readcpuinfo failed (response=0x%04x)\n", in _sclp_get_core_info()
106 sccb->header.response_code); in _sclp_get_core_info()
107 rc = -EIO; in _sclp_get_core_info()
113 return rc; in _sclp_get_core_info()
123 int rc; in do_core_configure() local
126 return -EOPNOTSUPP; in do_core_configure()
133 return -ENOMEM; in do_core_configure()
134 sccb->header.length = sizeof(*sccb); in do_core_configure()
135 rc = sclp_sync_request_timeout(cmd, sccb, SCLP_QUEUE_INTERVAL); in do_core_configure()
136 if (rc) in do_core_configure()
138 switch (sccb->header.response_code) { in do_core_configure()
143 pr_warn("configure cpu failed (cmd=0x%08x, response=0x%04x)\n", in do_core_configure()
144 cmd, sccb->header.response_code); in do_core_configure()
145 rc = -EIO; in do_core_configure()
150 return rc; in do_core_configure()
190 return (unsigned long long) (rn - 1) * sclp.rzm; in rn2addr()
196 int rc; in do_assign_storage() local
200 return -ENOMEM; in do_assign_storage()
201 sccb->header.length = PAGE_SIZE; in do_assign_storage()
202 sccb->rn = rn; in do_assign_storage()
203 rc = sclp_sync_request_timeout(cmd, sccb, SCLP_QUEUE_INTERVAL); in do_assign_storage()
204 if (rc) in do_assign_storage()
206 switch (sccb->header.response_code) { in do_assign_storage()
211 pr_warn("assign storage failed (cmd=0x%08x, response=0x%04x, rn=0x%04x)\n", in do_assign_storage()
212 cmd, sccb->header.response_code, rn); in do_assign_storage()
213 rc = -EIO; in do_assign_storage()
218 return rc; in do_assign_storage()
224 int rc; in sclp_assign_storage() local
226 rc = do_assign_storage(0x000d0001, rn); in sclp_assign_storage()
227 if (rc) in sclp_assign_storage()
228 return rc; in sclp_assign_storage()
250 int rc; in sclp_attach_storage() local
255 return -ENOMEM; in sclp_attach_storage()
256 sccb->header.length = PAGE_SIZE; in sclp_attach_storage()
257 sccb->header.function_code = 0x40; in sclp_attach_storage()
258 rc = sclp_sync_request_timeout(0x00080001 | id << 8, sccb, in sclp_attach_storage()
260 if (rc) in sclp_attach_storage()
262 switch (sccb->header.response_code) { in sclp_attach_storage()
265 for (i = 0; i < sccb->assigned; i++) { in sclp_attach_storage()
266 if (sccb->entries[i]) in sclp_attach_storage()
267 sclp_unassign_storage(sccb->entries[i] >> 16); in sclp_attach_storage()
271 rc = -EIO; in sclp_attach_storage()
276 return rc; in sclp_attach_storage()
284 int rc = 0; in sclp_mem_change_state() local
287 istart = rn2addr(incr->rn); in sclp_mem_change_state()
288 if (start + size - 1 < istart) in sclp_mem_change_state()
290 if (start > istart + sclp.rzm - 1) in sclp_mem_change_state()
293 rc |= sclp_assign_storage(incr->rn); in sclp_mem_change_state()
295 sclp_unassign_storage(incr->rn); in sclp_mem_change_state()
296 if (rc == 0) in sclp_mem_change_state()
297 incr->standby = online ? 0 : 1; in sclp_mem_change_state()
299 return rc ? -EIO : 0; in sclp_mem_change_state()
308 istart = rn2addr(incr->rn); in contains_standby_increment()
309 if (end - 1 < istart) in contains_standby_increment()
311 if (start > istart + sclp.rzm - 1) in contains_standby_increment()
313 if (incr->standby) in contains_standby_increment()
325 int rc = 0; in sclp_mem_notifier() local
328 start = arg->start_pfn << PAGE_SHIFT; in sclp_mem_notifier()
329 size = arg->nr_pages << PAGE_SHIFT; in sclp_mem_notifier()
341 rc = -EPERM; in sclp_mem_notifier()
347 rc = sclp_mem_change_state(start, size, 1); in sclp_mem_notifier()
356 rc = -EINVAL; in sclp_mem_notifier()
360 return rc ? NOTIFY_BAD : NOTIFY_OK; in sclp_mem_notifier()
374 size_align = rounddown(*start + *size, alignment) - start_align; in align_to_block_size()
376 pr_info("Standby memory at 0x%llx (%lluM of %lluM usable)\n", in align_to_block_size()
398 size = VMEM_MAX_PHYS - start; in add_memory_merged()
402 size = ident_map_size - start; in add_memory_merged()
419 if (incr->standby) in sclp_add_standby_memory()
420 add_memory_merged(incr->rn); in sclp_add_standby_memory()
433 new_incr->rn = rn; in insert_increment()
434 new_incr->standby = standby; in insert_increment()
438 if (assigned && incr->rn > rn) in insert_increment()
440 if (!assigned && incr->rn - last_rn > 1) in insert_increment()
442 last_rn = incr->rn; in insert_increment()
443 prev = &incr->list; in insert_increment()
446 new_incr->rn = last_rn + 1; in insert_increment()
447 if (new_incr->rn > sclp.rnmax) { in insert_increment()
451 list_add(&new_incr->list, prev); in insert_increment()
457 int i, id, assigned, rc; in sclp_detect_standby_memory() local
463 rc = -ENOMEM; in sclp_detect_standby_memory()
470 sccb->header.length = PAGE_SIZE; in sclp_detect_standby_memory()
471 rc = sclp_sync_request(SCLP_CMDW_READ_STORAGE_INFO | id << 8, sccb); in sclp_detect_standby_memory()
472 if (rc) in sclp_detect_standby_memory()
474 switch (sccb->header.response_code) { in sclp_detect_standby_memory()
477 for (i = 0; i < sccb->assigned; i++) { in sclp_detect_standby_memory()
478 if (!sccb->entries[i]) in sclp_detect_standby_memory()
481 insert_increment(sccb->entries[i] >> 16, 0, 1); in sclp_detect_standby_memory()
487 for (i = 0; i < sccb->assigned; i++) { in sclp_detect_standby_memory()
488 if (!sccb->entries[i]) in sclp_detect_standby_memory()
491 insert_increment(sccb->entries[i] >> 16, 1, 1); in sclp_detect_standby_memory()
495 rc = -EIO; in sclp_detect_standby_memory()
498 if (!rc) in sclp_detect_standby_memory()
499 sclp_max_storage_id = sccb->max_id; in sclp_detect_standby_memory()
501 if (rc || list_empty(&sclp_mem_list)) in sclp_detect_standby_memory()
503 for (i = 1; i <= sclp.rnmax - assigned; i++) in sclp_detect_standby_memory()
505 rc = register_memory_notifier(&sclp_mem_nb); in sclp_detect_standby_memory()
506 if (rc) in sclp_detect_standby_memory()
511 return rc; in sclp_detect_standby_memory()
535 int rc; in do_chp_configure() local
538 return -EOPNOTSUPP; in do_chp_configure()
542 return -ENOMEM; in do_chp_configure()
543 sccb->header.length = sizeof(*sccb); in do_chp_configure()
544 rc = sclp_sync_request(cmd, sccb); in do_chp_configure()
545 if (rc) in do_chp_configure()
547 switch (sccb->header.response_code) { in do_chp_configure()
554 pr_warn("configure channel-path failed (cmd=0x%08x, response=0x%04x)\n", in do_chp_configure()
555 cmd, sccb->header.response_code); in do_chp_configure()
556 rc = -EIO; in do_chp_configure()
561 return rc; in do_chp_configure()
565 * sclp_chp_configure - perform configure channel-path sclp command
566 * @chpid: channel-path ID
568 * Perform configure channel-path command sclp command for specified chpid.
569 * Return 0 after command successfully finished, non-zero otherwise.
577 * sclp_chp_deconfigure - perform deconfigure channel-path sclp command
578 * @chpid: channel-path ID
580 * Perform deconfigure channel-path command sclp command for specified chpid
581 * and wait for completion. On success return 0. Return non-zero otherwise.
599 * sclp_chp_read_info - perform read channel-path information sclp command
600 * @info: resulting channel-path information data
602 * Perform read channel-path information sclp command and wait for completion.
603 * On success, store channel-path information in @info and return 0. Return
604 * non-zero otherwise.
609 int rc; in sclp_chp_read_info() local
612 return -EOPNOTSUPP; in sclp_chp_read_info()
616 return -ENOMEM; in sclp_chp_read_info()
617 sccb->header.length = sizeof(*sccb); in sclp_chp_read_info()
618 rc = sclp_sync_request(SCLP_CMDW_READ_CHPATH_INFORMATION, sccb); in sclp_chp_read_info()
619 if (rc) in sclp_chp_read_info()
621 if (sccb->header.response_code != 0x0010) { in sclp_chp_read_info()
622 pr_warn("read channel-path info failed (response=0x%04x)\n", in sclp_chp_read_info()
623 sccb->header.response_code); in sclp_chp_read_info()
624 rc = -EIO; in sclp_chp_read_info()
627 memcpy(info->recognized, sccb->recognized, SCLP_CHP_INFO_MASK_SIZE); in sclp_chp_read_info()
628 memcpy(info->standby, sccb->standby, SCLP_CHP_INFO_MASK_SIZE); in sclp_chp_read_info()
629 memcpy(info->configured, sccb->configured, SCLP_CHP_INFO_MASK_SIZE); in sclp_chp_read_info()
632 return rc; in sclp_chp_read_info()