summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMarco Peereboom <marco@cvs.openbsd.org>2004-11-03 00:59:57 +0000
committerMarco Peereboom <marco@cvs.openbsd.org>2004-11-03 00:59:57 +0000
commitef4a8ee5369a09823cf52dd8f2ffc9201420f5da (patch)
tree791743ef1604e0e4a088249824c691999343e771 /sys
parent87d71b875072c6e094a93474fb9446564e479c7b (diff)
Revert to 3.6-current code since IBM onboard mpt's act up. Found by pval & deraadt
no cookie for me...
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/ic/mpt.c365
-rw-r--r--sys/dev/ic/mpt_mpilib.h52
-rw-r--r--sys/dev/ic/mpt_openbsd.c238
-rw-r--r--sys/dev/ic/mpt_openbsd.h42
4 files changed, 109 insertions, 588 deletions
diff --git a/sys/dev/ic/mpt.c b/sys/dev/ic/mpt.c
index e1628246dcc..c15e8968279 100644
--- a/sys/dev/ic/mpt.c
+++ b/sys/dev/ic/mpt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mpt.c,v 1.12 2004/10/30 18:07:06 marco Exp $ */
+/* $OpenBSD: mpt.c,v 1.13 2004/11/03 00:59:56 marco Exp $ */
/* $NetBSD: mpt.c,v 1.4 2003/11/02 11:07:45 wiz Exp $ */
/*
@@ -58,10 +58,6 @@ int mpt_wait_state(mpt_softc_t *, enum DB_STATE_BITS);
int mpt_get_iocfacts(mpt_softc_t *, MSG_IOC_FACTS_REPLY *);
int mpt_get_portfacts(mpt_softc_t *, MSG_PORT_FACTS_REPLY *);
int mpt_send_ioc_init(mpt_softc_t *, u_int32_t);
-void mpt_print_header(mpt_softc_t *, char *, fCONFIG_PAGE_HEADER *);
-int mpt_read_config_info_mfg(mpt_softc_t *);
-int mpt_read_config_info_ioc(mpt_softc_t *);
-int mpt_read_config_info_raid(mpt_softc_t *);
int mpt_read_config_info_spi(mpt_softc_t *);
int mpt_set_initial_config_spi(mpt_softc_t *);
int mpt_send_port_enable(mpt_softc_t *, int);
@@ -723,20 +719,7 @@ mpt_read_cfg_page(mpt_softc_t *mpt, int PageAddress, fCONFIG_PAGE_HEADER *hdr)
} else if (cfgp->Header.PageType == MPI_CONFIG_PAGETYPE_SCSI_DEVICE &&
cfgp->Header.PageNumber == 1) {
amt = sizeof (fCONFIG_PAGE_SCSI_DEVICE_1);
- } else if (cfgp->Header.PageType == MPI_CONFIG_PAGETYPE_MANUFACTURING &&
- cfgp->Header.PageNumber == 0) {
- amt = sizeof (fCONFIG_PAGE_MANUFACTURING_0);
- } else if (cfgp->Header.PageType == MPI_CONFIG_PAGETYPE_IOC &&
- cfgp->Header.PageNumber == 2) {
- amt = sizeof (fCONFIG_PAGE_IOC_2);
- } else if (cfgp->Header.PageType == MPI_CONFIG_PAGETYPE_RAID_VOLUME &&
- cfgp->Header.PageNumber == 0) {
- amt = sizeof (fCONFIG_PAGE_RAID_VOL_0);
- } else if (cfgp->Header.PageType == MPI_CONFIG_PAGETYPE_RAID_PHYSDISK &&
- cfgp->Header.PageNumber == 0) {
- amt = sizeof (fCONFIG_PAGE_RAID_PHYS_DISK_0);
}
-
bcopy(((caddr_t)req->req_vbuf)+CFG_DATA_OFF, hdr, amt);
mpt_free_request(mpt, req);
return (0);
@@ -827,322 +810,6 @@ mpt_write_cfg_page(mpt_softc_t *mpt, int PageAddress, fCONFIG_PAGE_HEADER *hdr)
return (0);
}
-void
-mpt_print_header(mpt_softc_t *mpt, char *s, fCONFIG_PAGE_HEADER *phdr)
-{
- mpt_prt(mpt, "%s %x: %x %x %x %x",
- s,
- phdr->PageNumber,
- phdr->PageType,
- phdr->PageNumber,
- phdr->PageLength,
- phdr->PageVersion);
-}
-
-/*
- * Read manufacturing configuration information
- */
-int
-mpt_read_config_info_mfg(mpt_softc_t *mpt)
-{
- int rv, i;
- fCONFIG_PAGE_HEADER *phdr[5] = {
- phdr[0] = &mpt->mpt_mfg_page0.Header,
- phdr[1] = &mpt->mpt_mfg_page1.Header,
- phdr[2] = &mpt->mpt_mfg_page2.Header,
- phdr[3] = &mpt->mpt_mfg_page3.Header,
- phdr[4] = &mpt->mpt_mfg_page4.Header
- };
-
- for (i = 0; i < 5 /* 5 pages total */; i++) {
- /* retrieve MFG headers */
- rv = mpt_read_cfg_header(mpt,
- MPI_CONFIG_PAGETYPE_MANUFACTURING, i, 0, phdr[i]);
- if (rv) {
- mpt_prt(mpt, "Could not retrieve Manufacturing Page "
- "%i Header.", i);
- return (-1);
- } else if (mpt->verbose > 1) {
- mpt_print_header(mpt, "Manufacturing Header Page",
- phdr[i]);
- }
-
- /* retrieve MFG config pages using retrieved headers */
- rv = mpt_read_cfg_page(mpt, i, phdr[i]);
- if (rv) {
- mpt_prt(mpt, "Could not retrieve manufacturing Page"
- " %i", i);
- return (-1);
- }
- }
-
- /* mpt->verbose = 2; */
- if (mpt->verbose > 1) {
- mpt_prt(mpt, "Manufacturing Page 0 data: %s %s %s %s %s",
- mpt->mpt_mfg_page0.ChipName,
- mpt->mpt_mfg_page0.ChipRevision,
- mpt->mpt_mfg_page0.BoardName,
- mpt->mpt_mfg_page0.BoardAssembly,
- mpt->mpt_mfg_page0.BoardTracerNumber);
-
- mpt_prt(mpt, "Manufacturing Page 1 data:");
- for (i = 0;
- i < ((mpt->mpt_mfg_page1.Header.PageLength - 1)<< 2); i++) {
- printf("%02x ", mpt->mpt_mfg_page1.VPD[i]);
- }
- printf("\n");
-
- mpt_prt(mpt, "Manufacturing Page 2 data: %x %x",
- mpt->mpt_mfg_page2.ChipId.PCIRevisionID,
- mpt->mpt_mfg_page2.ChipId.DeviceID);
- for (i = 0;
- i < (mpt->mpt_mfg_page2.Header.PageLength - 2); i++) {
- printf("%08x ", mpt->mpt_mfg_page2.HwSettings[i]);
- }
- printf("\n");
-
- mpt_prt(mpt, "Manufacturing Page 3 data: %x %x",
- mpt->mpt_mfg_page3.ChipId.PCIRevisionID,
- mpt->mpt_mfg_page3.ChipId.DeviceID);
- for (i = 0;
- i < (mpt->mpt_mfg_page3.Header.PageLength - 2); i++) {
- printf("%08x ", mpt->mpt_mfg_page3.Info[i]);
- }
- printf("\n");
-
- mpt_prt(mpt, "Manufacturing Page 4 data: %x %x %x %x %x",
- mpt->mpt_mfg_page4.InfoSize1,
- mpt->mpt_mfg_page4.InfoOffset1,
- mpt->mpt_mfg_page4.InfoSize0,
- mpt->mpt_mfg_page4.InfoOffset0,
- mpt->mpt_mfg_page4.InquirySize,
- mpt->mpt_mfg_page4.ISVolumeSettings,
- mpt->mpt_mfg_page4.IMEVolumeSettings,
- mpt->mpt_mfg_page4.IMVolumeSettings);
- for (i = 0; i < sizeof(mpt->mpt_mfg_page4.InquiryData); i++) {
- printf("%02x ", mpt->mpt_mfg_page4.InquiryData[i]);
- }
- printf("\n");
- }
- /* mpt->verbose = 1; */
-
- return (0);
-}
-
-/*
- * Read IOC configuration information
- */
-int
-mpt_read_config_info_ioc(mpt_softc_t *mpt)
-{
- int rv, i;
- fCONFIG_PAGE_HEADER *phdr[5] = {
- phdr[0] = &mpt->mpt_ioc_page0.Header,
- phdr[1] = &mpt->mpt_ioc_page1.Header,
- phdr[2] = &mpt->mpt_ioc_page2.Header,
- phdr[3] = &mpt->mpt_ioc_page3.Header,
- phdr[4] = &mpt->mpt_ioc_page4.Header
- };
-
- for (i = 0; i < 5 /* 5 pages total */; i++) {
- /* retrieve IOC headers */
- rv = mpt_read_cfg_header(mpt, MPI_CONFIG_PAGETYPE_IOC, i,
- 0, phdr[i]);
- if (rv) {
- mpt_prt(mpt, "Could not retrieve IOC Page %i header.",
- i);
- return (-1);
- } else if (mpt->verbose > 1) {
- mpt_print_header(mpt, "IOC Header Page", phdr[i]);
- }
-
- /* retrieve IOC config pages using retrieved headers */
- rv = mpt_read_cfg_page(mpt, i, phdr[i]);
- if (rv) {
- mpt_prt(mpt, "Could not retrieve IOC Page %i", i);
- return (-1);
- }
- }
-
- /* mpt->verbose = 2; */
- if (mpt->verbose > 1) {
- mpt_prt(mpt, "IOC Page 0 data: %x %x %x %x %x %x %x %x",
- mpt->mpt_ioc_page0.TotalNVStore,
- mpt->mpt_ioc_page0.FreeNVStore,
- mpt->mpt_ioc_page0.DeviceID,
- mpt->mpt_ioc_page0.VendorID,
- mpt->mpt_ioc_page0.RevisionID,
- mpt->mpt_ioc_page0.ClassCode,
- mpt->mpt_ioc_page0.SubsystemID,
- mpt->mpt_ioc_page0.SubsystemVendorID
- );
-
- mpt_prt(mpt, "IOC Page 1 data: %x %x %x",
- mpt->mpt_ioc_page1.Flags,
- mpt->mpt_ioc_page1.CoalescingTimeout,
- mpt->mpt_ioc_page1.CoalescingDepth);
-
- mpt_prt(mpt, "IOC Page 2 data: %x %x %x %x %x",
- mpt->mpt_ioc_page2.CapabilitiesFlags,
- mpt->mpt_ioc_page2.MaxPhysDisks,
- mpt->mpt_ioc_page2.NumActivePhysDisks,
- mpt->mpt_ioc_page2.MaxVolumes,
- mpt->mpt_ioc_page2.NumActiveVolumes);
-
- /* FIXME: move this to attach */
- if (mpt->mpt_ioc_page2.MaxVolumes >
- MPI_IOC_PAGE_2_RAID_VOLUME_MAX) {
- /* complain */
- }
- for (i = 0; i < mpt->mpt_ioc_page2.MaxVolumes; i++) {
- mpt_prt(mpt, "IOC Page 2 RAID Volume %x %x %x %x %x",
- mpt->mpt_ioc_page2.RaidVolume[i].VolumeType,
- mpt->mpt_ioc_page2.RaidVolume[i].VolumePageNumber,
- mpt->mpt_ioc_page2.RaidVolume[i].VolumeIOC,
- mpt->mpt_ioc_page2.RaidVolume[i].VolumeBus,
- mpt->mpt_ioc_page2.RaidVolume[i].VolumeID);
- }
-
- mpt_prt(mpt, "IOC Page 3 data: %x ",
- mpt->mpt_ioc_page3.NumPhysDisks);
-
- for (i = 0; i < mpt->mpt_ioc_page3.NumPhysDisks; i++) {
- mpt_prt(mpt, "IOC Page 3 Physical Disk: %x %x %x %x",
- mpt->mpt_ioc_page3.PhysDisk[i].PhysDiskNum,
- mpt->mpt_ioc_page3.PhysDisk[i].PhysDiskIOC,
- mpt->mpt_ioc_page3.PhysDisk[i].PhysDiskBus,
- mpt->mpt_ioc_page3.PhysDisk[i].PhysDiskID);
- }
-
- mpt_prt(mpt, "IOC Page 4 data: %x %x",
- mpt->mpt_ioc_page4.MaxSEP,
- mpt->mpt_ioc_page4.ActiveSEP);
-
- for (i = 0; i < mpt->mpt_ioc_page4.MaxSEP; i++) {
- mpt_prt(mpt, "IOC Page 4 SEP: %x %x",
- mpt->mpt_ioc_page4.SEP[i].SEPTargetID,
- mpt->mpt_ioc_page4.SEP[i].SEPBus);
- }
- }
- /* mpt->verbose = 1; */
-
- return (0);
-}
-
-/*
- * Read RAID Volume pages
- */
-int
-mpt_read_config_info_raid(mpt_softc_t *mpt)
-{
- int rv, i;
-
- /* retrieve raid volume headers */
- rv = mpt_read_cfg_header(mpt, MPI_CONFIG_PAGETYPE_RAID_VOLUME, 0,
- 0, &mpt->mpt_raidvol_page0.Header);
- if (rv) {
- mpt_prt(mpt, "Could not retrieve RAID Volume Page 0 Header");
- return (-1);
- } else if (mpt->verbose > 1) {
- mpt_print_header(mpt, "RAID Volume Header Page",
- &mpt->mpt_raidvol_page0.Header);
- }
-
- /* retrieve raid volume page using retrieved headers */
- rv = mpt_read_cfg_page(mpt, 0, &mpt->mpt_raidvol_page0.Header);
- if (rv) {
- mpt_prt(mpt, "Could not retrieve RAID Volume Page 0");
- return (-1);
- }
-
- /* retrieve raid physical disk header */
- rv = mpt_read_cfg_header(mpt, MPI_CONFIG_PAGETYPE_RAID_PHYSDISK, 0,
- 0, &mpt->mpt_raidphys_page0.Header);
- if (rv) {
- mpt_prt(mpt, "Could not retrieve RAID Phys Disk Page 0 Header");
- return (-1);
- } else if (mpt->verbose > 1) {
- mpt_print_header(mpt, "RAID Volume Physical Disk Page",
- &mpt->mpt_raidphys_page0.Header);
- }
-
- /* retrieve raid physical disk page using retrieved headers */
- rv = mpt_read_cfg_page(mpt, 0, &mpt->mpt_raidphys_page0.Header);
- if (rv) {
- mpt_prt(mpt, "Could not retrieve RAID Phys Disk Page 0");
- return (-1);
- }
-
- if (mpt->verbose > 1) {
- mpt_prt(mpt, "RAID Volume Page 0 data: %x %x %x %x %x"
- "%x %x %x %x",
- mpt->mpt_raidvol_page0.VolumeType,
- mpt->mpt_raidvol_page0.VolumeIOC,
- mpt->mpt_raidvol_page0.VolumeBus,
- mpt->mpt_raidvol_page0.VolumeID,
- mpt->mpt_raidvol_page0.VolumeStatus,
- mpt->mpt_raidvol_page0.VolumeSettings,
- mpt->mpt_raidvol_page0.MaxLBA,
- mpt->mpt_raidvol_page0.StripeSize,
- mpt->mpt_raidvol_page0.NumPhysDisks);
-
- for (i = 0; i < mpt->mpt_raidvol_page0.NumPhysDisks; i++) {
- mpt_prt(mpt, "RAID Volume Page 0 Physical Disk: %x %x",
- mpt->mpt_raidvol_page0.PhysDisk[i].PhysDiskNum,
- mpt->mpt_raidvol_page0.PhysDisk[i].PhysDiskMap);
- }
- printf("\n");
- }
-
- if (mpt->verbose > 1) {
- mpt_prt(mpt, "RAID Phyical Disk Page 0 data: %x %x %x %x %x"
- "%x %x %x",
- mpt->mpt_raidphys_page0.PhysDiskNum,
- mpt->mpt_raidphys_page0.PhysDiskIOC,
- mpt->mpt_raidphys_page0.PhysDiskBus,
- mpt->mpt_raidphys_page0.PhysDiskID,
- mpt->mpt_raidphys_page0.PhysDiskSettings.SepID,
- mpt->mpt_raidphys_page0.PhysDiskSettings.SepBus,
- mpt->mpt_raidphys_page0.PhysDiskSettings.HotSparePool,
- mpt->mpt_raidphys_page0.PhysDiskSettings.PhysDiskSettings);
-
- for (i = 0;
- i < sizeof(mpt->mpt_raidphys_page0.DiskIdentifier); i++) {
- printf("%02x ",
- mpt->mpt_raidphys_page0.DiskIdentifier[i]);
- }
-
- /* does them all */
- printf("\n");
- mpt_prt(mpt, "RAID Phyical Disk Page 0 data: %s",
- mpt->mpt_raidphys_page0.InquiryData.VendorID);
-
- for (i = 0;
- i < sizeof(mpt->mpt_raidphys_page0.InquiryData.Info); i++) {
- printf("%02x ",
- mpt->mpt_raidphys_page0.InquiryData.Info[i]);
- }
-
- printf("\n");
- mpt_prt(mpt, "RAID Phyical Disk Page 0 data: %x %x %x"
- "%x %x %x %x %x %x %x %x",
- mpt->mpt_raidphys_page0.PhysDiskStatus.Flags,
- mpt->mpt_raidphys_page0.PhysDiskStatus.State,
- mpt->mpt_raidphys_page0.MaxLBA,
- mpt->mpt_raidphys_page0.ErrorData.ErrorSenseKey,
- mpt->mpt_raidphys_page0.ErrorData.ErrorCdbByte,
- mpt->mpt_raidphys_page0.ErrorData.ErrorASCQ,
- mpt->mpt_raidphys_page0.ErrorData.ErrorASC,
- mpt->mpt_raidphys_page0.ErrorData.ErrorCount,
- mpt->mpt_raidphys_page0.ErrorData.SmartASCQ,
- mpt->mpt_raidphys_page0.ErrorData.SmartASC,
- mpt->mpt_raidphys_page0.ErrorData.SmartCount
- );
- }
-
- return (0);
-}
-
/*
* Read SCSI configuration information
*/
@@ -1611,36 +1278,6 @@ mpt_init(mpt_softc_t *mpt, u_int32_t who)
}
/*
- * Read manufacturing pages
- */
- if (mpt_read_config_info_mfg(mpt)) {
- mpt_prt(mpt, "could not retrieve manufacturing pages");
- return (EIO);
- }
-
- /*
- * Read IOC pages
- */
- if (mpt_read_config_info_ioc(mpt)) {
- mpt_prt(mpt, "could not retrieve IOC pages");
- return (EIO);
- }
- mpt->im_support = mpt->mpt_ioc_page2.CapabilitiesFlags &
- (MPI_IOCPAGE2_CAP_FLAGS_IS_SUPPORT |
- MPI_IOCPAGE2_CAP_FLAGS_IME_SUPPORT |
- MPI_IOCPAGE2_CAP_FLAGS_IM_SUPPORT);
-
- /*
- * Read RAID pages if we have IM/IME/IS volumes
- */
- if (mpt->mpt_ioc_page2.MaxVolumes) {
- if (mpt_read_config_info_raid(mpt)) {
- mpt_prt(mpt, "could not retrieve RAID pages");
- return (EIO);
- }
- }
-
- /*
* Now enable the port
*/
if (mpt_send_port_enable(mpt, 0) != MPT_OK) {
diff --git a/sys/dev/ic/mpt_mpilib.h b/sys/dev/ic/mpt_mpilib.h
index 9fbf867d9d0..f9e632547db 100644
--- a/sys/dev/ic/mpt_mpilib.h
+++ b/sys/dev/ic/mpt_mpilib.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: mpt_mpilib.h,v 1.3 2004/10/30 18:07:06 marco Exp $ */
+/* $OpenBSD: mpt_mpilib.h,v 1.4 2004/11/03 00:59:56 marco Exp $ */
/* $NetBSD: mpt_mpilib.h,v 1.2 2003/04/16 23:24:01 thorpej Exp $ */
/*
@@ -1097,7 +1097,7 @@ typedef struct _MSG_CONFIG_REPLY
typedef struct _CONFIG_PAGE_MANUFACTURING_0
{
- fCONFIG_PAGE_HEADER Header; /* 00h */
+ fCONFIG_PAGE_HEADER Header; /* 00h */
U8 ChipName[16]; /* 04h */
U8 ChipRevision[8]; /* 14h */
U8 BoardName[16]; /* 1Ch */
@@ -1112,7 +1112,7 @@ typedef struct _CONFIG_PAGE_MANUFACTURING_0
typedef struct _CONFIG_PAGE_MANUFACTURING_1
{
- fCONFIG_PAGE_HEADER Header; /* 00h */
+ fCONFIG_PAGE_HEADER Header; /* 00h */
U8 VPD[256]; /* 04h */
} fCONFIG_PAGE_MANUFACTURING_1, MPI_POINTER PTR_CONFIG_PAGE_MANUFACTURING_1,
ManufacturingPage1_t, MPI_POINTER pManufacturingPage1_t;
@@ -1134,14 +1134,12 @@ typedef struct _MPI_CHIP_REVISION_ID
* one and check Header.PageLength at runtime.
*/
#ifndef MPI_MAN_PAGE_2_HW_SETTINGS_WORDS
-/*#define MPI_MAN_PAGE_2_HW_SETTINGS_WORDS (1)*/
-/* MP: is this right? */
-#define MPI_MAN_PAGE_2_HW_SETTINGS_WORDS (16)
+#define MPI_MAN_PAGE_2_HW_SETTINGS_WORDS (1)
#endif
typedef struct _CONFIG_PAGE_MANUFACTURING_2
{
- fCONFIG_PAGE_HEADER Header; /* 00h */
+ fCONFIG_PAGE_HEADER Header; /* 00h */
MPI_CHIP_REVISION_ID ChipId; /* 04h */
U32 HwSettings[MPI_MAN_PAGE_2_HW_SETTINGS_WORDS];/* 08h */
} fCONFIG_PAGE_MANUFACTURING_2, MPI_POINTER PTR_CONFIG_PAGE_MANUFACTURING_2,
@@ -1155,14 +1153,12 @@ typedef struct _CONFIG_PAGE_MANUFACTURING_2
* one and check Header.PageLength at runtime.
*/
#ifndef MPI_MAN_PAGE_3_INFO_WORDS
-/*#define MPI_MAN_PAGE_3_INFO_WORDS (1)*/
-/* MP: is this right? */
-#define MPI_MAN_PAGE_3_INFO_WORDS (16)
+#define MPI_MAN_PAGE_3_INFO_WORDS (1)
#endif
typedef struct _CONFIG_PAGE_MANUFACTURING_3
{
- fCONFIG_PAGE_HEADER Header; /* 00h */
+ fCONFIG_PAGE_HEADER Header; /* 00h */
MPI_CHIP_REVISION_ID ChipId; /* 04h */
U32 Info[MPI_MAN_PAGE_3_INFO_WORDS];/* 08h */
} fCONFIG_PAGE_MANUFACTURING_3, MPI_POINTER PTR_CONFIG_PAGE_MANUFACTURING_3,
@@ -1333,14 +1329,12 @@ typedef struct _CONFIG_PAGE_IOC_2_RAID_VOL
* one and check Header.PageLength at runtime.
*/
#ifndef MPI_IOC_PAGE_2_RAID_VOLUME_MAX
-/* #define MPI_IOC_PAGE_2_RAID_VOLUME_MAX (1) */
-/* MP: is this the right way of doing this? */
-#define MPI_IOC_PAGE_2_RAID_VOLUME_MAX (16)
+#define MPI_IOC_PAGE_2_RAID_VOLUME_MAX (1)
#endif
typedef struct _CONFIG_PAGE_IOC_2
{
- fCONFIG_PAGE_HEADER Header; /* 00h */
+ fCONFIG_PAGE_HEADER Header; /* 00h */
U32 CapabilitiesFlags; /* 04h */
U8 NumActiveVolumes; /* 08h */
U8 MaxVolumes; /* 09h */
@@ -1382,9 +1376,7 @@ typedef struct _IOC_3_PHYS_DISK
* one and check Header.PageLength at runtime.
*/
#ifndef MPI_IOC_PAGE_3_PHYSDISK_MAX
-/* #define MPI_IOC_PAGE_3_PHYSDISK_MAX (1) */
-/* MP: is this the right way of doing this? */
-#define MPI_IOC_PAGE_3_PHYSDISK_MAX (16)
+#define MPI_IOC_PAGE_3_PHYSDISK_MAX (1)
#endif
typedef struct _CONFIG_PAGE_IOC_3
@@ -1412,15 +1404,13 @@ typedef struct _IOC_4_SEP
* Host code (drivers, BIOS, utilities, etc.) should leave this define set to
* one and check Header.PageLength at runtime.
*/
-#ifndef MPI_IOC_PAGE_4_SEP_MAX
-/* #define MPI_IOC_PAGE_4_SEP_MAX (1) */
-/* MP: is this the right way of doing this? */
-#define MPI_IOC_PAGE_4_SEP_MAX (16)
+#ifndef MPI_IOC_PAGE_4_SEP_MAX
+#define MPI_IOC_PAGE_4_SEP_MAX (1)
#endif
typedef struct _CONFIG_PAGE_IOC_4
{
- fCONFIG_PAGE_HEADER Header; /* 00h */
+ fCONFIG_PAGE_HEADER Header; /* 00h */
U8 ActiveSEP; /* 04h */
U8 MaxSEP; /* 05h */
U16 Reserved1; /* 06h */
@@ -1437,9 +1427,9 @@ typedef struct _CONFIG_PAGE_IOC_4
typedef struct _CONFIG_PAGE_SCSI_PORT_0
{
- fCONFIG_PAGE_HEADER Header; /* 00h */
- U32 Capabilities; /* 04h */
- U32 PhysicalInterface; /* 08h */
+ fCONFIG_PAGE_HEADER Header; /* 00h */
+ U32 Capabilities; /* 04h */
+ U32 PhysicalInterface; /* 08h */
} fCONFIG_PAGE_SCSI_PORT_0, MPI_POINTER PTR_CONFIG_PAGE_SCSI_PORT_0,
SCSIPortPage0_t, MPI_POINTER pSCSIPortPage0_t;
@@ -1461,9 +1451,9 @@ typedef struct _CONFIG_PAGE_SCSI_PORT_0
typedef struct _CONFIG_PAGE_SCSI_PORT_1
{
- fCONFIG_PAGE_HEADER Header; /* 00h */
- U32 Configuration; /* 04h */
- U32 OnBusTimerValue; /* 08h */
+ fCONFIG_PAGE_HEADER Header; /* 00h */
+ U32 Configuration; /* 04h */
+ U32 OnBusTimerValue; /* 08h */
} fCONFIG_PAGE_SCSI_PORT_1, MPI_POINTER PTR_CONFIG_PAGE_SCSI_PORT_1,
SCSIPortPage1_t, MPI_POINTER pSCSIPortPage1_t;
@@ -2024,9 +2014,7 @@ typedef struct _RAID_VOL0_SETTINGS
* one and check Header.PageLength at runtime.
*/
#ifndef MPI_RAID_VOL_PAGE_0_PHYSDISK_MAX
-/* #define MPI_RAID_VOL_PAGE_0_PHYSDISK_MAX (1) */
-/* MP: is this the right way of doing this? */
-#define MPI_RAID_VOL_PAGE_0_PHYSDISK_MAX (16)
+#define MPI_RAID_VOL_PAGE_0_PHYSDISK_MAX (1)
#endif
typedef struct _CONFIG_PAGE_RAID_VOL_0
diff --git a/sys/dev/ic/mpt_openbsd.c b/sys/dev/ic/mpt_openbsd.c
index b93e33df29b..7b61077f0b4 100644
--- a/sys/dev/ic/mpt_openbsd.c
+++ b/sys/dev/ic/mpt_openbsd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mpt_openbsd.c,v 1.17 2004/10/26 04:43:59 marco Exp $ */
+/* $OpenBSD: mpt_openbsd.c,v 1.18 2004/11/03 00:59:56 marco Exp $ */
/* $NetBSD: mpt_netbsd.c,v 1.7 2003/07/14 15:47:11 lukem Exp $ */
/*
@@ -119,9 +119,6 @@ void mpt_event_notify_reply(mpt_softc_t *, MSG_EVENT_NOTIFY_REPLY *);
int mpt_action(struct scsi_xfer *);
void mpt_minphys(struct buf *);
-#if NBIO > 0
-int mpt_ioctl(struct device *, u_long, caddr_t);
-#endif
struct cfdriver mpt_cd = {
NULL, "mpt", DV_DULL
};
@@ -191,12 +188,10 @@ mpt_ppr(mpt_softc_t *mpt, struct scsi_link *sc_link, int speed, int flags)
/*
* Set the synchronous parameters for the target.
*/
- page1.RequestedParameters &=
- ~(MPI_SCSIDEVPAGE1_RP_MIN_SYNC_PERIOD_MASK |
+ page1.RequestedParameters &= ~(MPI_SCSIDEVPAGE1_RP_MIN_SYNC_PERIOD_MASK |
MPI_SCSIDEVPAGE1_RP_MAX_SYNC_OFFSET_MASK |
MPI_SCSIDEVPAGE1_RP_DT | MPI_SCSIDEVPAGE1_RP_QAS |
MPI_SCSIDEVPAGE1_RP_IU);
-
if (!(sc_link->quirks & SDEV_NOSYNC)) {
int factor, offset, np;
@@ -209,18 +204,18 @@ mpt_ppr(mpt_softc_t *mpt, struct scsi_link *sc_link, int speed, int flags)
factor = (mpt->mpt_port_page0.Capabilities >> 8) & 0xff;
offset = (mpt->mpt_port_page0.Capabilities >> 16) & 0xff;
np = 0;
-
+
switch (speed) {
- case U320:
- /* do nothing */
- break;
-
- case U160:
- factor = 0x09; /* force U160 */
- break;
+ case U320:
+ /* do nothing */
+ break;
- case U80:
- factor = 0x0a; /* force U80 */
+ case U160:
+ factor = 0x09; /* force U160 */
+ break;
+
+ case U80:
+ factor = 0x0a; /* force U80 */
}
if (factor < 0x9) {
@@ -276,24 +271,20 @@ mpt_ppr(mpt_softc_t *mpt, struct scsi_link *sc_link, int speed, int flags)
if (mpt->verbose > 1) {
mpt_prt(mpt,
- "SPI Tgt %d Page 0: NParms %x Information %x",
- sc_link->target,
- page0.NegotiatedParameters, page0.Information);
+ "SPI Tgt %d Page 0: NParms %x Information %x",
+ sc_link->target,
+ page0.NegotiatedParameters, page0.Information);
}
if (!(page0.NegotiatedParameters & 0x07) && (speed == U320)) {
- /*
- * if lowest 3 aren't set the PPR probably failed,
- * retry with other parameters
- */
+ /* if lowest 3 aren't set the PPR probably failed, retry with other parameters */
if (mpt->verbose > 1) {
mpt_prt(mpt, "U320 PPR failed");
}
return 0;
}
- if ((((page0.NegotiatedParameters >> 8) & 0xff) > 0x09) &&
- (speed == U160)) {
+ if ((((page0.NegotiatedParameters >> 8) & 0xff) > 0x09) && (speed == U160)) {
/* if transfer period > 0x09 then U160 PPR failed, retry */
if (mpt->verbose > 1) {
mpt_prt(mpt, "U160 PPR failed");
@@ -302,56 +293,55 @@ mpt_ppr(mpt_softc_t *mpt, struct scsi_link *sc_link, int speed, int flags)
}
/*
- * Bit 3 - PPR rejected: IOC sets this if the device rejects PPR.
- * Bit 2 - WDTR rejected: IOC sets this if the device rejects WDTR.
- * Bit 1 - SDTR Rejected: IOC sets this if the device rejects SDTR.
- * Bit 0 - 1 A SCSI SDTR, WDTR, or PPR negotiation has occurred.
+ * Bit 3 - PPR rejected: The IOC sets this bit if the device rejects a PPR message.
+ * Bit 2 - WDTR Rejected: The IOC sets this bit if the device rejects a WDTR message.
+ * Bit 1 - SDTR Rejected: The IOC sets this bit if the device rejects a SDTR message.
+ * Bit 0 - 1 A SCSI SDTR, WDTR, or PPR negotiation has occurred with this device.
*/
if (page0.Information & 0x0e) {
/* target rejected PPR message */
mpt_prt(mpt, "Target %d rejected PPR message with %02x",
- sc_link->target,
- (uint8_t)page0.Information);
-
+ sc_link->target,
+ (uint8_t)page0.Information);
return 0;
}
/* print PPR results */
switch ((page0.NegotiatedParameters >> 8) & 0xff) {
- case 0x08:
- tp = 160;
- break;
-
- case 0x09:
- tp = 80;
- break;
-
- case 0x0a:
- tp = 40;
- break;
-
- case 0x0b:
- tp = 20;
- break;
-
- case 0x0c:
- tp = 10;
- break;
+ case 0x08:
+ tp = 160;
+ break;
+
+ case 0x09:
+ tp = 80;
+ break;
+
+ case 0x0a:
+ tp = 40;
+ break;
+
+ case 0x0b:
+ tp = 20;
+ break;
+
+ case 0x0c:
+ tp = 10;
+ break;
- default:
- tp = 0;
+ default:
+ tp = 0;
}
mpt_prt(mpt,
- "target %d %s at %dMHz width %dbit offset %d QAS %d DT %d IU %d",
- sc_link->target,
- tp ? "Synchronous" : "Asynchronous",
- tp,
- (page0.NegotiatedParameters & 0x20000000) ? 16 : 8,
- (page0.NegotiatedParameters >> 16) & 0xff,
- (page0.NegotiatedParameters & 0x04) ? 1 : 0,
- (page0.NegotiatedParameters & 0x02) ? 1 : 0,
- (page0.NegotiatedParameters & 0x01) ? 1 : 0);
+ "target %d %s at %dMHz width %dbit offset %d QAS %d DT %d IU %d",
+ sc_link->target,
+ tp ? "Synchronous" : "Asynchronous",
+ tp,
+ (page0.NegotiatedParameters & 0x20000000) ? 16 : 8,
+ (page0.NegotiatedParameters >> 16) & 0xff,
+ (page0.NegotiatedParameters & 0x04) ? 1 : 0,
+ (page0.NegotiatedParameters & 0x02) ? 1 : 0,
+ (page0.NegotiatedParameters & 0x01) ? 1 : 0);
return 1; /* success */
}
@@ -372,14 +362,12 @@ mpt_run_ppr(mpt_softc_t *mpt, int flags)
dev = TAILQ_NEXT(dev, dv_list)) {
if (dev->dv_parent == (struct device *)mpt) {
/* found scsibus softc */
- buswidth = ((struct scsi_link *)&mpt->sc_link)->
- adapter_buswidth;
+ buswidth = ((struct scsi_link *)&mpt->sc_link)->adapter_buswidth;
/* printf("mpt_softc: %x scsibus: %x buswidth: %d\n",
- * mpt, dev, buswidth); */
+ mpt, dev, buswidth); */
/* walk target list */
for (target = 0; target < buswidth; target++) {
- sc_link = ((struct scsibus_softc *)dev)->
- sc_link[target][0];
+ sc_link = ((struct scsibus_softc *)dev)->sc_link[target][0];
if ((sc_link != NULL)) {
/* got a device! run PPR */
/* FIXME: skip CPU devices since they
@@ -387,23 +375,21 @@ mpt_run_ppr(mpt_softc_t *mpt, int flags)
/*if (device == cpu) {
continue;
}*/
- if (mpt_ppr(mpt, sc_link, U320, flags)){
- mpt->mpt_negotiated_speed
- [target] = U320;
+ if (mpt_ppr(mpt, sc_link, U320, flags)) {
+ mpt->mpt_negotiated_speed[target] = U320;
continue;
}
- if (mpt_ppr(mpt, sc_link, U160, flags)){
- mpt->mpt_negotiated_speed
- [target] = U160;
+ if (mpt_ppr(mpt, sc_link, U160, flags)) {
+ mpt->mpt_negotiated_speed[target] = U160;
continue;
}
if (mpt_ppr(mpt, sc_link, U80, flags)) {
- mpt->mpt_negotiated_speed
- [target] = U80;
+ mpt->mpt_negotiated_speed[target] = U80;
continue;
}
+
} /* sc_link */
} /* for target */
} /* if dev */
@@ -417,6 +403,8 @@ void
mpt_attach(mpt_softc_t *mpt)
{
struct scsi_link *lptr = &mpt->sc_link;
+ struct _CONFIG_PAGE_IOC_2 iocp2;
+ int rv;
mpt->bus = 0; /* XXX ?? */
@@ -444,15 +432,29 @@ mpt_attach(mpt_softc_t *mpt)
mpt->verbose = 2;
#endif
-#if NBIO > 0
- if (bio_register(&mpt->mpt_dev, mpt_ioctl) != 0)
- panic("%s: controller registration failed",
- mpt->mpt_dev.dv_xname);
-#endif
+ /* Read IOC page 2 to figure out if we have IM */
+ rv = mpt_read_cfg_header(mpt, MPI_CONFIG_PAGETYPE_IOC, 2,
+ 0, &iocp2.Header);
+ if (rv) {
+ mpt_prt(mpt, "Could not retrieve IOC PAGE 2 to determine"
+ "RAID capabilities.");
+ }
+ else {
+ mpt->im_support = iocp2.CapabilitiesFlags &
+ (MPI_IOCPAGE2_CAP_FLAGS_IS_SUPPORT |
+ MPI_IOCPAGE2_CAP_FLAGS_IME_SUPPORT |
+ MPI_IOCPAGE2_CAP_FLAGS_IM_SUPPORT);
- mpt_prt(mpt, "IM support: %x", mpt->im_support);
- /*mpt_prt(mpt, "IM support: %x %x", mpt->im_support,
- mpt->mpt_ioc_page2.CapabilitiesFlags);*/
+ if (mpt->verbose > 1) {
+ mpt_prt(mpt, "IOC Page 2: %x %x %x %x %x",
+ iocp2.CapabilitiesFlags,
+ iocp2.NumActiveVolumes,
+ iocp2.MaxVolumes,
+ iocp2.NumActivePhysDisks,
+ iocp2.MaxPhysDisks);
+ mpt_prt(mpt, "IM support: %x", mpt->im_support);
+ }
+ }
(void) config_found(&mpt->mpt_dev, lptr, scsiprint);
@@ -1623,71 +1625,3 @@ mpt_free_fw_mem(mpt_softc_t *mpt)
bus_dmamem_unmap(mpt->sc_dmat, (caddr_t)mpt->fw, mpt->fw_image_size);
bus_dmamem_free(mpt->sc_dmat, &mpt->fw_seg, mpt->fw_rseg);
}
-
-#if NBIO > 0
-int
-mpt_ioctl(dev, cmd, addr)
- struct device *dev;
- u_long cmd;
- caddr_t addr;
-{
- int error = 0;
- int rv;
- struct mpt_dummy *dummy;
- struct mpt_mfg0 *pmfg0;
- fCONFIG_PAGE_MANUFACTURING_0 mfgp0;
- mpt_softc_t *mpt = (mpt_softc_t *)dev;
-
- switch (cmd) {
- case MPT_IOCTL_DUMMY:
- dummy = (struct mpt_dummy *)addr;
- if (mpt->verbose > 2) {
- printf("%s: MPT_IOCTL_DUMMY %d\n",
- dev->dv_xname, dummy->x++);
- }
- break;
- case MPT_IOCTL_MFG0:
- /* Retrieve Manufacturing Page 0 */
- mfgp0.Header.PageNumber = 0;
- mfgp0.Header.PageType = MPI_CONFIG_PAGETYPE_MANUFACTURING;
- rv = mpt_read_cfg_page(mpt, 0, &mfgp0.Header);
- if (rv) {
- mpt_prt(mpt, "Could not retrieve MFG PAGE 0.");
- error = EINVAL;
- }
- else {
- if (mpt->verbose > 2) {
- printf("Chip name: %s\n",
- mfgp0.ChipName);
- printf("Chip Revision: %s\n",
- mfgp0.ChipRevision);
- printf("Board name: %s\n",
- mfgp0.BoardName);
- printf("Board assembly: %s\n",
- mfgp0.BoardAssembly);
- printf("Board tracer number: %s\n",
- mfgp0.BoardTracerNumber);
- }
- pmfg0 = (struct mpt_mfg0 *)addr;
- memcpy(&pmfg0->cpm0, &mfgp0,
- sizeof(fCONFIG_PAGE_MANUFACTURING_0));
- }
- break;
- /* Retrieve Manufacturing Page 1 */
- case MPT_IOCTL_MFG1:
- break;
- /* Retrieve Manufacturing Page 2 */
- case MPT_IOCTL_MFG2:
- break;
- /* Retrieve Manufacturing Page 3 */
- case MPT_IOCTL_MFG3:
- break;
- /* Retrieve Manufacturing Page 4 */
- case MPT_IOCTL_MFG4:
- break;
- default:
- error = EINVAL;
- }
- return (error);
-}
-#endif
diff --git a/sys/dev/ic/mpt_openbsd.h b/sys/dev/ic/mpt_openbsd.h
index 758a9f77cca..e26af696bde 100644
--- a/sys/dev/ic/mpt_openbsd.h
+++ b/sys/dev/ic/mpt_openbsd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: mpt_openbsd.h,v 1.12 2004/10/28 02:58:33 marco Exp $ */
+/* $OpenBSD: mpt_openbsd.h,v 1.13 2004/11/03 00:59:56 marco Exp $ */
/* $NetBSD: mpt_netbsd.h,v 1.2 2003/04/16 23:02:14 thorpej Exp $ */
/*
@@ -106,7 +106,6 @@
#include <sys/systm.h>
#include <sys/malloc.h>
#include <sys/device.h>
-#include <sys/ioctl.h>
#include <sys/kernel.h>
#include <sys/timeout.h>
#include <sys/errno.h>
@@ -121,12 +120,8 @@
#include <scsi/scsi_all.h>
#include <scsi/scsiconf.h>
-#include <dev/biovar.h>
-#include <dev/ic/mpt_ioctl.h>
#include <dev/ic/mpt_mpilib.h>
-#include "bio.h"
-
/*
* macro to convert from milliseconds to hz without integer overflow
* Default version using only 32bits arithmetics.
@@ -221,7 +216,7 @@ typedef struct mpt_softc {
uint16_t mpt_ini_id;
/* Device configuration information */
- struct {
+ union {
struct mpt_spi_cfg {
fCONFIG_PAGE_SCSI_PORT_0 _port_page0;
fCONFIG_PAGE_SCSI_PORT_1 _port_page1;
@@ -250,39 +245,6 @@ typedef struct mpt_softc {
struct mpt_fc_cfg {
uint8_t nada;
} fc;
-
- struct mpt_mfg_cfg {
- fCONFIG_PAGE_MANUFACTURING_0 _mfg_page0;
- fCONFIG_PAGE_MANUFACTURING_1 _mfg_page1;
- fCONFIG_PAGE_MANUFACTURING_2 _mfg_page2;
- fCONFIG_PAGE_MANUFACTURING_3 _mfg_page3;
- fCONFIG_PAGE_MANUFACTURING_4 _mfg_page4;
- } mfg;
-#define mpt_mfg_page0 cfg.mfg._mfg_page0
-#define mpt_mfg_page1 cfg.mfg._mfg_page1
-#define mpt_mfg_page2 cfg.mfg._mfg_page2
-#define mpt_mfg_page3 cfg.mfg._mfg_page3
-#define mpt_mfg_page4 cfg.mfg._mfg_page4
-
- struct mpt_ioc_cfg {
- fCONFIG_PAGE_IOC_0 _ioc_page0;
- fCONFIG_PAGE_IOC_1 _ioc_page1;
- fCONFIG_PAGE_IOC_2 _ioc_page2;
- fCONFIG_PAGE_IOC_3 _ioc_page3;
- fCONFIG_PAGE_IOC_4 _ioc_page4;
- } ioc;
-#define mpt_ioc_page0 cfg.ioc._ioc_page0
-#define mpt_ioc_page1 cfg.ioc._ioc_page1
-#define mpt_ioc_page2 cfg.ioc._ioc_page2
-#define mpt_ioc_page3 cfg.ioc._ioc_page3
-#define mpt_ioc_page4 cfg.ioc._ioc_page4
-
- struct mpt_raid_cfg {
- fCONFIG_PAGE_RAID_VOL_0 _raidvol_page0;
- fCONFIG_PAGE_RAID_PHYS_DISK_0 _raidphys_page0;
- } raid;
-#define mpt_raidvol_page0 cfg.raid._raidvol_page0
-#define mpt_raidphys_page0 cfg.raid._raidphys_page0
} cfg;
bus_space_tag_t sc_st;