[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: iBook: dump/restore does not make it either
>ものは試しに DMA transfer を無効にして(flags を 0x0 にして)
>カーネルを作って再起動して,
>もう一度大量の tarballs を展開して fsck -f かけたら,
>これまでのような現象は全く起こらなくなりました(^^;;;).
あ、よそーどーり。:-)
↓これで動いたらハードウェアのバグです。
*** wdc_obio.c~ Mon Jul 3 02:01:27 2000
--- wdc_obio.c Thu Sep 7 15:43:38 2000
***************
*** 293,298 ****
--- 293,318 ----
return 0;
}
+ void
+ flushcache(from, len)
+ void *from;
+ int len;
+ {
+ int l, off;
+ char *p;
+
+ off = (u_int)from & (CACHELINESIZE - 1);
+ l = len += off;
+ p = (char *)from - off;
+ do {
+ __asm__ __volatile ("dcbst 0,%0" :: "r"(p));
+ __asm__ __volatile ("sync; isync");
+ __asm__ __volatile ("dcbi 0,%0" :: "r"(p));
+ p += CACHELINESIZE;
+ } while ((l -= CACHELINESIZE) > 0);
+ __asm__ __volatile ("sync");
+ }
+
int
wdc_obio_dma_init(v, channel, drive, databuf, datalen, read)
void *v;
***************
*** 315,320 ****
--- 335,341 ----
int rest = NBPG - offset; /* the rest of the page */
if (datalen > rest) { /* if continues to next page */
+ flushcache(va, rest);
DBDMA_BUILD(cmdp, cmd, 0, rest, vtophys(va),
DBDMA_INT_NEVER, DBDMA_WAIT_NEVER,
DBDMA_BRANCH_NEVER);
***************
*** 326,331 ****
--- 347,353 ----
/* now va is page-aligned */
while (datalen > NBPG) {
+ flushcache(va, NBPG);
DBDMA_BUILD(cmdp, cmd, 0, NBPG, vtophys(va),
DBDMA_INT_NEVER, DBDMA_WAIT_NEVER, DBDMA_BRANCH_NEVER);
datalen -= NBPG;
***************
*** 334,339 ****
--- 356,362 ----
}
/* the last page (datalen <= NBPG here) */
+ flushcache(va, datalen);
cmd = read ? DBDMA_CMD_IN_LAST : DBDMA_CMD_OUT_LAST;
DBDMA_BUILD(cmdp, cmd, 0, datalen, vtophys(va),
DBDMA_INT_NEVER, DBDMA_WAIT_NEVER, DBDMA_BRANCH_NEVER);