1 /* 2 * SCSI helpers 3 * 4 * Copyright 2017 Red Hat, Inc. 5 * 6 * Authors: 7 * Fam Zheng <famz@redhat.com> 8 * Paolo Bonzini <pbonzini@redhat.com> 9 * 10 * This program is free software; you can redistribute it and/or modify it 11 * under the terms of the GNU General Public License as published by the Free 12 * Software Foundation; either version 2 of the License, or (at your option) 13 * any later version. 14 */ 15 16 #include "qemu/osdep.h" 17 #include "scsi/constants.h" 18 #include "scsi/utils.h" 19 #include "qemu/bswap.h" 20 21 uint32_t scsi_data_cdb_xfer(uint8_t *buf) 22 { 23 if ((buf[0] >> 5) == 0 && buf[4] == 0) { 24 return 256; 25 } else { 26 return scsi_cdb_xfer(buf); 27 } 28 } 29 30 uint32_t scsi_cdb_xfer(uint8_t *buf) 31 { 32 switch (buf[0] >> 5) { 33 case 0: 34 return buf[4]; 35 break; 36 case 1: 37 case 2: 38 return lduw_be_p(&buf[7]); 39 break; 40 case 4: 41 return ldl_be_p(&buf[10]) & 0xffffffffULL; 42 break; 43 case 5: 44 return ldl_be_p(&buf[6]) & 0xffffffffULL; 45 break; 46 default: 47 return -1; 48 } 49 } 50 51 uint64_t scsi_cmd_lba(SCSICommand *cmd) 52 { 53 uint8_t *buf = cmd->buf; 54 uint64_t lba; 55 56 switch (buf[0] >> 5) { 57 case 0: 58 lba = ldl_be_p(&buf[0]) & 0x1fffff; 59 break; 60 case 1: 61 case 2: 62 case 5: 63 lba = ldl_be_p(&buf[2]) & 0xffffffffULL; 64 break; 65 case 4: 66 lba = ldq_be_p(&buf[2]); 67 break; 68 default: 69 lba = -1; 70 71 } 72 return lba; 73 } 74 75 int scsi_cdb_length(uint8_t *buf) 76 { 77 int cdb_len; 78 79 switch (buf[0] >> 5) { 80 case 0: 81 cdb_len = 6; 82 break; 83 case 1: 84 case 2: 85 cdb_len = 10; 86 break; 87 case 4: 88 cdb_len = 16; 89 break; 90 case 5: 91 cdb_len = 12; 92 break; 93 default: 94 cdb_len = -1; 95 } 96 return cdb_len; 97 } 98 99 int scsi_build_sense(uint8_t *buf, SCSISense sense) 100 { 101 memset(buf, 0, 18); 102 buf[0] = 0x70; 103 buf[2] = sense.key; 104 buf[7] = 10; 105 buf[12] = sense.asc; 106 buf[13] = sense.ascq; 107 return 18; 108 } 109 110 /* 111 * Predefined sense codes 112 */ 113 114 /* No sense data available */ 115 const struct SCSISense sense_code_NO_SENSE = { 116 .key = NO_SENSE , .asc = 0x00 , .ascq = 0x00 117 }; 118 119 /* LUN not ready, Manual intervention required */ 120 const struct SCSISense sense_code_LUN_NOT_READY = { 121 .key = NOT_READY, .asc = 0x04, .ascq = 0x03 122 }; 123 124 /* LUN not ready, Medium not present */ 125 const struct SCSISense sense_code_NO_MEDIUM = { 126 .key = NOT_READY, .asc = 0x3a, .ascq = 0x00 127 }; 128 129 /* LUN not ready, medium removal prevented */ 130 const struct SCSISense sense_code_NOT_READY_REMOVAL_PREVENTED = { 131 .key = NOT_READY, .asc = 0x53, .ascq = 0x02 132 }; 133 134 /* Hardware error, internal target failure */ 135 const struct SCSISense sense_code_TARGET_FAILURE = { 136 .key = HARDWARE_ERROR, .asc = 0x44, .ascq = 0x00 137 }; 138 139 /* Illegal request, invalid command operation code */ 140 const struct SCSISense sense_code_INVALID_OPCODE = { 141 .key = ILLEGAL_REQUEST, .asc = 0x20, .ascq = 0x00 142 }; 143 144 /* Illegal request, LBA out of range */ 145 const struct SCSISense sense_code_LBA_OUT_OF_RANGE = { 146 .key = ILLEGAL_REQUEST, .asc = 0x21, .ascq = 0x00 147 }; 148 149 /* Illegal request, Invalid field in CDB */ 150 const struct SCSISense sense_code_INVALID_FIELD = { 151 .key = ILLEGAL_REQUEST, .asc = 0x24, .ascq = 0x00 152 }; 153 154 /* Illegal request, Invalid field in parameter list */ 155 const struct SCSISense sense_code_INVALID_PARAM = { 156 .key = ILLEGAL_REQUEST, .asc = 0x26, .ascq = 0x00 157 }; 158 159 /* Illegal request, Parameter list length error */ 160 const struct SCSISense sense_code_INVALID_PARAM_LEN = { 161 .key = ILLEGAL_REQUEST, .asc = 0x1a, .ascq = 0x00 162 }; 163 164 /* Illegal request, LUN not supported */ 165 const struct SCSISense sense_code_LUN_NOT_SUPPORTED = { 166 .key = ILLEGAL_REQUEST, .asc = 0x25, .ascq = 0x00 167 }; 168 169 /* Illegal request, Saving parameters not supported */ 170 const struct SCSISense sense_code_SAVING_PARAMS_NOT_SUPPORTED = { 171 .key = ILLEGAL_REQUEST, .asc = 0x39, .ascq = 0x00 172 }; 173 174 /* Illegal request, Incompatible medium installed */ 175 const struct SCSISense sense_code_INCOMPATIBLE_FORMAT = { 176 .key = ILLEGAL_REQUEST, .asc = 0x30, .ascq = 0x00 177 }; 178 179 /* Illegal request, medium removal prevented */ 180 const struct SCSISense sense_code_ILLEGAL_REQ_REMOVAL_PREVENTED = { 181 .key = ILLEGAL_REQUEST, .asc = 0x53, .ascq = 0x02 182 }; 183 184 /* Illegal request, Invalid Transfer Tag */ 185 const struct SCSISense sense_code_INVALID_TAG = { 186 .key = ILLEGAL_REQUEST, .asc = 0x4b, .ascq = 0x01 187 }; 188 189 /* Command aborted, I/O process terminated */ 190 const struct SCSISense sense_code_IO_ERROR = { 191 .key = ABORTED_COMMAND, .asc = 0x00, .ascq = 0x06 192 }; 193 194 /* Command aborted, I_T Nexus loss occurred */ 195 const struct SCSISense sense_code_I_T_NEXUS_LOSS = { 196 .key = ABORTED_COMMAND, .asc = 0x29, .ascq = 0x07 197 }; 198 199 /* Command aborted, Logical Unit failure */ 200 const struct SCSISense sense_code_LUN_FAILURE = { 201 .key = ABORTED_COMMAND, .asc = 0x3e, .ascq = 0x01 202 }; 203 204 /* Command aborted, Overlapped Commands Attempted */ 205 const struct SCSISense sense_code_OVERLAPPED_COMMANDS = { 206 .key = ABORTED_COMMAND, .asc = 0x4e, .ascq = 0x00 207 }; 208 209 /* Command aborted, LUN Communication Failure */ 210 const struct SCSISense sense_code_LUN_COMM_FAILURE = { 211 .key = ABORTED_COMMAND, .asc = 0x08, .ascq = 0x00 212 }; 213 214 /* Medium Error, Unrecovered read error */ 215 const struct SCSISense sense_code_READ_ERROR = { 216 .key = MEDIUM_ERROR, .asc = 0x11, .ascq = 0x00 217 }; 218 219 /* Not ready, Cause not reportable */ 220 const struct SCSISense sense_code_NOT_READY = { 221 .key = NOT_READY, .asc = 0x04, .ascq = 0x00 222 }; 223 224 /* Unit attention, Capacity data has changed */ 225 const struct SCSISense sense_code_CAPACITY_CHANGED = { 226 .key = UNIT_ATTENTION, .asc = 0x2a, .ascq = 0x09 227 }; 228 229 /* Unit attention, Power on, reset or bus device reset occurred */ 230 const struct SCSISense sense_code_RESET = { 231 .key = UNIT_ATTENTION, .asc = 0x29, .ascq = 0x00 232 }; 233 234 /* Unit attention, SCSI bus reset */ 235 const struct SCSISense sense_code_SCSI_BUS_RESET = { 236 .key = UNIT_ATTENTION, .asc = 0x29, .ascq = 0x02 237 }; 238 239 /* Unit attention, No medium */ 240 const struct SCSISense sense_code_UNIT_ATTENTION_NO_MEDIUM = { 241 .key = UNIT_ATTENTION, .asc = 0x3a, .ascq = 0x00 242 }; 243 244 /* Unit attention, Medium may have changed */ 245 const struct SCSISense sense_code_MEDIUM_CHANGED = { 246 .key = UNIT_ATTENTION, .asc = 0x28, .ascq = 0x00 247 }; 248 249 /* Unit attention, Reported LUNs data has changed */ 250 const struct SCSISense sense_code_REPORTED_LUNS_CHANGED = { 251 .key = UNIT_ATTENTION, .asc = 0x3f, .ascq = 0x0e 252 }; 253 254 /* Unit attention, Device internal reset */ 255 const struct SCSISense sense_code_DEVICE_INTERNAL_RESET = { 256 .key = UNIT_ATTENTION, .asc = 0x29, .ascq = 0x04 257 }; 258 259 /* Data Protection, Write Protected */ 260 const struct SCSISense sense_code_WRITE_PROTECTED = { 261 .key = DATA_PROTECT, .asc = 0x27, .ascq = 0x00 262 }; 263 264 /* Data Protection, Space Allocation Failed Write Protect */ 265 const struct SCSISense sense_code_SPACE_ALLOC_FAILED = { 266 .key = DATA_PROTECT, .asc = 0x27, .ascq = 0x07 267 }; 268 269 /* 270 * scsi_convert_sense 271 * 272 * Convert between fixed and descriptor sense buffers 273 */ 274 int scsi_convert_sense(uint8_t *in_buf, int in_len, 275 uint8_t *buf, int len, bool fixed) 276 { 277 bool fixed_in; 278 SCSISense sense; 279 if (!fixed && len < 8) { 280 return 0; 281 } 282 283 if (in_len == 0) { 284 sense.key = NO_SENSE; 285 sense.asc = 0; 286 sense.ascq = 0; 287 } else { 288 fixed_in = (in_buf[0] & 2) == 0; 289 290 if (fixed == fixed_in) { 291 memcpy(buf, in_buf, MIN(len, in_len)); 292 return MIN(len, in_len); 293 } 294 295 if (fixed_in) { 296 sense.key = in_buf[2]; 297 sense.asc = in_buf[12]; 298 sense.ascq = in_buf[13]; 299 } else { 300 sense.key = in_buf[1]; 301 sense.asc = in_buf[2]; 302 sense.ascq = in_buf[3]; 303 } 304 } 305 306 memset(buf, 0, len); 307 if (fixed) { 308 /* Return fixed format sense buffer */ 309 buf[0] = 0x70; 310 buf[2] = sense.key; 311 buf[7] = 10; 312 buf[12] = sense.asc; 313 buf[13] = sense.ascq; 314 return MIN(len, SCSI_SENSE_LEN); 315 } else { 316 /* Return descriptor format sense buffer */ 317 buf[0] = 0x72; 318 buf[1] = sense.key; 319 buf[2] = sense.asc; 320 buf[3] = sense.ascq; 321 return 8; 322 } 323 } 324 325 int scsi_sense_to_errno(int key, int asc, int ascq) 326 { 327 switch (key) { 328 case 0x00: /* NO SENSE */ 329 case 0x01: /* RECOVERED ERROR */ 330 case 0x06: /* UNIT ATTENTION */ 331 /* These sense keys are not errors */ 332 return 0; 333 case 0x0b: /* COMMAND ABORTED */ 334 return ECANCELED; 335 case 0x02: /* NOT READY */ 336 case 0x05: /* ILLEGAL REQUEST */ 337 case 0x07: /* DATA PROTECTION */ 338 /* Parse ASCQ */ 339 break; 340 default: 341 return EIO; 342 } 343 switch ((asc << 8) | ascq) { 344 case 0x1a00: /* PARAMETER LIST LENGTH ERROR */ 345 case 0x2000: /* INVALID OPERATION CODE */ 346 case 0x2400: /* INVALID FIELD IN CDB */ 347 case 0x2600: /* INVALID FIELD IN PARAMETER LIST */ 348 return EINVAL; 349 case 0x2100: /* LBA OUT OF RANGE */ 350 case 0x2707: /* SPACE ALLOC FAILED */ 351 return ENOSPC; 352 case 0x2500: /* LOGICAL UNIT NOT SUPPORTED */ 353 return ENOTSUP; 354 case 0x3a00: /* MEDIUM NOT PRESENT */ 355 case 0x3a01: /* MEDIUM NOT PRESENT TRAY CLOSED */ 356 case 0x3a02: /* MEDIUM NOT PRESENT TRAY OPEN */ 357 return ENOMEDIUM; 358 case 0x2700: /* WRITE PROTECTED */ 359 return EACCES; 360 case 0x0401: /* NOT READY, IN PROGRESS OF BECOMING READY */ 361 return EAGAIN; 362 case 0x0402: /* NOT READY, INITIALIZING COMMAND REQUIRED */ 363 return ENOTCONN; 364 default: 365 return EIO; 366 } 367 } 368 369 int scsi_sense_buf_to_errno(const uint8_t *sense, size_t sense_size) 370 { 371 int key, asc, ascq; 372 if (sense_size < 1) { 373 return EIO; 374 } 375 switch (sense[0]) { 376 case 0x70: /* Fixed format sense data. */ 377 if (sense_size < 14) { 378 return EIO; 379 } 380 key = sense[2] & 0xF; 381 asc = sense[12]; 382 ascq = sense[13]; 383 break; 384 case 0x72: /* Descriptor format sense data. */ 385 if (sense_size < 4) { 386 return EIO; 387 } 388 key = sense[1] & 0xF; 389 asc = sense[2]; 390 ascq = sense[3]; 391 break; 392 default: 393 return EIO; 394 break; 395 } 396 return scsi_sense_to_errno(key, asc, ascq); 397 } 398 399 const char *scsi_command_name(uint8_t cmd) 400 { 401 static const char *names[] = { 402 [ TEST_UNIT_READY ] = "TEST_UNIT_READY", 403 [ REWIND ] = "REWIND", 404 [ REQUEST_SENSE ] = "REQUEST_SENSE", 405 [ FORMAT_UNIT ] = "FORMAT_UNIT", 406 [ READ_BLOCK_LIMITS ] = "READ_BLOCK_LIMITS", 407 [ REASSIGN_BLOCKS ] = "REASSIGN_BLOCKS/INITIALIZE ELEMENT STATUS", 408 /* LOAD_UNLOAD and INITIALIZE_ELEMENT_STATUS use the same operation code */ 409 [ READ_6 ] = "READ_6", 410 [ WRITE_6 ] = "WRITE_6", 411 [ SET_CAPACITY ] = "SET_CAPACITY", 412 [ READ_REVERSE ] = "READ_REVERSE", 413 [ WRITE_FILEMARKS ] = "WRITE_FILEMARKS", 414 [ SPACE ] = "SPACE", 415 [ INQUIRY ] = "INQUIRY", 416 [ RECOVER_BUFFERED_DATA ] = "RECOVER_BUFFERED_DATA", 417 [ MAINTENANCE_IN ] = "MAINTENANCE_IN", 418 [ MAINTENANCE_OUT ] = "MAINTENANCE_OUT", 419 [ MODE_SELECT ] = "MODE_SELECT", 420 [ RESERVE ] = "RESERVE", 421 [ RELEASE ] = "RELEASE", 422 [ COPY ] = "COPY", 423 [ ERASE ] = "ERASE", 424 [ MODE_SENSE ] = "MODE_SENSE", 425 [ START_STOP ] = "START_STOP/LOAD_UNLOAD", 426 /* LOAD_UNLOAD and START_STOP use the same operation code */ 427 [ RECEIVE_DIAGNOSTIC ] = "RECEIVE_DIAGNOSTIC", 428 [ SEND_DIAGNOSTIC ] = "SEND_DIAGNOSTIC", 429 [ ALLOW_MEDIUM_REMOVAL ] = "ALLOW_MEDIUM_REMOVAL", 430 [ READ_CAPACITY_10 ] = "READ_CAPACITY_10", 431 [ READ_10 ] = "READ_10", 432 [ WRITE_10 ] = "WRITE_10", 433 [ SEEK_10 ] = "SEEK_10/POSITION_TO_ELEMENT", 434 /* SEEK_10 and POSITION_TO_ELEMENT use the same operation code */ 435 [ WRITE_VERIFY_10 ] = "WRITE_VERIFY_10", 436 [ VERIFY_10 ] = "VERIFY_10", 437 [ SEARCH_HIGH ] = "SEARCH_HIGH", 438 [ SEARCH_EQUAL ] = "SEARCH_EQUAL", 439 [ SEARCH_LOW ] = "SEARCH_LOW", 440 [ SET_LIMITS ] = "SET_LIMITS", 441 [ PRE_FETCH ] = "PRE_FETCH/READ_POSITION", 442 /* READ_POSITION and PRE_FETCH use the same operation code */ 443 [ SYNCHRONIZE_CACHE ] = "SYNCHRONIZE_CACHE", 444 [ LOCK_UNLOCK_CACHE ] = "LOCK_UNLOCK_CACHE", 445 [ READ_DEFECT_DATA ] = "READ_DEFECT_DATA/INITIALIZE_ELEMENT_STATUS_WITH_RANGE", 446 /* READ_DEFECT_DATA and INITIALIZE_ELEMENT_STATUS_WITH_RANGE use the same operation code */ 447 [ MEDIUM_SCAN ] = "MEDIUM_SCAN", 448 [ COMPARE ] = "COMPARE", 449 [ COPY_VERIFY ] = "COPY_VERIFY", 450 [ WRITE_BUFFER ] = "WRITE_BUFFER", 451 [ READ_BUFFER ] = "READ_BUFFER", 452 [ UPDATE_BLOCK ] = "UPDATE_BLOCK", 453 [ READ_LONG_10 ] = "READ_LONG_10", 454 [ WRITE_LONG_10 ] = "WRITE_LONG_10", 455 [ CHANGE_DEFINITION ] = "CHANGE_DEFINITION", 456 [ WRITE_SAME_10 ] = "WRITE_SAME_10", 457 [ UNMAP ] = "UNMAP", 458 [ READ_TOC ] = "READ_TOC", 459 [ REPORT_DENSITY_SUPPORT ] = "REPORT_DENSITY_SUPPORT", 460 [ SANITIZE ] = "SANITIZE", 461 [ GET_CONFIGURATION ] = "GET_CONFIGURATION", 462 [ LOG_SELECT ] = "LOG_SELECT", 463 [ LOG_SENSE ] = "LOG_SENSE", 464 [ MODE_SELECT_10 ] = "MODE_SELECT_10", 465 [ RESERVE_10 ] = "RESERVE_10", 466 [ RELEASE_10 ] = "RELEASE_10", 467 [ MODE_SENSE_10 ] = "MODE_SENSE_10", 468 [ PERSISTENT_RESERVE_IN ] = "PERSISTENT_RESERVE_IN", 469 [ PERSISTENT_RESERVE_OUT ] = "PERSISTENT_RESERVE_OUT", 470 [ WRITE_FILEMARKS_16 ] = "WRITE_FILEMARKS_16", 471 [ EXTENDED_COPY ] = "EXTENDED_COPY", 472 [ ATA_PASSTHROUGH_16 ] = "ATA_PASSTHROUGH_16", 473 [ ACCESS_CONTROL_IN ] = "ACCESS_CONTROL_IN", 474 [ ACCESS_CONTROL_OUT ] = "ACCESS_CONTROL_OUT", 475 [ READ_16 ] = "READ_16", 476 [ COMPARE_AND_WRITE ] = "COMPARE_AND_WRITE", 477 [ WRITE_16 ] = "WRITE_16", 478 [ WRITE_VERIFY_16 ] = "WRITE_VERIFY_16", 479 [ VERIFY_16 ] = "VERIFY_16", 480 [ PRE_FETCH_16 ] = "PRE_FETCH_16", 481 [ SYNCHRONIZE_CACHE_16 ] = "SPACE_16/SYNCHRONIZE_CACHE_16", 482 /* SPACE_16 and SYNCHRONIZE_CACHE_16 use the same operation code */ 483 [ LOCATE_16 ] = "LOCATE_16", 484 [ WRITE_SAME_16 ] = "ERASE_16/WRITE_SAME_16", 485 /* ERASE_16 and WRITE_SAME_16 use the same operation code */ 486 [ SERVICE_ACTION_IN_16 ] = "SERVICE_ACTION_IN_16", 487 [ WRITE_LONG_16 ] = "WRITE_LONG_16", 488 [ REPORT_LUNS ] = "REPORT_LUNS", 489 [ ATA_PASSTHROUGH_12 ] = "BLANK/ATA_PASSTHROUGH_12", 490 [ MOVE_MEDIUM ] = "MOVE_MEDIUM", 491 [ EXCHANGE_MEDIUM ] = "EXCHANGE MEDIUM", 492 [ READ_12 ] = "READ_12", 493 [ WRITE_12 ] = "WRITE_12", 494 [ ERASE_12 ] = "ERASE_12/GET_PERFORMANCE", 495 /* ERASE_12 and GET_PERFORMANCE use the same operation code */ 496 [ SERVICE_ACTION_IN_12 ] = "SERVICE_ACTION_IN_12", 497 [ WRITE_VERIFY_12 ] = "WRITE_VERIFY_12", 498 [ VERIFY_12 ] = "VERIFY_12", 499 [ SEARCH_HIGH_12 ] = "SEARCH_HIGH_12", 500 [ SEARCH_EQUAL_12 ] = "SEARCH_EQUAL_12", 501 [ SEARCH_LOW_12 ] = "SEARCH_LOW_12", 502 [ READ_ELEMENT_STATUS ] = "READ_ELEMENT_STATUS", 503 [ SEND_VOLUME_TAG ] = "SEND_VOLUME_TAG/SET_STREAMING", 504 /* SEND_VOLUME_TAG and SET_STREAMING use the same operation code */ 505 [ READ_CD ] = "READ_CD", 506 [ READ_DEFECT_DATA_12 ] = "READ_DEFECT_DATA_12", 507 [ READ_DVD_STRUCTURE ] = "READ_DVD_STRUCTURE", 508 [ RESERVE_TRACK ] = "RESERVE_TRACK", 509 [ SEND_CUE_SHEET ] = "SEND_CUE_SHEET", 510 [ SEND_DVD_STRUCTURE ] = "SEND_DVD_STRUCTURE", 511 [ SET_CD_SPEED ] = "SET_CD_SPEED", 512 [ SET_READ_AHEAD ] = "SET_READ_AHEAD", 513 [ ALLOW_OVERWRITE ] = "ALLOW_OVERWRITE", 514 [ MECHANISM_STATUS ] = "MECHANISM_STATUS", 515 [ GET_EVENT_STATUS_NOTIFICATION ] = "GET_EVENT_STATUS_NOTIFICATION", 516 [ READ_DISC_INFORMATION ] = "READ_DISC_INFORMATION", 517 }; 518 519 if (cmd >= ARRAY_SIZE(names) || names[cmd] == NULL) { 520 return "*UNKNOWN*"; 521 } 522 return names[cmd]; 523 } 524 525 #ifdef CONFIG_LINUX 526 int sg_io_sense_from_errno(int errno_value, struct sg_io_hdr *io_hdr, 527 SCSISense *sense) 528 { 529 if (errno_value != 0) { 530 switch (errno_value) { 531 case EDOM: 532 return TASK_SET_FULL; 533 case ENOMEM: 534 *sense = SENSE_CODE(TARGET_FAILURE); 535 return CHECK_CONDITION; 536 default: 537 *sense = SENSE_CODE(IO_ERROR); 538 return CHECK_CONDITION; 539 } 540 } else { 541 if (io_hdr->host_status == SG_ERR_DID_NO_CONNECT || 542 io_hdr->host_status == SG_ERR_DID_BUS_BUSY || 543 io_hdr->host_status == SG_ERR_DID_TIME_OUT || 544 (io_hdr->driver_status & SG_ERR_DRIVER_TIMEOUT)) { 545 return BUSY; 546 } else if (io_hdr->host_status) { 547 *sense = SENSE_CODE(I_T_NEXUS_LOSS); 548 return CHECK_CONDITION; 549 } else if (io_hdr->status) { 550 return io_hdr->status; 551 } else if (io_hdr->driver_status & SG_ERR_DRIVER_SENSE) { 552 return CHECK_CONDITION; 553 } else { 554 return GOOD; 555 } 556 } 557 } 558 #endif 559