Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-1-5]: src/sys/dev/ic Pull up revisions 1.36-1.40 (requested by mj...
details: https://anonhg.NetBSD.org/src/rev/6d02831f818d
branches: netbsd-1-5
changeset: 490883:6d02831f818d
user: he <he%NetBSD.org@localhost>
date: Fri Mar 16 19:14:46 2001 +0000
description:
Pull up revisions 1.36-1.40 (requested by mjacob):
Do some cleanup based upon adapter role - mainly not enabling
interrupts if we're ISP_ROLE_NONE. ISPASYNC_LOGGED_INOUT ->
ISPASYNC_PROMENADE. Make sure we note if something is a fabric
device. ISPASYNC_PDB_CHANGED -> ISPASYNC_LOGGED_INOUT. Add
-Wformat patches. Handles are 16 bits.
diffstat:
sys/dev/ic/isp_netbsd.c | 194 ++++++++++++++++++++++++++++-------------------
1 files changed, 116 insertions(+), 78 deletions(-)
diffs (truncated from 370 to 300 lines):
diff -r 7db3b75e0386 -r 6d02831f818d sys/dev/ic/isp_netbsd.c
--- a/sys/dev/ic/isp_netbsd.c Fri Mar 16 19:13:47 2001 +0000
+++ b/sys/dev/ic/isp_netbsd.c Fri Mar 16 19:14:46 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: isp_netbsd.c,v 1.25.4.2 2001/01/25 18:25:52 jhawk Exp $ */
+/* $NetBSD: isp_netbsd.c,v 1.25.4.3 2001/03/16 19:14:46 he Exp $ */
/*
* This driver, which is contained in NetBSD in the files:
*
@@ -80,23 +80,21 @@
*/
#define _XT(xs) ((((xs)->timeout/1000) * hz) + (3 * hz))
-static void ispminphys __P((struct buf *));
-static int32_t ispcmd __P((XS_T *));
-static int
-ispioctl __P((struct scsipi_link *, u_long, caddr_t, int, struct proc *));
+static void ispminphys(struct buf *);
+static int32_t ispcmd(XS_T *);
+static int ispioctl (struct scsipi_link *, u_long, caddr_t, int, struct proc *);
static struct scsipi_device isp_dev = { NULL, NULL, NULL, NULL };
-static int isp_polled_cmd __P((struct ispsoftc *, XS_T *));
-static void isp_dog __P((void *));
-static void isp_command_requeue __P((void *));
-static void isp_internal_restart __P((void *));
+static int isp_polled_cmd(struct ispsoftc *, XS_T *);
+static void isp_dog(void *);
+static void isp_command_requeue(void *);
+static void isp_internal_restart(void *);
/*
* Complete attachment of hardware, include subdevices.
*/
void
-isp_attach(isp)
- struct ispsoftc *isp;
+isp_attach(struct ispsoftc *isp)
{
isp->isp_osinfo._adapter.scsipi_minphys = ispminphys;
isp->isp_osinfo._adapter.scsipi_ioctl = ispioctl;
@@ -197,8 +195,7 @@
*/
static void
-ispminphys(bp)
- struct buf *bp;
+ispminphys(struct buf *bp)
{
/*
* XX: Only the 1020 has a 24 bit limit.
@@ -210,12 +207,8 @@
}
static int
-ispioctl(sc_link, cmd, addr, flag, p)
- struct scsipi_link *sc_link;
- u_long cmd;
- caddr_t addr;
- int flag;
- struct proc *p;
+ispioctl(struct scsipi_link *sc_link, u_long cmd, caddr_t addr,
+ int flag, struct proc *p)
{
struct ispsoftc *isp = sc_link->adapter_softc;
int s, chan, retval = ENOTTY;
@@ -267,8 +260,7 @@
static int32_t
-ispcmd(xs)
- XS_T *xs;
+ispcmd(XS_T *xs)
{
struct ispsoftc *isp;
int result, s;
@@ -344,9 +336,7 @@
}
static int
-isp_polled_cmd(isp, xs)
- struct ispsoftc *isp;
- XS_T *xs;
+isp_polled_cmd(struct ispsoftc *isp, XS_T *xs)
{
int result;
int infinite = 0, mswait;
@@ -407,8 +397,7 @@
}
void
-isp_done(xs)
- XS_T *xs;
+isp_done(XS_T *xs)
{
XS_CMD_S_DONE(xs);
if (XS_CMD_WDOG_P(xs) == 0) {
@@ -424,12 +413,11 @@
}
static void
-isp_dog(arg)
- void *arg;
+isp_dog(void *arg)
{
XS_T *xs = arg;
struct ispsoftc *isp = XS_ISP(xs);
- u_int32_t handle;
+ u_int16_t handle;
ISP_ILOCK(isp);
/*
@@ -522,8 +510,7 @@
* Locks are held before coming here.
*/
void
-isp_uninit(isp)
- struct ispsoftc *isp;
+isp_uninit(struct ispsoftc *isp)
{
isp_lock(isp);
/*
@@ -537,12 +524,11 @@
* Restart function for a command to be requeued later.
*/
static void
-isp_command_requeue(arg)
- void *arg;
+isp_command_requeue(void *arg)
{
struct scsipi_xfer *xs = arg;
struct ispsoftc *isp = XS_ISP(xs);
- ISP_LOCK(isp);
+ ISP_ILOCK(isp);
switch (ispcmd(xs)) {
case SUCCESSFULLY_QUEUED:
isp_prt(isp, ISP_LOGINFO,
@@ -566,7 +552,7 @@
scsipi_done(xs);
break;
}
- ISP_UNLOCK(isp);
+ ISP_IUNLOCK(isp);
}
/*
@@ -574,13 +560,12 @@
* done as a timeout for some hysteresis.
*/
static void
-isp_internal_restart(arg)
- void *arg;
+isp_internal_restart(void *arg)
{
struct ispsoftc *isp = arg;
int result, nrestarted = 0;
- ISP_LOCK(isp);
+ ISP_ILOCK(isp);
if (isp->isp_osinfo.blocked == 0) {
struct scsipi_xfer *xs;
while ((xs = TAILQ_FIRST(&isp->isp_osinfo.waitq)) != NULL) {
@@ -603,14 +588,11 @@
isp_prt(isp, ISP_LOGINFO,
"isp_restart requeued %d commands", nrestarted);
}
- ISP_UNLOCK(isp);
+ ISP_IUNLOCK(isp);
}
int
-isp_async(isp, cmd, arg)
- struct ispsoftc *isp;
- ispasync_t cmd;
- void *arg;
+isp_async(struct ispsoftc *isp, ispasync_t cmd, void *arg)
{
int bus, tgt;
int s = splbio();
@@ -706,49 +688,51 @@
isp_internal_restart, isp);
isp_prt(isp, ISP_LOGINFO, "Loop UP");
break;
- case ISPASYNC_PDB_CHANGED:
+ case ISPASYNC_PROMENADE:
if (IS_FC(isp) && isp->isp_dblev) {
- const char *fmt = "Target %d (Loop 0x%x) Port ID 0x%x "
- "role %s %s\n Port WWN 0x%08x%08x\n Node WWN 0x%08x%08x";
+ const char fmt[] = "Target %d (Loop 0x%x) Port ID 0x%x "
+ "(role %s) %s\n Port WWN 0x%08x%08x\n Node WWN 0x%08x%08x";
const static char *roles[4] = {
"No", "Target", "Initiator", "Target/Initiator"
};
- char *ptr;
fcparam *fcp = isp->isp_param;
int tgt = *((int *) arg);
struct lportdb *lp = &fcp->portdb[tgt];
- if (lp->valid) {
- ptr = "arrived";
- } else {
- ptr = "disappeared";
- }
isp_prt(isp, ISP_LOGINFO, fmt, tgt, lp->loopid, lp->portid,
- roles[lp->roles & 0x3], ptr,
+ roles[lp->roles & 0x3],
+ (lp->valid)? "Arrived" : "Departed",
(u_int32_t) (lp->port_wwn >> 32),
(u_int32_t) (lp->port_wwn & 0xffffffffLL),
(u_int32_t) (lp->node_wwn >> 32),
(u_int32_t) (lp->node_wwn & 0xffffffffLL));
break;
}
-#ifdef ISP2100_FABRIC
case ISPASYNC_CHANGE_NOTIFY:
- isp_prt(isp, ISP_LOGINFO, "Name Server Database Changed");
+ if (arg == (void *) 1) {
+ isp_prt(isp, ISP_LOGINFO,
+ "Name Server Database Changed");
+ } else {
+ isp_prt(isp, ISP_LOGINFO,
+ "Name Server Database Changed");
+ }
break;
case ISPASYNC_FABRIC_DEV:
{
- int target;
- struct lportdb *lp;
- sns_scrsp_t *resp = (sns_scrsp_t *) arg;
+ int target, lrange;
+ struct lportdb *lp = NULL;
+ char *pt;
+ sns_ganrsp_t *resp = (sns_ganrsp_t *) arg;
u_int32_t portid;
- u_int64_t wwn;
+ u_int64_t wwpn, wwnn;
fcparam *fcp = isp->isp_param;
portid =
(((u_int32_t) resp->snscb_port_id[0]) << 16) |
(((u_int32_t) resp->snscb_port_id[1]) << 8) |
(((u_int32_t) resp->snscb_port_id[2]));
- wwn =
+
+ wwpn =
(((u_int64_t)resp->snscb_portname[0]) << 56) |
(((u_int64_t)resp->snscb_portname[1]) << 48) |
(((u_int64_t)resp->snscb_portname[2]) << 40) |
@@ -758,34 +742,95 @@
(((u_int64_t)resp->snscb_portname[6]) << 8) |
(((u_int64_t)resp->snscb_portname[7]));
- isp_prt(isp, ISP_LOGINFO,
- "Fabric Device (Type 0x%x)@PortID 0x%x WWN 0x%08x%08x",
- resp->snscb_port_type, portid, ((u_int32_t)(wwn >> 32)),
- ((u_int32_t)(wwn & 0xffffffff)));
+ wwnn =
+ (((u_int64_t)resp->snscb_nodename[0]) << 56) |
+ (((u_int64_t)resp->snscb_nodename[1]) << 48) |
+ (((u_int64_t)resp->snscb_nodename[2]) << 40) |
+ (((u_int64_t)resp->snscb_nodename[3]) << 32) |
+ (((u_int64_t)resp->snscb_nodename[4]) << 24) |
+ (((u_int64_t)resp->snscb_nodename[5]) << 16) |
+ (((u_int64_t)resp->snscb_nodename[6]) << 8) |
+ (((u_int64_t)resp->snscb_nodename[7]));
+ if (portid == 0 || wwpn == 0) {
+ break;
+ }
- for (target = FC_SNS_ID+1; target < MAX_FC_TARG; target++) {
+ switch (resp->snscb_port_type) {
+ case 1:
+ pt = " N_Port";
+ break;
+ case 2:
+ pt = " NL_Port";
+ break;
+ case 3:
+ pt = "F/NL_Port";
+ break;
+ case 0x7f:
+ pt = " Nx_Port";
+ break;
+ case 0x81:
+ pt = " F_port";
+ break;
+ case 0x82:
+ pt = " FL_Port";
+ break;
+ case 0x84:
+ pt = " E_port";
+ break;
+ default:
+ pt = "?";
+ break;
+ }
+ isp_prt(isp, ISP_LOGINFO,
+ "%s @ 0x%x, Node 0x%08x%08x Port %08x%08x",
+ pt, portid, ((u_int32_t) (wwnn >> 32)), ((u_int32_t) wwnn),
+ ((u_int32_t) (wwpn >> 32)), ((u_int32_t) wwpn));
Home |
Main Index |
Thread Index |
Old Index