Date: Sat, 18 Dec 2010 06:51:48 +0000 (UTC) From: Alexander Motin <mav@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r216514 - in projects/graid/7: etc/mtree include lib/libcam sbin/atacontrol sbin/camcontrol share/man/man4 sys/cam sys/cam/ata sys/cam/scsi sys/conf sys/dev/ahci sys/dev/asr sys/dev/ata... Message-ID: <201012180651.oBI6pmb5059424@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mav Date: Sat Dec 18 06:51:48 2010 New Revision: 216514 URL: http://svn.freebsd.org/changeset/base/216514 Log: Sync CAM, ata(4), ahci(4), siis(4) and mvs(4) with HEAD around 2010-10. This should give people still using 7.x branch possibility to use new more reliable and functional CAM-based ATA instead of legacy ata(4). Some SCSI/RAID drivers were also updated to reflect CAM changes in bus scanning and support of the different transports/protocols, but not all of them. Due to many API/ABI changes this unlikely to be committed to 7-STABLE. Sponsored by: Cisco Added: projects/graid/7/share/man/man4/ada.4 (contents, props changed) projects/graid/7/share/man/man4/ahci.4 (contents, props changed) projects/graid/7/share/man/man4/mvs.4 (contents, props changed) projects/graid/7/share/man/man4/siis.4 (contents, props changed) projects/graid/7/sys/cam/ata/ projects/graid/7/sys/cam/ata/ata_all.c (contents, props changed) projects/graid/7/sys/cam/ata/ata_all.h (contents, props changed) projects/graid/7/sys/cam/ata/ata_da.c (contents, props changed) projects/graid/7/sys/cam/ata/ata_pmp.c (contents, props changed) projects/graid/7/sys/cam/ata/ata_xpt.c (contents, props changed) projects/graid/7/sys/cam/cam_xpt_internal.h (contents, props changed) projects/graid/7/sys/cam/scsi/scsi_xpt.c (contents, props changed) projects/graid/7/sys/dev/ahci/ projects/graid/7/sys/dev/ahci/ahci.c (contents, props changed) projects/graid/7/sys/dev/ahci/ahci.h (contents, props changed) projects/graid/7/sys/dev/ata/ata-sata.c (contents, props changed) projects/graid/7/sys/dev/ata/chipsets/ projects/graid/7/sys/dev/ata/chipsets/ata-acard.c (contents, props changed) projects/graid/7/sys/dev/ata/chipsets/ata-acerlabs.c (contents, props changed) projects/graid/7/sys/dev/ata/chipsets/ata-adaptec.c (contents, props changed) projects/graid/7/sys/dev/ata/chipsets/ata-ahci.c (contents, props changed) projects/graid/7/sys/dev/ata/chipsets/ata-amd.c (contents, props changed) projects/graid/7/sys/dev/ata/chipsets/ata-ati.c (contents, props changed) projects/graid/7/sys/dev/ata/chipsets/ata-cenatek.c (contents, props changed) projects/graid/7/sys/dev/ata/chipsets/ata-cypress.c (contents, props changed) projects/graid/7/sys/dev/ata/chipsets/ata-cyrix.c (contents, props changed) projects/graid/7/sys/dev/ata/chipsets/ata-highpoint.c (contents, props changed) projects/graid/7/sys/dev/ata/chipsets/ata-intel.c (contents, props changed) projects/graid/7/sys/dev/ata/chipsets/ata-ite.c (contents, props changed) projects/graid/7/sys/dev/ata/chipsets/ata-jmicron.c (contents, props changed) projects/graid/7/sys/dev/ata/chipsets/ata-marvell.c (contents, props changed) projects/graid/7/sys/dev/ata/chipsets/ata-micron.c (contents, props changed) projects/graid/7/sys/dev/ata/chipsets/ata-national.c (contents, props changed) projects/graid/7/sys/dev/ata/chipsets/ata-netcell.c (contents, props changed) projects/graid/7/sys/dev/ata/chipsets/ata-nvidia.c (contents, props changed) projects/graid/7/sys/dev/ata/chipsets/ata-promise.c (contents, props changed) projects/graid/7/sys/dev/ata/chipsets/ata-serverworks.c (contents, props changed) projects/graid/7/sys/dev/ata/chipsets/ata-siliconimage.c (contents, props changed) projects/graid/7/sys/dev/ata/chipsets/ata-sis.c (contents, props changed) projects/graid/7/sys/dev/ata/chipsets/ata-via.c (contents, props changed) projects/graid/7/sys/dev/mvs/ projects/graid/7/sys/dev/mvs/mvs.c (contents, props changed) projects/graid/7/sys/dev/mvs/mvs.h (contents, props changed) projects/graid/7/sys/dev/mvs/mvs_if.m (contents, props changed) projects/graid/7/sys/dev/mvs/mvs_pci.c (contents, props changed) projects/graid/7/sys/dev/mvs/mvs_soc.c (contents, props changed) projects/graid/7/sys/dev/siis/ projects/graid/7/sys/dev/siis/siis.c (contents, props changed) projects/graid/7/sys/dev/siis/siis.h (contents, props changed) projects/graid/7/sys/modules/ahci/ projects/graid/7/sys/modules/ahci/Makefile (contents, props changed) projects/graid/7/sys/modules/ata/atacore/ projects/graid/7/sys/modules/ata/atacore/Makefile (contents, props changed) projects/graid/7/sys/modules/ata/atadevel/ projects/graid/7/sys/modules/ata/atadevel/Makefile (contents, props changed) projects/graid/7/sys/modules/ata/atadevel/ata-devel.c (contents, props changed) projects/graid/7/sys/modules/ata/atapci/Makefile.inc (contents, props changed) projects/graid/7/sys/modules/ata/atapci/chipsets/ projects/graid/7/sys/modules/ata/atapci/chipsets/Makefile (contents, props changed) projects/graid/7/sys/modules/ata/atapci/chipsets/Makefile.inc (contents, props changed) projects/graid/7/sys/modules/ata/atapci/chipsets/ataacard/ projects/graid/7/sys/modules/ata/atapci/chipsets/ataacard/Makefile (contents, props changed) projects/graid/7/sys/modules/ata/atapci/chipsets/ataacerlabs/ projects/graid/7/sys/modules/ata/atapci/chipsets/ataacerlabs/Makefile (contents, props changed) projects/graid/7/sys/modules/ata/atapci/chipsets/ataadaptec/ projects/graid/7/sys/modules/ata/atapci/chipsets/ataadaptec/Makefile (contents, props changed) projects/graid/7/sys/modules/ata/atapci/chipsets/ataahci/ projects/graid/7/sys/modules/ata/atapci/chipsets/ataahci/Makefile (contents, props changed) projects/graid/7/sys/modules/ata/atapci/chipsets/ataamd/ projects/graid/7/sys/modules/ata/atapci/chipsets/ataamd/Makefile (contents, props changed) projects/graid/7/sys/modules/ata/atapci/chipsets/ataati/ projects/graid/7/sys/modules/ata/atapci/chipsets/ataati/Makefile (contents, props changed) projects/graid/7/sys/modules/ata/atapci/chipsets/atacenatek/ projects/graid/7/sys/modules/ata/atapci/chipsets/atacenatek/Makefile (contents, props changed) projects/graid/7/sys/modules/ata/atapci/chipsets/atacypress/ projects/graid/7/sys/modules/ata/atapci/chipsets/atacypress/Makefile (contents, props changed) projects/graid/7/sys/modules/ata/atapci/chipsets/atacyrix/ projects/graid/7/sys/modules/ata/atapci/chipsets/atacyrix/Makefile (contents, props changed) projects/graid/7/sys/modules/ata/atapci/chipsets/atahighpoint/ projects/graid/7/sys/modules/ata/atapci/chipsets/atahighpoint/Makefile (contents, props changed) projects/graid/7/sys/modules/ata/atapci/chipsets/ataintel/ projects/graid/7/sys/modules/ata/atapci/chipsets/ataintel/Makefile (contents, props changed) projects/graid/7/sys/modules/ata/atapci/chipsets/ataite/ projects/graid/7/sys/modules/ata/atapci/chipsets/ataite/Makefile (contents, props changed) projects/graid/7/sys/modules/ata/atapci/chipsets/atajmicron/ projects/graid/7/sys/modules/ata/atapci/chipsets/atajmicron/Makefile (contents, props changed) projects/graid/7/sys/modules/ata/atapci/chipsets/atamarvell/ projects/graid/7/sys/modules/ata/atapci/chipsets/atamarvell/Makefile (contents, props changed) projects/graid/7/sys/modules/ata/atapci/chipsets/atamicron/ projects/graid/7/sys/modules/ata/atapci/chipsets/atamicron/Makefile (contents, props changed) projects/graid/7/sys/modules/ata/atapci/chipsets/atanational/ projects/graid/7/sys/modules/ata/atapci/chipsets/atanational/Makefile (contents, props changed) projects/graid/7/sys/modules/ata/atapci/chipsets/atanetcell/ projects/graid/7/sys/modules/ata/atapci/chipsets/atanetcell/Makefile (contents, props changed) projects/graid/7/sys/modules/ata/atapci/chipsets/atanvidia/ projects/graid/7/sys/modules/ata/atapci/chipsets/atanvidia/Makefile (contents, props changed) projects/graid/7/sys/modules/ata/atapci/chipsets/atapromise/ projects/graid/7/sys/modules/ata/atapci/chipsets/atapromise/Makefile (contents, props changed) projects/graid/7/sys/modules/ata/atapci/chipsets/ataserverworks/ projects/graid/7/sys/modules/ata/atapci/chipsets/ataserverworks/Makefile (contents, props changed) projects/graid/7/sys/modules/ata/atapci/chipsets/atasiliconimage/ projects/graid/7/sys/modules/ata/atapci/chipsets/atasiliconimage/Makefile (contents, props changed) projects/graid/7/sys/modules/ata/atapci/chipsets/atasis/ projects/graid/7/sys/modules/ata/atapci/chipsets/atasis/Makefile (contents, props changed) projects/graid/7/sys/modules/ata/atapci/chipsets/atavia/ projects/graid/7/sys/modules/ata/atapci/chipsets/atavia/Makefile (contents, props changed) projects/graid/7/sys/modules/mvs/ projects/graid/7/sys/modules/mvs/Makefile (contents, props changed) projects/graid/7/sys/modules/siis/ projects/graid/7/sys/modules/siis/Makefile (contents, props changed) projects/graid/7/sys/powerpc/powermac/ata_dbdma.c (contents, props changed) projects/graid/7/sys/powerpc/powermac/ata_dbdma.h (contents, props changed) Deleted: projects/graid/7/sys/dev/ata/ata-chipset.c projects/graid/7/sys/dev/ata/ata-usb.c projects/graid/7/sys/modules/ata/ata/ projects/graid/7/sys/modules/ata/atausb/ Modified: projects/graid/7/etc/mtree/BSD.include.dist projects/graid/7/include/Makefile projects/graid/7/lib/libcam/Makefile projects/graid/7/lib/libcam/cam.3 projects/graid/7/lib/libcam/cam_cdbparse.3 projects/graid/7/lib/libcam/camlib.c projects/graid/7/sbin/atacontrol/atacontrol.c projects/graid/7/sbin/camcontrol/camcontrol.8 projects/graid/7/sbin/camcontrol/camcontrol.c projects/graid/7/sbin/camcontrol/modeedit.c projects/graid/7/share/man/man4/Makefile projects/graid/7/share/man/man4/ata.4 projects/graid/7/share/man/man4/scsi.4 projects/graid/7/sys/cam/cam.c projects/graid/7/sys/cam/cam.h projects/graid/7/sys/cam/cam_ccb.h projects/graid/7/sys/cam/cam_debug.h projects/graid/7/sys/cam/cam_periph.c projects/graid/7/sys/cam/cam_periph.h projects/graid/7/sys/cam/cam_queue.c projects/graid/7/sys/cam/cam_queue.h projects/graid/7/sys/cam/cam_sim.c projects/graid/7/sys/cam/cam_xpt.c projects/graid/7/sys/cam/cam_xpt.h projects/graid/7/sys/cam/cam_xpt_periph.h projects/graid/7/sys/cam/cam_xpt_sim.h projects/graid/7/sys/cam/scsi/scsi_all.c projects/graid/7/sys/cam/scsi/scsi_all.h projects/graid/7/sys/cam/scsi/scsi_cd.c projects/graid/7/sys/cam/scsi/scsi_ch.c projects/graid/7/sys/cam/scsi/scsi_ch.h projects/graid/7/sys/cam/scsi/scsi_da.c projects/graid/7/sys/cam/scsi/scsi_low.c projects/graid/7/sys/cam/scsi/scsi_pass.c projects/graid/7/sys/cam/scsi/scsi_pt.c projects/graid/7/sys/cam/scsi/scsi_sa.c projects/graid/7/sys/cam/scsi/scsi_ses.c projects/graid/7/sys/cam/scsi/scsi_sg.c projects/graid/7/sys/cam/scsi/scsi_targ_bh.c projects/graid/7/sys/cam/scsi/scsi_target.c projects/graid/7/sys/conf/files projects/graid/7/sys/conf/files.powerpc projects/graid/7/sys/conf/options projects/graid/7/sys/dev/asr/asr.c projects/graid/7/sys/dev/ata/ata-all.c projects/graid/7/sys/dev/ata/ata-all.h projects/graid/7/sys/dev/ata/ata-card.c projects/graid/7/sys/dev/ata/ata-cbus.c projects/graid/7/sys/dev/ata/ata-disk.c projects/graid/7/sys/dev/ata/ata-disk.h projects/graid/7/sys/dev/ata/ata-dma.c projects/graid/7/sys/dev/ata/ata-isa.c projects/graid/7/sys/dev/ata/ata-lowlevel.c projects/graid/7/sys/dev/ata/ata-pci.c projects/graid/7/sys/dev/ata/ata-pci.h projects/graid/7/sys/dev/ata/ata-queue.c projects/graid/7/sys/dev/ata/ata-raid.c projects/graid/7/sys/dev/ata/ata_if.m projects/graid/7/sys/dev/ata/atapi-cam.c projects/graid/7/sys/dev/ata/atapi-cd.c projects/graid/7/sys/dev/ata/atapi-fd.c projects/graid/7/sys/dev/ata/atapi-tape.c projects/graid/7/sys/dev/ciss/ciss.c projects/graid/7/sys/dev/hptiop/hptiop.c projects/graid/7/sys/dev/hptrr/hptrr_osm_bsd.c projects/graid/7/sys/dev/hptrr/os_bsd.h projects/graid/7/sys/dev/iscsi/initiator/isc_cam.c projects/graid/7/sys/dev/mly/mly.c projects/graid/7/sys/dev/mpt/mpt_cam.h projects/graid/7/sys/dev/mpt/mpt_raid.c projects/graid/7/sys/dev/ppbus/vpo.c projects/graid/7/sys/dev/trm/trm.c projects/graid/7/sys/dev/twa/tw_osl_cam.c projects/graid/7/sys/dev/usb/umass.c projects/graid/7/sys/geom/geom_disk.c projects/graid/7/sys/geom/geom_disk.h projects/graid/7/sys/modules/Makefile projects/graid/7/sys/modules/ata/Makefile projects/graid/7/sys/modules/ata/atapci/Makefile projects/graid/7/sys/modules/cam/Makefile projects/graid/7/sys/pc98/include/md_var.h projects/graid/7/sys/pc98/pc98/pc98_machdep.c projects/graid/7/sys/powerpc/powermac/ata_kauai.c projects/graid/7/sys/powerpc/powermac/ata_macio.c projects/graid/7/sys/powerpc/psim/ata_iobus.c projects/graid/7/sys/sparc64/include/md_var.h projects/graid/7/sys/sparc64/sparc64/ata_machdep.c projects/graid/7/sys/sys/ata.h projects/graid/7/sys/sys/bio.h Modified: projects/graid/7/etc/mtree/BSD.include.dist ============================================================================== --- projects/graid/7/etc/mtree/BSD.include.dist Sat Dec 18 02:54:51 2010 (r216513) +++ projects/graid/7/etc/mtree/BSD.include.dist Sat Dec 18 06:51:48 2010 (r216514) @@ -78,6 +78,8 @@ .. .. cam + ata + .. scsi .. .. Modified: projects/graid/7/include/Makefile ============================================================================== --- projects/graid/7/include/Makefile Sat Dec 18 02:54:51 2010 (r216513) +++ projects/graid/7/include/Makefile Sat Dec 18 06:51:48 2010 (r216514) @@ -41,7 +41,7 @@ LDIRS= bsm cam geom net net80211 netatal nfs nfsclient nfsserver \ pccard sys vm -LSUBDIRS= cam/scsi \ +LSUBDIRS= cam/ata cam/scsi \ dev/acpica dev/an dev/bktr dev/firewire dev/hwpmc \ dev/ic dev/iicbus ${_dev_ieee488} dev/lmc dev/mfi dev/ofw \ dev/pbio ${_dev_powermac_nvram} dev/ppbus dev/smbus \ Modified: projects/graid/7/lib/libcam/Makefile ============================================================================== --- projects/graid/7/lib/libcam/Makefile Sat Dec 18 02:54:51 2010 (r216513) +++ projects/graid/7/lib/libcam/Makefile Sat Dec 18 06:51:48 2010 (r216514) @@ -2,7 +2,8 @@ LIB= cam SHLIBDIR?= /lib -SRCS= camlib.c scsi_cmdparse.c scsi_all.c scsi_da.c scsi_sa.c cam.c +SRCS= camlib.c scsi_cmdparse.c scsi_all.c scsi_da.c scsi_sa.c cam.c \ + ata_all.c INCS= camlib.h DPADD= ${LIBSBUF} @@ -10,6 +11,7 @@ LDADD= -lsbuf MAN= cam.3 cam_cdbparse.3 +WARNS?= 2 MLINKS+= cam.3 cam_open_device.3 \ cam.3 cam_open_spec_device.3 \ @@ -34,7 +36,8 @@ MLINKS+= cam.3 cam_open_device.3 \ cam_cdbparse.3 csio_encode_visit.3 \ cam_cdbparse.3 buff_encode_visit.3 -.PATH: ${.CURDIR}/../../sys/cam/scsi ${.CURDIR}/../../sys/cam +.PATH: ${.CURDIR}/../../sys/cam/scsi ${.CURDIR}/../../sys/cam/ata \ + ${.CURDIR}/../../sys/cam SDIR= ${.CURDIR}/../../sys CFLAGS+= -I${.CURDIR} -I${SDIR} Modified: projects/graid/7/lib/libcam/cam.3 ============================================================================== --- projects/graid/7/lib/libcam/cam.3 Sat Dec 18 02:54:51 2010 (r216513) +++ projects/graid/7/lib/libcam/cam.3 Sat Dec 18 06:51:48 2010 (r216514) @@ -28,8 +28,8 @@ .\" $FreeBSD$ .\" .Dd October 10, 1998 -.Os .Dt CAM 3 +.Os .Sh NAME .Nm cam_open_device , .Nm cam_open_spec_device , @@ -190,12 +190,6 @@ into a device name and unit number. Once the device name and unit number are determined, a lookup is performed to determine the passthrough device that corresponds to the given device. -.Fn cam_open_device -is rather simple to use, but it is not really suitable for general use -because its behavior is not necessarily deterministic. -Programmers writing -new applications should make the extra effort to use one of the other open -routines documented below. .Pp .Fn cam_open_spec_device opens the @@ -354,19 +348,15 @@ respectively. can handle strings of the following forms, at least: .Pp .Bl -tag -width 1234 -compact -.It /dev/foo0a -.It /dev/foo1s2c +.It /dev/foo1 .It foo0 -.It foo0a -.It nfoo0 +.It nsa2 .El .Pp .Fn cam_get_device is provided as a convenience function for applications that need to provide functionality similar to .Fn cam_open_device . -Programmers are encouraged to use more deterministic methods of obtaining -device names and unit numbers if possible. .Sh RETURN VALUES .Fn cam_open_device , .Fn cam_open_spec_device , @@ -382,7 +372,7 @@ returns an allocated and partially initi of the CCB failed. .Pp .Fn cam_send_ccb -returns a value of -1 if an error occured, and +returns a value of -1 if an error occurred, and .Va errno is set to indicate the error. .Pp Modified: projects/graid/7/lib/libcam/cam_cdbparse.3 ============================================================================== --- projects/graid/7/lib/libcam/cam_cdbparse.3 Sat Dec 18 02:54:51 2010 (r216513) +++ projects/graid/7/lib/libcam/cam_cdbparse.3 Sat Dec 18 06:51:48 2010 (r216514) @@ -62,8 +62,8 @@ .\" .\" .Dd October 13, 1998 -.Os .Dt CAM_CDBPARSE 3 +.Os .Sh NAME .Nm csio_build , .Nm csio_build_visit , @@ -258,7 +258,6 @@ typedef enum { Multiple flags should be ORed together. Any of the CCB flags may be used, although it is worth noting several important ones here: -.Pp .Bl -tag -width CAM_PASS_ERR_RECOVER .It Dv CAM_DIR_IN This indicates that the operation in question is a read operation. Modified: projects/graid/7/lib/libcam/camlib.c ============================================================================== --- projects/graid/7/lib/libcam/camlib.c Sat Dec 18 02:54:51 2010 (r216513) +++ projects/graid/7/lib/libcam/camlib.c Sat Dec 18 06:51:48 2010 (r216514) @@ -42,14 +42,9 @@ __FBSDID("$FreeBSD$"); #include <cam/scsi/scsi_pass.h> #include "camlib.h" -struct cam_devequiv { - char *given_dev; - char *real_dev; -}; -struct cam_devequiv devmatchtable[] = { - {"sd", "da"}, - {"st", "sa"} +static const char *nonrewind_devs[] = { + "sa" }; char cam_errbuf[CAM_ERRBUF_SIZE]; @@ -103,19 +98,14 @@ cam_freeccb(union ccb *ccb) /* * Take a device name or path passed in by the user, and attempt to figure * out the device name and unit number. Some possible device name formats are: - * /dev/foo0a - * /dev/rfoo0a - * /dev/rfoos2c + * /dev/foo0 * foo0 - * foo0a - * rfoo0 - * rfoo0a - * nrfoo0 - * - * If the caller passes in an old style device name like 'sd' or 'st', - * it will be converted to the new style device name based upon devmatchtable - * above. + * nfoo0 * + * Some peripheral drivers create separate device nodes with 'n' prefix for + * non-rewind operations. Currently only sa(4) tape driver has this feature. + * We extract pure peripheral name as device name for this special case. + * * Input parameters: device name/path, length of devname string * Output: device name, unit number * Return values: returns 0 for success, -1 for failure @@ -127,7 +117,7 @@ cam_get_device(const char *path, char *d char *tmpstr, *tmpstr2; char *newpath; int unit_offset; - int i, found = 0; + int i; if (path == NULL) { @@ -142,10 +132,6 @@ cam_get_device(const char *path, char *d newpath = (char *)strdup(path); tmpstr = newpath; - /* Get rid of any leading white space */ - while (isspace(*tmpstr) && (*tmpstr != '\0')) - tmpstr++; - /* * Check to see whether we have an absolute pathname. */ @@ -166,61 +152,22 @@ cam_get_device(const char *path, char *d * Check to see whether the user has given us a nonrewound tape * device. */ - if (*tmpstr == 'n') - tmpstr++; - - if (*tmpstr == '\0') { - sprintf(cam_errbuf, "%s: no text after leading 'n'", func_name); - free(newpath); - return(-1); - } - - /* - * See if the user has given us a character device. - */ - if (*tmpstr == 'r') - tmpstr++; - - if (*tmpstr == '\0') { - sprintf(cam_errbuf, "%s: no text after leading 'r'", func_name); - free(newpath); - return(-1); - } - - /* - * Try to get rid of any trailing white space or partition letters. - */ - tmpstr2 = &tmpstr[strlen(tmpstr) - 1]; - - while ((*tmpstr2 != '\0') && (tmpstr2 > tmpstr) &&(!isdigit(*tmpstr2))){ - *tmpstr2 = '\0'; - tmpstr2--; - } - - /* - * Check to see whether we have been given a partition with a slice - * name. If so, get rid of the slice name/number. - */ - if (strlen(tmpstr) > 3) { - /* - * Basically, we're looking for a string that ends in the - * following general manner: 1s1 -- a number, the letter - * s, and then another number. This indicates that the - * user has given us a slice. We substitute nulls for the - * s and the slice number. - */ - if ((isdigit(tmpstr[strlen(tmpstr) - 1])) - && (tmpstr[strlen(tmpstr) - 2] == 's') - && (isdigit(tmpstr[strlen(tmpstr) - 3]))) { - tmpstr[strlen(tmpstr) - 1] = '\0'; - tmpstr[strlen(tmpstr) - 1] = '\0'; + if (*tmpstr == 'n' || *tmpstr == 'e') { + for (i = 0; i < sizeof(nonrewind_devs)/sizeof(char *); i++) { + int len = strlen(nonrewind_devs[i]); + if (strncmp(tmpstr + 1, nonrewind_devs[i], len) == 0) { + if (isdigit(tmpstr[len + 1])) { + tmpstr++; + break; + } + } } } /* - * After we nuke off the slice, we should have just a device name - * and unit number. That means there must be at least 2 - * characters. If we only have 1, we don't have a valid device name. + * We should now have just a device name and unit number. + * That means that there must be at least 2 characters. + * If we only have 1, we don't have a valid device name. */ if (strlen(tmpstr) < 2) { sprintf(cam_errbuf, @@ -281,20 +228,7 @@ cam_get_device(const char *path, char *d */ tmpstr[strlen(tmpstr) - unit_offset] = '\0'; - /* - * Look through our equivalency table and see if the device name - * the user gave us is an old style device name. If so, translate - * it to the new style device name. - */ - for (i = 0;i < (sizeof(devmatchtable)/sizeof(struct cam_devequiv));i++){ - if (strcmp(tmpstr, devmatchtable[i].given_dev) == 0) { - strlcpy(dev_name,devmatchtable[i].real_dev, devnamelen); - found = 1; - break; - } - } - if (found == 0) - strlcpy(dev_name, tmpstr, devnamelen); + strlcpy(dev_name, tmpstr, devnamelen); /* Clean up allocated memory */ free(newpath); Modified: projects/graid/7/sbin/atacontrol/atacontrol.c ============================================================================== --- projects/graid/7/sbin/atacontrol/atacontrol.c Sat Dec 18 02:54:51 2010 (r216513) +++ projects/graid/7/sbin/atacontrol/atacontrol.c Sat Dec 18 06:51:48 2010 (r216514) @@ -42,7 +42,7 @@ static const char * mode2str(int mode) { - switch (mode) { + switch (mode & 0xff) { case ATA_PIO: return "BIOSPIO"; case ATA_PIO0: return "PIO0"; case ATA_PIO1: return "PIO1"; @@ -59,16 +59,24 @@ mode2str(int mode) case ATA_UDMA4: return "UDMA66"; case ATA_UDMA5: return "UDMA100"; case ATA_UDMA6: return "UDMA133"; - case ATA_SA150: return "SATA150"; - case ATA_SA300: return "SATA300"; - case ATA_USB: return "USB"; - case ATA_USB1: return "USB1"; - case ATA_USB2: return "USB2"; case ATA_DMA: return "BIOSDMA"; default: return "???"; } } +static const char * +satarev2str(int mode) +{ + switch ((mode & 0xff00) >> 8) { + case 0: return ""; + case 1: return "SATA 1.5Gb/s"; + case 2: return "SATA 3Gb/s"; + case 3: return "SATA 6Gb/s"; + case 0xff: return "SATA"; + default: return "???"; + } +} + static int str2mode(char *str) { @@ -82,7 +90,9 @@ str2mode(char *str) if (!strcasecmp(str, "WDMA1")) return ATA_WDMA1; if (!strcasecmp(str, "WDMA2")) return ATA_WDMA2; if (!strcasecmp(str, "UDMA0")) return ATA_UDMA0; + if (!strcasecmp(str, "UDMA16")) return ATA_UDMA0; if (!strcasecmp(str, "UDMA1")) return ATA_UDMA1; + if (!strcasecmp(str, "UDMA25")) return ATA_UDMA1; if (!strcasecmp(str, "UDMA2")) return ATA_UDMA2; if (!strcasecmp(str, "UDMA33")) return ATA_UDMA2; if (!strcasecmp(str, "UDMA3")) return ATA_UDMA3; @@ -93,11 +103,6 @@ str2mode(char *str) if (!strcasecmp(str, "UDMA100")) return ATA_UDMA5; if (!strcasecmp(str, "UDMA6")) return ATA_UDMA6; if (!strcasecmp(str, "UDMA133")) return ATA_UDMA6; - if (!strcasecmp(str, "SATA150")) return ATA_SA150; - if (!strcasecmp(str, "SATA300")) return ATA_SA300; - if (!strcasecmp(str, "USB")) return ATA_USB; - if (!strcasecmp(str, "USB1")) return ATA_USB1; - if (!strcasecmp(str, "USB2")) return ATA_USB2; if (!strcasecmp(str, "BIOSDMA")) return ATA_DMA; return -1; } @@ -388,7 +393,8 @@ main(int argc, char **argv) if (argc == 3 || argc == 4) { if (ioctl(fd, IOCATAGMODE, &mode) < 0) err(1, "ioctl(IOCATAGMODE)"); - printf("current mode = %s\n", mode2str(mode)); + printf("current mode = %s %s\n", + mode2str(mode), satarev2str(mode)); } exit(EX_OK); } Modified: projects/graid/7/sbin/camcontrol/camcontrol.8 ============================================================================== --- projects/graid/7/sbin/camcontrol/camcontrol.8 Sat Dec 18 02:54:51 2010 (r216513) +++ projects/graid/7/sbin/camcontrol/camcontrol.8 Sat Dec 18 06:51:48 2010 (r216514) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 21, 2006 +.Dd July 1, 2010 .Dt CAMCONTROL 8 .Os .Sh NAME @@ -59,6 +59,11 @@ .Op Fl S .Op Fl R .Nm +.Ic identify +.Op device id +.Op generic args +.Op Fl v +.Nm .Ic reportluns .Op device id .Op generic args @@ -116,10 +121,14 @@ .Ic cmd .Op device id .Op generic args +.Aq Fl a Ar cmd Op args .Aq Fl c Ar cmd Op args +.Op Fl d +.Op Fl f .Op Fl i Ar len Ar fmt .Bk -words .Op Fl o Ar len Ar fmt Op args +.Op Fl r Ar fmt .Ek .Nm .Ic debug @@ -143,6 +152,7 @@ .Op generic args .Op Fl c .Op Fl D Ar enable|disable +.Op Fl M Ar mode .Op Fl O Ar offset .Op Fl q .Op Fl R Ar syncrate @@ -159,6 +169,20 @@ .Op Fl w .Op Fl y .Nm +.Ic idle +.Op device id +.Op generic args +.Op Fl t Ar time +.Nm +.Ic standby +.Op device id +.Op generic args +.Op Fl t Ar time +.Nm +.Ic sleep +.Op device id +.Op generic args +.Nm .Ic help .Sh DESCRIPTION The @@ -283,6 +307,8 @@ This is to aid in script writing. .It Fl R Print out transfer rate information. .El +.It Ic identify +Send a ATA identify command (0xec) to a device. .It Ic reportluns Send the SCSI REPORT LUNS (0xA0) command to the given device. By default, @@ -480,26 +506,36 @@ Saved values .El .El .It Ic cmd -Allows the user to send an arbitrary SCSI CDB to any device. +Allows the user to send an arbitrary ATA or SCSI CDB to any device. The .Ic cmd function requires the .Fl c -argument to specify the CDB. +argument to specify SCSI CDB or the +.Fl a +argument to specify ATA Command Block registers values. Other arguments are optional, depending on the command type. The command and data specification syntax is documented in .Xr cam_cdbparse 3 . -NOTE: If the CDB specified causes data to be transfered to or from the +NOTE: If the CDB specified causes data to be transferred to or from the SCSI device in question, you MUST specify either .Fl i or .Fl o . .Bl -tag -width 17n +.It Fl a Ar cmd Op args +This specifies the content of 12 ATA Command Block registers (command, +features, lba_low, lba_mid, lba_high, device, lba_low_exp, lba_mid_exp. +lba_high_exp, features_exp, sector_count, sector_count_exp). .It Fl c Ar cmd Op args This specifies the SCSI CDB. -CDBs may be 6, 10, 12 or 16 bytes. +SCSI CDBs may be 6, 10, 12 or 16 bytes. +.It Fl d +Specifies DMA protocol to be used for ATA command. +.It Fl f +Specifies FPDMA (NCQ) protocol to be used for ATA command. .It Fl i Ar len Ar fmt This specifies the amount of data to read, and how it should be displayed. If the format is @@ -513,6 +549,13 @@ If the format is .Sq - , .Ar len bytes of data will be read from standard input and written to the device. +.It Fl r Ar fmt +This specifies that 11 result ATA Command Block registers should be displayed +(status, error, lba_low, lba_mid, lba_high, device, lba_low_exp, lba_mid_exp, +lba_high_exp, sector_count, sector_count_exp), and how. +If the format is +.Sq - , +11 result registers will be written to standard output in hex. .El .It Ic debug Turn on CAM debugging printfs in the kernel. @@ -670,6 +713,8 @@ Show or set current negotiation settings This is the default. .It Fl D Ar enable|disable Enable or disable disconnection. +.It Fl M Ar mode +Set ATA mode. .It Fl O Ar offset Set the command delay offset. .It Fl q @@ -800,6 +845,17 @@ The user will not be asked about the timeout if a timeout is specified on the command line. .El +.It Ic idle +Put ATA device into IDLE state. Optional parameter +.Pq Fl t +specifies automatic standby timer value in seconds. Value 0 disables timer. +.It Ic standby +Put ATA device into STANDBY state. Optional parameter +.Pq Fl t +specifies automatic standby timer value in seconds. Value 0 disables timer. +.It Ic sleep +Put ATA device into SLEEP state. Note that the only way get device out of +this state may be reset. .It Ic help Print out verbose usage information. .El Modified: projects/graid/7/sbin/camcontrol/camcontrol.c ============================================================================== --- projects/graid/7/sbin/camcontrol/camcontrol.c Sat Dec 18 02:54:51 2010 (r216513) +++ projects/graid/7/sbin/camcontrol/camcontrol.c Sat Dec 18 06:51:48 2010 (r216514) @@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$"); #include <sys/ioctl.h> #include <sys/stdint.h> #include <sys/types.h> +#include <sys/endian.h> #include <stdio.h> #include <stdlib.h> @@ -49,6 +50,7 @@ __FBSDID("$FreeBSD$"); #include <cam/scsi/scsi_da.h> #include <cam/scsi/scsi_pass.h> #include <cam/scsi/scsi_message.h> +#include <cam/ata/ata_all.h> #include <camlib.h> #include "camcontrol.h" @@ -71,7 +73,11 @@ typedef enum { CAM_CMD_RATE = 0x0000000f, CAM_CMD_DETACH = 0x00000010, CAM_CMD_REPORTLUNS = 0x00000011, - CAM_CMD_READCAP = 0x00000012 + CAM_CMD_READCAP = 0x00000012, + CAM_CMD_IDENTIFY = 0x00000013, + CAM_CMD_IDLE = 0x00000014, + CAM_CMD_STANDBY = 0x00000015, + CAM_CMD_SLEEP = 0x00000016 } cam_cmdmask; typedef enum { @@ -110,22 +116,23 @@ typedef enum { } cam_argmask; struct camcontrol_opts { - const char *optname; + const char *optname; cam_cmdmask cmdnum; cam_argmask argnum; const char *subopt; }; #ifndef MINIMALISTIC -static const char scsicmd_opts[] = "c:i:o:"; +static const char scsicmd_opts[] = "a:c:dfi:o:r"; static const char readdefect_opts[] = "f:GP"; -static const char negotiate_opts[] = "acD:O:qR:T:UW:"; +static const char negotiate_opts[] = "acD:M:O:qR:T:UW:"; #endif struct camcontrol_opts option_table[] = { #ifndef MINIMALISTIC {"tur", CAM_CMD_TUR, CAM_ARG_NONE, NULL}, {"inquiry", CAM_CMD_INQUIRY, CAM_ARG_NONE, "DSR"}, + {"identify", CAM_CMD_IDENTIFY, CAM_ARG_NONE, NULL}, {"start", CAM_CMD_STARTSTOP, CAM_ARG_START_UNIT, NULL}, {"stop", CAM_CMD_STARTSTOP, CAM_ARG_NONE, NULL}, {"load", CAM_CMD_STARTSTOP, CAM_ARG_START_UNIT | CAM_ARG_EJECT, NULL}, @@ -150,6 +157,9 @@ struct camcontrol_opts option_table[] = {"rate", CAM_CMD_RATE, CAM_ARG_NONE, negotiate_opts}, {"debug", CAM_CMD_DEBUG, CAM_ARG_NONE, "IPTSXc"}, {"format", CAM_CMD_FORMAT, CAM_ARG_NONE, "qrwy"}, + {"idle", CAM_CMD_IDLE, CAM_ARG_NONE, "t:"}, + {"standby", CAM_CMD_STANDBY, CAM_ARG_NONE, "t:"}, + {"sleep", CAM_CMD_SLEEP, CAM_ARG_NONE, ""}, #endif /* MINIMALISTIC */ {"help", CAM_CMD_USAGE, CAM_ARG_NONE, NULL}, {"-?", CAM_CMD_USAGE, CAM_ARG_NONE, NULL}, @@ -182,7 +192,7 @@ static int scsidoinquiry(struct cam_devi char *combinedopt, int retry_count, int timeout); static int scsiinquiry(struct cam_device *device, int retry_count, int timeout); static int scsiserial(struct cam_device *device, int retry_count, int timeout); -static int scsixferrate(struct cam_device *device); +static int camxferrate(struct cam_device *device); #endif /* MINIMALISTIC */ static int parse_btl(char *tstr, int *bus, int *target, int *lun, cam_argmask *arglst); @@ -194,7 +204,7 @@ static int readdefects(struct cam_device char *combinedopt, int retry_count, int timeout); static void modepage(struct cam_device *device, int argc, char **argv, char *combinedopt, int retry_count, int timeout); -static int scsicmd(struct cam_device *device, int argc, char **argv, +static int scsicmd(struct cam_device *device, int argc, char **argv, char *combinedopt, int retry_count, int timeout); static int tagcontrol(struct cam_device *device, int argc, char **argv, char *combinedopt); @@ -202,6 +212,7 @@ static void cts_print(struct cam_device struct ccb_trans_settings *cts); static void cpi_print(struct ccb_pathinq *cpi); static int get_cpi(struct cam_device *device, struct ccb_pathinq *cpi); +static int get_cgd(struct cam_device *device, struct ccb_getdev *cgd); static int get_print_cts(struct cam_device *device, int user_settings, int quiet, struct ccb_trans_settings *cts); static int ratecontrol(struct cam_device *device, int retry_count, @@ -212,10 +223,18 @@ static int scsireportluns(struct cam_dev char *combinedopt, int retry_count, int timeout); static int scsireadcapacity(struct cam_device *device, int argc, char **argv, char *combinedopt, int retry_count, int timeout); +static int atapm(struct cam_device *device, int argc, char **argv, + char *combinedopt, int retry_count, int timeout); #endif /* MINIMALISTIC */ +#ifndef min +#define min(a,b) (((a)<(b))?(a):(b)) +#endif +#ifndef max +#define max(a,b) (((a)>(b))?(a):(b)) +#endif camcontrol_optret -getoption(char *arg, cam_cmdmask *cmdnum, cam_argmask *argnum, +getoption(char *arg, cam_cmdmask *cmdnum, cam_argmask *argnum, const char **subopt) { struct camcontrol_opts *opts; @@ -401,19 +420,35 @@ getdevtree(void) } else skip_device = 0; - cam_strvis(vendor, dev_result->inq_data.vendor, + if (dev_result->protocol == PROTO_SCSI) { + cam_strvis(vendor, dev_result->inq_data.vendor, sizeof(dev_result->inq_data.vendor), sizeof(vendor)); - cam_strvis(product, + cam_strvis(product, dev_result->inq_data.product, sizeof(dev_result->inq_data.product), sizeof(product)); - cam_strvis(revision, + cam_strvis(revision, dev_result->inq_data.revision, sizeof(dev_result->inq_data.revision), sizeof(revision)); - sprintf(tmpstr, "<%s %s %s>", vendor, product, + sprintf(tmpstr, "<%s %s %s>", vendor, product, + revision); + } else if (dev_result->protocol == PROTO_ATA || + dev_result->protocol == PROTO_SATAPM) { + cam_strvis(product, + dev_result->ident_data.model, + sizeof(dev_result->ident_data.model), + sizeof(product)); + cam_strvis(revision, + dev_result->ident_data.revision, + sizeof(dev_result->ident_data.revision), + sizeof(revision)); + sprintf(tmpstr, "<%s %s>", product, revision); + } else { + sprintf(tmpstr, "<>"); + } if (need_close) { fprintf(stdout, ")\n"); need_close = 0; @@ -587,7 +622,7 @@ scsistart(struct cam_device *device, int else fprintf(stdout, "Error received from stop unit command\n"); - + if (arglist & CAM_ARG_VERBOSE) { cam_error_print(device, ccb, CAM_ESF_ALL, CAM_EPF_ALL, stderr); @@ -642,7 +677,7 @@ scsidoinquiry(struct cam_device *device, return(error); if (arglist & CAM_ARG_GET_XFERRATE) - error = scsixferrate(device); + error = camxferrate(device); return(error); } @@ -653,7 +688,7 @@ scsiinquiry(struct cam_device *device, i union ccb *ccb; struct scsi_inquiry_data *inq_buf; int error = 0; - + ccb = cam_getccb(device); if (ccb == NULL) { @@ -686,13 +721,13 @@ scsiinquiry(struct cam_device *device, i * scsi_inquiry() will convert an inq_len (which is passed in as * a u_int32_t, but the field in the CDB is only 1 byte) of 256 * to 0. Evidently, very few devices meet the spec in that - * regard. Some devices, like many Seagate disks, take the 0 as + * regard. Some devices, like many Seagate disks, take the 0 as * 0, and don't return any data. One Pioneer DVD-R drive * returns more data than the command asked for. * * So, since there are numerous devices that just don't work * right with the full inquiry size, we don't send the full size. - * + * * - The second reason not to use the full inquiry data length is * that we don't need it here. The only reason we issue a * standard inquiry is to get the vendor name, device name, @@ -852,14 +887,18 @@ scsiserial(struct cam_device *device, in } static int -scsixferrate(struct cam_device *device) +camxferrate(struct cam_device *device) { + struct ccb_pathinq cpi; u_int32_t freq = 0; u_int32_t speed = 0; union ccb *ccb; u_int mb; int retval = 0; + if ((retval = get_cpi(device, &cpi)) != 0) + return (1); + ccb = cam_getccb(device); if (ccb == NULL) { @@ -892,6 +931,8 @@ scsixferrate(struct cam_device *device) } + speed = cpi.base_transfer_speed; + freq = 0; if (ccb->cts.transport == XPORT_SPI) { struct ccb_trans_settings_spi *spi = &ccb->cts.xport_specific.spi; @@ -900,26 +941,53 @@ scsixferrate(struct cam_device *device) freq = scsi_calc_syncsrate(spi->sync_period); speed = freq; } - - fprintf(stdout, "%s%d: ", device->device_name, - device->dev_unit_num); - if ((spi->valid & CTS_SPI_VALID_BUS_WIDTH) != 0) { speed *= (0x01 << spi->bus_width); } + } else if (ccb->cts.transport == XPORT_FC) { + struct ccb_trans_settings_fc *fc = + &ccb->cts.xport_specific.fc; + + if (fc->valid & CTS_FC_VALID_SPEED) + speed = fc->bitrate; + } else if (ccb->cts.transport == XPORT_SAS) { + struct ccb_trans_settings_sas *sas = + &ccb->cts.xport_specific.sas; + + if (sas->valid & CTS_SAS_VALID_SPEED) + speed = sas->bitrate; + } else if (ccb->cts.transport == XPORT_ATA) { + struct ccb_trans_settings_ata *ata = + &ccb->cts.xport_specific.ata; + + if (ata->valid & CTS_ATA_VALID_MODE) + speed = ata_mode2speed(ata->mode); + } else if (ccb->cts.transport == XPORT_SATA) { + struct ccb_trans_settings_sata *sata = + &ccb->cts.xport_specific.sata; + + if (sata->valid & CTS_SATA_VALID_REVISION) + speed = ata_revision2speed(sata->revision); + } + + mb = speed / 1000; + if (mb > 0) { + fprintf(stdout, "%s%d: %d.%03dMB/s transfers", + device->device_name, device->dev_unit_num, + mb, speed % 1000); + } else { + fprintf(stdout, "%s%d: %dKB/s transfers", + device->device_name, device->dev_unit_num, + speed); + } - mb = speed / 1000; - - if (mb > 0) - fprintf(stdout, "%d.%03dMB/s transfers ", - mb, speed % 1000); - else - fprintf(stdout, "%dKB/s transfers ", - speed); + if (ccb->cts.transport == XPORT_SPI) { + struct ccb_trans_settings_spi *spi = + &ccb->cts.xport_specific.spi; if (((spi->valid & CTS_SPI_VALID_SYNC_OFFSET) != 0) && (spi->sync_offset != 0)) - fprintf(stdout, "(%d.%03dMHz, offset %d", freq / 1000, + fprintf(stdout, " (%d.%03dMHz, offset %d", freq / 1000, freq % 1000, spi->sync_offset); if (((spi->valid & CTS_SPI_VALID_BUS_WIDTH) != 0) @@ -935,25 +1003,34 @@ scsixferrate(struct cam_device *device) && (spi->sync_offset != 0)) { fprintf(stdout, ")"); } - } else { - struct ccb_pathinq cpi; - - retval = get_cpi(device, &cpi); - - if (retval != 0) - goto xferrate_bailout; - - speed = cpi.base_transfer_speed; - freq = 0; - - mb = speed / 1000; - - if (mb > 0) - fprintf(stdout, "%d.%03dMB/s transfers ", - mb, speed % 1000); + } else if (ccb->cts.transport == XPORT_ATA) { + struct ccb_trans_settings_ata *ata = + &ccb->cts.xport_specific.ata; + + printf(" ("); + if (ata->valid & CTS_ATA_VALID_MODE) + printf("%s, ", ata_mode2string(ata->mode)); + if ((ata->valid & CTS_ATA_VALID_ATAPI) && ata->atapi != 0) + printf("ATAPI %dbytes, ", ata->atapi); + if (ata->valid & CTS_ATA_VALID_BYTECOUNT) + printf("PIO %dbytes", ata->bytecount); + printf(")"); + } else if (ccb->cts.transport == XPORT_SATA) { + struct ccb_trans_settings_sata *sata = + &ccb->cts.xport_specific.sata; + + printf(" ("); + if (sata->valid & CTS_SATA_VALID_REVISION) + printf("SATA %d.x, ", sata->revision); else - fprintf(stdout, "%dKB/s transfers ", - speed); + printf("SATA, "); + if (sata->valid & CTS_SATA_VALID_MODE) + printf("%s, ", ata_mode2string(sata->mode)); + if ((sata->valid & CTS_SATA_VALID_ATAPI) && sata->atapi != 0) + printf("ATAPI %dbytes, ", sata->atapi); + if (sata->valid & CTS_SATA_VALID_BYTECOUNT) + printf("PIO %dbytes", sata->bytecount); + printf(")"); } if (ccb->cts.protocol == PROTO_SCSI) { @@ -974,6 +1051,342 @@ xferrate_bailout: return(retval); } + +static void +atacapprint(struct ata_params *parm) +{ + u_int32_t lbasize = (u_int32_t)parm->lba_size_1 | + ((u_int32_t)parm->lba_size_2 << 16); + + u_int64_t lbasize48 = ((u_int64_t)parm->lba_size48_1) | + ((u_int64_t)parm->lba_size48_2 << 16) | + ((u_int64_t)parm->lba_size48_3 << 32) | + ((u_int64_t)parm->lba_size48_4 << 48); + + printf("\n"); + printf("protocol "); + printf("ATA/ATAPI-%d", ata_version(parm->version_major)); + if (parm->satacapabilities && parm->satacapabilities != 0xffff) { + if (parm->satacapabilities & ATA_SATA_GEN3) + printf(" SATA 3.x\n"); + else if (parm->satacapabilities & ATA_SATA_GEN2) + printf(" SATA 2.x\n"); + else if (parm->satacapabilities & ATA_SATA_GEN1) + printf(" SATA 1.x\n"); + else + printf(" SATA\n"); + } + else + printf("\n"); + printf("device model %.40s\n", parm->model); + printf("firmware revision %.8s\n", parm->revision); + printf("serial number %.20s\n", parm->serial); + if (parm->enabled.extension & ATA_SUPPORT_64BITWWN) { + printf("WWN %02x%02x%02x%02x\n", + parm->wwn[0], parm->wwn[1], parm->wwn[2], parm->wwn[3]); + } + if (parm->enabled.extension & ATA_SUPPORT_MEDIASN) { + printf("media serial number %.30s\n", + parm->media_serial); + } + + printf("cylinders %d\n", parm->cylinders); + printf("heads %d\n", parm->heads); + printf("sectors/track %d\n", parm->sectors); + printf("sector size logical %u, physical %lu, offset %lu\n", + ata_logical_sector_size(parm), + (unsigned long)ata_physical_sector_size(parm), + (unsigned long)ata_logical_sector_offset(parm)); + + if (parm->config == ATA_PROTO_CFA || + (parm->support.command2 & ATA_SUPPORT_CFA)) + printf("CFA supported\n"); + + printf("LBA%ssupported ", + parm->capabilities1 & ATA_SUPPORT_LBA ? " " : " not "); + if (lbasize) + printf("%d sectors\n", lbasize); + else + printf("\n"); + + printf("LBA48%ssupported ", + parm->support.command2 & ATA_SUPPORT_ADDRESS48 ? " " : " not "); + if (lbasize48) + printf("%ju sectors\n", (uintmax_t)lbasize48); + else + printf("\n"); + + printf("PIO supported PIO"); + switch (ata_max_pmode(parm)) { + case ATA_PIO4: + printf("4"); + break; + case ATA_PIO3: + printf("3"); + break; + case ATA_PIO2: + printf("2"); + break; + case ATA_PIO1: + printf("1"); + break; + default: + printf("0"); + } + if ((parm->capabilities1 & ATA_SUPPORT_IORDY) == 0) + printf(" w/o IORDY"); + printf("\n"); + + printf("DMA%ssupported ", + parm->capabilities1 & ATA_SUPPORT_DMA ? " " : " not "); + if (parm->capabilities1 & ATA_SUPPORT_DMA) { + if (parm->mwdmamodes & 0xff) { + printf("WDMA"); + if (parm->mwdmamodes & 0x04) + printf("2"); + else if (parm->mwdmamodes & 0x02) + printf("1"); + else if (parm->mwdmamodes & 0x01) + printf("0"); + printf(" "); + } + if ((parm->atavalid & ATA_FLAG_88) && + (parm->udmamodes & 0xff)) { + printf("UDMA"); + if (parm->udmamodes & 0x40) + printf("6"); + else if (parm->udmamodes & 0x20) + printf("5"); + else if (parm->udmamodes & 0x10) + printf("4"); + else if (parm->udmamodes & 0x08) + printf("3"); + else if (parm->udmamodes & 0x04) + printf("2"); + else if (parm->udmamodes & 0x02) + printf("1"); + else if (parm->udmamodes & 0x01) + printf("0"); + printf(" "); + } + } + printf("\n"); + + if (parm->media_rotation_rate == 1) { + printf("media RPM non-rotating\n"); + } else if (parm->media_rotation_rate >= 0x0401 && + parm->media_rotation_rate <= 0xFFFE) { + printf("media RPM %d\n", + parm->media_rotation_rate); + } + + printf("\nFeature " *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201012180651.oBI6pmb5059424>