From 51a91e865e6c71dc334789c0d8db940bdd81db29 Mon Sep 17 00:00:00 2001 From: gilles Date: Thu, 2 Jan 2014 08:00:35 +0000 Subject: [PATCH] disable MSI for Samsung XP941. This is so I can use the machine to figure out the others things on it, the quirk will go away when interrupt routing gets fixed. ok dlg@, jmatthew@ --- sys/dev/ic/ahcivar.h | 3 ++- sys/dev/pci/ahci_pci.c | 20 ++++++++++++++++++-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/sys/dev/ic/ahcivar.h b/sys/dev/ic/ahcivar.h index ec358ead7e5..dd1e6d98b70 100644 --- a/sys/dev/ic/ahcivar.h +++ b/sys/dev/ic/ahcivar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ahcivar.h,v 1.2 2013/07/09 11:55:55 jmatthew Exp $ */ +/* $OpenBSD: ahcivar.h,v 1.3 2014/01/02 08:00:35 gilles Exp $ */ /* * Copyright (c) 2006 David Gwynne @@ -176,6 +176,7 @@ struct ahci_softc { #define AHCI_F_NO_NCQ (1<<0) #define AHCI_F_IPMS_PROBE (1<<1) /* IPMS on failed PMP probe */ #define AHCI_F_NO_PMP (1<<2) /* ignore PMP capability */ +#define AHCI_F_NO_MSI (1<<3) /* disable MSI */ u_int sc_ncmds; diff --git a/sys/dev/pci/ahci_pci.c b/sys/dev/pci/ahci_pci.c index d5f1e4767ac..0b9f4648951 100644 --- a/sys/dev/pci/ahci_pci.c +++ b/sys/dev/pci/ahci_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ahci_pci.c,v 1.2 2013/02/19 15:29:27 brad Exp $ */ +/* $OpenBSD: ahci_pci.c,v 1.3 2014/01/02 08:00:35 gilles Exp $ */ /* * Copyright (c) 2006 David Gwynne @@ -77,6 +77,8 @@ int ahci_amd_hudson2_attach(struct ahci_softc *, struct pci_attach_args *); int ahci_intel_attach(struct ahci_softc *, struct pci_attach_args *); +int ahci_samsung_attach(struct ahci_softc *, + struct pci_attach_args *); static const struct ahci_device ahci_devices[] = { { PCI_VENDOR_AMD, PCI_PRODUCT_AMD_HUDSON2_SATA_1, @@ -144,6 +146,9 @@ static const struct ahci_device ahci_devices[] = { { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_EP80579_AHCI, NULL, ahci_intel_attach }, + { PCI_VENDOR_SAMSUNG2, PCI_PRODUCT_SAMSUNG2_XP941, + NULL, ahci_samsung_attach }, + { PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT8251_SATA, ahci_no_match, ahci_vt8251_attach } }; @@ -285,6 +290,13 @@ ahci_intel_attach(struct ahci_softc *sc, struct pci_attach_args *pa) return (0); } +int +ahci_samsung_attach(struct ahci_softc *sc, struct pci_attach_args *pa) +{ + sc->sc_flags |= AHCI_F_NO_MSI; + return (0); +} + int ahci_pci_match(struct device *parent, void *match, void *aux) { @@ -316,6 +328,7 @@ ahci_pci_attach(struct device *parent, struct device *self, void *aux) struct pci_attach_args *pa = aux; const struct ahci_device *ad; pci_intr_handle_t ih; + int mapped = 0; psc->psc_pc = pa->pa_pc; psc->psc_tag = pa->pa_tag; @@ -329,7 +342,10 @@ ahci_pci_attach(struct device *parent, struct device *self, void *aux) } } - if (pci_intr_map_msi(pa, &ih) != 0 && pci_intr_map(pa, &ih) != 0) { + if (!(sc->sc_flags & AHCI_F_NO_MSI)) + mapped = pci_intr_map_msi(pa, &ih) != 0 ? 0 : 1; + + if (!mapped && pci_intr_map(pa, &ih) != 0) { printf(": unable to map interrupt\n"); return; } -- 2.20.1