Changeset df6ded8 in mainline for uspace/drv/block
- Timestamp:
- 2018-02-28T16:37:50Z (8 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 1b20da0
- Parents:
- f5e5f73 (diff), b2dca8de (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - git-author:
- Jakub Jermar <jakub@…> (2018-02-28 16:06:42)
- git-committer:
- Jakub Jermar <jakub@…> (2018-02-28 16:37:50)
- Location:
- uspace/drv/block/usbmast
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/block/usbmast/bo_trans.c
rf5e5f73 rdf6ded8 90 90 str_error(rc)); 91 91 if (rc != EOK) { 92 usb_log_error("Bulk out write failed: %s \n", str_error(rc));92 usb_log_error("Bulk out write failed: %s", str_error(rc)); 93 93 return EIO; 94 94 } … … 154 154 case cbs_failed: 155 155 cmd->status = CMDS_FAILED; 156 usb_log_error("CBS Failed. \n");156 usb_log_error("CBS Failed."); 157 157 break; 158 158 case cbs_phase_error: 159 usb_log_error("CBS phase error. \n");159 usb_log_error("CBS phase error."); 160 160 rc = EIO; 161 161 break; 162 162 default: 163 usb_log_error("CBS other error. \n");163 usb_log_error("CBS other error."); 164 164 rc = EIO; 165 165 break; … … 168 168 const size_t residue = uint32_usb2host(csw.dCSWDataResidue); 169 169 if (residue > dbuf_size) { 170 usb_log_error("Residue > buffer size (%zu > %zu). \n",170 usb_log_error("Residue > buffer size (%zu > %zu).", 171 171 residue, dbuf_size); 172 172 return EIO; -
uspace/drv/block/usbmast/main.c
rf5e5f73 rdf6ded8 2 2 * Copyright (c) 2011 Vojtech Horky 3 3 * Copyright (c) 2011 Jiri Svoboda 4 * Copyright (c) 2018 Ondrej Hlavaty 4 5 * All rights reserved. 5 6 * … … 156 157 usb_device_get_mapped_ep_desc(dev, &bulk_out_ep); 157 158 if (!epm_in || !epm_out || !epm_in->present || !epm_out->present) { 158 usb_log_error("Required EPs were not mapped. \n");159 usb_log_error("Required EPs were not mapped."); 159 160 return ENOENT; 160 161 } … … 163 164 mdev = usb_device_data_alloc(dev, sizeof(usbmast_dev_t)); 164 165 if (mdev == NULL) { 165 usb_log_error("Failed allocating softstate. \n");166 usb_log_error("Failed allocating softstate."); 166 167 return ENOMEM; 167 168 } … … 169 170 mdev->usb_dev = dev; 170 171 171 usb_log_info("Initializing mass storage `%s'. \n",172 usb_log_info("Initializing mass storage `%s'.", 172 173 usb_device_get_name(dev)); 173 usb_log_debug("Bulk in endpoint: %d [%zuB]. \n",174 epm_in->pipe. endpoint_no, epm_in->pipe.max_packet_size);175 usb_log_debug("Bulk out endpoint: %d [%zuB]. \n",176 epm_out->pipe. endpoint_no, epm_out->pipe.max_packet_size);177 178 usb_log_debug("Get LUN count... \n");174 usb_log_debug("Bulk in endpoint: %d [%zuB].", 175 epm_in->pipe.desc.endpoint_no, epm_in->pipe.desc.max_transfer_size); 176 usb_log_debug("Bulk out endpoint: %d [%zuB].", 177 epm_out->pipe.desc.endpoint_no, epm_out->pipe.desc.max_transfer_size); 178 179 usb_log_debug("Get LUN count..."); 179 180 mdev->lun_count = usb_masstor_get_lun_count(mdev); 180 181 mdev->luns = calloc(mdev->lun_count, sizeof(ddf_fun_t*)); 181 182 if (mdev->luns == NULL) { 182 rc = ENOMEM; 183 usb_log_error("Failed allocating luns table.\n"); 184 goto error; 183 usb_log_error("Failed allocating luns table."); 184 return ENOMEM; 185 185 } 186 186 … … 226 226 227 227 if (asprintf(&fun_name, "l%u", lun) < 0) { 228 usb_log_error("Out of memory. \n");228 usb_log_error("Out of memory."); 229 229 rc = ENOMEM; 230 230 goto error; … … 233 233 fun = usb_device_ddf_fun_create(mdev->usb_dev, fun_exposed, fun_name); 234 234 if (fun == NULL) { 235 usb_log_error("Failed to create DDF function %s. \n", fun_name);235 usb_log_error("Failed to create DDF function %s.", fun_name); 236 236 rc = ENOMEM; 237 237 goto error; … … 241 241 mfun = ddf_fun_data_alloc(fun, sizeof(usbmast_fun_t)); 242 242 if (mfun == NULL) { 243 usb_log_error("Failed allocating softstate. \n");243 usb_log_error("Failed allocating softstate."); 244 244 rc = ENOMEM; 245 245 goto error; … … 257 257 ddf_fun_set_conn_handler(fun, usbmast_bd_connection); 258 258 259 usb_log_debug("Inquire... \n");259 usb_log_debug("Inquire..."); 260 260 usbmast_inquiry_data_t inquiry; 261 261 rc = usbmast_inquiry(mfun, &inquiry); 262 262 if (rc != EOK) { 263 usb_log_warning("Failed to inquire device `%s': %s. \n",263 usb_log_warning("Failed to inquire device `%s': %s.", 264 264 usb_device_get_name(mdev->usb_dev), str_error(rc)); 265 265 rc = EIO; … … 281 281 rc = usbmast_read_capacity(mfun, &nblocks, &block_size); 282 282 if (rc != EOK) { 283 usb_log_warning("Failed to read capacity, device `%s': %s. \n",283 usb_log_warning("Failed to read capacity, device `%s': %s.", 284 284 usb_device_get_name(mdev->usb_dev), str_error(rc)); 285 285 rc = EIO; … … 295 295 rc = ddf_fun_bind(fun); 296 296 if (rc != EOK) { 297 usb_log_error("Failed to bind DDF function %s: %s. \n",297 usb_log_error("Failed to bind DDF function %s: %s.", 298 298 fun_name, str_error(rc)); 299 299 goto error; … … 390 390 static const usb_driver_ops_t usbmast_driver_ops = { 391 391 .device_add = usbmast_device_add, 392 .device_rem = usbmast_device_remove,392 .device_remove = usbmast_device_remove, 393 393 .device_gone = usbmast_device_gone, 394 394 }; -
uspace/drv/block/usbmast/scsi_ms.c
rf5e5f73 rdf6ded8 2 2 * Copyright (c) 2011 Vojtech Horky 3 3 * Copyright (c) 2011 Jiri Svoboda 4 * Copyright (c) 2018 Ondrej Hlavaty 4 5 * All rights reserved. 5 6 * … … 87 88 rc = usb_massstor_cmd(mfun, 0xDEADBEEF, &cmd); 88 89 89 if (rc != EOK) {90 if (rc != EOK) { 90 91 usb_log_error("Test Unit Ready failed on device %s: %s.", 91 usb_device_get_name(mfun->mdev->usb_dev), str_error(rc));92 usb_device_get_name(mfun->mdev->usb_dev), str_error(rc)); 92 93 return rc; 93 94 } … … 97 98 if (cmd.status != CMDS_GOOD) 98 99 usb_log_warning("Test Unit Ready command failed on device %s.", 99 usb_device_get_name(mfun->mdev->usb_dev));100 usb_device_get_name(mfun->mdev->usb_dev)); 100 101 101 102 return EOK; … … 116 117 rc = usb_massstor_unit_ready(mfun); 117 118 if (rc != EOK) { 118 usb_log_error("Inquiry transport failed, device %s: %s. \n",119 usb_device_get_name(mfun->mdev->usb_dev), str_error(rc));119 usb_log_error("Inquiry transport failed, device %s: %s.", 120 usb_device_get_name(mfun->mdev->usb_dev), str_error(rc)); 120 121 return rc; 121 122 } … … 123 124 rc = usb_massstor_cmd(mfun, 0xDEADBEEF, cmd); 124 125 if (rc != EOK) { 125 usb_log_error("Inquiry transport failed, device %s: %s. \n",126 usb_device_get_name(mfun->mdev->usb_dev), str_error(rc));126 usb_log_error("Inquiry transport failed, device %s: %s.", 127 usb_device_get_name(mfun->mdev->usb_dev), str_error(rc)); 127 128 return rc; 128 129 } … … 131 132 return EOK; 132 133 133 usb_log_error("SCSI command failed, device %s. \n",134 usb_log_error("SCSI command failed, device %s.", 134 135 usb_device_get_name(mfun->mdev->usb_dev)); 135 136 136 137 rc = usbmast_request_sense(mfun, &sense_buf, sizeof(sense_buf)); 137 138 if (rc != EOK) { 138 usb_log_error("Failed to read sense data. \n");139 usb_log_error("Failed to read sense data."); 139 140 return EIO; 140 141 } … … 182 183 183 184 if (rc != EOK) { 184 usb_log_error("Inquiry transport failed, device %s: %s. \n",185 usb_device_get_name(mfun->mdev->usb_dev), str_error(rc));185 usb_log_error("Inquiry transport failed, device %s: %s.", 186 usb_device_get_name(mfun->mdev->usb_dev), str_error(rc)); 186 187 return rc; 187 188 } 188 189 189 190 if (cmd.status != CMDS_GOOD) { 190 usb_log_error("Inquiry command failed, device %s. \n",191 usb_device_get_name(mfun->mdev->usb_dev));191 usb_log_error("Inquiry command failed, device %s.", 192 usb_device_get_name(mfun->mdev->usb_dev)); 192 193 return EIO; 193 194 } 194 195 195 196 if (cmd.rcvd_size < SCSI_STD_INQUIRY_DATA_MIN_SIZE) { 196 usb_log_error("SCSI Inquiry response too short (%zu). \n",197 cmd.rcvd_size);197 usb_log_error("SCSI Inquiry response too short (%zu).", 198 cmd.rcvd_size); 198 199 return EIO; 199 200 } … … 249 250 rc = usb_massstor_cmd(mfun, 0xDEADBEEF, &cmd); 250 251 251 if (rc != EOK || cmd.status != CMDS_GOOD) {252 usb_log_error("Request Sense failed, device %s: %s. \n",253 usb_device_get_name(mfun->mdev->usb_dev), str_error(rc));252 if (rc != EOK || cmd.status != CMDS_GOOD) { 253 usb_log_error("Request Sense failed, device %s: %s.", 254 usb_device_get_name(mfun->mdev->usb_dev), str_error(rc)); 254 255 return rc; 255 256 } … … 291 292 rc = usbmast_run_cmd(mfun, &cmd); 292 293 293 if (rc != EOK) {294 usb_log_error("Read Capacity (10) transport failed, device %s: %s. \n",295 usb_device_get_name(mfun->mdev->usb_dev), str_error(rc));294 if (rc != EOK) { 295 usb_log_error("Read Capacity (10) transport failed, device %s: %s.", 296 usb_device_get_name(mfun->mdev->usb_dev), str_error(rc)); 296 297 return rc; 297 298 } 298 299 299 300 if (cmd.status != CMDS_GOOD) { 300 usb_log_error("Read Capacity (10) command failed, device %s. \n",301 usb_device_get_name(mfun->mdev->usb_dev));301 usb_log_error("Read Capacity (10) command failed, device %s.", 302 usb_device_get_name(mfun->mdev->usb_dev)); 302 303 return EIO; 303 304 } 304 305 305 306 if (cmd.rcvd_size < sizeof(data)) { 306 usb_log_error("SCSI Read Capacity response too short (%zu). \n",307 cmd.rcvd_size);307 usb_log_error("SCSI Read Capacity response too short (%zu).", 308 cmd.rcvd_size); 308 309 return EIO; 309 310 } … … 349 350 350 351 if (rc != EOK) { 351 usb_log_error("Read (10) transport failed, device %s: %s. \n",352 usb_device_get_name(mfun->mdev->usb_dev), str_error(rc));352 usb_log_error("Read (10) transport failed, device %s: %s.", 353 usb_device_get_name(mfun->mdev->usb_dev), str_error(rc)); 353 354 return rc; 354 355 } 355 356 356 357 if (cmd.status != CMDS_GOOD) { 357 usb_log_error("Read (10) command failed, device %s. \n",358 usb_device_get_name(mfun->mdev->usb_dev));358 usb_log_error("Read (10) command failed, device %s.", 359 usb_device_get_name(mfun->mdev->usb_dev)); 359 360 return EIO; 360 361 } 361 362 362 363 if (cmd.rcvd_size < nblocks * mfun->block_size) { 363 usb_log_error("SCSI Read response too short (%zu). \n",364 usb_log_error("SCSI Read response too short (%zu).", 364 365 cmd.rcvd_size); 365 366 return EIO; … … 404 405 rc = usbmast_run_cmd(mfun, &cmd); 405 406 406 if (rc != EOK) {407 usb_log_error("Write (10) transport failed, device %s: %s. \n",408 usb_device_get_name(mfun->mdev->usb_dev), str_error(rc));407 if (rc != EOK) { 408 usb_log_error("Write (10) transport failed, device %s: %s.", 409 usb_device_get_name(mfun->mdev->usb_dev), str_error(rc)); 409 410 return rc; 410 411 } 411 412 412 413 if (cmd.status != CMDS_GOOD) { 413 usb_log_error("Write (10) command failed, device %s. \n",414 usb_device_get_name(mfun->mdev->usb_dev));414 usb_log_error("Write (10) command failed, device %s.", 415 usb_device_get_name(mfun->mdev->usb_dev)); 415 416 return EIO; 416 417 } … … 449 450 const errno_t rc = usbmast_run_cmd(mfun, &cmd); 450 451 451 if (rc != EOK) {452 usb_log_error("Synchronize Cache (10) transport failed, device %s: %s. \n",453 usb_device_get_name(mfun->mdev->usb_dev), str_error(rc));452 if (rc != EOK) { 453 usb_log_error("Synchronize Cache (10) transport failed, device %s: %s.", 454 usb_device_get_name(mfun->mdev->usb_dev), str_error(rc)); 454 455 return rc; 455 456 } 456 457 457 458 if (cmd.status != CMDS_GOOD) { 458 usb_log_error("Synchronize Cache (10) command failed, device %s. \n",459 usb_device_get_name(mfun->mdev->usb_dev));459 usb_log_error("Synchronize Cache (10) command failed, device %s.", 460 usb_device_get_name(mfun->mdev->usb_dev)); 460 461 return EIO; 461 462 }
Note:
See TracChangeset
for help on using the changeset viewer.
