direct-io.hg

changeset 4238:e57dc11820ba

bitkeeper revision 1.1236.1.100 (423e9979L44Puv-F5HidStoKQdiT-g)

Merge firebug.cl.cam.ac.uk:/local/scratch/kaf24/xen-2.0-testing.bk
into firebug.cl.cam.ac.uk:/local/scratch/kaf24/xen-unstable.bk
author kaf24@firebug.cl.cam.ac.uk
date Mon Mar 21 09:52:57 2005 +0000 (2005-03-21)
parents 5c446a448cfb 186fb5ed50c4
children 7351314f8d57 2405bf94a500
files linux-2.6.11-xen-sparse/include/asm-xen/asm-i386/floppy.h
line diff
     1.1 --- a/linux-2.6.11-xen-sparse/include/asm-xen/asm-i386/floppy.h	Mon Mar 21 09:00:17 2005 +0000
     1.2 +++ b/linux-2.6.11-xen-sparse/include/asm-xen/asm-i386/floppy.h	Mon Mar 21 09:52:57 2005 +0000
     1.3 @@ -28,10 +28,14 @@
     1.4  #define fd_enable_irq()         enable_irq(FLOPPY_IRQ)
     1.5  #define fd_disable_irq()        disable_irq(FLOPPY_IRQ)
     1.6  #define fd_free_irq()		free_irq(FLOPPY_IRQ, NULL)
     1.7 -#define fd_get_dma_residue()    vdma_get_dma_residue(FLOPPY_DMA)
     1.8 -#define fd_dma_mem_alloc(size)	vdma_mem_alloc(size)
     1.9 -#define fd_dma_mem_free(addr, size) vdma_mem_free(addr, size) 
    1.10 +#define fd_get_dma_residue()    (virtual_dma_count + virtual_dma_residue)
    1.11  #define fd_dma_setup(addr, size, mode, io) vdma_dma_setup(addr, size, mode, io)
    1.12 +/*
    1.13 + * Do not use vmalloc/vfree: floppy_release_irq_and_dma() gets called from
    1.14 + * softirq context via motor_off_callback. A generic bug we happen to trigger.
    1.15 + */
    1.16 +#define fd_dma_mem_alloc(size)	__get_free_pages(GFP_KERNEL, get_order(size))
    1.17 +#define fd_dma_mem_free(addr, size) free_pages(addr, get_order(size))
    1.18  
    1.19  static int virtual_dma_count;
    1.20  static int virtual_dma_residue;
    1.21 @@ -42,99 +46,36 @@ static int doing_pdma;
    1.22  static irqreturn_t floppy_hardint(int irq, void *dev_id, struct pt_regs * regs)
    1.23  {
    1.24  	register unsigned char st;
    1.25 -
    1.26 -#undef TRACE_FLPY_INT
    1.27 -#define NO_FLOPPY_ASSEMBLER
    1.28 +	register int lcount;
    1.29 +	register char *lptr;
    1.30  
    1.31 -#ifdef TRACE_FLPY_INT
    1.32 -	static int calls=0;
    1.33 -	static int bytes=0;
    1.34 -	static int dma_wait=0;
    1.35 -#endif
    1.36  	if (!doing_pdma)
    1.37  		return floppy_interrupt(irq, dev_id, regs);
    1.38  
    1.39 -#ifdef TRACE_FLPY_INT
    1.40 -	if(!calls)
    1.41 -		bytes = virtual_dma_count;
    1.42 -#endif
    1.43 +	st = 1;
    1.44 +	for(lcount=virtual_dma_count, lptr=virtual_dma_addr; 
    1.45 +	    lcount; lcount--, lptr++) {
    1.46 +		st=inb(virtual_dma_port+4) & 0xa0 ;
    1.47 +		if(st != 0xa0) 
    1.48 +			break;
    1.49 +		if(virtual_dma_mode)
    1.50 +			outb_p(*lptr, virtual_dma_port+5);
    1.51 +		else
    1.52 +			*lptr = inb_p(virtual_dma_port+5);
    1.53 +	}
    1.54 +	virtual_dma_count = lcount;
    1.55 +	virtual_dma_addr = lptr;
    1.56 +	st = inb(virtual_dma_port+4);
    1.57  
    1.58 -#ifndef NO_FLOPPY_ASSEMBLER
    1.59 -	__asm__ (
    1.60 -       "testl %1,%1"
    1.61 -	"je 3f"
    1.62 -"1:	inb %w4,%b0"
    1.63 -	"andb $160,%b0"
    1.64 -	"cmpb $160,%b0"
    1.65 -	"jne 2f"
    1.66 -	"incw %w4"
    1.67 -	"testl %3,%3"
    1.68 -	"jne 4f"
    1.69 -	"inb %w4,%b0"
    1.70 -	"movb %0,(%2)"
    1.71 -	"jmp 5f"
    1.72 -"4:    	movb (%2),%0"
    1.73 -	"outb %b0,%w4"
    1.74 -"5:	decw %w4"
    1.75 -	"outb %0,$0x80"
    1.76 -	"decl %1"
    1.77 -	"incl %2"
    1.78 -	"testl %1,%1"
    1.79 -	"jne 1b"
    1.80 -"3:	inb %w4,%b0"
    1.81 -"2:	"
    1.82 -       : "=a" ((char) st), 
    1.83 -       "=c" ((long) virtual_dma_count), 
    1.84 -       "=S" ((long) virtual_dma_addr)
    1.85 -       : "b" ((long) virtual_dma_mode),
    1.86 -       "d" ((short) virtual_dma_port+4), 
    1.87 -       "1" ((long) virtual_dma_count),
    1.88 -       "2" ((long) virtual_dma_addr));
    1.89 -#else	
    1.90 -	{
    1.91 -		register int lcount;
    1.92 -		register char *lptr;
    1.93 -
    1.94 -		st = 1;
    1.95 -		for(lcount=virtual_dma_count, lptr=virtual_dma_addr; 
    1.96 -		    lcount; lcount--, lptr++) {
    1.97 -			st=inb(virtual_dma_port+4) & 0xa0 ;
    1.98 -			if(st != 0xa0) 
    1.99 -				break;
   1.100 -			if(virtual_dma_mode)
   1.101 -				outb_p(*lptr, virtual_dma_port+5);
   1.102 -			else
   1.103 -				*lptr = inb_p(virtual_dma_port+5);
   1.104 -		}
   1.105 -		virtual_dma_count = lcount;
   1.106 -		virtual_dma_addr = lptr;
   1.107 -		st = inb(virtual_dma_port+4);
   1.108 -	}
   1.109 -#endif
   1.110 -
   1.111 -#ifdef TRACE_FLPY_INT
   1.112 -	calls++;
   1.113 -#endif
   1.114  	if(st == 0x20)
   1.115  		return IRQ_HANDLED;
   1.116  	if(!(st & 0x20)) {
   1.117  		virtual_dma_residue += virtual_dma_count;
   1.118  		virtual_dma_count=0;
   1.119 -#ifdef TRACE_FLPY_INT
   1.120 -		printk("count=%x, residue=%x calls=%d bytes=%d dma_wait=%d\n", 
   1.121 -		       virtual_dma_count, virtual_dma_residue, calls, bytes,
   1.122 -		       dma_wait);
   1.123 -		calls = 0;
   1.124 -		dma_wait=0;
   1.125 -#endif
   1.126  		doing_pdma = 0;
   1.127  		floppy_interrupt(irq, dev_id, regs);
   1.128  		return IRQ_HANDLED;
   1.129  	}
   1.130 -#ifdef TRACE_FLPY_INT
   1.131 -	if(!virtual_dma_count)
   1.132 -		dma_wait++;
   1.133 -#endif
   1.134  	return IRQ_HANDLED;
   1.135  }
   1.136  
   1.137 @@ -145,28 +86,12 @@ static void fd_disable_dma(void)
   1.138  	virtual_dma_count=0;
   1.139  }
   1.140  
   1.141 -static int vdma_get_dma_residue(unsigned int dummy)
   1.142 -{
   1.143 -	return virtual_dma_count + virtual_dma_residue;
   1.144 -}
   1.145 -
   1.146  static int fd_request_irq(void)
   1.147  {
   1.148  	return request_irq(FLOPPY_IRQ, floppy_hardint,SA_INTERRUPT,
   1.149  					   "floppy", NULL);
   1.150  }
   1.151  
   1.152 -static unsigned long vdma_mem_alloc(unsigned long size)
   1.153 -{
   1.154 -	return (unsigned long) vmalloc(size);
   1.155 -
   1.156 -}
   1.157 -
   1.158 -static void vdma_mem_free(unsigned long addr, unsigned long size)
   1.159 -{
   1.160 -	vfree((void *)addr);
   1.161 -}
   1.162 -
   1.163  static int vdma_dma_setup(char *addr, unsigned long size, int mode, int io)
   1.164  {
   1.165  	doing_pdma = 1;