Exemple #1
0
static int
ncvattach(DEVPORT_PDEVICE devi)
{
	struct ncv_softc *sc;
	struct scsi_low_softc *slp;
	u_int32_t flags = DEVPORT_PDEVFLAGS(devi);
	intrmask_t s;
	char dvname[16]; /* SCSI_LOW_DVNAME_LEN */

	strcpy(dvname, "ncv");

	sc = DEVPORT_PDEVALLOC_SOFTC(devi);
	if (sc == NULL) {
		return(0);
	}

	slp = &sc->sc_sclow;
	slp->sl_dev = devi;
	sc->sc_iot = rman_get_bustag(sc->port_res);
	sc->sc_ioh = rman_get_bushandle(sc->port_res);

	slp->sl_hostid = NCV_HOSTID;
	slp->sl_cfgflags = flags;

	s = splcam();
	ncvattachsubr(sc);
	splx(s);

	return(NCVIOSZ);
}
static int
ncvattach(DEVPORT_PDEVICE devi)
{
	struct ncv_softc *sc;
	struct scsi_low_softc *slp;
	u_int32_t flags = DEVPORT_PDEVFLAGS(devi);
#if defined(__FreeBSD__) && __FreeBSD_version < 400001
	int unit = DEVPORT_PDEVUNIT(devi);
	bus_addr_t offset = 0;
	u_int iobase = DEVPORT_PDEVIOBASE(devi);
#endif
	char dvname[16]; /* SCSI_LOW_DVNAME_LEN */

	strcpy(dvname, "ncv");

#if defined(__FreeBSD__) && __FreeBSD_version < 400001
	if (unit >= NNCV)
	{
		printf("%s: unit number too high\n", dvname);
		return (0);
	}

	if (iobase == 0)
	{
		printf("%s: no ioaddr is given\n", dvname);
		return (0);
	}

	if(flags & KME_KXLC004_01)
		offset = OFFSET_KME_KXLC004_01;
#endif

	sc = DEVPORT_PDEVALLOC_SOFTC(devi);
	if (sc == NULL) {
		return(0);
	}

	slp = &sc->sc_sclow;
#if defined(__FreeBSD__) && __FreeBSD_version >= 400001
	slp->sl_dev = devi;
	sc->sc_iot = rman_get_bustag(sc->port_res);
	sc->sc_ioh = rman_get_bushandle(sc->port_res);
#else
	bzero(sc, sizeof(struct ncv_softc));
	strcpy(slp->sl_dev.dv_xname, dvname);
	slp->sl_dev.dv_unit = unit;
	sc->sc_iot = I386_BUS_SPACE_IO;
	sc->sc_ioh = iobase + offset;
#endif

	slp->sl_hostid = NCV_HOSTID;
	slp->sl_cfgflags = flags;

	ncvattachsubr(sc);

	sc->sc_ih = ncvintr;

	return(NCVIOSZ);
}
static	int
nspattach(DEVPORT_PDEVICE devi)
{
    struct nsp_softc *sc;
    struct scsi_low_softc *slp;
    u_int32_t flags = DEVPORT_PDEVFLAGS(devi);
    u_int	iobase = DEVPORT_PDEVIOBASE(devi);
    intrmask_t s;
    char	dvname[16];

    strcpy(dvname,"nsp");

    if (iobase == 0) {
        printf("%s: no ioaddr is given\n", dvname);
        return (0);
    }

    sc = DEVPORT_PDEVALLOC_SOFTC(devi);
    if (sc == NULL)
        return (0);

    slp = &sc->sc_sclow;
    slp->sl_dev = devi;
    sc->sc_iot = rman_get_bustag(sc->port_res);
    sc->sc_ioh = rman_get_bushandle(sc->port_res);

    if (sc->mem_res == NULL) {
        printf("WARNING: CANNOT GET Memory RESOURCE going PIO mode");
        flags |= PIO_MODE;
    }

    if ((flags & PIO_MODE) == 0) {
        sc->sc_memt = rman_get_bustag(sc->mem_res);
        sc->sc_memh = rman_get_bushandle(sc->mem_res);
    } else {
        sc->sc_memh = 0;
    }
    /* slp->sl_irq = devi->pd_irq; */
    sc->sc_iclkdiv = CLKDIVR_20M;
    sc->sc_clkdiv = CLKDIVR_40M;

    slp->sl_hostid = NSP_HOSTID;
    slp->sl_cfgflags = flags;

    s = splcam();
    nspattachsubr(sc);
    splx(s);

    return(NSP_IOSIZE);
}
static	int
nspattach(DEVPORT_PDEVICE devi)
{
	struct nsp_softc *sc;
	struct scsi_low_softc *slp;
	u_int32_t flags = DEVPORT_PDEVFLAGS(devi);
	u_int	iobase = DEVPORT_PDEVIOBASE(devi);
	char	dvname[16];

	strcpy(dvname,"nsp");

	if (iobase == 0)
	{
		kprintf("%s: no ioaddr is given\n", dvname);
		return (0);
	}

	sc = DEVPORT_PDEVALLOC_SOFTC(devi);
	if (sc == NULL) {
		return (0);
	}

	slp = &sc->sc_sclow;
	slp->sl_dev = devi;
	sc->sc_iot = rman_get_bustag(sc->port_res);
	sc->sc_ioh = rman_get_bushandle(sc->port_res);

	if((flags & PIO_MODE) == 0) {
		sc->sc_memt = rman_get_bustag(sc->mem_res);
		sc->sc_memh = rman_get_bushandle(sc->mem_res);
	} else {
		sc->sc_memh = 0;
	}
	/* slp->sl_irq = devi->pd_irq; */
	sc->sc_iclkdiv = CLKDIVR_20M;
	sc->sc_clkdiv = CLKDIVR_40M;

	slp->sl_hostid = NSP_HOSTID;
	slp->sl_cfgflags = flags;

	crit_enter();
	nspattachsubr(sc);
	crit_exit();

	return(NSP_IOSIZE);
}
static	int
stgattach(DEVPORT_PDEVICE devi)
{
	struct stg_softc *sc;
	struct scsi_low_softc *slp;
	u_int32_t flags = DEVPORT_PDEVFLAGS(devi);
	u_int iobase = DEVPORT_PDEVIOBASE(devi);
	char	dvname[16];

	strcpy(dvname,"stg");

	if (iobase == 0)
	{
		kprintf("%s: no ioaddr is given\n", dvname);
		return (0);
	}

	sc = DEVPORT_PDEVALLOC_SOFTC(devi);
	if (sc == NULL) {
		return(0);
	}

	slp = &sc->sc_sclow;
	slp->sl_dev = devi;
	sc->sc_iot = rman_get_bustag(sc->port_res);
	sc->sc_ioh = rman_get_bushandle(sc->port_res);

	slp->sl_hostid = STG_HOSTID;
	slp->sl_cfgflags = flags;

	crit_enter();
	stgattachsubr(sc);
	crit_exit();

	return(STGIOSZ);
}