Date: Tue, 03 Mar 2009 10:30:14 -0800 From: Sean Bruno <sean.bruno@dsl-only.net> To: Boris Kotzev <boris.kotzev@gmail.com> Cc: freebsd-firewire@freebsd.org Subject: Re: firewire disk stopped working Message-ID: <1236105014.7868.18.camel@localhost.localdomain> In-Reply-To: <200903031052.31368.boris.kotzev@gmail.com> References: <200902150012.49329.boris.kotzev@gmail.com> <49A9B245.8030804@gmx.net> <1236056380.11182.5.camel@localhost.localdomain> <200903031052.31368.boris.kotzev@gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
Ok, so let's try this a different way.
This patch should be applied against HEAD. This reverts every change I
have made in the last month.
Once we confirm that this works, I'll start moving forward until we find
the broken change.
Sean
[-- Attachment #2 --]
Index: fwphyreg.h
===================================================================
--- fwphyreg.h (revision 189309)
+++ fwphyreg.h (revision 188507)
@@ -34,10 +34,6 @@
* $FreeBSD$
*/
-/*
- * IEEE 1394a
- * Figure 5B - 1
- */
struct phyreg_base {
#if BYTE_ORDER == BIG_ENDIAN
uint8_t phy_id:6,
@@ -104,10 +100,6 @@
#endif
};
-/*
- * IEEE 1394a
- * Figure 5B - 2
- */
struct phyreg_page0 {
#if BYTE_ORDER == BIG_ENDIAN
uint8_t astat:2,
@@ -168,10 +160,6 @@
#endif
};
-/*
- * IEEE 1394a
- * Figure 5B - 3
- */
struct phyreg_page1 {
uint8_t compliance;
uint8_t :8;
Index: firewire.c
===================================================================
--- firewire.c (revision 189309)
+++ firewire.c (revision 188507)
@@ -77,7 +77,7 @@
struct crom_chunk hw;
};
-int firewire_debug=0, try_bmr=1, hold_count=0;
+int firewire_debug=0, try_bmr=1, hold_count=3;
SYSCTL_INT(_debug, OID_AUTO, firewire_debug, CTLFLAG_RW, &firewire_debug, 0,
"FireWire driver debug flag");
SYSCTL_NODE(_hw, OID_AUTO, firewire, CTLFLAG_RD, 0, "FireWire Subsystem");
@@ -1257,11 +1257,12 @@
fp->mode.common.tcode |= FWTCODE_PHY;
if (firewire_debug)
- device_printf(fc->bdev, "%s: root_node=%d gap_count=%d\n",
- __func__, root_node, gap_count);
+ printf("send phy_config root_node=%d gap_count=%d\n",
+ root_node, gap_count);
fw_asyreq(fc, -1, xfer);
}
+#if 0
/*
* Dump self ID.
*/
@@ -1270,30 +1271,14 @@
{
union fw_self_id *s;
s = (union fw_self_id *) &sid;
- if ( s->p0.sequel ) {
- if ( s->p1.sequence_num == FW_SELF_ID_PAGE0 ) {
- printf("node:%d p3:%d p4:%d p5:%d p6:%d p7:%d"
- "p8:%d p9:%d p10:%d\n",
- s->p1.phy_id, s->p1.port3, s->p1.port4,
- s->p1.port5, s->p1.port6, s->p1.port7,
- s->p1.port8, s->p1.port9, s->p1.port10);
- } else if (s->p2.sequence_num == FW_SELF_ID_PAGE1 ){
- printf("node:%d p11:%d p12:%d p13:%d p14:%d p15:%d\n",
- s->p2.phy_id, s->p2.port11, s->p2.port12,
- s->p2.port13, s->p2.port14, s->p2.port15);
- } else {
- printf("node:%d Unknown Self ID Page number %d\n",
- s->p1.phy_id, s->p1.sequence_num);
- }
- } else {
- printf("node:%d link:%d gap:%d spd:%d con:%d pwr:%d"
- " p0:%d p1:%d p2:%d i:%d m:%d\n",
- s->p0.phy_id, s->p0.link_active, s->p0.gap_count,
- s->p0.phy_speed, s->p0.contender,
- s->p0.power_class, s->p0.port0, s->p0.port1,
- s->p0.port2, s->p0.initiated_reset, s->p0.more_packets);
- }
+ printf("node:%d link:%d gap:%d spd:%d del:%d con:%d pwr:%d"
+ " p0:%d p1:%d p2:%d i:%d m:%d\n",
+ s->p0.phy_id, s->p0.link_active, s->p0.gap_count,
+ s->p0.phy_speed, s->p0.phy_delay, s->p0.contender,
+ s->p0.power_class, s->p0.port0, s->p0.port1,
+ s->p0.port2, s->p0.initiated_reset, s->p0.more_packets);
}
+#endif
/*
* To receive self ID.
@@ -1317,8 +1302,7 @@
self_id = &fc->topology_map->self_id[0];
for(i = 0; i < fc->sid_cnt; i ++){
if (sid[1] != ~sid[0]) {
- device_printf(fc->bdev, "%s: ERROR invalid self-id packet\n",
- __func__);
+ printf("fw_sidrcv: invalid self-id packet\n");
sid += 2;
continue;
}
@@ -1327,8 +1311,9 @@
if(self_id->p0.sequel == 0){
fc->topology_map->node_count ++;
c_port = 0;
- if (firewire_debug)
- fw_print_sid(sid[0]);
+#if 0
+ fw_print_sid(sid[0]);
+#endif
node = self_id->p0.phy_id;
if(fc->max_node < node){
fc->max_node = self_id->p0.phy_id;
@@ -1363,6 +1348,7 @@
self_id++;
fc->topology_map->self_id_count ++;
}
+ device_printf(fc->bdev, "%d nodes", fc->max_node + 1);
/* CRC */
fc->topology_map->crc = fw_crc16(
(uint32_t *)&fc->topology_map->generation,
@@ -1381,11 +1367,16 @@
bcopy(p, &CSRARC(fc, SPED_MAP + 8), (fc->speed_map->crc_len - 1)*4);
fc->max_hop = fc->max_node - i_branch;
- device_printf(fc->bdev, "%d nodes, maxhop <= %d %s irm(%d) %s\n",
- fc->max_node + 1, fc->max_hop,
- (fc->irm == -1) ? "Not IRM capable" : "cable IRM",
- fc->irm,
- (fc->irm == fc->nodeid) ? " (me) " : "");
+ printf(", maxhop <= %d", fc->max_hop);
+
+ if(fc->irm == -1 ){
+ printf(", Not found IRM capable node");
+ }else{
+ printf(", cable IRM = %d", fc->irm);
+ if (fc->irm == fc->nodeid)
+ printf(" (me)");
+ }
+ printf("\n");
if (try_bmr && (fc->irm != -1) && (CSRARC(fc, BUS_MGR_ID) == 0x3f)) {
if (fc->irm == fc->nodeid) {
@@ -1417,23 +1408,10 @@
fc->status = FWBUSEXPLORE;
/* Invalidate all devices, just after bus reset. */
- if (firewire_debug)
- device_printf(fc->bdev, "%s:"
- "iterate and invalidate all nodes\n",
- __func__);
STAILQ_FOREACH(fwdev, &fc->devices, link)
if (fwdev->status != FWDEVINVAL) {
fwdev->status = FWDEVINVAL;
fwdev->rcnt = 0;
- if (firewire_debug)
- device_printf(fc->bdev, "%s:"
- "Invalidate Dev ID: %08x%08x\n",
- __func__, fwdev->eui.hi, fwdev->eui.lo);
- } else {
- if (firewire_debug)
- device_printf(fc->bdev, "%s:"
- "Dev ID: %08x%08x already invalid\n",
- __func__, fwdev->eui.hi, fwdev->eui.lo);
}
splx(s);
@@ -1442,13 +1420,13 @@
static int
fw_explore_read_quads(struct fw_device *fwdev, int offset,
- uint32_t *quad, int length)
+ uint32_t *quad, int n)
{
struct fw_xfer *xfer;
uint32_t tmp;
int i, error;
- for (i = 0; i < length; i ++, offset += sizeof(uint32_t)) {
+ for (i = 0; i < n; i ++, offset += sizeof(uint32_t)) {
xfer = fwmem_read_quad(fwdev, NULL, -1,
0xffff, 0xf0000000 | offset, (void *)&tmp,
fw_xferwake);
@@ -1525,8 +1503,7 @@
uint32_t *csr;
struct csrhdr *hdr;
struct bus_info *binfo;
- int err, node;
- uint32_t speed_test = 0;
+ int err, node, spd;
fc = dfwdev->fc;
csr = dfwdev->csrrom;
@@ -1534,48 +1511,28 @@
/* First quad */
err = fw_explore_read_quads(dfwdev, CSRROMOFF, &csr[0], 1);
- if (err) {
- device_printf(fc->bdev, "%s: node%d: explore_read_quads failure\n",
- __func__, node);
- dfwdev->status = FWDEVINVAL;
+ if (err)
return (-1);
- }
hdr = (struct csrhdr *)&csr[0];
if (hdr->info_len != 4) {
if (firewire_debug)
- device_printf(fc->bdev, "%s: node%d: wrong bus info len(%d)\n",
- __func__, node, hdr->info_len);
- dfwdev->status = FWDEVINVAL;
+ printf("node%d: wrong bus info len(%d)\n",
+ node, hdr->info_len);
return (-1);
}
/* bus info */
err = fw_explore_read_quads(dfwdev, CSRROMOFF + 0x04, &csr[1], 4);
- if (err) {
- device_printf(fc->bdev, "%s: node%d: error reading 0x04\n",
- __func__, node);
- dfwdev->status = FWDEVINVAL;
+ if (err)
return (-1);
- }
binfo = (struct bus_info *)&csr[1];
if (binfo->bus_name != CSR_BUS_NAME_IEEE1394) {
- device_printf(fc->bdev, "%s: node%d: invalid bus name 0x%08x\n",
- __func__, node, binfo->bus_name);
- dfwdev->status = FWDEVINVAL;
+ if (firewire_debug)
+ printf("node%d: invalid bus name 0x%08x\n",
+ node, binfo->bus_name);
return (-1);
}
-
- if (firewire_debug)
- device_printf(fc->bdev, "%s: node(%d) BUS INFO BLOCK:\n"
- "irmc(%d) cmc(%d) isc(%d) bmc(%d) pmc(%d) "
- "cyc_clk_acc(%d) max_rec(%d) max_rom(%d) "
- "generation(%d) link_spd(%d)\n",
- __func__, node,
- binfo->irmc, binfo->cmc, binfo->isc,
- binfo->bmc, binfo->pmc, binfo->cyc_clk_acc,
- binfo->max_rec, binfo->max_rom,
- binfo->generation, binfo->link_spd);
-
+ spd = fc->speed_map->speed[fc->nodeid][node];
STAILQ_FOREACH(fwdev, &fc->devices, link)
if (FW_EUI64_EQUAL(fwdev->eui, binfo->eui64))
break;
@@ -1584,46 +1541,12 @@
fwdev = malloc(sizeof(struct fw_device), M_FW,
M_NOWAIT | M_ZERO);
if (fwdev == NULL) {
- device_printf(fc->bdev, "%s: node%d: no memory\n",
- __func__, node);
+ if (firewire_debug)
+ printf("node%d: no memory\n", node);
return (-1);
}
fwdev->fc = fc;
fwdev->eui = binfo->eui64;
- /*
- * Pre-1394a-2000 didn't have link_spd in
- * the Bus Info block, so try and use the
- * speed map value.
- * 1394a-2000 compliant devices only use
- * the Bus Info Block link spd value, so
- * ignore the speed map alltogether. SWB
- */
- if ( binfo->link_spd == FWSPD_S100 /* 0 */) {
- device_printf(fc->bdev, "%s"
- "Pre 1394a-2000 detected\n",
- __func__);
- fwdev->speed = fc->speed_map->speed[fc->nodeid][node];
- } else
- fwdev->speed = binfo->link_spd;
- /*
- * Test this speed with a read to the CSRROM.
- * If it fails, slow down the speed and retry.
- */
- while (fwdev->speed > 0) {
- err = fw_explore_read_quads(fwdev, CSRROMOFF,
- &speed_test, 1);
- if (err)
- fwdev->speed--;
- else
- break;
-
- }
- if (fwdev->speed != binfo->link_spd)
- device_printf(fc->bdev, "%s: fwdev->speed(%s)"
- " set lower than binfo->link_spd(%s)\n",
- __func__,
- linkspeed[fwdev->speed],
- linkspeed[binfo->link_spd]);
/* inesrt into sorted fwdev list */
pfwdev = NULL;
STAILQ_FOREACH(tfwdev, &fc->devices, link) {
@@ -1639,11 +1562,12 @@
STAILQ_INSERT_AFTER(&fc->devices, pfwdev, fwdev, link);
device_printf(fc->bdev, "New %s device ID:%08x%08x\n",
- linkspeed[fwdev->speed],
+ linkspeed[spd],
fwdev->eui.hi, fwdev->eui.lo);
}
fwdev->dst = node;
fwdev->status = FWDEVINIT;
+ fwdev->speed = spd;
/* unchanged ? */
if (bcmp(&csr[0], &fwdev->csrrom[0], sizeof(uint32_t) * 5) == 0) {
@@ -1704,22 +1628,12 @@
for (node = 0; node <= fc->max_node; node ++) {
/* We don't probe myself and linkdown nodes */
- if (node == fc->nodeid) {
- if (firewire_debug)
- device_printf(fc->bdev, "%s:"
- "found myself node(%d) fc->nodeid(%d) fc->max_node(%d)\n",
- __func__, node, fc->nodeid, fc->max_node);
+ if (node == fc->nodeid)
continue;
- } else if (firewire_debug) {
- device_printf(fc->bdev, "%s:"
- "node(%d) fc->max_node(%d) found\n",
- __func__, node, fc->max_node);
- }
fwsid = fw_find_self_id(fc, node);
if (!fwsid || !fwsid->p0.link_active) {
if (firewire_debug)
- device_printf(fc->bdev, "%s: node%d: link down\n",
- __func__, node);
+ printf("node%d: link down\n", node);
continue;
}
nodes[todo++] = node;
@@ -1734,8 +1648,8 @@
if (err)
nodes[todo2++] = nodes[i];
if (firewire_debug)
- device_printf(fc->bdev, "%s: node %d, err = %d\n",
- __func__, node, err);
+ printf("%s: node %d, err = %d\n",
+ __FUNCTION__, node, err);
}
todo = todo2;
}
@@ -1785,18 +1699,11 @@
fwdev->status = FWDEVATTACHED;
} else if (fwdev->status == FWDEVINVAL) {
fwdev->rcnt ++;
- if (firewire_debug)
- device_printf(fc->bdev, "%s:"
- "fwdev->rcnt(%d), hold_count(%d)\n",
- __func__, fwdev->rcnt, hold_count);
if (fwdev->rcnt > hold_count) {
/*
* Remove devices which have not been seen
* for a while.
*/
- device_printf(fc->bdev, "%s:"
- "Removing missing device ID:%08x%08x\n",
- __func__, fwdev->eui.hi, fwdev->eui.lo);
STAILQ_REMOVE(&fc->devices, fwdev, fw_device,
link);
free(fwdev, M_FW);
@@ -1805,16 +1712,16 @@
}
err = device_get_children(fc->bdev, &devlistp, &devcnt);
- if( err == 0 ) {
- for( i = 0 ; i < devcnt ; i++){
- if (device_get_state(devlistp[i]) >= DS_ATTACHED) {
- fdc = device_get_softc(devlistp[i]);
- if (fdc->post_explore != NULL)
- fdc->post_explore(fdc);
- }
+ if( err != 0 )
+ return;
+ for( i = 0 ; i < devcnt ; i++){
+ if (device_get_state(devlistp[i]) >= DS_ATTACHED) {
+ fdc = device_get_softc(devlistp[i]);
+ if (fdc->post_explore != NULL)
+ fdc->post_explore(fdc);
}
- free(devlistp, M_TEMP);
}
+ free(devlistp, M_TEMP);
return;
}
@@ -1894,9 +1801,8 @@
for (i = 0; i < rb->nvec; i++, rb->vec++) {
len = MIN(rb->vec->iov_len, plen);
if (res < len) {
- device_printf(rb->fc->bdev, "%s:"
- " rcv buffer(%d) is %d bytes short.\n",
- __func__, rb->xfer->recv.pay_len, len - res);
+ printf("rcv buffer(%d) is %d bytes short.\n",
+ rb->xfer->recv.pay_len, len - res);
len = res;
}
bcopy(rb->vec->iov_base, p, len);
@@ -1943,15 +1849,13 @@
rb->xfer = fw_tl2xfer(rb->fc, fp->mode.hdr.src,
fp->mode.hdr.tlrt >> 2, fp->mode.hdr.tcode);
if(rb->xfer == NULL) {
- device_printf(rb->fc->bdev, "%s: "
- "unknown response "
- "%s(%x) src=0x%x tl=0x%x rt=%d data=0x%x\n",
- __func__,
- tcode_str[tcode], tcode,
- fp->mode.hdr.src,
- fp->mode.hdr.tlrt >> 2,
- fp->mode.hdr.tlrt & 3,
- fp->mode.rresq.data);
+ printf("fw_rcv: unknown response "
+ "%s(%x) src=0x%x tl=0x%x rt=%d data=0x%x\n",
+ tcode_str[tcode], tcode,
+ fp->mode.hdr.src,
+ fp->mode.hdr.tlrt >> 2,
+ fp->mode.hdr.tlrt & 3,
+ fp->mode.rresq.data);
#if 0
printf("try ad-hoc work around!!\n");
rb->xfer = fw_tl2xfer(rb->fc, fp->mode.hdr.src,
@@ -1983,8 +1887,7 @@
#endif
break;
default:
- device_printf(rb->fc->bdev, "%s: "
- "unexpected flag 0x%02x\n", __func__, rb->xfer->flag);
+ printf("unexpected flag 0x%02x\n", rb->xfer->flag);
}
return;
case FWTCODE_WREQQ:
@@ -1995,23 +1898,17 @@
bind = fw_bindlookup(rb->fc, fp->mode.rreqq.dest_hi,
fp->mode.rreqq.dest_lo);
if(bind == NULL){
- device_printf(rb->fc->bdev, "%s: "
- "Unknown service addr 0x%04x:0x%08x %s(%x)"
+ printf("Unknown service addr 0x%04x:0x%08x %s(%x)"
#if defined(__DragonFly__) || __FreeBSD_version < 500000
- " src=0x%x data=%lx\n",
+ " src=0x%x data=%lx\n",
#else
- " src=0x%x data=%x\n",
+ " src=0x%x data=%x\n",
#endif
- __func__,
- fp->mode.wreqq.dest_hi,
- fp->mode.wreqq.dest_lo,
- tcode_str[tcode], tcode,
- fp->mode.hdr.src,
- ntohl(fp->mode.wreqq.data));
-
+ fp->mode.wreqq.dest_hi, fp->mode.wreqq.dest_lo,
+ tcode_str[tcode], tcode,
+ fp->mode.hdr.src, ntohl(fp->mode.wreqq.data));
if (rb->fc->status == FWBUSINIT) {
- device_printf(rb->fc->bdev, "%s: cannot respond(bus reset)!\n",
- __func__);
+ printf("fw_rcv: cannot respond(bus reset)!\n");
return;
}
rb->xfer = fw_xfer_alloc(M_FWXFER);
@@ -2057,9 +1954,9 @@
len += rb->vec[i].iov_len;
rb->xfer = STAILQ_FIRST(&bind->xferlist);
if (rb->xfer == NULL) {
- device_printf(rb->fc->bdev, "%s: "
- "Discard a packet for this bind.\n",
- __func__);
+#if 1
+ printf("Discard a packet for this bind.\n");
+#endif
return;
}
STAILQ_REMOVE_HEAD(&bind->xferlist, link);
@@ -2110,8 +2007,7 @@
}
#endif
default:
- device_printf(rb->fc->bdev,"%s: unknown tcode %d\n",
- __func__, tcode);
+ printf("fw_rcv: unknow tcode %d\n", tcode);
break;
}
}
@@ -2284,12 +2180,6 @@
return((uint16_t) crc);
}
-/*
- * Find the root node, if it is not
- * Cycle Master Capable, then we should
- * override this and become the Cycle
- * Master
- */
static int
fw_bmr(struct firewire_comm *fc)
{
@@ -2314,13 +2204,13 @@
} else
cmstr = -1;
- device_printf(fc->bdev, "bus manager %d %s\n",
- CSRARC(fc, BUS_MGR_ID),
- (CSRARC(fc, BUS_MGR_ID) != fc->nodeid) ? "(me)" : "");
+ device_printf(fc->bdev, "bus manager %d ", CSRARC(fc, BUS_MGR_ID));
if(CSRARC(fc, BUS_MGR_ID) != fc->nodeid) {
/* We are not the bus manager */
+ printf("\n");
return(0);
}
+ printf("(me)\n");
/* Optimize gapcount */
if(fc->max_hop <= MAX_GAPHOP )
Index: fwohci.c
===================================================================
--- fwohci.c (revision 189309)
+++ fwohci.c (revision 188507)
@@ -306,8 +306,8 @@
if((bm & 0x3f) == 0x3f)
bm = node;
if (firewire_debug)
- device_printf(sc->fc.dev, "%s: %d->%d (loop=%d)\n",
- __func__, bm, node, i);
+ device_printf(sc->fc.dev,
+ "fw_set_bus_manager: %d->%d (loop=%d)\n", bm, node, i);
return(bm);
}
@@ -332,7 +332,7 @@
}
if(i >= MAX_RETRY) {
if (firewire_debug)
- device_printf(sc->fc.dev, "%s: failed(1).\n", __func__);
+ device_printf(sc->fc.dev, "phy read failed(1).\n");
if (++retry < MAX_RETRY) {
DELAY(100);
goto again;
@@ -343,16 +343,15 @@
if ((stat & OHCI_INT_REG_FAIL) != 0 ||
((fun >> PHYDEV_REGADDR) & 0xf) != addr) {
if (firewire_debug)
- device_printf(sc->fc.dev, "%s: failed(2).\n", __func__);
+ device_printf(sc->fc.dev, "phy read failed(2).\n");
if (++retry < MAX_RETRY) {
DELAY(100);
goto again;
}
}
- if (firewire_debug > 1 || retry >= MAX_RETRY)
+ if (firewire_debug || retry >= MAX_RETRY)
device_printf(sc->fc.dev,
- "%s:: 0x%x loop=%d, retry=%d\n",
- __func__, addr, i, retry);
+ "fwphy_rddata: 0x%x loop=%d, retry=%d\n", addr, i, retry);
#undef MAX_RETRY
return((fun >> PHYDEV_RDDATA )& 0xff);
}
@@ -1849,7 +1848,7 @@
/* Disable bus reset interrupt until sid recv. */
OWRITE(sc, FWOHCI_INTMASKCLR, OHCI_INT_PHY_BUS_R);
- device_printf(fc->dev, "%s: BUS reset\n", __func__);
+ device_printf(fc->dev, "BUS reset\n");
OWRITE(sc, FWOHCI_INTMASKCLR, OHCI_INT_CYC_LOST);
OWRITE(sc, OHCI_LNKCTLCLR, OHCI_CNTL_CYCSRC);
@@ -1886,11 +1885,10 @@
plen = OREAD(sc, OHCI_SID_CNT);
fc->nodeid = node_id & 0x3f;
- device_printf(fc->dev, "%s: node_id=0x%08x, SelfID Count=%d, ",
- __func__, fc->nodeid, (plen >> 16) & 0xff);
+ device_printf(fc->dev, "node_id=0x%08x, SelfID Count=%d, ",
+ fc->nodeid, (plen >> 16) & 0xff);
if (!(node_id & OHCI_NODE_VALID)) {
- device_printf(fc->dev, "%s: Bus reset failure\n",
- __func__);
+ printf("Bus reset failure\n");
goto sidout;
}
@@ -2979,7 +2977,7 @@
db_tr = STAILQ_NEXT(db_tr, link);
resCount = FWOHCI_DMA_READ(db_tr->db[0].db.desc.res)
& OHCI_COUNT_MASK;
- }
+ } while (resCount == 0)
printf(" done\n");
dbch->top = db_tr;
dbch->buf_offset = dbch->xferq.psize - resCount;
Index: firewire.h
===================================================================
--- firewire.h (revision 189309)
+++ firewire.h (revision 188507)
@@ -99,16 +99,9 @@
#define FWRCODE_ER_TYPE 6
#define FWRCODE_ER_ADDR 7
-/*
- * Defined 1394a-2000
- * Table 5B-1
- */
#define FWSPD_S100 0
#define FWSPD_S200 1
#define FWSPD_S400 2
-#define FWSPD_S800 3
-#define FWSPD_S1600 4
-#define FWSPD_S3200 5
#define FWP_TL_VALID (1 << 7)
@@ -284,18 +277,10 @@
struct fw_devinfo dev[FW_MAX_DEVLST];
};
-/*
- * Defined in IEEE 1394a-2000
- * 4.3.4.1
- */
#define FW_SELF_ID_PORT_CONNECTED_TO_CHILD 3
#define FW_SELF_ID_PORT_CONNECTED_TO_PARENT 2
#define FW_SELF_ID_PORT_NOT_CONNECTED 1
#define FW_SELF_ID_PORT_NOT_EXISTS 0
-
-#define FW_SELF_ID_PAGE0 0
-#define FW_SELF_ID_PAGE1 1
-
#if BYTE_ORDER == BIG_ENDIAN
union fw_self_id {
struct {
@@ -305,7 +290,7 @@
link_active:1,
gap_count:6,
phy_speed:2,
- reserved:2,
+ phy_delay:2,
contender:1,
power_class:3,
port0:2,
@@ -320,32 +305,18 @@
phy_id:6,
sequel:1,
sequence_num:3,
- reserved2:2,
- port3:2,
- port4:2,
- port5:2,
- port6:2,
- port7:2,
- port8:2,
- port9:2,
- port10:2,
- reserved1:1,
+ :2,
+ porta:2,
+ portb:2,
+ portc:2,
+ portd:2,
+ porte:2,
+ portf:2,
+ portg:2,
+ porth:2,
+ :1,
more_packets:1;
} p1;
- struct {
- uint32_t
- id:2,
- phy_id:6,
- sequel:1,
- sequence_num:3,
- :2,
- port11:2,
- port12:2,
- port13:2,
- port14:2,
- port15:2,
- :8;
- } p2;
};
#else
union fw_self_id {
@@ -357,7 +328,7 @@
port0:2,
power_class:3,
contender:1,
- reserved:2,
+ phy_delay:2,
phy_speed:2,
gap_count:6,
link_active:1,
@@ -368,34 +339,20 @@
struct {
uint32_t more_packets:1,
reserved1:1,
- port10:2,
- port9:2,
- port8:2,
- port7:2,
- port6:2,
- port5:2,
- port4:2,
- port3:2,
+ porth:2,
+ portg:2,
+ portf:2,
+ porte:2,
+ portd:2,
+ portc:2,
+ portb:2,
+ porta:2,
reserved2:2,
sequence_num:3,
sequel:1,
phy_id:6,
id:2;
} p1;
- struct {
- uint32_t
- reserved3:8,
- port15:2,
- port14:2,
- port13:2,
- port12:2,
- port11:2,
- reserved4:2,
- sequence_num:3,
- sequel:1,
- phy_id:6,
- id:2;
- } p2;
};
#endif
Index: fwohcireg.h
===================================================================
--- fwohcireg.h (revision 189309)
+++ fwohcireg.h (revision 188507)
@@ -411,31 +411,32 @@
#define OHCI_CNTL_PHYPKT (0x1 << 10)
#define OHCI_CNTL_SID (0x1 << 9)
-/*
- * defined in OHCI 1.1
- * chapter 6.1
- */
#define OHCI_INT_DMA_ATRQ (0x1 << 0)
#define OHCI_INT_DMA_ATRS (0x1 << 1)
#define OHCI_INT_DMA_ARRQ (0x1 << 2)
#define OHCI_INT_DMA_ARRS (0x1 << 3)
#define OHCI_INT_DMA_PRRQ (0x1 << 4)
#define OHCI_INT_DMA_PRRS (0x1 << 5)
-#define OHCI_INT_DMA_IT (0x1 << 6)
-#define OHCI_INT_DMA_IR (0x1 << 7)
-#define OHCI_INT_PW_ERR (0x1 << 8)
-#define OHCI_INT_LR_ERR (0x1 << 9)
+#define OHCI_INT_DMA_IT (0x1 << 6)
+#define OHCI_INT_DMA_IR (0x1 << 7)
+#define OHCI_INT_PW_ERR (0x1 << 8)
+#define OHCI_INT_LR_ERR (0x1 << 9)
+
#define OHCI_INT_PHY_SID (0x1 << 16)
#define OHCI_INT_PHY_BUS_R (0x1 << 17)
+
#define OHCI_INT_REG_FAIL (0x1 << 18)
+
#define OHCI_INT_PHY_INT (0x1 << 19)
#define OHCI_INT_CYC_START (0x1 << 20)
#define OHCI_INT_CYC_64SECOND (0x1 << 21)
#define OHCI_INT_CYC_LOST (0x1 << 22)
#define OHCI_INT_CYC_ERR (0x1 << 23)
+
#define OHCI_INT_ERR (0x1 << 24)
#define OHCI_INT_CYC_LONG (0x1 << 25)
#define OHCI_INT_PHY_REG (0x1 << 26)
+
#define OHCI_INT_EN (0x1 << 31)
#define IP_CHANNELS 0x0234
Index: sbp.c
===================================================================
--- sbp.c (revision 189309)
+++ sbp.c (revision 188507)
@@ -218,7 +218,6 @@
char vendor[32];
char product[32];
char revision[10];
- char bustgtlun[32];
};
struct sbp_target {
@@ -365,35 +364,36 @@
return (0);
}
-/*
- * Display device characteristics on the console
- */
static void
-sbp_show_sdev_info(struct sbp_dev *sdev)
+sbp_show_sdev_info(struct sbp_dev *sdev, int new)
{
struct fw_device *fwdev;
+ printf("%s:%d:%d ",
+ device_get_nameunit(sdev->target->sbp->fd.dev),
+ sdev->target->target_id,
+ sdev->lun_id
+ );
+ if (new == 2) {
+ return;
+ }
fwdev = sdev->target->fwdev;
- device_printf(sdev->target->sbp->fd.dev,
- "%s: %s: ordered:%d type:%d EUI:%08x%08x node:%d "
- "speed:%d maxrec:%d\n",
- __func__,
- sdev->bustgtlun,
+ printf("ordered:%d type:%d EUI:%08x%08x node:%d "
+ "speed:%d maxrec:%d",
(sdev->type & 0x40) >> 6,
(sdev->type & 0x1f),
fwdev->eui.hi,
fwdev->eui.lo,
fwdev->dst,
fwdev->speed,
- fwdev->maxrec);
-
- device_printf(sdev->target->sbp->fd.dev,
- "%s: %s '%s' '%s' '%s'\n",
- __func__,
- sdev->bustgtlun,
- sdev->vendor,
- sdev->product,
- sdev->revision);
+ fwdev->maxrec
+ );
+ if (new)
+ printf(" new!\n");
+ else
+ printf("\n");
+ sbp_show_sdev_info(sdev, 2);
+ printf("'%s' '%s' '%s'\n", sdev->vendor, sdev->product, sdev->revision);
}
static struct {
@@ -549,10 +549,6 @@
CALLOUT_INIT(&sdev->login_callout);
sdev->status = SBP_DEV_RESET;
new = 1;
- snprintf(sdev->bustgtlun, 32, "%s:%d:%d",
- device_get_nameunit(sdev->target->sbp->fd.dev),
- sdev->target->target_id,
- sdev->lun_id);
}
sdev->flags |= VALID_LUN;
sdev->type = (reg->val & 0xff0000) >> 16;
@@ -721,18 +717,20 @@
sbp_probe_target(void *arg)
{
struct sbp_target *target = (struct sbp_target *)arg;
- struct sbp_softc *sbp = target->sbp;
+ struct sbp_softc *sbp;
struct sbp_dev *sdev;
+ struct firewire_comm *fc;
int i, alive;
alive = SBP_FWDEV_ALIVE(target->fwdev);
SBP_DEBUG(1)
- device_printf(sbp->fd.dev, "%s %d%salive\n",
- __func__, target->target_id,
- (!alive) ? " not " : "");
+ printf("sbp_probe_target %d\n", target->target_id);
+ if (!alive)
+ printf("not alive\n");
END_DEBUG
sbp = target->sbp;
+ fc = target->sbp->fd.fc;
sbp_alloc_lun(target);
/* XXX untimeout mgm_ocb and dequeue */
@@ -748,7 +746,10 @@
SBP_UNLOCK(sbp);
}
sbp_probe_lun(sdev);
- sbp_show_sdev_info(sdev);
+SBP_DEBUG(0)
+ sbp_show_sdev_info(sdev,
+ (sdev->status == SBP_DEV_RESET));
+END_DEBUG
sbp_abort_all_ocbs(sdev, CAM_SCSI_BUS_RESET);
switch (sdev->status) {
@@ -770,8 +771,8 @@
case SBP_DEV_ATTACHED:
SBP_DEBUG(0)
/* the device has gone */
- device_printf(sbp->fd.dev, "%s: lost target\n",
- __func__);
+ sbp_show_sdev_info(sdev, 2);
+ printf("lost target\n");
END_DEBUG
if (sdev->path) {
SBP_LOCK(sbp);
@@ -856,10 +857,12 @@
/* traverse device list */
STAILQ_FOREACH(fwdev, &sbp->fd.fc->devices, link) {
SBP_DEBUG(0)
- device_printf(sbp->fd.dev,"%s:: EUI:%08x%08x %s attached, state=%d\n",
- __func__, fwdev->eui.hi, fwdev->eui.lo,
- (fwdev->status != FWDEVATTACHED) ? "not" : "",
- fwdev->status);
+ printf("sbp_post_explore: EUI:%08x%08x ",
+ fwdev->eui.hi, fwdev->eui.lo);
+ if (fwdev->status != FWDEVATTACHED)
+ printf("not attached, state=%d.\n", fwdev->status);
+ else
+ printf("attached\n");
END_DEBUG
alive = SBP_FWDEV_ALIVE(fwdev);
for(i = 0 ; i < SBP_NUM_TARGETS ; i ++){
@@ -896,7 +899,8 @@
struct sbp_dev *sdev;
sdev = (struct sbp_dev *)xfer->sc;
SBP_DEBUG(1)
- device_printf(sdev->target->sbp->fd.dev,"%s\n", __func__);
+ sbp_show_sdev_info(sdev, 2);
+ printf("sbp_loginres_callback\n");
END_DEBUG
/* recycle */
s = splfw();
@@ -929,8 +933,8 @@
int i;
if (xfer->resp != 0) {
- device_printf(sdev->target->sbp->fd.dev,
- "%s: %s failed: resp=%d\n", __func__, sdev->bustgtlun, xfer->resp);
+ sbp_show_sdev_info(sdev, 2);
+ printf("sbp_reset_start failed: resp=%d\n", xfer->resp);
}
for (i = 0; i < target->num_lun; i++) {
@@ -947,8 +951,8 @@
struct fw_pkt *fp;
SBP_DEBUG(0)
- device_printf(sdev->target->sbp->fd.dev,
- "%s:%s\n", __func__,sdev->bustgtlun);
+ sbp_show_sdev_info(sdev, 2);
+ printf("sbp_reset_start\n");
END_DEBUG
xfer = sbp_write_cmd(sdev, FWTCODE_WREQQ, 0);
@@ -969,11 +973,18 @@
sdev = (struct sbp_dev *)xfer->sc;
SBP_DEBUG(1)
- device_printf(sdev->target->sbp->fd.dev,
- "%s:%s\n", __func__, sdev->bustgtlun);
+ sbp_show_sdev_info(sdev, 2);
+ printf("sbp_mgm_callback\n");
END_DEBUG
resp = xfer->resp;
sbp_xfer_free(xfer);
+#if 0
+ if (resp != 0) {
+ sbp_show_sdev_info(sdev, 2);
+ printf("management ORB failed(%d) ... RESET_START\n", resp);
+ sbp_reset_start(sdev);
+ }
+#endif
return;
}
@@ -1000,14 +1011,14 @@
sdev = (struct sbp_dev *) ccb->ccb_h.ccb_sdev_ptr;
target = sdev->target;
SBP_DEBUG(0)
- device_printf(sdev->target->sbp->fd.dev,
- "%s:%s\n", __func__, sdev->bustgtlun);
+ sbp_show_sdev_info(sdev, 2);
+ printf("sbp_cam_scan_lun\n");
END_DEBUG
if ((ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) {
sdev->status = SBP_DEV_ATTACHED;
} else {
- device_printf(sdev->target->sbp->fd.dev,
- "%s:%s failed\n", __func__, sdev->bustgtlun);
+ sbp_show_sdev_info(sdev, 2);
+ printf("scan failed\n");
}
sdev = sbp_next_dev(target, sdev->lun_id + 1);
if (sdev == NULL) {
@@ -1036,8 +1047,8 @@
return;
}
SBP_DEBUG(0)
- device_printf(sdev->target->sbp->fd.dev,
- "%s:%s\n", __func__, sdev->bustgtlun);
+ sbp_show_sdev_info(sdev, 2);
+ printf("sbp_cam_scan_target\n");
END_DEBUG
ccb = malloc(sizeof(union ccb), M_SBP, M_NOWAIT | M_ZERO);
if (ccb == NULL) {
@@ -1078,8 +1089,8 @@
target = sdev->target;
sbp = target->sbp;
SBP_DEBUG(0)
- device_printf(sdev->target->sbp->fd.dev,
- "%s:%s\n", __func__, sdev->bustgtlun);
+ sbp_show_sdev_info(sdev, 2);
+ printf("sbp_do_attach\n");
END_DEBUG
sbp_xfer_free(xfer);
@@ -1109,12 +1120,12 @@
sdev = (struct sbp_dev *)xfer->sc;
SBP_DEBUG(1)
- device_printf(sdev->target->sbp->fd.dev,
- "%s:%s\n", __func__, sdev->bustgtlun);
+ sbp_show_sdev_info(sdev, 2);
+ printf("%s\n", __func__);
END_DEBUG
if (xfer->resp != 0) {
- device_printf(sdev->target->sbp->fd.dev,
- "%s:%s resp=%d\n", __func__, sdev->bustgtlun, xfer->resp);
+ sbp_show_sdev_info(sdev, 2);
+ printf("%s: resp=%d\n", __func__, xfer->resp);
}
sbp_xfer_free(xfer);
@@ -1133,8 +1144,8 @@
struct fw_pkt *fp;
SBP_DEBUG(0)
- device_printf(sdev->target->sbp->fd.dev,
- "%s:%s\n", __func__, sdev->bustgtlun);
+ sbp_show_sdev_info(sdev, 2);
+ printf("sbp_agent_reset\n");
END_DEBUG
xfer = sbp_write_cmd(sdev, FWTCODE_WREQQ, 0x04);
if (xfer == NULL)
@@ -1156,8 +1167,8 @@
sdev = (struct sbp_dev *)xfer->sc;
SBP_DEBUG(1)
- device_printf(sdev->target->sbp->fd.dev,
- "%s:%s\n", __func__, sdev->bustgtlun);
+ sbp_show_sdev_info(sdev, 2);
+ printf("sbp_busy_timeout_callback\n");
END_DEBUG
sbp_xfer_free(xfer);
sbp_agent_reset(sdev);
@@ -1169,8 +1180,8 @@
struct fw_pkt *fp;
struct fw_xfer *xfer;
SBP_DEBUG(0)
- device_printf(sdev->target->sbp->fd.dev,
- "%s:%s\n", __func__, sdev->bustgtlun);
+ sbp_show_sdev_info(sdev, 2);
+ printf("sbp_busy_timeout\n");
END_DEBUG
xfer = sbp_write_cmd(sdev, FWTCODE_WREQQ, 0);
@@ -1189,8 +1200,8 @@
sdev = (struct sbp_dev *)xfer->sc;
SBP_DEBUG(2)
- device_printf(sdev->target->sbp->fd.dev,
- "%s:%s\n", __func__, sdev->bustgtlun);
+ sbp_show_sdev_info(sdev, 2);
+ printf("%s\n", __func__);
END_DEBUG
if (xfer->resp != 0) {
/* XXX */
@@ -1219,10 +1230,8 @@
struct fw_xfer *xfer;
struct fw_pkt *fp;
SBP_DEBUG(1)
- device_printf(sdev->target->sbp->fd.dev,
- "%s:%s 0x%08x\n",
- __func__, sdev->bustgtlun,
- (uint32_t)ocb->bus_addr);
+ sbp_show_sdev_info(sdev, 2);
+ printf("%s: 0x%08x\n", __func__, (uint32_t)ocb->bus_addr);
END_DEBUG
mtx_assert(&sdev->target->sbp->mtx, MA_OWNED);
@@ -1269,13 +1278,12 @@
sdev = (struct sbp_dev *)xfer->sc;
SBP_DEBUG(1)
- device_printf(sdev->target->sbp->fd.dev,
- "%s:%s\n", __func__, sdev->bustgtlun);
+ sbp_show_sdev_info(sdev, 2);
+ printf("sbp_doorbell_callback\n");
END_DEBUG
if (xfer->resp != 0) {
/* XXX */
- device_printf(sdev->target->sbp->fd.dev,
- "%s: xfer->resp = %d\n", __func__, xfer->resp);
+ printf("%s: xfer->resp = %d\n", __func__, xfer->resp);
}
sbp_xfer_free(xfer);
sdev->flags &= ~ORB_DOORBELL_ACTIVE;
@@ -1294,8 +1302,8 @@
struct fw_xfer *xfer;
struct fw_pkt *fp;
SBP_DEBUG(1)
- device_printf(sdev->target->sbp->fd.dev,
- "%s:%s\n", __func__, sdev->bustgtlun);
+ sbp_show_sdev_info(sdev, 2);
+ printf("sbp_doorbell\n");
END_DEBUG
if ((sdev->flags & ORB_DOORBELL_ACTIVE) != 0) {
@@ -1423,10 +1431,8 @@
ocb->orb[7] = htonl(SBP_DEV2ADDR(target->target_id, sdev->lun_id));
SBP_DEBUG(0)
- device_printf(sdev->target->sbp->fd.dev,
- "%s:%s %s\n",
- __func__,sdev->bustgtlun,
- orb_fun_name[(func>>16)&0xf]);
+ sbp_show_sdev_info(sdev, 2);
+ printf("%s\n", orb_fun_name[(func>>16)&0xf]);
END_DEBUG
switch (func) {
case ORB_FUN_LGI:
@@ -1479,6 +1485,10 @@
fp->mode.wreqb.extcode = 0;
xfer->send.payload[0] = htonl(nid << 16);
xfer->send.payload[1] = htonl(ocb->bus_addr & 0xffffffff);
+SBP_DEBUG(0)
+ sbp_show_sdev_info(sdev, 2);
+ printf("mgm orb: %08x\n", (uint32_t)ocb->bus_addr);
+END_DEBUG
fw_asyreq(xfer->fc, -1, xfer);
}
@@ -1522,15 +1532,16 @@
SBP_DEBUG(0)
sbp_print_scsi_cmd(ocb);
/* XXX need decode status */
- printf("%s: SCSI status %x sfmt %x valid %x key %x code %x qlfr %x len %d\n",
- ocb->sdev->bustgtlun,
+ sbp_show_sdev_info(ocb->sdev, 2);
+ printf("SCSI status %x sfmt %x valid %x key %x code %x qlfr %x len %d\n",
sbp_cmd_status->status,
sbp_cmd_status->sfmt,
sbp_cmd_status->valid,
sbp_cmd_status->s_key,
sbp_cmd_status->s_code,
sbp_cmd_status->s_qlfr,
- sbp_status->len);
+ sbp_status->len
+ );
END_DEBUG
switch (sbp_cmd_status->status) {
@@ -1590,10 +1601,9 @@
*/
break;
default:
- device_printf(ocb->sdev->target->sbp->fd.dev,
- "%s:%s unknown scsi status 0x%x\n",
- __func__, ocb->sdev->bustgtlun,
- sbp_cmd_status->status);
+ sbp_show_sdev_info(ocb->sdev, 2);
+ printf("sbp_scsi_status: unknown scsi status 0x%x\n",
+ sbp_cmd_status->status);
}
}
@@ -1610,8 +1620,8 @@
if (ccb->csio.cdb_io.cdb_bytes[1] & SI_EVPD)
return;
SBP_DEBUG(1)
- device_printf(sdev->target->sbp->fd.dev,
- "%s:%s\n", __func__, sdev->bustgtlun);
+ sbp_show_sdev_info(sdev, 2);
+ printf("sbp_fix_inq_data\n");
END_DEBUG
inq = (struct scsi_inquiry_data *) ccb->csio.data_ptr;
switch (SID_TYPE(inq)) {
@@ -1720,26 +1730,23 @@
}
ocb = sbp_dequeue_ocb(sdev, sbp_status);
if (ocb == NULL) {
- device_printf(sdev->target->sbp->fd.dev,
+ sbp_show_sdev_info(sdev, 2);
#if defined(__DragonFly__) || __FreeBSD_version < 500000
- "%s:%s No ocb(%lx) on the queue\n",
+ printf("No ocb(%lx) on the queue\n",
#else
- "%s:%s No ocb(%x) on the queue\n",
+ printf("No ocb(%x) on the queue\n",
#endif
- __func__,sdev->bustgtlun,
- ntohl(sbp_status->orb_lo));
+ ntohl(sbp_status->orb_lo));
}
break;
case 2:
/* unsolicit */
- device_printf(sdev->target->sbp->fd.dev,
- "%s:%s unsolicit status received\n",
- __func__, sdev->bustgtlun);
+ sbp_show_sdev_info(sdev, 2);
+ printf("unsolicit status received\n");
break;
default:
- device_printf(sdev->target->sbp->fd.dev,
- "%s:%s unknown sbp_status->src\n",
- __func__, sdev->bustgtlun);
+ sbp_show_sdev_info(sdev, 2);
+ printf("unknown sbp_status->src\n");
}
status_valid0 = (sbp_status->src < 2
@@ -1750,20 +1757,18 @@
if (!status_valid0 || debug > 2){
int status;
SBP_DEBUG(0)
- device_printf(sdev->target->sbp->fd.dev,
- "%s:%s ORB status src:%x resp:%x dead:%x"
+ sbp_show_sdev_info(sdev, 2);
+ printf("ORB status src:%x resp:%x dead:%x"
#if defined(__DragonFly__) || __FreeBSD_version < 500000
" len:%x stat:%x orb:%x%08lx\n",
#else
" len:%x stat:%x orb:%x%08x\n",
#endif
- __func__, sdev->bustgtlun,
sbp_status->src, sbp_status->resp, sbp_status->dead,
sbp_status->len, sbp_status->status,
ntohs(sbp_status->orb_hi), ntohl(sbp_status->orb_lo));
END_DEBUG
- device_printf(sdev->target->sbp->fd.dev,
- "%s\n", sdev->bustgtlun);
+ sbp_show_sdev_info(sdev, 2);
status = sbp_status->status;
switch(sbp_status->resp) {
case 0:
@@ -1822,19 +1827,14 @@
login_res->cmd_lo = ntohl(login_res->cmd_lo);
if (status_valid) {
SBP_DEBUG(0)
- device_printf(sdev->target->sbp->fd.dev,
- "%s:%s login: len %d, ID %d, cmd %08x%08x, recon_hold %d\n",
- __func__, sdev->bustgtlun,
- login_res->len, login_res->id,
- login_res->cmd_hi, login_res->cmd_lo,
- ntohs(login_res->recon_hold));
+sbp_show_sdev_info(sdev, 2);
+printf("login: len %d, ID %d, cmd %08x%08x, recon_hold %d\n", login_res->len, login_res->id, login_res->cmd_hi, login_res->cmd_lo, ntohs(login_res->recon_hold));
END_DEBUG
sbp_busy_timeout(sdev);
} else {
/* forgot logout? */
- device_printf(sdev->target->sbp->fd.dev,
- "%s:%s login failed\n",
- __func__, sdev->bustgtlun);
+ sbp_show_sdev_info(sdev, 2);
+ printf("login failed\n");
sdev->status = SBP_DEV_RESET;
}
break;
@@ -1842,22 +1842,23 @@
login_res = sdev->login;
if (status_valid) {
SBP_DEBUG(0)
- device_printf(sdev->target->sbp->fd.dev,
- "%s:%s reconnect: len %d, ID %d, cmd %08x%08x\n",
- __func__, sdev->bustgtlun,
- login_res->len, login_res->id,
- login_res->cmd_hi, login_res->cmd_lo);
+sbp_show_sdev_info(sdev, 2);
+printf("reconnect: len %d, ID %d, cmd %08x%08x\n", login_res->len, login_res->id, login_res->cmd_hi, login_res->cmd_lo);
END_DEBUG
+#if 1
if (sdev->status == SBP_DEV_ATTACHED)
sbp_scan_dev(sdev);
else
sbp_agent_reset(sdev);
+#else
+ sdev->status = SBP_DEV_ATTACHED;
+ sbp_mgm_orb(sdev, ORB_FUN_ATS, NULL);
+#endif
} else {
/* reconnection hold time exceed? */
SBP_DEBUG(0)
- device_printf(sdev->target->sbp->fd.dev,
- "%s:%s reconnect failed\n",
- __func__, sdev->bustgtlun);
+ sbp_show_sdev_info(sdev, 2);
+ printf("reconnect failed\n");
END_DEBUG
sbp_login(sdev);
}
@@ -1874,9 +1875,8 @@
sbp_agent_reset(sdev);
break;
default:
- device_printf(sdev->target->sbp->fd.dev,
- "%s:%s unknown function %d\n",
- __func__, sdev->bustgtlun, orb_fun);
+ sbp_show_sdev_info(sdev, 2);
+ printf("unknown function %d\n", orb_fun);
break;
}
sbp_mgm_orb(sdev, ORB_FUN_RUNQUEUE, NULL);
@@ -1885,7 +1885,15 @@
sdev->timeout = 0;
if(ocb->ccb != NULL){
union ccb *ccb;
-
+/*
+ uint32_t *ld;
+ ld = ocb->ccb->csio.data_ptr;
+ if(ld != NULL && ocb->ccb->csio.dxfer_len != 0)
+ printf("ptr %08x %08x %08x %08x\n", ld[0], ld[1], ld[2], ld[3]);
+ else
+ printf("ptr NULL\n");
+printf("len %d\n", sbp_status->len);
+*/
ccb = ocb->ccb;
if(sbp_status->len > 1){
sbp_scsi_status(sbp_status, ocb);
@@ -2271,9 +2279,9 @@
struct sbp_dev *sdev = ocb->sdev;
struct sbp_target *target = sdev->target;
- device_printf(sdev->target->sbp->fd.dev,
- "%s:%s request timeout(mgm orb:0x%08x)\n",
- __func__, sdev->bustgtlun, (uint32_t)ocb->bus_addr);
+ sbp_show_sdev_info(sdev, 2);
+ printf("request timeout(mgm orb:0x%08x) ... ",
+ (uint32_t)ocb->bus_addr);
target->mgm_ocb_cur = NULL;
sbp_free_ocb(sdev, ocb);
#if 0
@@ -2281,10 +2289,10 @@
printf("run next request\n");
sbp_mgm_orb(sdev, ORB_FUN_RUNQUEUE, NULL);
#endif
- device_printf(sdev->target->sbp->fd.dev,
- "%s:%s reset start\n",
- __func__, sdev->bustgtlun);
+#if 1
+ printf("reset start\n");
sbp_reset_start(sdev);
+#endif
}
static void
@@ -2293,9 +2301,9 @@
struct sbp_ocb *ocb = (struct sbp_ocb *)arg;
struct sbp_dev *sdev = ocb->sdev;
- device_printf(sdev->target->sbp->fd.dev,
- "%s:%s request timeout(cmd orb:0x%08x) ... ",
- __func__, sdev->bustgtlun, (uint32_t)ocb->bus_addr);
+ sbp_show_sdev_info(sdev, 2);
+ printf("request timeout(cmd orb:0x%08x) ... ",
+ (uint32_t)ocb->bus_addr);
sdev->timeout ++;
switch(sdev->timeout) {
@@ -2752,13 +2760,13 @@
int flags;
SBP_DEBUG(1)
- device_printf(sdev->target->sbp->fd.dev,
+ sbp_show_sdev_info(sdev, 2);
#if defined(__DragonFly__) || __FreeBSD_version < 500000
- "%s:%s 0x%08lx src %d\n",
+ printf("%s: 0x%08lx src %d\n",
#else
- "%s:%s 0x%08x src %d\n",
+ printf("%s: 0x%08x src %d\n",
#endif
- __func__, sdev->bustgtlun, ntohl(sbp_status->orb_lo), sbp_status->src);
+ __func__, ntohl(sbp_status->orb_lo), sbp_status->src);
END_DEBUG
SBP_LOCK(sdev->target->sbp);
for (ocb = STAILQ_FIRST(&sdev->ocbs); ocb != NULL; ocb = next) {
@@ -2815,9 +2823,8 @@
splx(s);
SBP_DEBUG(0)
if (ocb && order > 0) {
- device_printf(sdev->target->sbp->fd.dev,
- "%s:%s unordered execution order:%d\n",
- __func__, sdev->bustgtlun, order);
+ sbp_show_sdev_info(sdev, 2);
+ printf("unordered execution order:%d\n", order);
}
END_DEBUG
return (ocb);
@@ -2831,11 +2838,11 @@
mtx_assert(&sdev->target->sbp->mtx, MA_OWNED);
SBP_DEBUG(1)
- device_printf(sdev->target->sbp->fd.dev,
+ sbp_show_sdev_info(sdev, 2);
#if defined(__DragonFly__) || __FreeBSD_version < 500000
- "%s:%s 0x%08x\n", __func__, sdev->bustgtlun, ocb->bus_addr);
+ printf("%s: 0x%08x\n", __func__, ocb->bus_addr);
#else
- "%s:%s 0x%08jx\n", __func__, sdev->bustgtlun, (uintmax_t)ocb->bus_addr);
+ printf("%s: 0x%08jx\n", __func__, (uintmax_t)ocb->bus_addr);
#endif
END_DEBUG
prev2 = prev = STAILQ_LAST(&sdev->ocbs, sbp_ocb, ocb);
@@ -2917,11 +2924,11 @@
sdev = ocb->sdev;
SBP_DEBUG(0)
- device_printf(sdev->target->sbp->fd.dev,
+ sbp_show_sdev_info(sdev, 2);
#if defined(__DragonFly__) || __FreeBSD_version < 500000
- "%s:%s 0x%x\n", __func__, sdev->bustgtlun, ocb->bus_addr);
+ printf("sbp_abort_ocb 0x%x\n", ocb->bus_addr);
#else
- "%s:%s 0x%jx\n", __func__, sdev->bustgtlun, (uintmax_t)ocb->bus_addr);
+ printf("sbp_abort_ocb 0x%jx\n", (uintmax_t)ocb->bus_addr);
#endif
END_DEBUG
SBP_DEBUG(1)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1236105014.7868.18.camel>
