diff options
-rw-r--r-- | share/man/man4/Makefile | 6 | ||||
-rw-r--r-- | share/man/man4/ahci.4 | 43 | ||||
-rw-r--r-- | share/man/man4/pci.4 | 4 | ||||
-rw-r--r-- | sys/dev/pci/ahci.c | 114 | ||||
-rw-r--r-- | sys/dev/pci/files.pci | 7 |
5 files changed, 169 insertions, 5 deletions
diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile index 017dcc86857..dc8a89a0be4 100644 --- a/share/man/man4/Makefile +++ b/share/man/man4/Makefile @@ -1,9 +1,9 @@ -# $OpenBSD: Makefile,v 1.397 2006/11/28 10:56:56 grange Exp $ +# $OpenBSD: Makefile,v 1.398 2006/12/09 05:10:43 dlg Exp $ MAN= aac.4 ac97.4 acphy.4 acpi.4 acx.4 \ adc.4 addcom.4 admcts.4 admlc.4 admtemp.4 \ - admtm.4 admtmp.4 admtt.4 adt.4 adv.4 aha.4 ahb.4 ahc.4 ahd.4 aic.4 \ - akbd.4 alipm.4 amdiic.4 amdpm.4 ami.4 amphy.4 ams.4 \ + admtm.4 admtmp.4 admtt.4 adt.4 adv.4 aha.4 ahb.4 ahc.4 ahci.4 ahd.4 \ + aic.4 akbd.4 alipm.4 amdiic.4 amdpm.4 ami.4 amphy.4 ams.4 \ an.4 aps.4 arc.4 aria.4 art.4 \ asbtm.4 ast.4 atalk.4 atapiscsi.4 ath.4 atu.4 atw.4 audio.4 aue.4 \ auich.4 autri.4 auixp.4 auvia.4 awi.4 axe.4 az.4 azalia.4 \ diff --git a/share/man/man4/ahci.4 b/share/man/man4/ahci.4 new file mode 100644 index 00000000000..a56911cbd70 --- /dev/null +++ b/share/man/man4/ahci.4 @@ -0,0 +1,43 @@ +.\" $OpenBSD: ahci.4,v 1.1 2006/12/09 05:10:43 dlg Exp $ +.\" +.\" Copyright (c) 2006 David Gwynne <dlg@openbsd.org> +.\" +.\" Permission to use, copy, modify, and distribute this software for any +.\" purpose with or without fee is hereby granted, provided that the above +.\" copyright notice and this permission notice appear in all copies. +.\" +.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +.\" TORTIOUS ACTION, ARISING OUT OF +.\" PERFORMANCE OF THIS SOFTWARE. +.\" +.Dd December 9, 2006 +.Dt AHCI 4 +.Os +.Sh NAME +.Nm ahci +.Nd Advanced Host Controller Interface for Serial ATA +.Sh SYNOPSIS +.Cd "ahci* at pci?" +.Sh DESCRIPTION +The +.Nm +driver provides support for Serial ATA controllers conforming to the +Advanced Host Controller Interface specification. +.Sh SEE ALSO +.Xr intro 4 , +.Xr pci 4 +.Sh HISTORY +The +.Nm +driver first appeared in +.Ox 4.1 . +.Sh AUTHORS +.An -nosplit +The +.Nm +driver was written by +.An David Gwynne Aq dlg@openbsd.org . diff --git a/share/man/man4/pci.4 b/share/man/man4/pci.4 index ac39048c151..d8f172c426a 100644 --- a/share/man/man4/pci.4 +++ b/share/man/man4/pci.4 @@ -1,4 +1,4 @@ -.\" $OpenBSD: pci.4,v 1.196 2006/12/01 16:50:16 jsg Exp $ +.\" $OpenBSD: pci.4,v 1.197 2006/12/09 05:10:43 dlg Exp $ .\" $NetBSD: pci.4,v 1.29 2000/04/01 00:32:23 tsarna Exp $ .\" .\" Copyright (c) 2000 Theo de Raadt. All rights reserved. @@ -109,6 +109,8 @@ TRM-S1040 based PCI SCSI interface .El .Ss IDE disk controllers .Bl -tag -width 10n -offset ind -compact +.It Xr ahci 4 +Advanced Host Controller Interface for Serial ATA .It Xr pciide 4 PCI IDE controller driver .El diff --git a/sys/dev/pci/ahci.c b/sys/dev/pci/ahci.c new file mode 100644 index 00000000000..8909017a2aa --- /dev/null +++ b/sys/dev/pci/ahci.c @@ -0,0 +1,114 @@ +/* $OpenBSD: ahci.c,v 1.1 2006/12/09 05:10:43 dlg Exp $ */ + +/* + * Copyright (c) 2006 David Gwynne <dlg@openbsd.org> + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include <sys/param.h> +#include <sys/systm.h> +#include <sys/buf.h> +#include <sys/kernel.h> +#include <sys/malloc.h> +#include <sys/device.h> +#include <sys/proc.h> + +#include <machine/bus.h> + +#include <dev/pci/pcireg.h> +#include <dev/pci/pcivar.h> +#include <dev/pci/pcidevs.h> + +#define AHCI_PCI_BAR 0x24 + +static const struct pci_matchid ahci_devices[] = { + { PCI_VENDOR_JMICRON, PCI_PRODUCT_JMICRON_JMB361 } +}; + +int ahci_match(struct device *, void *, void *); +void ahci_attach(struct device *, struct device *, void *); + +struct ahci_softc { + struct device sc_dev; + + void *sc_ih; + + bus_space_tag_t sc_iot; + bus_space_handle_t sc_ioh; + bus_size_t sc_ios; + bus_dma_tag_t sc_dmat; +}; +#define DEVNAME(_s) ((_s)->sc_dev.dv_xname) + +struct cfattach ahci_ca = { + sizeof(struct ahci_softc), ahci_match, ahci_attach +}; + +struct cfdriver ahci_cd = { + NULL, "ahci", DV_DULL +}; + +int ahci_intr(void *); + + +int +ahci_match(struct device *parent, void *match, void *aux) +{ + return (pci_matchbyid((struct pci_attach_args *)aux, ahci_devices, + sizeof(ahci_devices) / sizeof(ahci_devices[0]))); +} + +void +ahci_attach(struct device *parent, struct device *self, void *aux) +{ + struct ahci_softc *sc = (struct ahci_softc *)self; + struct pci_attach_args *pa = aux; + pcireg_t memtype; + pci_intr_handle_t ih; + const char *intrstr; + + memtype = pci_mapreg_type(pa->pa_pc, pa->pa_tag, AHCI_PCI_BAR); + if (pci_mapreg_map(pa, AHCI_PCI_BAR, memtype, 0, &sc->sc_iot, + &sc->sc_ioh, NULL, &sc->sc_ios, 0) != 0) { + printf(": unable to map registers\n"); + return; + } + + if (pci_intr_map(pa, &ih) != 0) { + printf(": unable to map interrupt\n"); + goto unmap; + } + intrstr = pci_intr_string(pa->pa_pc, ih); + sc->sc_ih = pci_intr_establish(pa->pa_pc, ih, IPL_BIO, + ahci_intr, sc, DEVNAME(sc)); + if (sc->sc_ih == NULL) { + printf(": unable to map interrupt%s%s\n", + intrstr == NULL ? "" : " at ", + intrstr == NULL ? "" : intrstr); + goto unmap; + } + printf(": %s\n", intrstr); + + return; + +unmap: + bus_space_unmap(sc->sc_iot, sc->sc_ioh, sc->sc_ios); + sc->sc_ios = 0; +} + +int +ahci_intr(void *arg) +{ + return (0); +} diff --git a/sys/dev/pci/files.pci b/sys/dev/pci/files.pci index 199e4768333..48e2a17e5d3 100644 --- a/sys/dev/pci/files.pci +++ b/sys/dev/pci/files.pci @@ -1,4 +1,4 @@ -# $OpenBSD: files.pci,v 1.221 2006/12/06 20:07:52 martin Exp $ +# $OpenBSD: files.pci,v 1.222 2006/12/09 05:10:43 dlg Exp $ # $NetBSD: files.pci,v 1.20 1996/09/24 17:47:15 christos Exp $ # # Config file and device description for machine-independent PCI code. @@ -79,6 +79,11 @@ device arc: scsi attach arc at pci file dev/pci/arc.c arc +# Advanced Host Controller Interface for Serial ATA +device ahci +attach ahci at pci +file dev/pci/ahci.c ahci + # AMI MegaRAID Express x00/Elite 1500/Express 1x00 RAID Controllers attach ami at pci with ami_pci file dev/pci/ami_pci.c ami_pci |