Add newer cars supports. Tested on MegaRAID SAS 9260-8i.
- Add MFI gen2 support from OpenBSD. - Add entry for MegaRAID SAS 9260-8i
This commit is contained in:
parent
40b88c199a
commit
38a7bbf82a
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mfi.c,v 1.32 2010/02/08 23:54:33 msaitoh Exp $ */
|
||||
/* $NetBSD: mfi.c,v 1.33 2010/02/09 00:05:18 msaitoh Exp $ */
|
||||
/* $OpenBSD: mfi.c,v 1.66 2006/11/28 23:59:45 dlg Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2006 Marco Peereboom <marco@peereboom.us>
|
||||
|
@ -17,7 +17,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: mfi.c,v 1.32 2010/02/08 23:54:33 msaitoh Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: mfi.c,v 1.33 2010/02/09 00:05:18 msaitoh Exp $");
|
||||
|
||||
#include "bio.h"
|
||||
|
||||
|
@ -137,6 +137,20 @@ static const struct mfi_iop_ops mfi_iop_ppc = {
|
|||
mfi_ppc_post
|
||||
};
|
||||
|
||||
uint32_t mfi_gen2_fw_state(struct mfi_softc *sc);
|
||||
void mfi_gen2_intr_ena(struct mfi_softc *sc);
|
||||
void mfi_gen2_intr_dis(struct mfi_softc *sc);
|
||||
int mfi_gen2_intr(struct mfi_softc *sc);
|
||||
void mfi_gen2_post(struct mfi_softc *sc, struct mfi_ccb *ccb);
|
||||
|
||||
static const struct mfi_iop_ops mfi_iop_gen2 = {
|
||||
mfi_gen2_fw_state,
|
||||
mfi_gen2_intr_dis,
|
||||
mfi_gen2_intr_ena,
|
||||
mfi_gen2_intr,
|
||||
mfi_gen2_post
|
||||
};
|
||||
|
||||
#define mfi_fw_state(_s) ((_s)->sc_iop->mio_fw_state(_s))
|
||||
#define mfi_intr_enable(_s) ((_s)->sc_iop->mio_intr_ena(_s))
|
||||
#define mfi_intr_disable(_s) ((_s)->sc_iop->mio_intr_dis(_s))
|
||||
|
@ -709,6 +723,9 @@ mfi_attach(struct mfi_softc *sc, enum mfi_iop iop)
|
|||
case MFI_IOP_PPC:
|
||||
sc->sc_iop = &mfi_iop_ppc;
|
||||
break;
|
||||
case MFI_IOP_GEN2:
|
||||
sc->sc_iop = &mfi_iop_gen2;
|
||||
break;
|
||||
default:
|
||||
panic("%s: unknown iop %d", DEVNAME(sc), iop);
|
||||
}
|
||||
|
@ -1299,7 +1316,8 @@ mfi_create_sgl(struct mfi_ccb *ccb, int flags)
|
|||
|
||||
static int
|
||||
mfi_mgmt_internal(struct mfi_softc *sc, uint32_t opc, uint32_t dir,
|
||||
uint32_t len, void *buf, uint8_t *mbox) {
|
||||
uint32_t len, void *buf, uint8_t *mbox)
|
||||
{
|
||||
struct mfi_ccb *ccb;
|
||||
int rv = 1;
|
||||
|
||||
|
@ -2168,3 +2186,45 @@ mfi_ppc_post(struct mfi_softc *sc, struct mfi_ccb *ccb)
|
|||
mfi_write(sc, MFI_IQP, 0x1 | ccb->ccb_pframe |
|
||||
(ccb->ccb_extra_frames << 1));
|
||||
}
|
||||
|
||||
u_int32_t
|
||||
mfi_gen2_fw_state(struct mfi_softc *sc)
|
||||
{
|
||||
return (mfi_read(sc, MFI_OSP));
|
||||
}
|
||||
|
||||
void
|
||||
mfi_gen2_intr_dis(struct mfi_softc *sc)
|
||||
{
|
||||
mfi_write(sc, MFI_OMSK, 0xffffffff);
|
||||
mfi_write(sc, MFI_ODC, 0xffffffff);
|
||||
}
|
||||
|
||||
void
|
||||
mfi_gen2_intr_ena(struct mfi_softc *sc)
|
||||
{
|
||||
mfi_write(sc, MFI_ODC, 0xffffffff);
|
||||
mfi_write(sc, MFI_OMSK, ~MFI_OSTS_GEN2_INTR_VALID);
|
||||
}
|
||||
|
||||
int
|
||||
mfi_gen2_intr(struct mfi_softc *sc)
|
||||
{
|
||||
u_int32_t status;
|
||||
|
||||
status = mfi_read(sc, MFI_OSTS);
|
||||
if (!ISSET(status, MFI_OSTS_GEN2_INTR_VALID))
|
||||
return (0);
|
||||
|
||||
/* write status back to acknowledge interrupt */
|
||||
mfi_write(sc, MFI_ODC, status);
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
void
|
||||
mfi_gen2_post(struct mfi_softc *sc, struct mfi_ccb *ccb)
|
||||
{
|
||||
mfi_write(sc, MFI_IQP, 0x1 | ccb->ccb_pframe |
|
||||
(ccb->ccb_extra_frames << 1));
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mfireg.h,v 1.3 2008/02/25 10:46:02 xtraeme Exp $ */
|
||||
/* $NetBSD: mfireg.h,v 1.4 2010/02/09 00:05:18 msaitoh Exp $ */
|
||||
/* $OpenBSD: mfireg.h,v 1.24 2006/06/19 19:05:45 marco Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2006 Marco Peereboom <marco@peereboom.us>
|
||||
|
@ -25,6 +25,7 @@
|
|||
#define MFI_SENSE_SIZE 128
|
||||
#define MFI_OSTS_INTR_VALID 0x00000002 /* valid interrupt */
|
||||
#define MFI_OSTS_PPC_INTR_VALID 0x80000000
|
||||
#define MFI_OSTS_GEN2_INTR_VALID (0x00000001 | 0x00000004)
|
||||
#define MFI_INVALID_CTX 0xffffffff
|
||||
#define MFI_ENABLE_INTR 0x01
|
||||
#define MFI_MAXFER MAXPHYS /* XXX bogus */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mfivar.h,v 1.13 2009/07/16 18:58:38 dyoung Exp $ */
|
||||
/* $NetBSD: mfivar.h,v 1.14 2010/02/09 00:05:18 msaitoh Exp $ */
|
||||
/* $OpenBSD: mfivar.h,v 1.28 2006/08/31 18:18:46 marco Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2006 Marco Peereboom <marco@peereboom.us>
|
||||
|
@ -98,7 +98,8 @@ TAILQ_HEAD(mfi_ccb_list, mfi_ccb);
|
|||
|
||||
enum mfi_iop {
|
||||
MFI_IOP_XSCALE,
|
||||
MFI_IOP_PPC
|
||||
MFI_IOP_PPC,
|
||||
MFI_IOP_GEN2
|
||||
};
|
||||
|
||||
struct mfi_iop_ops {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mfi_pci.c,v 1.11 2009/07/16 18:58:38 dyoung Exp $ */
|
||||
/* $NetBSD: mfi_pci.c,v 1.12 2010/02/09 00:05:18 msaitoh Exp $ */
|
||||
/* $OpenBSD: mfi_pci.c,v 1.11 2006/08/06 04:40:08 brad Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2006 Marco Peereboom <marco@peereboom.us>
|
||||
|
@ -17,7 +17,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: mfi_pci.c,v 1.11 2009/07/16 18:58:38 dyoung Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: mfi_pci.c,v 1.12 2010/02/09 00:05:18 msaitoh Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -38,6 +38,7 @@ __KERNEL_RCSID(0, "$NetBSD: mfi_pci.c,v 1.11 2009/07/16 18:58:38 dyoung Exp $");
|
|||
#include <dev/ic/mfivar.h>
|
||||
|
||||
#define MFI_BAR 0x10
|
||||
#define MFI_BAR_GEN2 0x14
|
||||
#define MFI_PCI_MEMSIZE 0x2000 /* 8k */
|
||||
|
||||
struct mfi_pci_softc {
|
||||
|
@ -82,6 +83,11 @@ static const struct mfi_pci_subtype mfi_perc5_subtypes[] = {
|
|||
{ 0, 0, NULL }
|
||||
};
|
||||
|
||||
static const struct mfi_pci_subtype mfi_gen2_subtypes[] = {
|
||||
{ PCI_VENDOR_SYMBIOS, 0x9261, "SAS 9260-8i" },
|
||||
{ 0x0, 0, "" }
|
||||
};
|
||||
|
||||
static const
|
||||
struct mfi_pci_device {
|
||||
pcireg_t mpd_vendor;
|
||||
|
@ -95,10 +101,16 @@ struct mfi_pci_device {
|
|||
MFI_IOP_XSCALE, NULL },
|
||||
{ PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_SAS1078,
|
||||
MFI_IOP_PPC, mfi_1078_subtypes },
|
||||
{ PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_SAS1078DE,
|
||||
MFI_IOP_PPC, mfi_1078_subtypes },
|
||||
{ PCI_VENDOR_DELL, PCI_PRODUCT_DELL_PERC_5,
|
||||
MFI_IOP_XSCALE, mfi_perc5_subtypes },
|
||||
{ PCI_VENDOR_DELL, PCI_PRODUCT_DELL_PERC_6,
|
||||
MFI_IOP_PPC, mfi_1078_subtypes },
|
||||
{ PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_SAS2108_1,
|
||||
MFI_IOP_GEN2, mfi_gen2_subtypes },
|
||||
{ PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_SAS2108_2,
|
||||
MFI_IOP_GEN2, mfi_gen2_subtypes },
|
||||
};
|
||||
|
||||
const struct mfi_pci_device *
|
||||
|
@ -151,15 +163,27 @@ mfi_pci_attach(device_t parent, device_t self, void *aux)
|
|||
const char *intrstr;
|
||||
pci_intr_handle_t ih;
|
||||
pcireg_t csr;
|
||||
int regbar;
|
||||
const char *subtype = NULL;
|
||||
uint32_t subsysid;
|
||||
|
||||
sc->sc_dev = self;
|
||||
psc->psc_pc = pa->pa_pc;
|
||||
|
||||
csr = pci_mapreg_type(pa->pa_pc, pa->pa_tag, MFI_BAR);
|
||||
mpd = mfi_pci_find_device(pa);
|
||||
if (mpd == NULL) {
|
||||
printf(": can't find matching pci device\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (mpd->mpd_iop == MFI_IOP_GEN2)
|
||||
regbar = MFI_BAR_GEN2;
|
||||
else
|
||||
regbar = MFI_BAR;
|
||||
|
||||
csr = pci_mapreg_type(pa->pa_pc, pa->pa_tag, regbar);
|
||||
csr |= PCI_MAPREG_MEM_TYPE_32BIT;
|
||||
if (pci_mapreg_map(pa, MFI_BAR, csr, 0,
|
||||
if (pci_mapreg_map(pa, regbar, csr, 0,
|
||||
&sc->sc_iot, &sc->sc_ioh, NULL, &sc->sc_size)) {
|
||||
aprint_error(": can't map controller pci space\n");
|
||||
return;
|
||||
|
@ -183,8 +207,6 @@ mfi_pci_attach(device_t parent, device_t self, void *aux)
|
|||
return;
|
||||
}
|
||||
|
||||
mpd = mfi_pci_find_device(pa);
|
||||
|
||||
subsysid = pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_SUBSYS_ID_REG);
|
||||
if (mpd->mpd_subtype != NULL) {
|
||||
st = mpd->mpd_subtype;
|
||||
|
|
Loading…
Reference in New Issue