[Fwd: Re: firewire issue]
Andreas Tobler
andreast-list at fgznet.ch
Mon Oct 26 20:04:50 UTC 2009
Fabio,
I do not know what the issue is.
Sean Bruno wrote:
> Look over this patch from Andreas. I haven't done anything with it as I
> don't have the h/w to test with.
Please use the attached diff instead, it might bring you a bit further.
It is still not the final thing, but I did not have the time to follow
up here. Busy with other stuff.
The patch forwared from Sean is a bit old.
Regards,
Andreas
-------------- next part --------------
Index: sys/dev/firewire/fwohci_pci.c
===================================================================
--- sys/dev/firewire/fwohci_pci.c (revision 198452)
+++ sys/dev/firewire/fwohci_pci.c (working copy)
@@ -196,6 +196,10 @@
device_set_desc(dev, "Apple UniNorth");
return BUS_PROBE_DEFAULT;
}
+ if (id == (FW_VENDORID_APPLE | FW_DEVICE_UNINORTH_V1)) {
+ device_set_desc(dev, "Apple UniNorth, v1");
+ return BUS_PROBE_DEFAULT;
+ }
if (id == (FW_VENDORID_LUCENT | FW_DEVICE_FW322)) {
device_set_desc(dev, "Lucent FW322/323");
return BUS_PROBE_DEFAULT;
@@ -285,6 +289,10 @@
fwohci_softc_t *sc = device_get_softc(self);
int err;
int rid;
+ uint32_t id;
+
+ sc->old_uninorth = 0;
+
#if defined(__DragonFly__) || __FreeBSD_version < 500000
int intr;
/* For the moment, put in a message stating what is wrong */
@@ -383,6 +391,12 @@
return (ENOMEM);
}
+ id = pci_get_devid(self);
+ if (id == (FW_VENDORID_APPLE | FW_DEVICE_UNINORTH_V1)) {
+ sc->old_uninorth = 1;
+ device_printf(self, "Uninorth V1\n");
+ }
+
err = fwohci_init(sc, self);
if (err) {
Index: sys/dev/firewire/fwohci.c
===================================================================
--- sys/dev/firewire/fwohci.c (revision 198452)
+++ sys/dev/firewire/fwohci.c (working copy)
@@ -79,6 +79,7 @@
#undef OHCI_DEBUG
static int nocyclemaster = 0;
+static int old_uninorth = 0;
int firewire_phydma_enable = 1;
SYSCTL_DECL(_hw_firewire);
SYSCTL_INT(_hw_firewire, OID_AUTO, nocyclemaster, CTLFLAG_RW, &nocyclemaster, 0,
@@ -266,6 +267,15 @@
d_ioctl_t fwohci_ioctl;
+#if BYTE_ORDER == BIG_ENDIAN
+#define FWOHCI_DMA_READ_UNI(x) \
+ old_uninorth ? (x) : FWOHCI_DMA_READ(x)
+#define FWOHCI_DMA_WRITE_UNI(x,y) \
+ old_uninorth ? ((x) = (y)) : FWOHCI_DMA_WRITE(x,y)
+#else
+#define FWOHCI_DMA_READ_UNI(x) FWOHCI_DMA_READ(x)
+#define FWOHCI_DMA_WRITE_UNI(x,y) FWOHCI_DMA_WRITE(x,y)
+#endif
/*
* Communication with PHY device
*/
@@ -624,6 +634,8 @@
return (ENXIO);
}
+ old_uninorth = sc->old_uninorth;
+
/* Available Isochronous DMA channel probe */
OWRITE(sc, OHCI_IT_MASK, 0xffffffff);
OWRITE(sc, OHCI_IR_MASK, 0xffffffff);
@@ -1811,7 +1823,7 @@
fwohci_dump_intr(struct fwohci_softc *sc, uint32_t stat)
{
if(stat & OREAD(sc, FWOHCI_INTMASK))
- device_printf(fc->dev, "INTERRUPT < %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s> 0x%08x, 0x%08x\n",
+ device_printf(sc->fc.dev, "INTERRUPT < %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s> 0x%08x, 0x%08x\n",
stat & OHCI_INT_EN ? "DMA_EN ":"",
stat & OHCI_INT_PHY_REG ? "PHY_REG ":"",
stat & OHCI_INT_CYC_LONG ? "CYC_LONG ":"",
@@ -1848,7 +1860,7 @@
fc->status = FWBUSRESET;
/* Disable bus reset interrupt until sid recv. */
OWRITE(sc, FWOHCI_INTMASKCLR, OHCI_INT_PHY_BUS_R);
-
+
device_printf(fc->dev, "%s: BUS reset\n", __func__);
OWRITE(sc, FWOHCI_INTMASKCLR, OHCI_INT_CYC_LOST);
OWRITE(sc, OHCI_LNKCTLCLR, OHCI_CNTL_CYCSRC);
@@ -2037,7 +2049,7 @@
return;
}
for (i = 0; i < plen / 4; i ++)
- buf[i] = FWOHCI_DMA_READ(sc->sid_buf[i+1]);
+ buf[i] = FWOHCI_DMA_READ_UNI(sc->sid_buf[i+1]);
/* pending all pre-bus_reset packets */
fwohci_txd(sc, &sc->atrq);
@@ -2068,6 +2080,7 @@
fwohci_check_stat(struct fwohci_softc *sc)
{
uint32_t stat, irstat, itstat;
+ static int sid_count;
FW_GLOCK_ASSERT(&sc->fc);
stat = OREAD(sc, FWOHCI_INTSTAT);
@@ -2076,8 +2089,14 @@
"device physically ejected?\n");
return (FILTER_STRAY);
}
- if (stat)
+
+ if (stat && old_uninorth && (sid_count < 5)) {
+ OWRITE(sc, FWOHCI_INTSTATCLR,
+ stat & ~(OHCI_INT_PHY_BUS_R | OHCI_INT_PHY_SID));
+ sid_count++;
+ } else {
OWRITE(sc, FWOHCI_INTSTATCLR, stat & ~OHCI_INT_PHY_BUS_R);
+ }
stat &= sc->intmask;
if (stat == 0)
@@ -2657,7 +2676,7 @@
int i;
#endif
- ld0 = FWOHCI_DMA_READ(fp->mode.ld[0]);
+ ld0 = FWOHCI_DMA_READ_UNI(fp->mode.ld[0]);
#if 0
printf("ld0: x%08x\n", ld0);
#endif
@@ -2690,7 +2709,7 @@
}
#if BYTE_ORDER == BIG_ENDIAN
for(i = 0; i < slen/4; i ++)
- fp->mode.ld[i] = FWOHCI_DMA_READ(fp->mode.ld[i]);
+ fp->mode.ld[i] = FWOHCI_DMA_READ_UNI(fp->mode.ld[i]);
#endif
return(hlen);
}
@@ -2884,7 +2903,7 @@
printf("nvec == 0\n");
/* DMA result-code will be written at the tail of packet */
- stat = FWOHCI_DMA_READ(*(uint32_t *)(ld - sizeof(struct fwohci_trailer)));
+ stat = FWOHCI_DMA_READ_UNI(*(uint32_t *)(ld - sizeof(struct fwohci_trailer)));
#if 0
printf("plen: %d, stat %x\n",
plen ,stat);
Index: sys/dev/firewire/fwohcireg.h
===================================================================
--- sys/dev/firewire/fwohcireg.h (revision 198452)
+++ sys/dev/firewire/fwohcireg.h (working copy)
@@ -73,6 +73,7 @@
#define FW_DEVICE_R5C552 (0x0552 << 16)
#define FW_DEVICE_PANGEA (0x0030 << 16)
#define FW_DEVICE_UNINORTH (0x0031 << 16)
+#define FW_DEVICE_UNINORTH_V1 (0x0018 << 16)
#define FW_DEVICE_AIC5800 (0x5800 << 16)
#define FW_DEVICE_FW322 (0x5811 << 16)
#define FW_DEVICE_7007 (0x7007 << 16)
Index: sys/dev/firewire/fwohcivar.h
===================================================================
--- sys/dev/firewire/fwohcivar.h (revision 198452)
+++ sys/dev/firewire/fwohcivar.h (working copy)
@@ -75,6 +75,7 @@
struct task fwohci_task_sid;
struct task fwohci_task_dma;
int cycle_lost;
+ int old_uninorth;
} fwohci_softc_t;
void fwohci_intr (void *arg);
More information about the freebsd-firewire
mailing list