Index: sys/sys/ata.h =================================================================== RCS file: /space/ncvs/src/sys/sys/ata.h,v retrieving revision 1.16 diff -u -r1.16 ata.h --- sys/sys/ata.h 20 Feb 2003 19:55:45 -0000 1.16 +++ sys/sys/ata.h 19 Mar 2003 22:40:05 -0000 @@ -369,6 +369,7 @@ #define ATARAIDDELETE 10 #define ATARAIDSTATUS 11 #define ATAENCSTAT 12 +#define ATAGMAXCHANNEL 13 union { struct { @@ -421,6 +422,7 @@ int error; char sense_data[18]; } atapi; + int maxchan; } u; }; Index: sys/dev/ata/ata-all.c =================================================================== RCS file: /space/ncvs/src/sys/dev/ata/ata-all.c,v retrieving revision 1.172 diff -u -r1.172 ata-all.c --- sys/dev/ata/ata-all.c 18 Mar 2003 08:45:20 -0000 1.172 +++ sys/dev/ata/ata-all.c 19 Mar 2003 23:14:46 -0000 @@ -304,6 +304,11 @@ if (cmd != IOCATA) return ENOTTY; + if (iocmd->cmd == ATAGMAXCHANNEL) { + iocmd->u.maxchan = devclass_get_maxunit(ata_devclass); + return 0; + } + if (iocmd->channel < -1 || iocmd->device < -1 || iocmd->device > SLAVE) return ENXIO; Index: sbin/atacontrol/atacontrol.c =================================================================== RCS file: /space/ncvs/src/sbin/atacontrol/atacontrol.c,v retrieving revision 1.19 diff -u -r1.19 atacontrol.c --- sbin/atacontrol/atacontrol.c 16 Sep 2002 08:34:08 -0000 1.19 +++ sbin/atacontrol/atacontrol.c 19 Mar 2003 23:18:11 -0000 @@ -278,9 +278,17 @@ } if (!strcmp(argv[1], "list") && argc == 2) { - int unit = 0; + struct ata_cmd iocmd; + int maxunit, unit; - while (info_print(fd, unit++, 1) != ENXIO); + bzero(&iocmd, sizeof(struct ata_cmd)); + iocmd.cmd = ATAGMAXCHANNEL; + if (ioctl(fd, IOCATA, &iocmd) < 0) + err(1, "ioctl"); + + maxunit = iocmd.u.maxchan; + for (unit = 0; unit < maxunit; unit++) + info_print(fd, unit, 1); } else if (!strcmp(argv[1], "info") && argc == 3) { info_print(fd, iocmd.channel, 0);