summaryrefslogtreecommitdiff
path: root/sys/dev/firewire
diff options
context:
space:
mode:
authorWill Andrews <will@FreeBSD.org>2015-01-21 20:03:46 +0000
committerWill Andrews <will@FreeBSD.org>2015-01-21 20:03:46 +0000
commit7eaab60d36eb0ea0c3e05b16db9fc2aa8a37ff63 (patch)
tree26de6d68f69034fb5dd858ef9e3c410db7b2880c /sys/dev/firewire
parentff9ae2210b2a3b36f13caf1df2a13025e9084d18 (diff)
Notes
Diffstat (limited to 'sys/dev/firewire')
-rw-r--r--sys/dev/firewire/firewire.c29
1 files changed, 19 insertions, 10 deletions
diff --git a/sys/dev/firewire/firewire.c b/sys/dev/firewire/firewire.c
index 6fff13299a14..026bd056d40f 100644
--- a/sys/dev/firewire/firewire.c
+++ b/sys/dev/firewire/firewire.c
@@ -761,8 +761,15 @@ fw_busreset(struct firewire_comm *fc, uint32_t new_status)
src = &fc->crom_src_buf->src;
crom_load(src, newrom, CROMSIZE);
if (bcmp(newrom, fc->config_rom, CROMSIZE) != 0) {
- if (src->businfo.generation++ > FW_MAX_GENERATION)
+ /* Bump generation and reload. */
+ src->businfo.generation++;
+
+ /* Handle generation count wraps. */
+ if (src->businfo.generation < FW_GENERATION_CHANGEABLE)
src->businfo.generation = FW_GENERATION_CHANGEABLE;
+
+ /* Recalculate CRC to account for generation change. */
+ crom_load(src, newrom, CROMSIZE);
bcopy(newrom, fc->config_rom, CROMSIZE);
}
free(newrom, M_FW);
@@ -1156,16 +1163,18 @@ fw_xfer_unload(struct fw_xfer *xfer)
if (xfer == NULL)
return;
- FW_GLOCK(xfer->fc);
- if (xfer->flag & FWXF_INQ) {
- STAILQ_REMOVE(&xfer->q->q, xfer, fw_xfer, link);
- xfer->flag &= ~FWXF_INQ;
-#if 0
- xfer->q->queued--;
-#endif
- }
- FW_GUNLOCK(xfer->fc);
+
if (xfer->fc != NULL) {
+ FW_GLOCK(xfer->fc);
+ if (xfer->flag & FWXF_INQ) {
+ STAILQ_REMOVE(&xfer->q->q, xfer, fw_xfer, link);
+ xfer->flag &= ~FWXF_INQ;
+ #if 0
+ xfer->q->queued--;
+ #endif
+ }
+ FW_GUNLOCK(xfer->fc);
+
/*
* Ensure that any tlabel owner can't access this
* xfer after it's freed.