diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2023-05-10 15:28:27 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2023-05-10 15:28:27 +0000 |
commit | 0235ca151d789f7c336bc786c13a118bd899e902 (patch) | |
tree | 31e78af9587cd8f21db43113490a2ea12563237c /sys/scsi | |
parent | 0f4650e3a106cc446c20c1c1c21328fec3ea167d (diff) |
Add flag SDEV_UFI so umass_scsi_attach() can provide information
sufficient to get sdgetdisklabel() to correctly set d_type to
DTYPE_FLOPPY in the default disklabel.
installboot(8) in particular likes to know it is dealing with a
floppy.
ok miod@
Diffstat (limited to 'sys/scsi')
-rw-r--r-- | sys/scsi/scsiconf.h | 3 | ||||
-rw-r--r-- | sys/scsi/sd.c | 20 |
2 files changed, 15 insertions, 8 deletions
diff --git a/sys/scsi/scsiconf.h b/sys/scsi/scsiconf.h index 881a79586c3..a62b6ea883b 100644 --- a/sys/scsi/scsiconf.h +++ b/sys/scsi/scsiconf.h @@ -1,4 +1,4 @@ -/* $OpenBSD: scsiconf.h,v 1.201 2022/04/16 19:19:59 naddy Exp $ */ +/* $OpenBSD: scsiconf.h,v 1.202 2023/05/10 15:28:26 krw Exp $ */ /* $NetBSD: scsiconf.h,v 1.35 1997/04/02 02:29:38 mycroft Exp $ */ /* @@ -299,6 +299,7 @@ struct scsi_link { #define SDEV_UMASS 0x0400 /* device is UMASS SCSI */ #define SDEV_VIRTUAL 0x0800 /* device is virtualised on the hba */ #define SDEV_OWN_IOPL 0x1000 /* scsibus */ +#define SDEV_UFI 0x2000 /* Universal Floppy Interface */ u_int16_t quirks; /* per-device oddities */ #define SDEV_AUTOSAVE 0x0001 /* do implicit SAVEDATAPOINTER on disconnect */ #define SDEV_NOSYNC 0x0002 /* does not grok SDTR */ diff --git a/sys/scsi/sd.c b/sys/scsi/sd.c index d697de784a8..c62e188ded9 100644 --- a/sys/scsi/sd.c +++ b/sys/scsi/sd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sd.c,v 1.333 2022/10/23 14:39:19 krw Exp $ */ +/* $OpenBSD: sd.c,v 1.334 2023/05/10 15:28:26 krw Exp $ */ /* $NetBSD: sd.c,v 1.111 1997/04/02 02:29:41 mycroft Exp $ */ /*- @@ -1115,13 +1115,19 @@ sdgetdisklabel(dev_t dev, struct sd_softc *sc, struct disklabel *lp, /* As long as it's not 0 - readdisklabel divides by it. */ } - lp->d_type = DTYPE_SCSI; - if ((link->inqdata.device & SID_TYPE) == T_OPTICAL) - strncpy(lp->d_typename, "SCSI optical", - sizeof(lp->d_typename)); - else - strncpy(lp->d_typename, "SCSI disk", + if (ISSET(link->flags, SDEV_UFI)) { + lp->d_type = DTYPE_FLOPPY; + strncpy(lp->d_typename, "USB floppy disk", sizeof(lp->d_typename)); + } else { + lp->d_type = DTYPE_SCSI; + if ((link->inqdata.device & SID_TYPE) == T_OPTICAL) + strncpy(lp->d_typename, "SCSI optical", + sizeof(lp->d_typename)); + else + strncpy(lp->d_typename, "SCSI disk", + sizeof(lp->d_typename)); + } /* * Try to fit '<vendor> <product>' into d_packname. If that doesn't fit |