From: krw Date: Wed, 10 May 2023 15:28:26 +0000 (+0000) Subject: Add flag SDEV_UFI so umass_scsi_attach() can provide information X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=176eada02fb44815181757b04aa1b4dcd4a2b887;p=openbsd 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@ --- diff --git a/sys/dev/usb/umass_scsi.c b/sys/dev/usb/umass_scsi.c index 18676aaa76d..16f466baa88 100644 --- a/sys/dev/usb/umass_scsi.c +++ b/sys/dev/usb/umass_scsi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: umass_scsi.c,v 1.63 2022/04/16 19:19:59 naddy Exp $ */ +/* $OpenBSD: umass_scsi.c,v 1.64 2023/05/10 15:28:26 krw Exp $ */ /* $NetBSD: umass_scsipi.c,v 1.9 2003/02/16 23:14:08 augustss Exp $ */ /* * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -96,6 +96,11 @@ umass_scsi_attach(struct umass_softc *sc) sc->sc_dev.dv_xname, sc, scbus)); break; case UMASS_CPROTO_UFI: + flags |= SDEV_UFI | SDEV_ATAPI; + DPRINTF(UDMASS_USB, ("%s: umass_attach_bus: UFI\n" + "sc = 0x%p, scbus = 0x%p\n", + sc->sc_dev.dv_xname, sc, scbus)); + break; case UMASS_CPROTO_ATAPI: flags |= SDEV_ATAPI; DPRINTF(UDMASS_USB, ("%s: umass_attach_bus: ATAPI\n" 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 ' ' into d_packname. If that doesn't fit