summaryrefslogtreecommitdiffstats
path: root/usr.sbin/fwcontrol/fwcontrol.c
diff options
context:
space:
mode:
authorsimokawa <simokawa@FreeBSD.org>2003-04-17 03:38:03 +0000
committersimokawa <simokawa@FreeBSD.org>2003-04-17 03:38:03 +0000
commit29b43e58e396537013e1057229debf865e3901e1 (patch)
tree11114a8420b3e8fd28f1d77e46ddae593b132e23 /usr.sbin/fwcontrol/fwcontrol.c
parentf946ac101075e1f9e524d40e1cccc51f674b7f5a (diff)
downloadFreeBSD-src-29b43e58e396537013e1057229debf865e3901e1.zip
FreeBSD-src-29b43e58e396537013e1057229debf865e3901e1.tar.gz
MFp4(simokawa_firewire):
Many internal structure changes for the FireWire driver. - Compute CRC in CROM parsing. - Add support for configuration ROM build. - Simplify dummy buffer handling. - busdma conversion - Use swi_taskqueue_giant for -current. Mark the interrupt routine as MPSAFE. - AR buffer handling. Don't reallocate AR buffer but just recycle it. Don't malloc and copy per packet in fwohci_arcv(). Pass packet to fw_rcv() using iovec. Application must prepare receiving buffer in advance. - Change fw_bind API so that application should pre-allocate xfer structure. - Add fw_xfer_unload() for recycling struct fw_xfer. - Add post_busreset hook - Remove unused 'sub' and 'act_type' in struct fw_xfer. - Remove npacket from struct fw_bulkxfer. - Don't call back handlers in fwochi_arcv() if the packet has not drained in AT queue - Make firewire works on big endian platform. - Use native endian for packet header and remove unnecessary ntohX/htonX. - Remove FWXFERQ_PACKET mode. We don't use it anymore. - Remove unnecessary restriction of FWSTMAXCHUNK. - Don't set root node for phy config packet if the root node is not cycle master capable but set myself for root node. We should be the root node after next bus reset. Spotted by: Yoshihiro Tabira <tabira@scd.mei.co.jp> - Improve self id handling Tested on: i386, sparc64 and i386 with forced bounce buffer
Diffstat (limited to 'usr.sbin/fwcontrol/fwcontrol.c')
-rw-r--r--usr.sbin/fwcontrol/fwcontrol.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/usr.sbin/fwcontrol/fwcontrol.c b/usr.sbin/fwcontrol/fwcontrol.c
index 6044ece..3ac3814 100644
--- a/usr.sbin/fwcontrol/fwcontrol.c
+++ b/usr.sbin/fwcontrol/fwcontrol.c
@@ -127,8 +127,8 @@ read_write_quad(int fd, struct fw_eui64 eui, u_int32_t addr_lo, int read, u_int3
else
asyreq->pkt.mode.rreqq.tcode = FWTCODE_WREQQ;
- asyreq->pkt.mode.rreqq.dest_hi = htons(0xffff);
- asyreq->pkt.mode.rreqq.dest_lo = htonl(addr_lo);
+ asyreq->pkt.mode.rreqq.dest_hi = 0xffff;
+ asyreq->pkt.mode.rreqq.dest_lo = addr_lo;
qld = (u_int32_t *)&asyreq->pkt;
if (!read)
@@ -157,9 +157,9 @@ send_phy_config(int fd, int root_node, int gap_count)
asyreq->pkt.mode.ld[1] = 0;
asyreq->pkt.mode.common.tcode = FWTCODE_PHY;
if (root_node >= 0)
- asyreq->pkt.mode.ld[1] |= htonl((root_node & 0x3f) << 24 | 1 << 23);
+ asyreq->pkt.mode.ld[1] |= (root_node & 0x3f) << 24 | 1 << 23;
if (gap_count >= 0)
- asyreq->pkt.mode.ld[1] |= htonl(1 << 22 | (gap_count & 0x3f) << 16);
+ asyreq->pkt.mode.ld[1] |= 1 << 22 | (gap_count & 0x3f) << 16;
asyreq->pkt.mode.ld[2] = ~asyreq->pkt.mode.ld[1];
printf("send phy_config root_node=%d gap_count=%d\n",
@@ -251,8 +251,9 @@ show_crom(u_int32_t *crom_buf)
struct csrreg *reg;
struct csrdirectory *dir;
struct csrhdr *hdr;
+ u_int16_t crc;
- printf("first quad: 0x%08x\n", *crom_buf);
+ printf("first quad: 0x%08x ", *crom_buf);
hdr = (struct csrhdr *)crom_buf;
if (hdr->info_len == 1) {
/* minimum ROM */
@@ -261,13 +262,24 @@ show_crom(u_int32_t *crom_buf)
printf("verndor ID: 0x%06x\n", reg->val);
return;
}
- printf("len: %d\n", hdr->crc_len);
+ printf("info_len=%d crc_len=%d crc=0x%04x",
+ hdr->info_len, hdr->crc_len, hdr->crc);
+ crc = crom_crc(crom_buf+1, hdr->crc_len);
+ if (crc == hdr->crc)
+ printf("(OK)\n");
+ else
+ printf("(NG)\n");
parse_bus_info_block(crom_buf+1, hdr->info_len);
crom_init_context(&cc, crom_buf);
dir = cc.stack[0].dir;
- printf("root_directory: len=0x%04x(%d) crc=0x%04x\n",
+ printf("root_directory: len=0x%04x(%d) crc=0x%04x",
dir->crc_len, dir->crc_len, dir->crc);
+ crc = crom_crc((u_int32_t *)&dir->entry[0], dir->crc_len);
+ if (crc == dir->crc)
+ printf("(OK)\n");
+ else
+ printf("(NG)\n");
if (dir->crc_len < 1)
return;
while (cc.depth >= 0) {
OpenPOWER on IntegriCloud