diff options
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/firewire/firewire.h | 24 | ||||
-rw-r--r-- | sys/dev/firewire/firewirereg.h | 2 | ||||
-rw-r--r-- | sys/dev/firewire/fwdev.c | 30 | ||||
-rw-r--r-- | sys/dev/firewire/fwohci.c | 19 | ||||
-rw-r--r-- | sys/dev/firewire/if_fwe.c | 15 |
5 files changed, 50 insertions, 40 deletions
diff --git a/sys/dev/firewire/firewire.h b/sys/dev/firewire/firewire.h index 6ac583c..e07dfd7 100644 --- a/sys/dev/firewire/firewire.h +++ b/sys/dev/firewire/firewire.h @@ -310,6 +310,11 @@ struct fw_pkt { struct fw_eui64 { u_int32_t hi, lo; }; +#define FW_EUI64_BYTE(eui, x) \ + ((((x)<4)? \ + ((eui)->hi >> (8*(3-(x)))): \ + ((eui)->lo >> (8*(7-(x)))) \ + ) & 0xff) struct fw_asyreq { struct fw_asyreq_t{ @@ -328,11 +333,17 @@ struct fw_asyreq { u_int32_t data[512]; }; +struct fw_devinfo { + struct fw_eui64 eui; + u_int16_t dst; + u_int16_t status; +}; + +#define FW_MAX_DEVLST 70 struct fw_devlstreq { - int n; - struct fw_eui64 eui[64]; - u_int16_t dst[64]; - u_int16_t status[64]; + u_int16_t n; + u_int16_t info_len; + struct fw_devinfo dev[FW_MAX_DEVLST]; }; #define FW_SELF_ID_PORT_CONNECTED_TO_CHILD 3 @@ -430,11 +441,6 @@ struct fw_speed_map { u_int8_t speed[64][64]; }; -struct fw_map_buf { - int len; - void *ptr; -}; - struct fw_crom_buf { struct fw_eui64 eui; int len; diff --git a/sys/dev/firewire/firewirereg.h b/sys/dev/firewire/firewirereg.h index 05f6d3e..a2c994e 100644 --- a/sys/dev/firewire/firewirereg.h +++ b/sys/dev/firewire/firewirereg.h @@ -135,7 +135,7 @@ struct firewire_comm{ #define FWBUSEXPDONE 7 #define FWBUSCOMPLETION 10 int nisodma; - u_int8_t eui[8]; + struct fw_eui64 eui; STAILQ_HEAD(fw_queue, fw_xfer); struct fw_xferq *arq, *atq, *ars, *ats, *it[FW_MAX_DMACH],*ir[FW_MAX_DMACH]; diff --git a/sys/dev/firewire/fwdev.c b/sys/dev/firewire/fwdev.c index d096ba1..7233f35 100644 --- a/sys/dev/firewire/fwdev.c +++ b/sys/dev/firewire/fwdev.c @@ -531,15 +531,13 @@ fw_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, fw_proc *td) struct fw_xferq *ir, *it; struct fw_xfer *xfer; struct fw_pkt *fp; + struct fw_devinfo *devinfo; struct fw_devlstreq *fwdevlst = (struct fw_devlstreq *)data; struct fw_asyreq *asyreq = (struct fw_asyreq *)data; struct fw_isochreq *ichreq = (struct fw_isochreq *)data; struct fw_isobufreq *ibufreq = (struct fw_isobufreq *)data; struct fw_asybindreq *bindreq = (struct fw_asybindreq *)data; -#if 0 - struct fw_map_buf *map_buf = (struct fw_map_buf *)data; -#endif struct fw_crom_buf *crom_buf = (struct fw_crom_buf *)data; if (DEV_FWMEM(dev)) @@ -842,19 +840,27 @@ error: err = fw_bindadd(sc->fc, fwb); break; case FW_GDEVLST: - i = 0; - for(fwdev = TAILQ_FIRST(&sc->fc->devices); fwdev != NULL; - fwdev = TAILQ_NEXT(fwdev, link)){ - if(i < fwdevlst->n){ - fwdevlst->dst[i] = fwdev->dst; - fwdevlst->status[i] = - (fwdev->status == FWDEVATTACHED)?1:0; - fwdevlst->eui[i].hi = fwdev->eui.hi; - fwdevlst->eui[i].lo = fwdev->eui.lo; + i = len = 1; + /* myself */ + devinfo = &fwdevlst->dev[0]; + devinfo->dst = sc->fc->nodeid; + devinfo->status = 0; /* XXX */ + devinfo->eui.hi = sc->fc->eui.hi; + devinfo->eui.lo = sc->fc->eui.lo; + for (fwdev = TAILQ_FIRST(&sc->fc->devices); fwdev != NULL; + fwdev = TAILQ_NEXT(fwdev, link)) { + if(len < FW_MAX_DEVLST){ + devinfo = &fwdevlst->dev[len++]; + devinfo->dst = fwdev->dst; + devinfo->status = + (fwdev->status == FWDEVINVAL)?0:1; + devinfo->eui.hi = fwdev->eui.hi; + devinfo->eui.lo = fwdev->eui.lo; } i++; } fwdevlst->n = i; + fwdevlst->info_len = len; break; case FW_GTPMAP: bcopy(sc->fc->topology_map, data, diff --git a/sys/dev/firewire/fwohci.c b/sys/dev/firewire/fwohci.c index 94f763d..ea6e3d2 100644 --- a/sys/dev/firewire/fwohci.c +++ b/sys/dev/firewire/fwohci.c @@ -579,6 +579,7 @@ fwohci_init(struct fwohci_softc *sc, device_t dev) { int i; u_int32_t reg; + u_int8_t ui[8]; reg = OREAD(sc, OHCI_VERSION); device_printf(dev, "OHCI version %x.%x (ROM=%d)\n", @@ -682,19 +683,13 @@ fwohci_init(struct fwohci_softc *sc, device_t dev) if ((sc->atrs.flags & FWOHCI_DBCH_INIT) == 0) return ENOMEM; - reg = OREAD(sc, FWOHCIGUID_H); - for( i = 0 ; i < 4 ; i ++){ - sc->fc.eui[3 - i] = reg & 0xff; - reg = reg >> 8; - } - reg = OREAD(sc, FWOHCIGUID_L); - for( i = 0 ; i < 4 ; i ++){ - sc->fc.eui[7 - i] = reg & 0xff; - reg = reg >> 8; - } + sc->fc.eui.hi = OREAD(sc, FWOHCIGUID_H); + sc->fc.eui.lo = OREAD(sc, FWOHCIGUID_L); + for( i = 0 ; i < 8 ; i ++) + ui[i] = FW_EUI64_BYTE(&sc->fc.eui,i); device_printf(dev, "EUI64 %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n", - sc->fc.eui[0], sc->fc.eui[1], sc->fc.eui[2], sc->fc.eui[3], - sc->fc.eui[4], sc->fc.eui[5], sc->fc.eui[6], sc->fc.eui[7]); + ui[0], ui[1], ui[2], ui[3], ui[4], ui[5], ui[6], ui[7]); + sc->fc.ioctl = fwohci_ioctl; sc->fc.cyctimer = fwohci_cyctimer; sc->fc.set_bmr = fwohci_set_bus_manager; diff --git a/sys/dev/firewire/if_fwe.c b/sys/dev/firewire/if_fwe.c index 5c77705..6565807 100644 --- a/sys/dev/firewire/if_fwe.c +++ b/sys/dev/firewire/if_fwe.c @@ -146,6 +146,7 @@ fwe_attach(device_t dev) struct ifnet *ifp; int unit, s; u_char *eaddr; + struct fw_eui64 *eui; fwe = ((struct fwe_softc *)device_get_softc(dev)); unit = device_get_unit(dev); @@ -168,12 +169,14 @@ fwe_attach(device_t dev) #define LOCAL (0x02) #define GROUP (0x01) eaddr = &fwe->eth_softc.arpcom.ac_enaddr[0]; - eaddr[0] = (fwe->fd.fc->eui[0] | LOCAL) & ~GROUP; - eaddr[1] = fwe->fd.fc->eui[1]; - eaddr[2] = fwe->fd.fc->eui[2]; - eaddr[3] = fwe->fd.fc->eui[5]; - eaddr[4] = fwe->fd.fc->eui[6]; - eaddr[5] = fwe->fd.fc->eui[7]; + + eui = &fwe->fd.fc->eui; + eaddr[0] = (FW_EUI64_BYTE(eui, 0) | LOCAL) & ~GROUP; + eaddr[1] = FW_EUI64_BYTE(eui, 1); + eaddr[2] = FW_EUI64_BYTE(eui, 2); + eaddr[3] = FW_EUI64_BYTE(eui, 5); + eaddr[4] = FW_EUI64_BYTE(eui, 6); + eaddr[5] = FW_EUI64_BYTE(eui, 7); printf("if_fwe%d: Fake Ethernet address: " "%02x:%02x:%02x:%02x:%02x:%02x\n", unit, eaddr[0], eaddr[1], eaddr[2], eaddr[3], eaddr[4], eaddr[5]); |