Add new ioctl to specify target EUI64 for fwmem.
This commit is contained in:
parent
d85be48243
commit
233b1b978b
@ -150,14 +150,14 @@ fw_noderesolve_nodeid(struct firewire_comm *fc, int dst)
|
||||
* Lookup fwdev by EUI64.
|
||||
*/
|
||||
struct fw_device *
|
||||
fw_noderesolve_eui64(struct firewire_comm *fc, struct fw_eui64 eui)
|
||||
fw_noderesolve_eui64(struct firewire_comm *fc, struct fw_eui64 *eui)
|
||||
{
|
||||
struct fw_device *fwdev;
|
||||
int s;
|
||||
|
||||
s = splfw();
|
||||
STAILQ_FOREACH(fwdev, &fc->devices, link)
|
||||
if (FW_EUI64_EQUAL(fwdev->eui, eui))
|
||||
if (FW_EUI64_EQUAL(fwdev->eui, *eui))
|
||||
break;
|
||||
splx(s);
|
||||
|
||||
|
@ -471,6 +471,9 @@ struct fw_crom_buf {
|
||||
#define FW_GTPMAP _IOR('S', 5, struct fw_topology_map)
|
||||
#define FW_GCROM _IOWR('S', 7, struct fw_crom_buf)
|
||||
|
||||
#define FW_SDEUI64 _IOW('S', 20, struct fw_eui64)
|
||||
#define FW_GDEUI64 _IOR('S', 21, struct fw_eui64)
|
||||
|
||||
#define FWOHCI_RDREG _IOWR('S', 80, struct fw_reg_req_t)
|
||||
#define FWOHCI_WRREG _IOWR('S', 81, struct fw_reg_req_t)
|
||||
|
||||
|
@ -324,7 +324,7 @@ void fw_xfer_timeout __P((void *));
|
||||
void fw_xfer_done __P((struct fw_xfer *));
|
||||
void fw_asy_callback __P((struct fw_xfer *));
|
||||
struct fw_device *fw_noderesolve_nodeid __P((struct firewire_comm *, int));
|
||||
struct fw_device *fw_noderesolve_eui64 __P((struct firewire_comm *, struct fw_eui64));
|
||||
struct fw_device *fw_noderesolve_eui64 __P((struct firewire_comm *, struct fw_eui64 *));
|
||||
struct fw_bind *fw_bindlookup __P((struct firewire_comm *, u_int32_t, u_int32_t));
|
||||
|
||||
|
||||
|
@ -746,7 +746,7 @@ fw_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, fw_proc *td)
|
||||
break;
|
||||
case FWASREQEUI:
|
||||
fwdev = fw_noderesolve_eui64(sc->fc,
|
||||
asyreq->req.dst.eui);
|
||||
&asyreq->req.dst.eui);
|
||||
if (fwdev == NULL) {
|
||||
device_printf(sc->fc->bdev,
|
||||
"cannot find node\n");
|
||||
|
@ -61,7 +61,7 @@ SYSCTL_NODE(_hw_firewire, OID_AUTO, fwmem, CTLFLAG_RD, 0,
|
||||
"FireWire Memory Access");
|
||||
SYSCTL_UINT(_hw_firewire_fwmem, OID_AUTO, eui64_hi, CTLFLAG_RW,
|
||||
&fwmem_eui64.hi, 0, "Fwmem target EUI64 high");
|
||||
SYSCTL_UINT(_hw_firewire_fwmem, OID_AUTO, eui64_low, CTLFLAG_RW,
|
||||
SYSCTL_UINT(_hw_firewire_fwmem, OID_AUTO, eui64_lo, CTLFLAG_RW,
|
||||
&fwmem_eui64.lo, 0, "Fwmem target EUI64 low");
|
||||
SYSCTL_INT(_hw_firewire_fwmem, OID_AUTO, speed, CTLFLAG_RW, &fwmem_speed, 0,
|
||||
"Fwmem link speed");
|
||||
@ -250,15 +250,22 @@ fwmem_write_block(
|
||||
int
|
||||
fwmem_open (dev_t dev, int flags, int fmt, fw_proc *td)
|
||||
{
|
||||
int err = 0;
|
||||
return err;
|
||||
struct fw_eui64 *eui;
|
||||
|
||||
eui = (struct fw_eui64 *)malloc(sizeof(struct fw_eui64), M_FW, 0);
|
||||
if (eui == NULL)
|
||||
return ENOMEM;
|
||||
bcopy(&fwmem_eui64, eui, sizeof(struct fw_eui64));
|
||||
dev->si_drv1 = (void *)eui;
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
fwmem_close (dev_t dev, int flags, int fmt, fw_proc *td)
|
||||
{
|
||||
int err = 0;
|
||||
return err;
|
||||
free(dev->si_drv1, M_FW);
|
||||
return (0);
|
||||
}
|
||||
|
||||
#define MAXLEN 2048
|
||||
@ -277,7 +284,7 @@ fwmem_read (dev_t dev, struct uio *uio, int ioflag)
|
||||
int len;
|
||||
|
||||
sc = devclass_get_softc(firewire_devclass, unit);
|
||||
fwdev = fw_noderesolve_eui64(sc->fc, fwmem_eui64);
|
||||
fwdev = fw_noderesolve_eui64(sc->fc, (struct fw_eui64 *)dev->si_drv1);
|
||||
if (fwdev == NULL) {
|
||||
if (fwmem_debug)
|
||||
printf("fwmem: no such device ID:%08x%08x\n",
|
||||
@ -340,7 +347,7 @@ fwmem_write (dev_t dev, struct uio *uio, int ioflag)
|
||||
int len;
|
||||
|
||||
sc = devclass_get_softc(firewire_devclass, unit);
|
||||
fwdev = fw_noderesolve_eui64(sc->fc, fwmem_eui64);
|
||||
fwdev = fw_noderesolve_eui64(sc->fc, (struct fw_eui64 *)dev->si_drv1);
|
||||
if (fwdev == NULL) {
|
||||
if (fwmem_debug)
|
||||
printf("fwmem: no such device ID:%08x%08x\n",
|
||||
@ -393,7 +400,18 @@ fwmem_write (dev_t dev, struct uio *uio, int ioflag)
|
||||
int
|
||||
fwmem_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, fw_proc *td)
|
||||
{
|
||||
return EINVAL;
|
||||
int err = 0;
|
||||
switch (cmd) {
|
||||
case FW_SDEUI64:
|
||||
bcopy(data, dev->si_drv1, sizeof(struct fw_eui64));
|
||||
break;
|
||||
case FW_GDEUI64:
|
||||
bcopy(dev->si_drv1, data, sizeof(struct fw_eui64));
|
||||
break;
|
||||
default:
|
||||
err = EINVAL;
|
||||
}
|
||||
return(err);
|
||||
}
|
||||
int
|
||||
fwmem_poll (dev_t dev, int events, fw_proc *td)
|
||||
|
Loading…
x
Reference in New Issue
Block a user