From: jcs Date: Wed, 10 Jan 2018 15:45:46 +0000 (+0000) Subject: Attach nvme to additional Apple NVMe device, limit targets to 1 X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=e276f6b17b2cc5220ef32d02744baf2fc19ee7be;p=openbsd Attach nvme to additional Apple NVMe device, limit targets to 1 ok dlg --- diff --git a/sys/dev/ic/nvme.c b/sys/dev/ic/nvme.c index 93e1da33e61..a6b912076fd 100644 --- a/sys/dev/ic/nvme.c +++ b/sys/dev/ic/nvme.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nvme.c,v 1.60 2017/08/18 09:26:43 jsg Exp $ */ +/* $OpenBSD: nvme.c,v 1.61 2018/01/10 15:45:46 jcs Exp $ */ /* * Copyright (c) 2014 David Gwynne @@ -1059,6 +1059,18 @@ nvme_identify(struct nvme_softc *sc, u_int mps) sc->sc_nn = lemtoh32(&identify->nn); + /* + * At least one Apple NVMe device presents a second, bogus disk that is + * inaccessible, so cap targets at 1. + * + * sd1 at scsibus1 targ 1 lun 0: [..] + * sd1: 0MB, 4096 bytes/sector, 2 sectors + */ + if (sc->sc_nn > 1 && + mn[0] == 'A' && mn[1] == 'P' && mn[2] == 'P' && mn[3] == 'L' && + mn[4] == 'E') + sc->sc_nn = 1; + memcpy(&sc->sc_identify, identify, sizeof(sc->sc_identify)); done: diff --git a/sys/dev/pci/nvme_pci.c b/sys/dev/pci/nvme_pci.c index 01d78839823..165f1a242de 100644 --- a/sys/dev/pci/nvme_pci.c +++ b/sys/dev/pci/nvme_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nvme_pci.c,v 1.6 2017/07/03 23:27:53 dlg Exp $ */ +/* $OpenBSD: nvme_pci.c,v 1.7 2018/01/10 15:45:46 jcs Exp $ */ /* * Copyright (c) 2014 David Gwynne @@ -71,7 +71,8 @@ nvme_pci_match(struct device *parent, void *match, void *aux) return (1); if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_APPLE && - PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_APPLE_NVME) + (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_APPLE_NVME1 || + PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_APPLE_NVME2)) return (1); return (0);