diff options
Diffstat (limited to 'sys')
-rw-r--r-- | sys/scsi/cd.c | 3 | ||||
-rw-r--r-- | sys/scsi/scsi_disk.h | 8 | ||||
-rw-r--r-- | sys/scsi/scsi_ioctl.c | 18 | ||||
-rw-r--r-- | sys/scsi/sd.c | 6 | ||||
-rw-r--r-- | sys/sys/scsiio.h | 19 |
5 files changed, 45 insertions, 9 deletions
diff --git a/sys/scsi/cd.c b/sys/scsi/cd.c index 3199c5af986..746dbcc110b 100644 --- a/sys/scsi/cd.c +++ b/sys/scsi/cd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cd.c,v 1.40 1999/08/10 23:09:49 deraadt Exp $ */ +/* $OpenBSD: cd.c,v 1.41 1999/08/24 01:20:22 csapuntz Exp $ */ /* $NetBSD: cd.c,v 1.100 1997/04/02 02:29:30 mycroft Exp $ */ /* @@ -766,6 +766,7 @@ cdioctl(dev, cmd, addr, flag, p) case DIOCLOCK: case DIOCEJECT: case SCIOCIDENTIFY: + case OSCIOCIDENTIFY: case SCIOCCOMMAND: case SCIOCDEBUG: case CDIOCLOADUNLOAD: diff --git a/sys/scsi/scsi_disk.h b/sys/scsi/scsi_disk.h index 33c207d6bb7..59a34e62bbb 100644 --- a/sys/scsi/scsi_disk.h +++ b/sys/scsi/scsi_disk.h @@ -1,4 +1,4 @@ -/* $OpenBSD: scsi_disk.h,v 1.7 1999/07/25 07:09:19 csapuntz Exp $ */ +/* $OpenBSD: scsi_disk.h,v 1.8 1999/08/24 01:20:22 csapuntz Exp $ */ /* $NetBSD: scsi_disk.h,v 1.10 1996/07/05 16:19:05 christos Exp $ */ /* @@ -240,6 +240,12 @@ struct scsi_reassign_blocks_data { } defect_descriptor[1]; }; +struct scsi_disk_blk_desc { + u_int8_t nblocks[4]; + u_int8_t density; + u_int8_t blklen[3]; +}; + union scsi_disk_pages { #define DISK_PGCODE 0x3F /* only 6 bits valid */ struct page_disk_format { diff --git a/sys/scsi/scsi_ioctl.c b/sys/scsi/scsi_ioctl.c index dfe18a0ea49..80cdbbd4a83 100644 --- a/sys/scsi/scsi_ioctl.c +++ b/sys/scsi/scsi_ioctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: scsi_ioctl.c,v 1.9 1997/09/01 19:11:46 niklas Exp $ */ +/* $OpenBSD: scsi_ioctl.c,v 1.10 1999/08/24 01:20:22 csapuntz Exp $ */ /* $NetBSD: scsi_ioctl.c,v 1.23 1996/10/12 23:23:17 christos Exp $ */ /* @@ -347,6 +347,11 @@ scsi_do_ioctl(sc_link, dev, cmd, addr, flag, p) sc_link->flags |= SDEV_DB4; return 0; } + case OSCIOCREPROBE: { + struct oscsi_addr *sca = (struct oscsi_addr *)addr; + + return scsi_probe_busses(sca->scbus, sca->target, sca->lun); + } case SCIOCREPROBE: { struct scsi_addr *sca = (struct scsi_addr *)addr; @@ -383,9 +388,19 @@ scsi_do_safeioctl(sc_link, dev, cmd, addr, flag, p) SC_DEBUG(sc_link, SDEV_DB2, ("scsi_do_safeioctl(0x%lx)\n", cmd)); switch(cmd) { + case OSCIOCIDENTIFY: { + struct oscsi_addr *sca = (struct oscsi_addr *)addr; + + sca->scbus = sc_link->scsibus; + sca->target = sc_link->target; + sca->lun = sc_link->lun; + return 0; + } case SCIOCIDENTIFY: { struct scsi_addr *sca = (struct scsi_addr *)addr; + sca->type = (sc_link->flags & SDEV_ATAPI) + ? TYPE_ATAPI : TYPE_SCSI; sca->scbus = sc_link->scsibus; sca->target = sc_link->target; sca->lun = sc_link->lun; @@ -394,6 +409,7 @@ scsi_do_safeioctl(sc_link, dev, cmd, addr, flag, p) case SCIOCCOMMAND: case SCIOCDEBUG: case SCIOCREPROBE: + case OSCIOCREPROBE: case SCIOCRESET: return EBADF; case SCIOCRECONFIG: diff --git a/sys/scsi/sd.c b/sys/scsi/sd.c index b1c8cb3fa3b..f2dcaffee9c 100644 --- a/sys/scsi/sd.c +++ b/sys/scsi/sd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sd.c,v 1.39 1999/08/10 23:09:49 deraadt Exp $ */ +/* $OpenBSD: sd.c,v 1.40 1999/08/24 01:20:22 csapuntz Exp $ */ /* $NetBSD: sd.c,v 1.111 1997/04/02 02:29:41 mycroft Exp $ */ /*- @@ -184,7 +184,8 @@ sdattach(parent, self, aux) dk_establish(&sd->sc_dk, &sd->sc_dev); - if (sc_link->flags & SDEV_ATAPI) { + if (sc_link->flags & SDEV_ATAPI && + (sc_link->flags & SDEV_REMOVABLE)) { sd->sc_ops = &sd_atapibus_ops; } else { sd->sc_ops = &sd_scsibus_ops; @@ -772,6 +773,7 @@ sdioctl(dev, cmd, addr, flag, p) case DIOCLOCK: case DIOCEJECT: case SCIOCIDENTIFY: + case OSCIOCIDENTIFY: case SCIOCCOMMAND: case SCIOCDEBUG: if (part == RAW_PART) diff --git a/sys/sys/scsiio.h b/sys/sys/scsiio.h index 2935ebe66a7..83cffa73d85 100644 --- a/sys/sys/scsiio.h +++ b/sys/sys/scsiio.h @@ -1,4 +1,4 @@ -/* $OpenBSD: scsiio.h,v 1.4 1996/07/12 08:57:59 pefo Exp $ */ +/* $OpenBSD: scsiio.h,v 1.5 1999/08/24 01:20:21 csapuntz Exp $ */ /* $NetBSD: scsiio.h,v 1.3 1994/06/29 06:45:09 cgd Exp $ */ #ifndef _SYS_SCSIIO_H_ @@ -49,17 +49,28 @@ typedef struct scsireq { #define SC_DB_DMA 0x00000008 /* show DMA segments etc */ #define SCIOCDEBUG _IOW('Q', 2, int) /* from 0 to 15 */ -struct scsi_addr { +struct oscsi_addr { int scbus; /* -1 if wildcard */ int target; /* -1 if wildcard */ int lun; /* -1 if wildcard */ } ; -#define SCIOCREPROBE _IOW('Q', 3, struct scsi_addr) /* look for new devs */ -#define SCIOCIDENTIFY _IOR('Q', 4, struct scsi_addr) /* where are you? */ +struct scsi_addr { + int type; +#define TYPE_SCSI 0 +#define TYPE_ATAPI 1 + int scbus; /* -1 if wildcard */ + int target; /* -1 if wildcard */ + int lun; /* -1 if wildcard */ +}; + +#define OSCIOCREPROBE _IOW('Q', 3, struct oscsi_addr) /* look for new devs */ +#define OSCIOCIDENTIFY _IOR('Q', 4, struct oscsi_addr) #define SCIOCDECONFIG _IO('Q', 5) /* please dissappear */ #define SCIOCRECONFIG _IO('Q', 6) /* please check again */ #define SCIOCRESET _IO('Q', 7) /* reset the device */ #define SCIOCREASSIGN _IOW('Q', 8, int) /* reassign block */ +#define SCIOCIDENTIFY _IOR('Q', 9, struct scsi_addr) +#define SCIOCREPROBE _IOW('Q', 10, struct scsi_addr) #endif /* _SYS_SCSIIO_H_ */ |