diff options
author | Marco Peereboom <marco@cvs.openbsd.org> | 2006-06-15 04:45:00 +0000 |
---|---|---|
committer | Marco Peereboom <marco@cvs.openbsd.org> | 2006-06-15 04:45:00 +0000 |
commit | 464263103058491c13b88c4fed5b7f6d4eabcf20 (patch) | |
tree | 1cfd752a6cc84dd3ac24e47d607d8bc8f3ef5cee /sys | |
parent | b8ae841ef38a2439d43267f0cec4a9c1cc0ec250 (diff) |
Add structures and initial code to retrieve IOC page 2. We need this for
RAID support and bio. "go at it" dlg
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/ic/mpi.c | 36 | ||||
-rw-r--r-- | sys/dev/ic/mpireg.h | 35 | ||||
-rw-r--r-- | sys/dev/ic/mpivar.h | 3 |
3 files changed, 70 insertions, 4 deletions
diff --git a/sys/dev/ic/mpi.c b/sys/dev/ic/mpi.c index 6cfac6e0ce2..b0b5c23bf21 100644 --- a/sys/dev/ic/mpi.c +++ b/sys/dev/ic/mpi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mpi.c,v 1.38 2006/06/15 02:56:51 marco Exp $ */ +/* $OpenBSD: mpi.c,v 1.39 2006/06/15 04:44:59 marco Exp $ */ /* * Copyright (c) 2005, 2006 David Gwynne <dlg@openbsd.org> @@ -38,12 +38,13 @@ uint32_t mpi_debug = 0 /* | MPI_D_CMD */ /* | MPI_D_INTR */ /* | MPI_D_MISC */ - | MPI_D_DMA +/* | MPI_D_DMA */ /* | MPI_D_IOCTL */ /* | MPI_D_RW */ /* | MPI_D_MEM */ /* | MPI_D_CCB */ /* | MPI_D_PPR */ + | MPI_D_RAID ; #endif @@ -109,6 +110,7 @@ int mpi_portfacts(struct mpi_softc *); int mpi_eventnotify(struct mpi_softc *); void mpi_eventnotify_done(struct mpi_ccb *); int mpi_portenable(struct mpi_softc *); +void mpi_get_raid(struct mpi_softc *); int mpi_cfg_header(struct mpi_softc *, u_int8_t, u_int8_t, u_int32_t, struct mpi_cfg_hdr *); @@ -206,6 +208,9 @@ mpi_attach(struct mpi_softc *sc) config_found(&sc->sc_dev, &sc->sc_link, scsiprint); + /* get raid pages */ + mpi_get_raid(sc); + /* do domain validation */ if (sc->sc_porttype == MPI_PORTFACTS_PORTTYPE_SCSI) mpi_run_ppr(sc); @@ -1852,6 +1857,33 @@ mpi_portenable(struct mpi_softc *sc) return (0); } +void +mpi_get_raid(struct mpi_softc *sc) +{ + struct mpi_cfg_hdr hdr; + struct mpi_cfg_ioc_pg2 pg; + + DNPRINTF(MPI_D_RAID, "%s: mpi_get_raid\n", DEVNAME(sc)); + + if (mpi_cfg_header(sc, MPI_CONFIG_REQ_PAGE_TYPE_IOC, 2, 0, &hdr) != 0) { + DNPRINTF(MPI_D_PPR, "%s: mpi_get_raid unable to fetch header" + "for IOC page 2\n", DEVNAME(sc)); + return; + } + + /* make page length bytes instead of dwords */ + if (mpi_cfg_page(sc, 0, &hdr, 1, &pg, hdr.page_length * 4) != 0) { + DNPRINTF(MPI_D_RAID, "%s: mpi_get_raid unable to fetch IOC " + "page 2\n", DEVNAME(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(pg.capabilities), pg.no_active_vols, + pg.max_vols, pg.no_active_phys_disks, pg.max_phys_disks); +} + int mpi_cfg_header(struct mpi_softc *sc, u_int8_t type, u_int8_t number, u_int32_t address, struct mpi_cfg_hdr *hdr) diff --git a/sys/dev/ic/mpireg.h b/sys/dev/ic/mpireg.h index 62da10f12dd..27c9fd4ac9a 100644 --- a/sys/dev/ic/mpireg.h +++ b/sys/dev/ic/mpireg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mpireg.h,v 1.13 2006/06/12 03:55:39 dlg Exp $ */ +/* $OpenBSD: mpireg.h,v 1.14 2006/06/15 04:44:59 marco Exp $ */ /* * Copyright (c) 2005 David Gwynne <dlg@openbsd.org> @@ -1006,3 +1006,36 @@ struct mpi_cfg_manufacturing_pg0 { char board_assembly[16]; char board_tracer_number[16]; } __packed; + +struct mpi_cfg_raid_vol { + struct mpi_cfg_hdr config_header; + + u_int8_t vol_id; + u_int8_t vol_bus; + u_int8_t vol_ioc; + u_int8_t vol_page; + u_int8_t vol_type; +#define MPI_CFG_RAID_TYPE_RAID_IS (1<<0) /* RAID 0 */ +#define MPI_CFG_RAID_TYPE_RAID_IME (1<<1) /* RAID 1 */ +#define MPI_CFG_RAID_TYPE_RAID_IM (1<<2) /* RAID 1 */ +#define MPI_CFG_RAID_TYPE_RAID5 (1<<3) +#define MPI_CFG_RAID_TYPE_RAID6 (1<<4) +#define MPI_CFG_RAID_TYPE_RAID10 (1<<5) +#define MPI_CFG_RAID_TYPE_RAID50 (1<<6) +#define MPI_CFG_RAID_TYPE_UNKNOWN (0xff) + u_int8_t flags; +#define MPI_CFG_RAID_VOL_ACTIVE (0<<3) +#define MPI_CFG_RAID_VOL_INACTIVE (1<<3) + u_int16_t reserved; +} __packed; + +struct mpi_cfg_ioc_pg2 { + struct mpi_cfg_hdr config_header; + + u_int32_t capabilities; + u_int8_t no_active_vols; + u_int8_t max_vols; + u_int8_t no_active_phys_disks; + u_int8_t max_phys_disks; + struct mpi_cfg_raid_vol raid_vol[1]; /* length is stored in header */ +} __packed; diff --git a/sys/dev/ic/mpivar.h b/sys/dev/ic/mpivar.h index df848e1d94a..f915a276b22 100644 --- a/sys/dev/ic/mpivar.h +++ b/sys/dev/ic/mpivar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mpivar.h,v 1.10 2006/06/12 14:06:05 dlg Exp $ */ +/* $OpenBSD: mpivar.h,v 1.11 2006/06/15 04:44:59 marco Exp $ */ /* * Copyright (c) 2005 David Gwynne <dlg@openbsd.org> @@ -32,6 +32,7 @@ extern uint32_t mpi_debug; #define MPI_D_MEM 0x0040 #define MPI_D_CCB 0x0080 #define MPI_D_PPR 0x0100 +#define MPI_D_RAID 0x0200 #else #define DPRINTF(x...) #define DNPRINTF(n,x...) |