Index: head/sbin/camcontrol/camcontrol.8 =================================================================== --- head/sbin/camcontrol/camcontrol.8 +++ head/sbin/camcontrol/camcontrol.8 @@ -78,6 +78,7 @@ .Op Fl b .Op Fl h .Op Fl H +.Op Fl l .Op Fl N .Op Fl q .Op Fl s @@ -544,6 +545,11 @@ .Fl b . .It Fl H Print out the device size in human readable (base 10, 1K == 1000) format. +.It Fl l +Skip sending the SCSI READ CAPACITY (10) command. +Send only the SCSI READ CAPACITY (16) service action and report +its results. +When the two do not match, a quirk is needed to resolve the ambiguity. .It Fl N Print out the number of blocks in the device instead of the last logical block. Index: head/sbin/camcontrol/camcontrol.c =================================================================== --- head/sbin/camcontrol/camcontrol.c +++ head/sbin/camcontrol/camcontrol.c @@ -203,7 +203,7 @@ {"load", CAM_CMD_STARTSTOP, CAM_ARG_START_UNIT | CAM_ARG_EJECT, NULL}, {"eject", CAM_CMD_STARTSTOP, CAM_ARG_EJECT, NULL}, {"reportluns", CAM_CMD_REPORTLUNS, CAM_ARG_NONE, "clr:"}, - {"readcapacity", CAM_CMD_READCAP, CAM_ARG_NONE, "bhHNqs"}, + {"readcapacity", CAM_CMD_READCAP, CAM_ARG_NONE, "bhHlNqs"}, {"reprobe", CAM_CMD_REPROBE, CAM_ARG_NONE, NULL}, #endif /* MINIMALISTIC */ {"rescan", CAM_CMD_RESCAN, CAM_ARG_NONE, NULL}, @@ -7162,7 +7162,7 @@ char *combinedopt, int task_attr, int retry_count, int timeout) { union ccb *ccb; - int blocksizeonly, humanize, numblocks, quiet, sizeonly, baseten; + int blocksizeonly, humanize, numblocks, quiet, sizeonly, baseten, longonly; struct scsi_read_capacity_data rcap; struct scsi_read_capacity_data_long rcaplong; uint64_t maxsector; @@ -7172,6 +7172,7 @@ blocksizeonly = 0; humanize = 0; + longonly = 0; numblocks = 0; quiet = 0; sizeonly = 0; @@ -7200,6 +7201,9 @@ humanize++; baseten++; break; + case 'l': + longonly++; + break; case 'N': numblocks++; break; @@ -7242,6 +7246,9 @@ goto bailout; } + if (longonly != 0) + goto long_only; + scsi_read_capacity(&ccb->csio, /*retries*/ retry_count, /*cbfcnp*/ NULL, @@ -7284,6 +7291,7 @@ if (maxsector != 0xffffffff) goto do_print; +long_only: scsi_read_capacity_16(&ccb->csio, /*retries*/ retry_count, /*cbfcnp*/ NULL, @@ -9515,7 +9523,7 @@ " camcontrol identify [dev_id][generic args] [-v]\n" " camcontrol reportluns [dev_id][generic args] [-c] [-l] [-r report]\n" " camcontrol readcap [dev_id][generic args] [-b] [-h] [-H] [-N]\n" -" [-q] [-s]\n" +" [-q] [-s] [-l]\n" " camcontrol start [dev_id][generic args]\n" " camcontrol stop [dev_id][generic args]\n" " camcontrol load [dev_id][generic args]\n"