Page MenuHomeFreeBSD

D58204.diff
No OneTemporary

D58204.diff

diff --git a/share/man/man4/fwdv.4 b/share/man/man4/fwdv.4
--- a/share/man/man4/fwdv.4
+++ b/share/man/man4/fwdv.4
@@ -3,7 +3,7 @@
.\"
.\" SPDX-License-Identifier: BSD-2-Clause
.\"
-.Dd June 19, 2026
+.Dd July 12, 2026
.Dt FWDV 4
.Os
.Sh NAME
@@ -18,12 +18,16 @@
driver provides DV frame capture from AV/C tape devices attached via
IEEE 1394 (FireWire), including DV camcorders, VCRs, and DV converters.
.Pp
-The driver attaches to the
+The driver attaches to unit directories in the device CSR configuration ROM
+with
+.Va unit_spec_id
+0x00a02d (1394 Trade Association) and
+.Va unit_sw_version
+0x010001 (AV/C).
+When a matching device is present on the
.Xr firewire 4
-bus and creates
+bus, the driver creates
.Pa /dev/fwdvX
-at load time.
-When an AV/C device is connected, the driver automatically discovers it
and begins receiving IEC 61883 isochronous packets on first open,
assembling complete DV frames.
Applications read raw DV frames from the character device
diff --git a/sys/dev/firewire/fwdv.c b/sys/dev/firewire/fwdv.c
--- a/sys/dev/firewire/fwdv.c
+++ b/sys/dev/firewire/fwdv.c
@@ -54,12 +54,9 @@
printf("fwdv: " fmt, ## __VA_ARGS__); \
} while (0)
-static void fwdv_identify(driver_t *, device_t);
static int fwdv_probe(device_t);
static int fwdv_attach(device_t);
static int fwdv_detach(device_t);
-static void fwdv_post_busreset(void *);
-static void fwdv_post_explore(void *);
static void fwdv_probe_task(void *, int);
static int fwdv_avc_command(struct fwdv_softc *, const uint8_t *, int,
@@ -865,70 +862,6 @@
}
-static void
-fwdv_post_explore(void *arg)
-{
- struct fwdv_softc *sc = (struct fwdv_softc *)arg;
- struct fw_device *fwdev;
- int was_streaming;
-
- FWDV_LOCK(sc);
-
- if (sc->state == FWDV_STATE_DETACHING) {
- FWDV_UNLOCK(sc);
- return;
- }
-
- if (sc->fwdev != NULL) {
- STAILQ_FOREACH(fwdev, &sc->fd.fc->devices, link) {
- if (fwdev == sc->fwdev &&
- fwdev->status == FWDEVATTACHED)
- break;
- }
- if (fwdev == NULL) {
- was_streaming = (sc->state == FWDV_STATE_STREAMING);
- device_printf(sc->fd.dev, "AV/C device disconnected%s\n",
- was_streaming ? " (was streaming)" : "");
- sc->fwdev = NULL;
- sc->state = FWDV_STATE_IDLE;
- wakeup(sc);
- selwakeup(&sc->rsel);
- FWDV_UNLOCK(sc);
- if (was_streaming)
- fwdv_iso_stop(sc);
- FWDV_LOCK(sc);
- }
- }
-
- if (sc->fwdev == NULL) {
- STAILQ_FOREACH(fwdev, &sc->fd.fc->devices, link) {
- if (fwdev->status != FWDEVATTACHED)
- continue;
-
- if (!crom_has_specver(fwdev->csrrom,
- CSRVAL_1394TA, CSR_PROTAVC))
- continue;
-
- sc->fwdev = fwdev;
- sc->eui_hi = fwdev->eui.hi;
- sc->eui_lo = fwdev->eui.lo;
-
- FWDV_UNLOCK(sc);
-
- if (taskqueue_enqueue(taskqueue_thread,
- &sc->probe_task) != 0) {
- device_printf(sc->fd.dev,
- "probe task enqueue failed\n");
- FWDV_LOCK(sc);
- sc->fwdev = NULL;
- FWDV_UNLOCK(sc);
- }
- return;
- }
- }
-
- FWDV_UNLOCK(sc);
-}
static void
fwdv_probe_task(void *arg, int pending __unused)
@@ -963,26 +896,24 @@
fwdv_iso_start(sc);
}
-static void
-fwdv_post_busreset(void *arg __unused)
-{
-}
-
-static void
-fwdv_identify(driver_t *driver, device_t parent)
-{
-
- if (device_find_child(parent, "fwdv", DEVICE_UNIT_ANY) == NULL)
- BUS_ADD_CHILD(parent, 0, "fwdv", DEVICE_UNIT_ANY);
-}
static int
fwdv_probe(device_t dev)
{
+ struct fw_unit *unit;
+
+ unit = fw_get_unit(dev);
+ if (unit == NULL)
+ return (ENXIO);
+
+ if (unit->spec_id != CSRVAL_1394TA)
+ return (ENXIO);
+ if (unit->sw_version != CSR_PROTAVC)
+ return (ENXIO);
device_set_desc(dev, "AV/C DV Capture over FireWire");
- return (0);
+ return (BUS_PROBE_DEFAULT);
}
static int
@@ -990,15 +921,26 @@
{
struct fwdv_softc *sc;
struct firewire_comm *fc;
+ struct fw_unit *unit;
+ struct fw_device *fwdev;
int err;
+ unit = fw_get_unit(dev);
+ if (unit == NULL)
+ return (ENXIO);
+ fwdev = unit->fwdev;
+ if (fwdev == NULL)
+ return (ENXIO);
+
sc = device_get_softc(dev);
sc->fd.dev = dev;
- sc->fd.fc = device_get_ivars(dev);
+ sc->fd.fc = fw_get_comm(dev);
fc = sc->fd.fc;
mtx_init(&sc->mtx, "fwdv", NULL, MTX_DEF);
- sc->fwdev = NULL;
+ sc->fwdev = fwdev;
+ sc->eui_hi = fwdev->eui.hi;
+ sc->eui_lo = fwdev->eui.lo;
sc->state = FWDV_STATE_IDLE;
sc->dma_ch = -1;
sc->open_count = 0;
@@ -1044,10 +986,8 @@
return (err);
}
- sc->fd.post_busreset = fwdv_post_busreset;
- sc->fd.post_explore = fwdv_post_explore;
-
- fwdv_post_explore(sc);
+ if (taskqueue_enqueue(taskqueue_thread, &sc->probe_task) != 0)
+ device_printf(dev, "probe task enqueue failed\n");
return (0);
}
@@ -1083,7 +1023,6 @@
}
static device_method_t fwdv_methods[] = {
- DEVMETHOD(device_identify, fwdv_identify),
DEVMETHOD(device_probe, fwdv_probe),
DEVMETHOD(device_attach, fwdv_attach),
DEVMETHOD(device_detach, fwdv_detach),

File Metadata

Mime Type
text/plain
Expires
Fri, Jul 17, 8:12 PM (21 h, 2 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
35147559
Default Alt Text
D58204.diff (4 KB)

Event Timeline