Deleted Added
full compact
fdc.c (198857) fdc.c (199104)
1/*-
2 * Copyright (c) 2004 Poul-Henning Kamp
3 * Copyright (c) 1990 The Regents of the University of California.
4 * All rights reserved.
5 *
6 * This code is derived from software contributed to Berkeley by
7 * Don Ahn.
8 *

--- 37 unchanged lines hidden (view full) ---

46 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
47 * SUCH DAMAGE.
48 *
49 * from: @(#)fd.c 7.4 (Berkeley) 5/25/91
50 *
51 */
52
53#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2004 Poul-Henning Kamp
3 * Copyright (c) 1990 The Regents of the University of California.
4 * All rights reserved.
5 *
6 * This code is derived from software contributed to Berkeley by
7 * Don Ahn.
8 *

--- 37 unchanged lines hidden (view full) ---

46 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
47 * SUCH DAMAGE.
48 *
49 * from: @(#)fd.c 7.4 (Berkeley) 5/25/91
50 *
51 */
52
53#include <sys/cdefs.h>
54__FBSDID("$FreeBSD: head/sys/dev/fdc/fdc.c 198857 2009-11-03 19:05:05Z jh $");
54__FBSDID("$FreeBSD: head/sys/dev/fdc/fdc.c 199104 2009-11-09 20:29:10Z rdivacky $");
55
56#include "opt_fdc.h"
57
58#include <sys/param.h>
59#include <sys/bio.h>
60#include <sys/bus.h>
61#include <sys/devicestat.h>
62#include <sys/disk.h>

--- 713 unchanged lines hidden (view full) ---

776 fd->flags |= FD_EMPTY;
777 mtx_unlock(&fdc->fdc_mtx);
778 }
779 return (fdc_biodone(fdc, EIO));
780 }
781
782 /* Disable ISADMA if we bailed while it was active */
783 if (fd != NULL && (fd->flags & FD_ISADMA)) {
55
56#include "opt_fdc.h"
57
58#include <sys/param.h>
59#include <sys/bio.h>
60#include <sys/bus.h>
61#include <sys/devicestat.h>
62#include <sys/disk.h>

--- 713 unchanged lines hidden (view full) ---

776 fd->flags |= FD_EMPTY;
777 mtx_unlock(&fdc->fdc_mtx);
778 }
779 return (fdc_biodone(fdc, EIO));
780 }
781
782 /* Disable ISADMA if we bailed while it was active */
783 if (fd != NULL && (fd->flags & FD_ISADMA)) {
784 mtx_lock(&Giant);
785 isa_dmadone(
786 bp->bio_cmd & BIO_READ ? ISADMA_READ : ISADMA_WRITE,
787 fd->fd_ioptr, fd->fd_iosize, fdc->dmachan);
784 isa_dmadone(
785 bp->bio_cmd & BIO_READ ? ISADMA_READ : ISADMA_WRITE,
786 fd->fd_ioptr, fd->fd_iosize, fdc->dmachan);
788 mtx_unlock(&Giant);
789 mtx_lock(&fdc->fdc_mtx);
790 fd->flags &= ~FD_ISADMA;
791 mtx_unlock(&fdc->fdc_mtx);
792 }
793
794 /* Unwedge the controller ? */
795 if (fdc->flags & FDC_NEEDS_RESET) {
796 fdc->flags &= ~FDC_NEEDS_RESET;

--- 156 unchanged lines hidden (view full) ---

953 if (debugflags & 8)
954 printf("op %x bn %ju siz %u ptr %p retry %d\n",
955 bp->bio_cmd, bp->bio_pblkno, fd->fd_iosize,
956 fd->fd_ioptr, fdc->retry);
957
958 /* Setup ISADMA if we need it and have it */
959 if ((bp->bio_cmd & (BIO_READ|BIO_WRITE|BIO_FMT))
960 && !(fdc->flags & FDC_NODMA)) {
787 mtx_lock(&fdc->fdc_mtx);
788 fd->flags &= ~FD_ISADMA;
789 mtx_unlock(&fdc->fdc_mtx);
790 }
791
792 /* Unwedge the controller ? */
793 if (fdc->flags & FDC_NEEDS_RESET) {
794 fdc->flags &= ~FDC_NEEDS_RESET;

--- 156 unchanged lines hidden (view full) ---

951 if (debugflags & 8)
952 printf("op %x bn %ju siz %u ptr %p retry %d\n",
953 bp->bio_cmd, bp->bio_pblkno, fd->fd_iosize,
954 fd->fd_ioptr, fdc->retry);
955
956 /* Setup ISADMA if we need it and have it */
957 if ((bp->bio_cmd & (BIO_READ|BIO_WRITE|BIO_FMT))
958 && !(fdc->flags & FDC_NODMA)) {
961 mtx_lock(&Giant);
962 isa_dmastart(
963 bp->bio_cmd & BIO_READ ? ISADMA_READ : ISADMA_WRITE,
964 fd->fd_ioptr, fd->fd_iosize, fdc->dmachan);
959 isa_dmastart(
960 bp->bio_cmd & BIO_READ ? ISADMA_READ : ISADMA_WRITE,
961 fd->fd_ioptr, fd->fd_iosize, fdc->dmachan);
965 mtx_unlock(&Giant);
966 mtx_lock(&fdc->fdc_mtx);
967 fd->flags |= FD_ISADMA;
968 mtx_unlock(&fdc->fdc_mtx);
969 }
970
971 /* Do PIO if we have to */
972 if (fdc->flags & FDC_NODMA) {
973 if (bp->bio_cmd & (BIO_READ|BIO_WRITE|BIO_FMT))

--- 61 unchanged lines hidden (view full) ---

1035 i = tsleep(fdc, PRIBIO, "fddata", hz);
1036
1037 /* PIO if the read looks good */
1038 if (i == 0 && (fdc->flags & FDC_NODMA) && (bp->bio_cmd & BIO_READ))
1039 fdc_pio(fdc);
1040
1041 /* Finish DMA */
1042 if (fd->flags & FD_ISADMA) {
962 mtx_lock(&fdc->fdc_mtx);
963 fd->flags |= FD_ISADMA;
964 mtx_unlock(&fdc->fdc_mtx);
965 }
966
967 /* Do PIO if we have to */
968 if (fdc->flags & FDC_NODMA) {
969 if (bp->bio_cmd & (BIO_READ|BIO_WRITE|BIO_FMT))

--- 61 unchanged lines hidden (view full) ---

1031 i = tsleep(fdc, PRIBIO, "fddata", hz);
1032
1033 /* PIO if the read looks good */
1034 if (i == 0 && (fdc->flags & FDC_NODMA) && (bp->bio_cmd & BIO_READ))
1035 fdc_pio(fdc);
1036
1037 /* Finish DMA */
1038 if (fd->flags & FD_ISADMA) {
1043 mtx_lock(&Giant);
1044 isa_dmadone(
1045 bp->bio_cmd & BIO_READ ? ISADMA_READ : ISADMA_WRITE,
1046 fd->fd_ioptr, fd->fd_iosize, fdc->dmachan);
1039 isa_dmadone(
1040 bp->bio_cmd & BIO_READ ? ISADMA_READ : ISADMA_WRITE,
1041 fd->fd_ioptr, fd->fd_iosize, fdc->dmachan);
1047 mtx_unlock(&Giant);
1048 mtx_lock(&fdc->fdc_mtx);
1049 fd->flags &= ~FD_ISADMA;
1050 mtx_unlock(&fdc->fdc_mtx);
1051 }
1052
1053 if (i != 0) {
1054 /*
1055 * Timeout.

--- 1030 unchanged lines hidden ---
1042 mtx_lock(&fdc->fdc_mtx);
1043 fd->flags &= ~FD_ISADMA;
1044 mtx_unlock(&fdc->fdc_mtx);
1045 }
1046
1047 if (i != 0) {
1048 /*
1049 * Timeout.

--- 1030 unchanged lines hidden ---