All pastes #736262 Raw Edit

dewi ahci new patch-2

public text v1 · immutable
·published 2007-10-14 11:28 UTC
rendered paste body
Index: ahci.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/ahci.c,v
retrieving revision 1.129
diff -u -r1.129 ahci.c
--- ahci.c	1 Oct 2007 15:34:48 -0000	1.129
+++ ahci.c	14 Oct 2007 11:14:52 -0000
@@ -1,4 +1,4 @@
-/*	$OpenBSD: ahci.c,v 1.128 2007/07/03 22:33:20 dlg Exp $ */
+/*	$OpenBSD: ahci.c,v 1.130 2007/10/14 21:00:33 krw Exp $ */
 
 /*
  * Copyright (c) 2006 David Gwynne <dlg@openbsd.org>
@@ -386,6 +386,7 @@
 
 	int			sc_flags;
 #define AHCI_F_NO_NCQ			(1<<0)
+#define AHCI_F_NO_FER			(1<<1)
 
 	u_int			sc_ncmds;
 
@@ -414,10 +415,14 @@
 int			ahci_no_match(struct pci_attach_args *);
 int			ahci_vt8251_attach(struct ahci_softc *,
 			    struct pci_attach_args *);
+int			ahci_ati_ixp600_attach(struct ahci_softc *,
+			    struct pci_attach_args *);
 
 static const struct ahci_device ahci_devices[] = {
 	{ PCI_VENDOR_VIATECH,	PCI_PRODUCT_VIATECH_VT8251_SATA,
-	    ahci_no_match,	ahci_vt8251_attach }
+	    ahci_no_match,	ahci_vt8251_attach },
+	{ PCI_VENDOR_ATI,	PCI_PRODUCT_ATI_IXP_SATA_600,
+	    NULL,		ahci_ati_ixp600_attach }
 };
 
 int			ahci_pci_match(struct device *, void *, void *);
@@ -546,6 +551,14 @@
 }
 
 int
+ahci_ati_ixp600_attach(struct ahci_softc *sc, struct pci_attach_args *pa)
+{
+	sc->sc_flags |= AHCI_F_NO_FER;
+
+	return (0);
+}
+
+int
 ahci_pci_match(struct device *parent, void *match, void *aux)
 {
 	struct pci_attach_args		*pa = aux;
@@ -1069,7 +1082,8 @@
 
 	/* Turn on FRE (and ST) */
 	r = ahci_pread(ap, AHCI_PREG_CMD) & ~AHCI_PREG_CMD_ICC;
-	r |= AHCI_PREG_CMD_FRE;
+	if (!(ap->ap_sc->sc_flags & AHCI_F_NO_FER))
+	    r |= AHCI_PREG_CMD_FRE;
 	if (!fre_only)
 		r |= AHCI_PREG_CMD_ST;
 	ahci_pwrite(ap, AHCI_PREG_CMD, r);
@@ -1083,9 +1097,10 @@
 	}
 #endif
 
-	/* Wait for FR to come on */
-	if (ahci_pwait_set(ap, AHCI_PREG_CMD, AHCI_PREG_CMD_FR))
-		return (2);
+	if (!(ap->ap_sc->sc_flags & AHCI_F_NO_FER))
+		/* Wait for FR to come on */
+		if (ahci_pwait_set(ap, AHCI_PREG_CMD, AHCI_PREG_CMD_FR))
+			return (2);
 
 	/* Wait for CR to come on */
 	if (!fre_only && ahci_pwait_set(ap, AHCI_PREG_CMD, AHCI_PREG_CMD_CR))