summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2007-05-16 04:33:58 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2007-05-16 04:33:58 +0000
commit46395f39999cb5f2fcfda90bcd9e6f3ed6eb90c1 (patch)
tree75b43b5a16528d113c81fbd88fdb789178480ac0 /sys/dev
parent8b0d29bcc34c76f263907e4d69da85a47a1f690f (diff)
map the pci BARs that we're interested in. this gives us access to the
chips registers and io interface, but whats actually in them is still a mystery to me.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/ic/slireg.h7
-rw-r--r--sys/dev/ic/slivar.h9
-rw-r--r--sys/dev/pci/sli_pci.c43
3 files changed, 54 insertions, 5 deletions
diff --git a/sys/dev/ic/slireg.h b/sys/dev/ic/slireg.h
index b253f6d9488..264ea13c662 100644
--- a/sys/dev/ic/slireg.h
+++ b/sys/dev/ic/slireg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: slireg.h,v 1.1 2007/05/15 01:00:15 dlg Exp $ */
+/* $OpenBSD: slireg.h,v 1.2 2007/05/16 04:33:57 dlg Exp $ */
/*
* Copyright (c) 2007 David Gwynne <dlg@openbsd.org>
@@ -15,3 +15,8 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+
+#define SLI_PCI_BAR_SLIM 0x10
+#define SLI_PCI_BAR_REGISTER 0x18
+#define SLI_PCI_BAR_BIU 0x20
+#define SLI_PCI_BAR_REGISTER_IO 0x24
diff --git a/sys/dev/ic/slivar.h b/sys/dev/ic/slivar.h
index fd06163e627..723418e740e 100644
--- a/sys/dev/ic/slivar.h
+++ b/sys/dev/ic/slivar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: slivar.h,v 1.1 2007/05/15 01:00:15 dlg Exp $ */
+/* $OpenBSD: slivar.h,v 1.2 2007/05/16 04:33:57 dlg Exp $ */
/*
* Copyright (c) 2007 David Gwynne <dlg@openbsd.org>
@@ -19,6 +19,13 @@
struct sli_softc {
struct device sc_dev;
struct scsi_link sc_link;
+
+ bus_space_tag_t sc_iot_slim;
+ bus_space_handle_t sc_ioh_slim;
+ bus_size_t sc_ios_slim;
+ bus_space_tag_t sc_iot_reg;
+ bus_space_handle_t sc_ioh_reg;
+ bus_size_t sc_ios_reg;
};
#define DEVNAME(_s) ((_s)->sc_dev.dv_xname)
diff --git a/sys/dev/pci/sli_pci.c b/sys/dev/pci/sli_pci.c
index 8eee51f229c..29846462829 100644
--- a/sys/dev/pci/sli_pci.c
+++ b/sys/dev/pci/sli_pci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sli_pci.c,v 1.1 2007/05/15 01:00:15 dlg Exp $ */
+/* $OpenBSD: sli_pci.c,v 1.2 2007/05/16 04:33:57 dlg Exp $ */
/*
* Copyright (c) 2007 David Gwynne <dlg@openbsd.org>
@@ -70,8 +70,45 @@ sli_pci_attach(struct device *parent, struct device *self, void *aux)
{
struct sli_pci_softc *psc = (struct sli_pci_softc *)self;
struct sli_softc *sc = &psc->psc_sli;
-
- sli_attach(sc);
+ struct pci_attach_args *pa = aux;
+ pcireg_t memtype;
+
+ psc->psc_pc = pa->pa_pc;
+ psc->psc_tag = pa->pa_tag;
+ sc->sc_ios_slim = 0;
+ sc->sc_ios_reg = 0;
+
+ memtype = pci_mapreg_type(psc->psc_pc, psc->psc_tag,
+ SLI_PCI_BAR_SLIM);
+ if (pci_mapreg_map(pa, SLI_PCI_BAR_SLIM, memtype, 0,
+ &sc->sc_iot_slim, &sc->sc_ioh_slim, NULL,
+ &sc->sc_ios_slim, 0) != 0) {
+ printf(": unable to map SLIM bar\n");
+ return;
+ }
+
+ memtype = pci_mapreg_type(psc->psc_pc, psc->psc_tag,
+ SLI_PCI_BAR_REGISTER);
+ if (pci_mapreg_map(pa, SLI_PCI_BAR_REGISTER, memtype, 0,
+ &sc->sc_iot_reg, &sc->sc_ioh_reg, NULL,
+ &sc->sc_ios_reg, 0) != 0) {
+ printf(": unable to map REGISTER bar\n");
+ goto unmap_slim;
+ }
+
+ if (sli_attach(sc) != 0) {
+ /* error already printed by sli_attach() */
+ goto unmap_reg;
+ }
+
+ return;
+
+unmap_reg:
+ bus_space_unmap(sc->sc_iot_reg, sc->sc_ioh_reg, sc->sc_ios_reg);
+ sc->sc_ios_reg = 0;
+unmap_slim:
+ bus_space_unmap(sc->sc_iot_slim, sc->sc_ioh_slim, sc->sc_ios_slim);
+ sc->sc_ios_slim = 0;
}
int