Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 8 Jun 2004 03:16:29 GMT
From:      Scott Long <scottl@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 54389 for review
Message-ID:  <200406080316.i583GT5I017282@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=54389

Change 54389 by scottl@scottl-esp-sparc64 on 2004/06/08 03:16:23

	For some unpleasant reason, giving an alignment arg of '8' to
	uma_zcreate() results in uma_zalloc() getting unaligned chunks.
	Add a basic implementation of XPT_PATH_INQ.  The driver can now
	somewhat play with CAM.

Affected files ...

.. //depot/projects/scottl-esp/src/sys/dev/esp/ncr53c9x.c#13 edit

Differences ...

==== //depot/projects/scottl-esp/src/sys/dev/esp/ncr53c9x.c#13 (text+ko) ====

@@ -102,7 +102,7 @@
 #include <dev/esp/ncr53c9xreg.h>
 #include <dev/esp/ncr53c9xvar.h>
 
-int ncr53c9x_debug = NCR_SHOWMISC; /*NCR_SHOWPHASE|NCR_SHOWMISC|NCR_SHOWTRAC|NCR_SHOWCMDS;*/
+int ncr53c9x_debug = NCR_SHOWMISC|NCR_SHOWPHASE|NCR_SHOWMISC|NCR_SHOWTRAC|NCR_SHOWCMDS;
 #ifdef DEBUG
 int ncr53c9x_notag = 0;
 #endif
@@ -439,7 +439,7 @@
 		/* All instances share this zone */
 		ecb_zone = uma_zcreate("ncr53c9x ecb zone",
 				       sizeof(struct ncr53c9x_ecb), NULL, NULL,
-				       NULL, NULL, 8, M_NOWAIT);
+				       NULL, NULL, 0, 0);
 		ecb_zone_initialized = 1;
 	}
 
@@ -794,7 +794,7 @@
 
 	ecb = (struct ncr53c9x_ecb *)uma_zalloc(ecb_zone, M_NOWAIT);
 	if (ecb) {
-		memset(ecb, 0, sizeof(*ecb));
+		bzero(ecb, sizeof(struct ncr53c9x_ecb));
 		ecb->flags |= ECB_ALLOC;
 		ecb->sc = sc;
 	}
@@ -817,12 +817,45 @@
 	struct ncr53c9x_softc *sc;
 	struct ncr53c9x_ecb *ecb;
 
-	NCR_TRACE(("[ncr53c9x_action] "));
+	NCR_TRACE(("[ncr53c9x_action %d]", ccb->ccb_h.func_code));
 
 	sc = cam_sim_softc(sim);
 	mtx_lock(&sc->sc_lock);
 
 	switch (ccb->ccb_h.func_code) {
+	case XPT_RESET_DEV:
+		break;
+	case XPT_CALC_GEOMETRY:
+		break;
+	case XPT_PATH_INQ:
+	{
+		struct ccb_pathinq *cpi = &ccb->cpi;
+
+		cpi->version_num = 1;
+		cpi->hba_inquiry = PI_WIDE_16;
+		cpi->target_sprt = 0;
+		cpi->hba_misc = 0;
+		cpi->hba_eng_cnt = 0;
+		cpi->max_target = 15;
+		cpi->max_lun = 8;
+		cpi->initiator_id = 7;
+		cpi->bus_id = 0;
+		cpi->base_transfer_speed = 3300;
+		strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
+		strncpy(cpi->hba_vid, "Sun", HBA_IDLEN);
+		strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
+		cpi->unit_number = cam_sim_unit(sim);
+		ccb->ccb_h.status = CAM_REQ_CMP;
+		mtx_unlock(&sc->sc_lock);
+		xpt_done(ccb);
+		return;
+	}
+	case XPT_GET_TRAN_SETTINGS:
+		break;
+	case XPT_ABORT:
+		break;
+	case XPT_TERM_IO:
+		break;
 	case XPT_SCSI_IO:
 	case XPT_RESET_BUS:
 	{
@@ -929,7 +962,12 @@
 		break;
 #endif
 	default:
-		break;
+		printf("%s: Unhandled function code %d\n", sc->dv_name,
+		       ccb->ccb_h.func_code);
+		ccb->ccb_h.status = CAM_PROVIDE_FAIL;
+		mtx_unlock(&sc->sc_lock);
+		xpt_done(ccb);
+		return;
 	}
 
 	mtx_unlock(&sc->sc_lock);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200406080316.i583GT5I017282>