(1) add a 'channel' field to scsi_link.
(2) in scsibusmatch, match channel as appropriate. (3) add a scsiprint() function, to do the "scsibus at..." and channel (if not SCSI_CHANNEL_ONLY_ONE) printing, i.e. the common functionality that all SCSI drivers currently should be doing.
This commit is contained in:
parent
0f3dafde2e
commit
11ec3588ad
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: scsiconf.c,v 1.61 1996/08/27 22:00:04 cgd Exp $ */
|
/* $NetBSD: scsiconf.c,v 1.62 1996/08/28 18:47:51 cgd Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1994 Charles Hannum. All rights reserved.
|
* Copyright (c) 1994 Charles Hannum. All rights reserved.
|
||||||
|
@ -97,13 +97,44 @@ struct cfdriver scsibus_cd = {
|
||||||
|
|
||||||
int scsibusprint __P((void *, const char *));
|
int scsibusprint __P((void *, const char *));
|
||||||
|
|
||||||
|
int
|
||||||
|
scsiprint(aux, pnp)
|
||||||
|
void *aux;
|
||||||
|
const char *pnp;
|
||||||
|
{
|
||||||
|
struct scsi_link *l = aux;
|
||||||
|
|
||||||
|
/* only "scsibus"es can attach to "scsi"s; easy. */
|
||||||
|
if (pnp)
|
||||||
|
printf("scsibus at %s", pnp);
|
||||||
|
|
||||||
|
/* don't print channel if the controller says there can be only one. */
|
||||||
|
if (l->channel != SCSI_CHANNEL_ONLY_ONE)
|
||||||
|
printf(" channel %d", l->channel);
|
||||||
|
|
||||||
|
return (UNCONF);
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
scsibusmatch(parent, match, aux)
|
scsibusmatch(parent, match, aux)
|
||||||
struct device *parent;
|
struct device *parent;
|
||||||
void *match, *aux;
|
void *match, *aux;
|
||||||
{
|
{
|
||||||
|
struct cfdata *cf = match;
|
||||||
|
struct scsi_link *l = aux;
|
||||||
|
int channel;
|
||||||
|
|
||||||
return 1;
|
/*
|
||||||
|
* Allow single-channel controllers to specify their channel
|
||||||
|
* in a special way, so that it's not printed.
|
||||||
|
*/
|
||||||
|
channel = (l->channel != SCSI_CHANNEL_ONLY_ONE) ? l->channel : 0;
|
||||||
|
|
||||||
|
if (cf->scsicf_channel != channel &&
|
||||||
|
cf->scsicf_channel != SCSI_CHANNEL_UNKNOWN)
|
||||||
|
return (0);
|
||||||
|
|
||||||
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: scsiconf.h,v 1.30 1996/07/05 16:19:12 christos Exp $ */
|
/* $NetBSD: scsiconf.h,v 1.31 1996/08/28 18:47:55 cgd Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1993, 1994, 1995 Charles Hannum. All rights reserved.
|
* Copyright (c) 1993, 1994, 1995 Charles Hannum. All rights reserved.
|
||||||
|
@ -132,8 +132,13 @@ struct scsi_device {
|
||||||
* a device driver, and is used by each to call services provided by
|
* a device driver, and is used by each to call services provided by
|
||||||
* the other, and to allow generic scsi glue code to call these services
|
* the other, and to allow generic scsi glue code to call these services
|
||||||
* as well.
|
* as well.
|
||||||
|
*
|
||||||
|
* XXX Given the way NetBSD's autoconfiguration works, this is ...
|
||||||
|
* XXX nasty.
|
||||||
*/
|
*/
|
||||||
struct scsi_link {
|
struct scsi_link {
|
||||||
|
int channel; /* channel, i.e. bus # on controller */
|
||||||
|
|
||||||
u_int8_t scsibus; /* the Nth scsibus */
|
u_int8_t scsibus; /* the Nth scsibus */
|
||||||
u_int8_t target; /* targ of this dev */
|
u_int8_t target; /* targ of this dev */
|
||||||
u_int8_t lun; /* lun of this dev */
|
u_int8_t lun; /* lun of this dev */
|
||||||
|
@ -158,6 +163,16 @@ struct scsi_link {
|
||||||
void *adapter_softc; /* needed for call to foo_scsi_cmd */
|
void *adapter_softc; /* needed for call to foo_scsi_cmd */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Other definitions used by autoconfiguration.
|
||||||
|
*/
|
||||||
|
#define scsicf_channel cf_loc[0]
|
||||||
|
#define SCSI_CHANNEL_UNKNOWN -1
|
||||||
|
|
||||||
|
#define SCSI_CHANNEL_ONLY_ONE -1 /* only one channel on controller */
|
||||||
|
|
||||||
|
int scsiprint __P((void *, const char *));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This describes matching information for scsi_inqmatch(). The more things
|
* This describes matching information for scsi_inqmatch(). The more things
|
||||||
* match, the higher the configuration priority.
|
* match, the higher the configuration priority.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: scsiconf.c,v 1.61 1996/08/27 22:00:04 cgd Exp $ */
|
/* $NetBSD: scsiconf.c,v 1.62 1996/08/28 18:47:51 cgd Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1994 Charles Hannum. All rights reserved.
|
* Copyright (c) 1994 Charles Hannum. All rights reserved.
|
||||||
|
@ -97,13 +97,44 @@ struct cfdriver scsibus_cd = {
|
||||||
|
|
||||||
int scsibusprint __P((void *, const char *));
|
int scsibusprint __P((void *, const char *));
|
||||||
|
|
||||||
|
int
|
||||||
|
scsiprint(aux, pnp)
|
||||||
|
void *aux;
|
||||||
|
const char *pnp;
|
||||||
|
{
|
||||||
|
struct scsi_link *l = aux;
|
||||||
|
|
||||||
|
/* only "scsibus"es can attach to "scsi"s; easy. */
|
||||||
|
if (pnp)
|
||||||
|
printf("scsibus at %s", pnp);
|
||||||
|
|
||||||
|
/* don't print channel if the controller says there can be only one. */
|
||||||
|
if (l->channel != SCSI_CHANNEL_ONLY_ONE)
|
||||||
|
printf(" channel %d", l->channel);
|
||||||
|
|
||||||
|
return (UNCONF);
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
scsibusmatch(parent, match, aux)
|
scsibusmatch(parent, match, aux)
|
||||||
struct device *parent;
|
struct device *parent;
|
||||||
void *match, *aux;
|
void *match, *aux;
|
||||||
{
|
{
|
||||||
|
struct cfdata *cf = match;
|
||||||
|
struct scsi_link *l = aux;
|
||||||
|
int channel;
|
||||||
|
|
||||||
return 1;
|
/*
|
||||||
|
* Allow single-channel controllers to specify their channel
|
||||||
|
* in a special way, so that it's not printed.
|
||||||
|
*/
|
||||||
|
channel = (l->channel != SCSI_CHANNEL_ONLY_ONE) ? l->channel : 0;
|
||||||
|
|
||||||
|
if (cf->scsicf_channel != channel &&
|
||||||
|
cf->scsicf_channel != SCSI_CHANNEL_UNKNOWN)
|
||||||
|
return (0);
|
||||||
|
|
||||||
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: scsiconf.h,v 1.30 1996/07/05 16:19:12 christos Exp $ */
|
/* $NetBSD: scsiconf.h,v 1.31 1996/08/28 18:47:55 cgd Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1993, 1994, 1995 Charles Hannum. All rights reserved.
|
* Copyright (c) 1993, 1994, 1995 Charles Hannum. All rights reserved.
|
||||||
|
@ -132,8 +132,13 @@ struct scsi_device {
|
||||||
* a device driver, and is used by each to call services provided by
|
* a device driver, and is used by each to call services provided by
|
||||||
* the other, and to allow generic scsi glue code to call these services
|
* the other, and to allow generic scsi glue code to call these services
|
||||||
* as well.
|
* as well.
|
||||||
|
*
|
||||||
|
* XXX Given the way NetBSD's autoconfiguration works, this is ...
|
||||||
|
* XXX nasty.
|
||||||
*/
|
*/
|
||||||
struct scsi_link {
|
struct scsi_link {
|
||||||
|
int channel; /* channel, i.e. bus # on controller */
|
||||||
|
|
||||||
u_int8_t scsibus; /* the Nth scsibus */
|
u_int8_t scsibus; /* the Nth scsibus */
|
||||||
u_int8_t target; /* targ of this dev */
|
u_int8_t target; /* targ of this dev */
|
||||||
u_int8_t lun; /* lun of this dev */
|
u_int8_t lun; /* lun of this dev */
|
||||||
|
@ -158,6 +163,16 @@ struct scsi_link {
|
||||||
void *adapter_softc; /* needed for call to foo_scsi_cmd */
|
void *adapter_softc; /* needed for call to foo_scsi_cmd */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Other definitions used by autoconfiguration.
|
||||||
|
*/
|
||||||
|
#define scsicf_channel cf_loc[0]
|
||||||
|
#define SCSI_CHANNEL_UNKNOWN -1
|
||||||
|
|
||||||
|
#define SCSI_CHANNEL_ONLY_ONE -1 /* only one channel on controller */
|
||||||
|
|
||||||
|
int scsiprint __P((void *, const char *));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This describes matching information for scsi_inqmatch(). The more things
|
* This describes matching information for scsi_inqmatch(). The more things
|
||||||
* match, the higher the configuration priority.
|
* match, the higher the configuration priority.
|
||||||
|
|
Loading…
Reference in New Issue