Index: dev/fd.c =================================================================== RCS file: /cvsroot/src/sys/arch/x68k/dev/fd.c,v retrieving revision 1.96 diff -u -p -r1.96 fd.c --- dev/fd.c 2 Feb 2012 19:43:01 -0000 1.96 +++ dev/fd.c 4 May 2012 17:53:58 -0000 @@ -103,6 +103,8 @@ __KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.96 #include "locators.h" +#define FD_NO_RDYINTR + #ifdef FDDEBUG #define DPRINTF(x) if (fddebug) printf x int fddebug = 0; @@ -148,6 +150,7 @@ struct fdc_softc { u_int8_t *sc_addr; /* physical address */ struct dmac_channel_stat *sc_dmachan; /* intio DMA channel */ struct dmac_dma_xfer *sc_xfer; /* DMA transfer */ + int sc_read; struct fd_softc *sc_fd[4]; /* pointers to children */ TAILQ_HEAD(drivehead, fd_softc) sc_drives; @@ -209,7 +212,7 @@ struct fd_softc { struct fd_type *sc_deftype; /* default type descriptor */ struct fd_type *sc_type; /* current type descriptor */ -#if 0 /* see comments in fd_motor_on() */ +#ifdef FD_NO_RDYINTR /* see comments in fd_motor_on() */ struct callout sc_motoron_ch; #endif struct callout sc_motoroff_ch; @@ -275,7 +278,7 @@ struct dkdriver fddkdriver = { fdstrateg void fd_set_motor(struct fdc_softc *, int); void fd_motor_off(void *); -#if 0 +#ifdef FD_NO_RDYINTR void fd_motor_on(void *); #endif int fdcresult(struct fdc_softc *); @@ -322,8 +325,9 @@ fdc_dmastart(struct fdc_softc *fdc, int (DMAC_SCR_MAC_COUNT_UP| DMAC_SCR_DAC_NO_COUNT), (u_int8_t*) (fdc->sc_addr + - fddata)); /* XXX */ + fddata*2+1)); /* XXX */ + fdc->sc_read = read; dmac_start_xfer(fdc->sc_dmachan->ch_softc, fdc->sc_xfer); } @@ -332,6 +336,10 @@ fdcdmaintr(void *arg) { struct fdc_softc *fdc = arg; + bus_dmamap_sync(fdc->sc_dmat, fdc->sc_dmamap, + 0, fdc->sc_dmamap->dm_mapsize, + fdc->sc_read ? + BUS_DMASYNC_POSTREAD : BUS_DMASYNC_POSTWRITE); bus_dmamap_unload(fdc->sc_dmat, fdc->sc_dmamap); return 0; @@ -464,6 +472,10 @@ fdcattach(device_t parent, device_t self void fdcreset(struct fdc_softc *fdc) { +#ifdef FD_NO_RDYINTR + out_fdc(fdc->sc_iot, fdc->sc_ioh, NE7CMD_SENSEI); + (void)fdcresult(fdc); +#endif bus_space_write_1(fdc->sc_iot, fdc->sc_ioh, fdsts, NE7CMD_RESET); } @@ -513,6 +525,7 @@ retry: out_fdc(iot, ioh, drive); i = 25000; +#ifndef FD_NO_RDYINTR while (--i > 0) { if ((intio_get_sicilian_intr() & SICILIAN_STAT_FDC)) { out_fdc(iot, ioh, NE7CMD_SENSEI); @@ -521,6 +534,10 @@ retry: } DELAY(100); } +#else + out_fdc(iot, ioh, NE7CMD_SENSEI); + n = fdcresult(fdc); +#endif #ifdef FDDEBUG { @@ -563,7 +580,7 @@ fdattach(device_t parent, device_t self, struct fd_type *type = &fd_types[0]; /* XXX 1.2MB */ int drive = fa->fa_drive; -#if 0 +#ifdef FD_NO_RDYINTR callout_init(&fd->sc_motoron_ch, 0); #endif callout_init(&fd->sc_motoroff_ch, 0); @@ -785,7 +802,8 @@ fd_motor_off(void *arg) splx(s); } -#if 0 /* on x68k motor on triggers interrupts by state change of ready line. */ +#ifdef FD_NO_RDYINTR +/* on x68k motor on triggers interrupts by state change of ready line. */ void fd_motor_on(void *arg) { @@ -999,7 +1017,7 @@ fdctimeout(void *arg) splx(s); } -#if 0 +#ifdef FD_NO_RDYINTR void fdcpseudointr(void *arg) { @@ -1081,7 +1099,7 @@ loop: fd->sc_flags |= FD_MOTOR | FD_MOTOR_WAIT; fd_set_motor(fdc, 0); fdc->sc_state = MOTORWAIT; -#if 0 /* no need to callout on x68k; motor on will trigger interrupts */ +#ifdef FD_NO_RDYINTR /* no need to callout on x68k; motor on will trigger interrupts */ /* allow .5s for motor to stabilize */ callout_reset(&fd->sc_motoron_ch, hz / 2, fd_motor_on, fd); @@ -1289,7 +1307,7 @@ loop: callout_stop(&fdc->sc_timo_ch); fdc->sc_state = SEEKCOMPLETE; /* allow 1/50 second for heads to settle */ -#if 0 +#ifdef FD_NO_RDYINTR callout_reset(&fdc->sc_intr_ch, hz / 50, fdcpseudointr, fdc); #endif return 1; @@ -1300,6 +1318,7 @@ loop: bus_space_read_1(fdc->sc_iot, fdc->sc_ioh, fdsts))); out_fdc(iot, ioh, NE7CMD_SENSEI); tmp = fdcresult(fdc); +#ifndef FD_NO_RDYINTR if ((st0 & 0xf8) == 0xc0) { DPRINTF(("fdcintr: first seek!\n")); fdc->sc_state = DORECAL; @@ -1313,6 +1332,7 @@ loop: fdcretry(fdc); goto loop; } +#endif fd->sc_cylin = bp->b_cylinder; goto doio; @@ -1414,7 +1434,7 @@ loop: callout_stop(&fdc->sc_timo_ch); fdc->sc_state = RECALCOMPLETE; /* allow 1/30 second for heads to settle */ -#if 0 +#ifdef FD_NO_RDYINTR callout_reset(&fdc->sc_intr_ch, hz / 30, fdcpseudointr, fdc); #endif return 1; /* will return later */ @@ -1423,6 +1443,7 @@ loop: DPRINTF(("fdcintr: in RECALCOMPLETE\n")); out_fdc(iot, ioh, NE7CMD_SENSEI); tmp = fdcresult(fdc); +#ifndef FD_NO_RDYINTR if ((st0 & 0xf8) == 0xc0) { DPRINTF(("fdcintr: first seek!\n")); fdc->sc_state = DORECAL; @@ -1434,6 +1455,7 @@ loop: fdcretry(fdc); goto loop; } +#endif fd->sc_cylin = 0; goto doseek; @@ -1446,12 +1468,14 @@ loop: KASSERT(fd->sc_flags & FD_MOTOR_WAIT); out_fdc(iot, ioh, NE7CMD_SENSEI); tmp = fdcresult(fdc); +#ifndef FD_NO_RDYINTR if (tmp != 2 || (st0 & 0xc0) != 0xc0 /* ready changed */) { printf("%s: unexpected interrupt during MOTORWAIT", device_xname(fd->sc_dev)); fdcpstatus(7, fdc); return 1; } +#endif fd->sc_flags &= ~FD_MOTOR_WAIT; #endif goto doseek; Index: x68k/machdep.c =================================================================== RCS file: /cvsroot/src/sys/arch/x68k/x68k/machdep.c,v retrieving revision 1.181 diff -u -p -r1.181 machdep.c --- x68k/machdep.c 29 Jan 2012 12:43:00 -0000 1.181 +++ x68k/machdep.c 4 May 2012 17:53:59 -0000 @@ -174,6 +174,7 @@ void x68k_init(void) { u_int i; + paddr_t msgbuf_pa; /* * Tell the VM system about available physical memory. @@ -181,6 +182,8 @@ x68k_init(void) uvm_page_physload(atop(avail_start), atop(avail_end), atop(avail_start), atop(avail_end), VM_FREELIST_MAINMEM); + msgbuf_pa = avail_end; + #ifdef EXTENDED_MEMORY setmemrange(); #endif @@ -191,7 +194,7 @@ x68k_init(void) */ for (i = 0; i < btoc(MSGBUFSIZE); i++) pmap_kenter_pa((vaddr_t)msgbufaddr + i * PAGE_SIZE, - avail_end + i * PAGE_SIZE, VM_PROT_READ|VM_PROT_WRITE, 0); + msgbuf_pa + i * PAGE_SIZE, VM_PROT_READ|VM_PROT_WRITE, 0); pmap_update(pmap_kernel()); initmsgbuf(msgbufaddr, m68k_round_page(MSGBUFSIZE)); } @@ -1146,6 +1149,8 @@ setmemrange(void) atop(mlist[i].base), atop(h), VM_FREELIST_HIGHMEM); mem_size += h - (u_long) mlist[i].base; + if (avail_end < h) + avail_end = h; } }