Add support for Adaptec 200[05]S
reviewed by Andrew Doran
This commit is contained in:
parent
9a37a3052b
commit
f321ab1a02
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: iop.c,v 1.28 2002/10/23 09:13:12 jdolecek Exp $ */
|
||||
/* $NetBSD: iop.c,v 1.29 2002/11/08 05:47:35 msaitoh Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
|
||||
|
@ -41,7 +41,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: iop.c,v 1.28 2002/10/23 09:13:12 jdolecek Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: iop.c,v 1.29 2002/11/08 05:47:35 msaitoh Exp $");
|
||||
|
||||
#include "opt_i2o.h"
|
||||
#include "iop.h"
|
||||
|
@ -218,6 +218,9 @@ static const char * const iop_status[] = {
|
|||
static inline u_int32_t iop_inl(struct iop_softc *, int);
|
||||
static inline void iop_outl(struct iop_softc *, int, u_int32_t);
|
||||
|
||||
static inline u_int32_t iop_inl_msg(struct iop_softc *, int);
|
||||
static inline void iop_outl_rep(struct iop_softc *, int, u_int32_t);
|
||||
|
||||
static void iop_config_interrupts(struct device *);
|
||||
static void iop_configure_devices(struct iop_softc *, int, int);
|
||||
static void iop_devinfo(int, char *);
|
||||
|
@ -267,6 +270,24 @@ iop_outl(struct iop_softc *sc, int off, u_int32_t val)
|
|||
BUS_SPACE_BARRIER_WRITE);
|
||||
}
|
||||
|
||||
static inline u_int32_t
|
||||
iop_inl_msg(struct iop_softc *sc, int off)
|
||||
{
|
||||
|
||||
bus_space_barrier(sc->sc_iot, sc->sc_ioh, off, 4,
|
||||
BUS_SPACE_BARRIER_WRITE | BUS_SPACE_BARRIER_READ);
|
||||
return (bus_space_read_4(sc->sc_iot, sc->sc_ioh, off));
|
||||
}
|
||||
|
||||
static inline void
|
||||
iop_outl_rep(struct iop_softc *sc, int off, u_int32_t val)
|
||||
{
|
||||
|
||||
bus_space_write_4(sc->sc_rep_iot, sc->sc_rep_ioh, off, val);
|
||||
bus_space_barrier(sc->sc_rep_iot, sc->sc_rep_ioh, off, 4,
|
||||
BUS_SPACE_BARRIER_WRITE);
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialise the IOP and our interface.
|
||||
*/
|
||||
|
@ -1673,7 +1694,7 @@ iop_handle_reply(struct iop_softc *sc, u_int32_t rmfa)
|
|||
status = I2O_STATUS_SUCCESS;
|
||||
|
||||
fn = (struct i2o_fault_notify *)rb;
|
||||
tctx = iop_inl(sc, fn->lowmfa + 12);
|
||||
tctx = iop_inl_msg(sc, fn->lowmfa + 12);
|
||||
iop_release_mfa(sc, fn->lowmfa);
|
||||
iop_tfn_print(sc, fn);
|
||||
} else {
|
||||
|
@ -2109,9 +2130,10 @@ iop_post(struct iop_softc *sc, u_int32_t *mb)
|
|||
sc->sc_rep_size, BUS_DMASYNC_PREREAD);
|
||||
|
||||
/* Copy out the message frame. */
|
||||
bus_space_write_region_4(sc->sc_iot, sc->sc_ioh, mfa, mb, mb[0] >> 16);
|
||||
bus_space_barrier(sc->sc_iot, sc->sc_ioh, mfa, (mb[0] >> 14) & ~3,
|
||||
BUS_SPACE_BARRIER_WRITE);
|
||||
bus_space_write_region_4(sc->sc_rep_iot, sc->sc_rep_ioh, mfa, mb,
|
||||
mb[0] >> 16);
|
||||
bus_space_barrier(sc->sc_rep_iot, sc->sc_rep_ioh, mfa,
|
||||
(mb[0] >> 14) & ~3, BUS_SPACE_BARRIER_WRITE);
|
||||
|
||||
/* Post the MFA back to the IOP. */
|
||||
iop_outl(sc, IOP_REG_IFIFO, mfa);
|
||||
|
@ -2246,10 +2268,10 @@ iop_release_mfa(struct iop_softc *sc, u_int32_t mfa)
|
|||
{
|
||||
|
||||
/* Use the frame to issue a no-op. */
|
||||
iop_outl(sc, mfa, I2O_VERSION_11 | (4 << 16));
|
||||
iop_outl(sc, mfa + 4, I2O_MSGFUNC(I2O_TID_IOP, I2O_UTIL_NOP));
|
||||
iop_outl(sc, mfa + 8, 0);
|
||||
iop_outl(sc, mfa + 12, 0);
|
||||
iop_outl_rep(sc, mfa, I2O_VERSION_11 | (4 << 16));
|
||||
iop_outl_rep(sc, mfa + 4, I2O_MSGFUNC(I2O_TID_IOP, I2O_UTIL_NOP));
|
||||
iop_outl_rep(sc, mfa + 8, 0);
|
||||
iop_outl_rep(sc, mfa + 12, 0);
|
||||
|
||||
iop_outl(sc, IOP_REG_IFIFO, mfa);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: iopvar.h,v 1.10 2001/09/27 18:43:38 ad Exp $ */
|
||||
/* $NetBSD: iopvar.h,v 1.11 2002/11/08 05:47:36 msaitoh Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
|
||||
|
@ -112,6 +112,8 @@ struct iop_softc {
|
|||
bus_space_handle_t sc_ioh; /* Bus space handle */
|
||||
bus_space_tag_t sc_iot; /* Bus space tag */
|
||||
bus_dma_tag_t sc_dmat; /* Bus DMA tag */
|
||||
bus_space_handle_t sc_rep_ioh; /* Bus space handle */
|
||||
bus_space_tag_t sc_rep_iot; /* Bus space tag */
|
||||
void *sc_ih; /* Interrupt handler cookie */
|
||||
|
||||
struct iop_msg *sc_ims; /* Message wrappers */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: iop_pci.c,v 1.10 2002/10/02 16:51:39 thorpej Exp $ */
|
||||
/* $NetBSD: iop_pci.c,v 1.11 2002/11/08 05:47:35 msaitoh Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2000 The NetBSD Foundation, Inc.
|
||||
|
@ -41,7 +41,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: iop_pci.c,v 1.10 2002/10/02 16:51:39 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: iop_pci.c,v 1.11 2002/11/08 05:47:35 msaitoh Exp $");
|
||||
|
||||
#include "opt_i2o.h"
|
||||
|
||||
|
@ -88,6 +88,10 @@ iop_pci_match(struct device *parent, struct cfdata *match, void *aux)
|
|||
PCI_SUBCLASS(pa->pa_class) == PCI_SUBCLASS_I2O_STANDARD &&
|
||||
PCI_INTERFACE(pa->pa_class) == PCI_INTERFACE_I2O_INTRDRIVEN)
|
||||
return (1);
|
||||
if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_DPT &&
|
||||
((PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_DPT_RAID_2000S)
|
||||
|| (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_DPT_RAID_2005S)))
|
||||
return (1);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
@ -131,6 +135,30 @@ iop_pci_attach(struct device *parent, struct device *self, void *aux)
|
|||
return;
|
||||
}
|
||||
|
||||
/* Map the 2nd register window. */
|
||||
if (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_DPT_RAID_2005S) {
|
||||
i += 4; /* next BAR */
|
||||
if (i == PCI_MAPREG_END) {
|
||||
printf("can't find mapping\n");
|
||||
return;
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* Should we check it? (see FreeBSD's asr driver) */
|
||||
reg = pci_conf_read(pc, pa->pa_tag, PCI_SUBSYS_ID_REG);
|
||||
printf("subid %x, %x\n", PCI_VENDOR(reg), PCI_PRODUCT(reg));
|
||||
#endif
|
||||
if (pci_mapreg_map(pa, i, PCI_MAPREG_TYPE_MEM, 0,
|
||||
&sc->sc_rep_iot, &sc->sc_rep_ioh, NULL, NULL)) {
|
||||
printf("%s: can't map 2nd register window\n", sc->sc_dv.dv_xname);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
/* iop devices other than 2005S */
|
||||
sc->sc_rep_iot = sc->sc_iot;
|
||||
sc->sc_rep_ioh = sc->sc_ioh;
|
||||
}
|
||||
|
||||
sc->sc_pcibus = pa->pa_bus;
|
||||
sc->sc_pcidev = pa->pa_device;
|
||||
sc->sc_dmat = pa->pa_dmat;
|
||||
|
|
Loading…
Reference in New Issue