[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: iBook: dump/restore does not make it either
よく考えたらもうちょっと簡単になりました。
やってることは同じです。
*** sys/arch/macppc/dev/wdc_obio.c Mon Jul 3 02:01:27 2000
--- sys/arch/macppc/dev/wdc_obio.c Thu Sep 7 18:42:19 2000
***************
*** 79,84 ****
--- 79,85 ----
void wdc_obio_dma_start __P((void *, int, int));
int wdc_obio_dma_finish __P((void *, int, int, int));
static void adjust_timing __P((struct channel_softc *));
+ static void flushcache __P((vaddr_t, int));
struct cfattach wdc_obio_ca = {
sizeof(struct wdc_obio_softc), wdc_obio_probe, wdc_obio_attach,
***************
*** 293,298 ****
--- 294,316 ----
return 0;
}
+ static __inline void
+ flushcache(addr, len)
+ vaddr_t addr;
+ int len;
+ {
+ int off = addr & (CACHELINESIZE - 1);
+
+ addr -= off;
+ len += off;
+ while (len > 0) {
+ asm volatile ("dcbf 0,%0" :: "r"(addr));
+ addr += CACHELINESIZE;
+ len -= CACHELINESIZE;
+ }
+ asm volatile ("sync");
+ }
+
int
wdc_obio_dma_init(v, channel, drive, databuf, datalen, read)
void *v;
***************
*** 309,314 ****
--- 327,334 ----
cmd = read ? DBDMA_CMD_IN_MORE : DBDMA_CMD_OUT_MORE;
offset = va & PGOFSET;
+
+ flushcache(va, datalen);
/* if va is not page-aligned, setup the first page */
if (offset != 0) {