Have MI ncr53c9x_attach() the 2nd and 3rd arguments for scsipi_adater

and scsipi_device respectively, with size reduction of ncr53c9x_softc.
Specifying NULL instructs the driver to use default adapter and default
device codes. Every target port has ncr53c9x_attach(sc, NULL, NULL) anyway.
This commit is contained in:
nisimura 2000-06-05 07:59:50 +00:00
parent 36a1354bc6
commit 4371d91433
12 changed files with 57 additions and 137 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: asc.c,v 1.16 1999/09/22 03:32:26 mhitch Exp $ */
/* $NetBSD: asc.c,v 1.17 2000/06/05 07:59:50 nisimura Exp $ */
/*-
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@ -78,7 +78,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: asc.c,v 1.16 1999/09/22 03:32:26 mhitch Exp $");
__KERNEL_RCSID(0, "$NetBSD: asc.c,v 1.17 2000/06/05 07:59:50 nisimura Exp $");
#include <sys/types.h>
#include <sys/param.h>
@ -115,13 +115,6 @@ struct cfattach asc_tcds_ca = {
sizeof(struct asc_tcds_softc), asc_tcds_match, asc_tcds_attach
};
struct scsipi_device asc_tcds_dev = {
NULL, /* Use default error handler */
NULL, /* have a queue, served by this */
NULL, /* have no async handler */
NULL, /* Use default 'done' routine */
};
/*
* Functions and the switch for the MI code.
*/
@ -190,8 +183,7 @@ asc_tcds_attach(parent, self, aux)
asc->sc_dma->sc_asc = asc; /* XXX */
tcds_intr_establish(parent, tcdsdev->tcdsda_chip,
(int (*) __P((void *)))ncr53c9x_intr, sc);
tcds_intr_establish(parent, tcdsdev->tcdsda_chip, ncr53c9x_intr, sc);
/*
* XXX More of this should be in ncr53c9x_attach(), but
@ -233,9 +225,7 @@ asc_tcds_attach(parent, self, aux)
sc->sc_maxxfer = 64 * 1024;
/* Do the common parts of attachment. */
sc->sc_adapter.scsipi_cmd = ncr53c9x_scsi_cmd;
sc->sc_adapter.scsipi_minphys = minphys;
ncr53c9x_attach(sc, &asc_tcds_dev);
ncr53c9x_attach(sc, NULL, NULL);
}
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: esp.c,v 1.24 1999/10/19 17:00:41 thorpej Exp $ */
/* $NetBSD: esp.c,v 1.25 2000/06/05 07:59:52 nisimura Exp $ */
/*
* Copyright (c) 1997 Jason R. Thorpe.
@ -113,13 +113,6 @@ struct cfattach esp_ca = {
sizeof(struct esp_softc), espmatch, espattach
};
struct scsipi_device esp_dev = {
NULL, /* Use default error handler */
NULL, /* have a queue, served by this */
NULL, /* have no async handler */
NULL, /* Use default 'done' routine */
};
/*
* Functions and the switch for the MI code.
*/
@ -318,9 +311,7 @@ espattach(parent, self, aux)
/*
* Now try to attach all the sub-devices
*/
sc->sc_adapter.scsipi_cmd = ncr53c9x_scsi_cmd;
sc->sc_adapter.scsipi_minphys = minphys;
ncr53c9x_attach(sc, &esp_dev);
ncr53c9x_attach(sc, NULL, NULL);
}
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: esp.c,v 1.9 1998/11/19 21:46:41 thorpej Exp $ */
/* $NetBSD: esp.c,v 1.10 2000/06/05 07:59:51 nisimura Exp $ */
/*-
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@ -116,13 +116,6 @@ struct cfattach esp_ca = {
sizeof(struct esp_softc), espmatch, espattach
};
struct scsipi_device esp_dev = {
NULL, /* Use default error handler */
NULL, /* have a queue, served by this */
NULL, /* have no async handler */
NULL, /* Use default 'done' routine */
};
/*
* Functions and the switch for the MI code.
*/
@ -251,16 +244,13 @@ espattach(parent, self, aux)
sc->sc_maxxfer = 64 * 1024;
/* and the interuppts */
intr_establish(esc->sc_pri, IST_LEVEL, IPL_BIO, (void *)ncr53c9x_intr,
sc);
intr_establish(esc->sc_pri, IST_LEVEL, IPL_BIO, ncr53c9x_intr, sc);
/* Reset SCSI bus when halt. */
shutdownhook_establish(esp_shutdownhook, sc);
/* Do the common parts of attachment. */
sc->sc_adapter.scsipi_cmd = ncr53c9x_scsi_cmd;
sc->sc_adapter.scsipi_minphys = minphys;
ncr53c9x_attach(sc, &esp_dev);
ncr53c9x_attach(sc, NULL, NULL);
/* Turn on target selection using the `dma' method */
ncr53c9x_dmaselect = 1;

View File

@ -1,4 +1,4 @@
/* $NetBSD: esp.c,v 1.26 2000/06/04 19:14:53 cgd Exp $ */
/* $NetBSD: esp.c,v 1.27 2000/06/05 07:59:51 nisimura Exp $ */
/*-
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@ -147,13 +147,6 @@ struct cfattach esp_ca = {
sizeof(struct esp_softc), espmatch_intio, espattach_intio
};
struct scsipi_device esp_dev = {
NULL, /* Use default error handler */
NULL, /* have a queue, served by this */
NULL, /* have no async handler */
NULL, /* Use default 'done' routine */
};
/*
* Functions and the switch for the MI code.
*/
@ -397,8 +390,7 @@ espattach_intio(parent, self, aux)
}
/* Establish interrupt channel */
isrlink_autovec((int(*)__P((void*)))ncr53c9x_intr, sc,
NEXT_I_IPL(NEXT_I_SCSI), 0);
isrlink_autovec(ncr53c9x_intr, sc, NEXT_I_IPL(NEXT_I_SCSI), 0);
INTR_ENABLE(NEXT_I_SCSI);
/* register interrupt stats */
@ -406,9 +398,7 @@ espattach_intio(parent, self, aux)
sc->sc_dev.dv_xname, "intr");
/* Do the common parts of attachment. */
sc->sc_adapter.scsipi_cmd = ncr53c9x_scsi_cmd;
sc->sc_adapter.scsipi_minphys = minphys;
ncr53c9x_attach(sc, &esp_dev);
ncr53c9x_attach(sc, NULL, NULL);
}
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: asc_ioasic.c,v 1.7 2000/06/03 07:55:17 nisimura Exp $ */
/* $NetBSD: asc_ioasic.c,v 1.8 2000/06/05 07:59:52 nisimura Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: asc_ioasic.c,v 1.7 2000/06/03 07:55:17 nisimura Exp $");
__KERNEL_RCSID(0, "$NetBSD: asc_ioasic.c,v 1.8 2000/06/05 07:59:52 nisimura Exp $");
#include <sys/types.h>
#include <sys/param.h>
@ -82,13 +82,6 @@ struct cfattach xasc_ioasic_ca = {
sizeof(struct asc_softc), asc_ioasic_match, asc_ioasic_attach
};
static struct scsipi_device asc_ioasic_dev = {
NULL, /* Use default error handler */
NULL, /* have a queue, served by this */
NULL, /* have no async handler */
NULL, /* Use default 'done' routine */
};
static u_char asc_read_reg __P((struct ncr53c9x_softc *, int));
static void asc_write_reg __P((struct ncr53c9x_softc *, int, u_char));
static int asc_dma_isintr __P((struct ncr53c9x_softc *sc));
@ -162,7 +155,7 @@ asc_ioasic_attach(parent, self, aux)
sc->sc_freq /= 1000000;
ioasic_intr_establish(parent, d->iada_cookie, TC_IPL_BIO,
(int (*)(void *))ncr53c9x_intr, sc);
ncr53c9x_intr, sc);
/*
* XXX More of this should be in ncr53c9x_attach(), but
@ -197,9 +190,7 @@ asc_ioasic_attach(parent, self, aux)
sc->sc_maxxfer = 64 * 1024;
/* Do the common parts of attachment. */
sc->sc_adapter.scsipi_cmd = ncr53c9x_scsi_cmd;
sc->sc_adapter.scsipi_minphys = minphys;
ncr53c9x_attach(sc, &asc_ioasic_dev);
ncr53c9x_attach(sc, NULL, NULL);
}
void

View File

@ -1,4 +1,4 @@
/* $NetBSD: asc_pmaz.c,v 1.5 2000/03/06 03:09:43 mhitch Exp $ */
/* $NetBSD: asc_pmaz.c,v 1.6 2000/06/05 07:59:53 nisimura Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: asc_pmaz.c,v 1.5 2000/03/06 03:09:43 mhitch Exp $");
__KERNEL_RCSID(0, "$NetBSD: asc_pmaz.c,v 1.6 2000/06/05 07:59:53 nisimura Exp $");
#include <sys/types.h>
#include <sys/param.h>
@ -80,13 +80,6 @@ struct cfattach xasc_pmaz_ca = {
sizeof(struct asc_softc), asc_pmaz_match, asc_pmaz_attach
};
static struct scsipi_device asc_pmaz_dev = {
NULL, /* Use default error handler */
NULL, /* have a queue, served by this */
NULL, /* have no async handler */
NULL, /* Use default 'done' routine */
};
static u_char asc_read_reg __P((struct ncr53c9x_softc *, int));
static void asc_write_reg __P((struct ncr53c9x_softc *, int, u_char));
static int asc_dma_isintr __P((struct ncr53c9x_softc *));
@ -163,8 +156,7 @@ asc_pmaz_attach(parent, self, aux)
}
asc->sc_base = (caddr_t)ta->ta_addr; /* XXX XXX XXX */
tc_intr_establish(parent, ta->ta_cookie, IPL_BIO,
(int (*)(void *))ncr53c9x_intr, sc);
tc_intr_establish(parent, ta->ta_cookie, IPL_BIO, ncr53c9x_intr, sc);
sc->sc_id = 7;
sc->sc_freq = (ta->ta_busspeed) ? 25000000 : 12500000;
@ -206,9 +198,7 @@ asc_pmaz_attach(parent, self, aux)
sc->sc_maxxfer = 64 * 1024;
/* Do the common parts of attachment. */
sc->sc_adapter.scsipi_cmd = ncr53c9x_scsi_cmd;
sc->sc_adapter.scsipi_minphys = minphys;
ncr53c9x_attach(sc, &asc_pmaz_dev);
ncr53c9x_attach(sc, NULL, NULL);
}
static void

View File

@ -1,4 +1,4 @@
/* $NetBSD: esp_obio.c,v 1.6 2000/06/04 19:15:01 cgd Exp $ */
/* $NetBSD: esp_obio.c,v 1.7 2000/06/05 07:59:53 nisimura Exp $ */
/*-
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@ -79,13 +79,6 @@ struct cfattach esp_obio_ca = {
sizeof(struct esp_softc), espmatch_obio, espattach_obio
};
static struct scsipi_device esp_obio_dev = {
NULL, /* Use default error handler */
NULL, /* have a queue, served by this */
NULL, /* have no async handler */
NULL, /* Use default 'done' routine */
};
/*
* Functions and the switch for the MI code.
*/
@ -261,18 +254,14 @@ espattach_obio(parent, self, aux)
}
/* Establish interrupt channel */
bus_intr_establish(esc->sc_bustag,
oba->oba_pri, 0,
(int(*)__P((void*)))ncr53c9x_intr, sc);
bus_intr_establish(esc->sc_bustag, oba->oba_pri, 0, ncr53c9x_intr, sc);
/* register interrupt stats */
evcnt_attach_dynamic(&sc->sc_intrcnt, EVCNT_TYPE_INTR, NULL,
sc->sc_dev.dv_xname, "intr");
/* Do the common parts of attachment. */
sc->sc_adapter.scsipi_cmd = ncr53c9x_scsi_cmd;
sc->sc_adapter.scsipi_minphys = minphys;
ncr53c9x_attach(sc, &esp_obio_dev);
ncr53c9x_attach(sc, NULL, NULL);
/* Turn on target selection using the `dma' method */
ncr53c9x_dmaselect = 1;

View File

@ -1,4 +1,4 @@
/* $NetBSD: esp.c,v 1.11 2000/06/04 19:15:06 cgd Exp $ */
/* $NetBSD: esp.c,v 1.12 2000/06/05 07:59:53 nisimura Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@ -77,13 +77,6 @@ struct cfattach esp_ca = {
sizeof(struct esp_softc), espmatch, espattach
};
static struct scsipi_device esp_dev = {
NULL, /* Use default error handler */
NULL, /* have a queue, served by this */
NULL, /* have no async handler */
NULL, /* Use default 'done' routine */
};
/*
* Functions and the switch for the MI code.
*/
@ -242,14 +235,12 @@ espattach(parent, self, aux)
}
/* and the interuppts */
isr_add_autovect((void*)ncr53c9x_intr, sc, ca->ca_intpri);
isr_add_autovect(ncr53c9x_intr, sc, ca->ca_intpri);
evcnt_attach_dynamic(&sc->sc_intrcnt, EVCNT_TYPE_INTR, NULL,
sc->sc_dev.dv_xname, "intr");
/* Do the common parts of attachment. */
sc->sc_adapter.scsipi_cmd = ncr53c9x_scsi_cmd;
sc->sc_adapter.scsipi_minphys = minphys;
ncr53c9x_attach(sc, &esp_dev);
ncr53c9x_attach(sc, NULL, NULL);
#if 0
/* XXX - This doesn't work yet. Not sure why... */

View File

@ -1,4 +1,4 @@
/* $NetBSD: asc_vsbus.c,v 1.16 2000/06/05 00:09:20 matt Exp $ */
/* $NetBSD: asc_vsbus.c,v 1.17 2000/06/05 07:59:54 nisimura Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -40,7 +40,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: asc_vsbus.c,v 1.16 2000/06/05 00:09:20 matt Exp $");
__KERNEL_RCSID(0, "$NetBSD: asc_vsbus.c,v 1.17 2000/06/05 07:59:54 nisimura Exp $");
#include <sys/types.h>
#include <sys/param.h>
@ -109,13 +109,6 @@ struct cfattach asc_vsbus_ca = {
sizeof(struct asc_vsbus_softc), asc_vsbus_match, asc_vsbus_attach
};
static struct scsipi_device asc_vsbus_dev = {
NULL, /* Use the default error handler */
NULL, /* have a queue, served by this */
NULL, /* have no async handler */
NULL, /* use the default done handler */
};
/*
* Functions and the switch for the MI code
*/
@ -313,9 +306,7 @@ asc_vsbus_attach(struct device *parent, struct device *self, void *aux)
printf("\n%s", self->dv_xname); /* Pretty print */
/* Do the common parts of attachment. */
sc->sc_adapter.scsipi_cmd = ncr53c9x_scsi_cmd;
sc->sc_adapter.scsipi_minphys = minphys;
ncr53c9x_attach(sc, &asc_vsbus_dev);
ncr53c9x_attach(sc, NULL, NULL);
}
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: ncr53c9x.c,v 1.49 2000/03/29 13:57:51 tsutsui Exp $ */
/* $NetBSD: ncr53c9x.c,v 1.50 2000/06/05 07:59:54 nisimura Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -134,7 +134,7 @@ static inline void ncr53c9x_setsync __P((struct ncr53c9x_softc *,
* Names for the NCR53c9x variants, correspnding to the variant tags
* in ncr53c9xvar.h.
*/
const char *ncr53c9x_variant_names[] = {
static const char *ncr53c9x_variant_names[] = {
"ESP100",
"ESP100A",
"ESP200",
@ -146,13 +146,29 @@ const char *ncr53c9x_variant_names[] = {
"AM53C974",
};
static struct scsipi_adapter ncr53c9x_adapter = {
0, /* adapter refcnt */
ncr53c9x_scsi_cmd, /* cmd */
minphys, /* minphys */
NULL, /* ioctl */
NULL, /* getgeom */
};
static struct scsipi_device ncr53c9x_device = {
NULL, /* use default error handler */
NULL, /* have a queue, served by this */
NULL, /* have no async handler */
NULL, /* use default 'done' routine */
};
/*
* Attach this instance, and then all the sub-devices
*/
void
ncr53c9x_attach(sc, dev)
ncr53c9x_attach(sc, adapter, device)
struct ncr53c9x_softc *sc;
struct scsipi_device *dev;
struct scsipi_adapter *adapter;
struct scsipi_device *device;
{
/*
@ -212,8 +228,8 @@ ncr53c9x_attach(sc, dev)
sc->sc_link.scsipi_scsi.channel = SCSI_CHANNEL_ONLY_ONE;
sc->sc_link.adapter_softc = sc;
sc->sc_link.scsipi_scsi.adapter_target = sc->sc_id;
sc->sc_link.adapter = &sc->sc_adapter;
sc->sc_link.device = dev;
sc->sc_link.adapter = (adapter) ? adapter : &ncr53c9x_adapter;
sc->sc_link.device = (device) ? device : &ncr53c9x_device;
sc->sc_link.openings = 2;
sc->sc_link.scsipi_scsi.max_target = 7;
sc->sc_link.scsipi_scsi.max_lun = 7;

View File

@ -1,4 +1,4 @@
/* $NetBSD: ncr53c9xvar.h,v 1.23 2000/03/29 03:03:28 simonb Exp $ */
/* $NetBSD: ncr53c9xvar.h,v 1.24 2000/06/05 07:59:54 nisimura Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@ -233,7 +233,6 @@ struct ncr53c9x_softc {
struct evcnt sc_intrcnt; /* intr count */
struct scsipi_link sc_link; /* scsipi link struct */
struct scsipi_adapter sc_adapter; /* scsipi adapter glue */
struct device *sc_child; /* attached scsibus, if any */
struct ncr53c9x_glue *sc_glue; /* glue to MD code */
@ -395,7 +394,8 @@ struct ncr53c9x_softc {
#define ncr53c9x_cpb2stp(sc, cpb) \
((250 * (cpb)) / (sc)->sc_freq)
void ncr53c9x_attach __P((struct ncr53c9x_softc *, struct scsipi_device *));
void ncr53c9x_attach __P((struct ncr53c9x_softc *,
struct scsipi_adapter *, struct scsipi_device *));
int ncr53c9x_detach __P((struct ncr53c9x_softc *, int));
int ncr53c9x_scsi_cmd __P((struct scsipi_xfer *));
void ncr53c9x_reset __P((struct ncr53c9x_softc *));

View File

@ -1,4 +1,4 @@
/* $NetBSD: esp_sbus.c,v 1.9 2000/06/04 19:15:13 cgd Exp $ */
/* $NetBSD: esp_sbus.c,v 1.10 2000/06/05 07:59:55 nisimura Exp $ */
/*-
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@ -88,13 +88,6 @@ struct cfattach esp_dma_ca = {
sizeof(struct esp_softc), espmatch_sbus, espattach_dma
};
static struct scsipi_device esp_sbus_dev = {
NULL, /* Use default error handler */
NULL, /* have a queue, served by this */
NULL, /* have no async handler */
NULL, /* Use default 'done' routine */
};
/*
* Functions and the switch for the MI code.
*/
@ -393,16 +386,14 @@ espattach(esc, gluep)
/* Establish interrupt channel */
icookie = bus_intr_establish(esc->sc_bustag,
esc->sc_pri, 0,
(int(*)__P((void*)))ncr53c9x_intr, sc);
ncr53c9x_intr, sc);
/* register interrupt stats */
evcnt_attach_dynamic(&sc->sc_intrcnt, EVCNT_TYPE_INTR, NULL,
sc->sc_dev.dv_xname, "intr");
/* Do the common parts of attachment. */
sc->sc_adapter.scsipi_cmd = ncr53c9x_scsi_cmd;
sc->sc_adapter.scsipi_minphys = minphys;
ncr53c9x_attach(sc, &esp_sbus_dev);
ncr53c9x_attach(sc, NULL, NULL);
/* Turn on target selection using the `dma' method */
ncr53c9x_dmaselect = 1;