summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Pascoe <pascoe@cvs.openbsd.org>2007-03-04 14:06:35 +0000
committerChristopher Pascoe <pascoe@cvs.openbsd.org>2007-03-04 14:06:35 +0000
commit54687401492eea25a87bf198fc4f1662932d7aa3 (patch)
tree868072b1d59e162b2d333768c46e49f1b0164ada
parent979da7eec1a17a80931f528acaa28a03d01da735 (diff)
Save BIOS configured parameters over reset. Always enable staggered spin-up.
Don't clean interrupt status now - have to flush individual ports' status first.
-rw-r--r--sys/dev/pci/ahci.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/sys/dev/pci/ahci.c b/sys/dev/pci/ahci.c
index d0eeb44f943..5d852d87289 100644
--- a/sys/dev/pci/ahci.c
+++ b/sys/dev/pci/ahci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ahci.c,v 1.59 2007/03/04 13:53:17 pascoe Exp $ */
+/* $OpenBSD: ahci.c,v 1.60 2007/03/04 14:06:34 pascoe Exp $ */
/*
* Copyright (c) 2006 David Gwynne <dlg@openbsd.org>
@@ -586,12 +586,18 @@ ahci_unmap_intr(struct ahci_softc *sc, struct pci_attach_args *pa)
int
ahci_init(struct ahci_softc *sc)
{
- u_int32_t reg;
+ u_int32_t reg, cap, pi;
const char *revision;
DPRINTF(AHCI_D_VERBOSE, " GHC 0x%b", ahci_read(sc, AHCI_REG_GHC),
AHCI_FMT_GHC);
+ /* save BIOS initialised parameters, enable staggered spin up */
+ cap = ahci_read(sc, AHCI_REG_CAP);
+ cap &= AHCI_REG_CAP_SMPS;
+ cap |= AHCI_REG_CAP_SSS;
+ pi = ahci_read(sc, AHCI_REG_PI);
+
if (ISSET(AHCI_REG_GHC_AE, ahci_read(sc, AHCI_REG_GHC))) {
/* reset the controller */
ahci_write(sc, AHCI_REG_GHC, AHCI_REG_GHC_HR);
@@ -602,7 +608,11 @@ ahci_init(struct ahci_softc *sc)
}
}
- /* enable ahci */
+ /* restore parameters */
+ ahci_write(sc, AHCI_REG_CAP, cap);
+ ahci_write(sc, AHCI_REG_PI, pi);
+
+ /* enable ahci (global interrupts disabled) */
ahci_write(sc, AHCI_REG_GHC, AHCI_REG_GHC_AE);
/* check the revision */
@@ -623,10 +633,6 @@ ahci_init(struct ahci_softc *sc)
return (1);
}
- /* clean interrupts */
- reg = ahci_read(sc, AHCI_REG_IS);
- ahci_write(sc, AHCI_REG_IS, reg);
-
printf(": AHCI %s", revision);
return (0);