summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorMarco Peereboom <marco@cvs.openbsd.org>2006-06-15 06:45:54 +0000
committerMarco Peereboom <marco@cvs.openbsd.org>2006-06-15 06:45:54 +0000
commit63b77d9e1ff3ab5407e3183d82fcdeb3a5aa22c7 (patch)
tree9b94d59cc2828d9716fb199284810f8de866bc90 /sys/dev
parentb61955ca53a1f8a180b09ee74a3c70a59d41a92c (diff)
Add IOC page 3 support. Needed for RAID and bio.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/ic/mpi.c40
-rw-r--r--sys/dev/ic/mpireg.h17
-rw-r--r--sys/dev/ic/mpivar.h4
3 files changed, 52 insertions, 9 deletions
diff --git a/sys/dev/ic/mpi.c b/sys/dev/ic/mpi.c
index 9d7dd8d3040..9748a59a948 100644
--- a/sys/dev/ic/mpi.c
+++ b/sys/dev/ic/mpi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mpi.c,v 1.41 2006/06/15 05:22:08 marco Exp $ */
+/* $OpenBSD: mpi.c,v 1.42 2006/06/15 06:45:53 marco Exp $ */
/*
* Copyright (c) 2005, 2006 David Gwynne <dlg@openbsd.org>
@@ -1881,21 +1881,47 @@ mpi_get_raid(struct mpi_softc *sc)
return;
}
- DNPRINTF(MPI_D_RAID, "%s: capabilities: %x active vols %d max vols: %d"
- " active phys disks: %d max disks: %d\n",
- DEVNAME(sc), letoh32(sc->sc_ioc_pg2->capabilities),
- sc->sc_ioc_pg2->no_active_vols, sc->sc_ioc_pg2->max_vols,
- sc->sc_ioc_pg2->no_active_phys_disks,
+ DNPRINTF(MPI_D_RAID, "%s: capabilities: %x active vols %d "
+ "max vols: %d\n", DEVNAME(sc),
+ letoh32(sc->sc_ioc_pg2->capabilities),
+ sc->sc_ioc_pg2->no_active_vols, sc->sc_ioc_pg2->max_vols);
+ DNPRINTF(MPI_D_RAID, "%s: active phys disks: %d max disks: %d\n",
+ DEVNAME(sc), sc->sc_ioc_pg2->no_active_phys_disks,
sc->sc_ioc_pg2->max_phys_disks);
for (i = 0; i < sc->sc_ioc_pg2->max_vols; i++) {
raidvol = &sc->sc_ioc_pg2->raid_vol[i];
- DNPRINTF(MPI_D_RAID, "%s: id: %#02x bus: %d ioc: %d page: %d "
+ DNPRINTF(MPI_D_RAID, "%s: id: %#02x bus: %d ioc: %d page: %d "
"type: %#02x flags: %#02x\n", DEVNAME(sc), raidvol->vol_id,
raidvol->vol_bus, raidvol->vol_ioc, raidvol->vol_page,
raidvol->vol_type, raidvol->flags);
}
+
+ /* reuse hdr */
+ if (mpi_cfg_header(sc, MPI_CONFIG_REQ_PAGE_TYPE_IOC, 3, 0, &hdr) != 0) {
+ DNPRINTF(MPI_D_PPR, "%s: mpi_get_raid unable to fetch header"
+ "for IOC page 3\n", DEVNAME(sc));
+ return;
+ }
+
+ /* make page length bytes instead of dwords */
+ sc->sc_ioc_pg3 = malloc(hdr.page_length * 4, M_DEVBUF, M_WAITOK);
+ if (mpi_cfg_page(sc, 0, &hdr, 1, sc->sc_ioc_pg3,
+ hdr.page_length * 4) != 0) {
+ DNPRINTF(MPI_D_RAID, "%s: mpi_get_raid unable to fetch IOC "
+ "page 3\n", DEVNAME(sc));
+ return;
+ }
+
+ for (i = 0; i < sc->sc_ioc_pg3->no_phys_disks; i++) {
+ DNPRINTF(MPI_D_RAID, "%s: id: %#02x bus: %d ioc: %d "
+ "num: %#02x\n", DEVNAME(sc),
+ sc->sc_ioc_pg3->phys_disks[i].phys_disk_id,
+ sc->sc_ioc_pg3->phys_disks[i].phys_disk_bus,
+ sc->sc_ioc_pg3->phys_disks[i].phys_disk_ioc,
+ sc->sc_ioc_pg3->phys_disks[i].phys_disk_num);
+ }
}
int
diff --git a/sys/dev/ic/mpireg.h b/sys/dev/ic/mpireg.h
index 7882bddd754..fac91fd167f 100644
--- a/sys/dev/ic/mpireg.h
+++ b/sys/dev/ic/mpireg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: mpireg.h,v 1.15 2006/06/15 05:21:46 marco Exp $ */
+/* $OpenBSD: mpireg.h,v 1.16 2006/06/15 06:45:53 marco Exp $ */
/*
* Copyright (c) 2005 David Gwynne <dlg@openbsd.org>
@@ -1037,3 +1037,18 @@ struct mpi_cfg_ioc_pg2 {
u_int8_t max_phys_disks;
struct mpi_cfg_raid_vol raid_vol[1]; /* length is stored in header */
} __packed;
+
+struct mpi_cfg_raid_pd {
+ u_int8_t phys_disk_id;
+ u_int8_t phys_disk_bus;
+ u_int8_t phys_disk_ioc;
+ u_int8_t phys_disk_num;
+} __packed;
+
+struct mpi_cfg_ioc_pg3 {
+ struct mpi_cfg_hdr config_header;
+
+ u_int8_t no_phys_disks;
+ u_int8_t reserved[3];
+ struct mpi_cfg_raid_pd phys_disks[1]; /* length stored in header */
+} __packed;
diff --git a/sys/dev/ic/mpivar.h b/sys/dev/ic/mpivar.h
index 5be18deb939..d188ed676d1 100644
--- a/sys/dev/ic/mpivar.h
+++ b/sys/dev/ic/mpivar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: mpivar.h,v 1.12 2006/06/15 04:59:21 marco Exp $ */
+/* $OpenBSD: mpivar.h,v 1.13 2006/06/15 06:45:53 marco Exp $ */
/*
* Copyright (c) 2005 David Gwynne <dlg@openbsd.org>
@@ -115,7 +115,9 @@ struct mpi_softc {
struct mpi_dmamem *sc_replies;
+ /* RAID pages */
struct mpi_cfg_ioc_pg2 *sc_ioc_pg2;
+ struct mpi_cfg_ioc_pg3 *sc_ioc_pg3;
};
int mpi_attach(struct mpi_softc *);