summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/ic/nvme.c14
-rw-r--r--sys/dev/pci/nvme_pci.c5
2 files changed, 16 insertions, 3 deletions
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 <dlg@openbsd.org>
@@ -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: <NVMe, APPLE SSD AP0512, 16.1> [..]
+ * 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 <dlg@openbsd.org>
@@ -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);