From uknf@rzstud1.rz.uni-karlsruhe.de Wed Feb 23 13:11:03 EST 1994 Article: 5821 of comp.os.linux.development Path: bigblue.oit.unc.edu!concert!corpgate!news.utdallas.edu!convex!cs.utexas.edu!math.ohio-state.edu!jussieu.fr!univ-lyon1.fr!swidir.switch.ch!scsing.switch.ch!news.dfn.de!news.belwue.de!news.uni-stuttgart.de!rz.uni-karlsruhe.de!rzstud1.rz.uni-karlsruhe.de!uknf From: uknf@rzstud1.rz.uni-karlsruhe.de (Olaf Titz) Newsgroups: comp.os.linux.development Subject: [Patch] Interrupt-free IDE driver Date: 22 Feb 1994 21:00:34 GMT Organization: University of Karlsruhe, Germany Lines: 99 Message-ID: <2kdrpi$b82@nz12.rz.uni-karlsruhe.de> NNTP-Posting-Host: rzstud1.rz.uni-karlsruhe.de Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit This patch enables interrupts while reading/writing a disk sector on IDE disks. There was a two-liner for older Linux kernels that doesn't work anymore since the affected inline functions have been moved to a header in 0.99.15, so I took the opportunity of making it a bit cleaner. You can disable it by #define CONFIG_NO_STI_IO. The effect is a drastically reduced interrupt latency during disk I/O, needed mostly for the serial driver. Rumours are that this doesn't work with some IDE disks that have odd interrupt timing. Use strictly at your own risk etc. Olaf --- drivers/block/hd.c.orig Fri Jan 21 13:50:11 1994 +++ drivers/block/hd.c Tue Feb 8 19:41:32 1994 @@ -30,6 +30,7 @@ #define REALLY_SLOW_IO #include #include +#include #include #define MAJOR_NR HD_MAJOR @@ -333,7 +334,7 @@ do_hd_request(); return; ok_to_read: - insw(HD_DATA,CURRENT->buffer,256); + ninsw(HD_DATA,CURRENT->buffer,256); CURRENT->errors = 0; CURRENT->buffer += 512; CURRENT->sector++; @@ -392,7 +393,7 @@ end_request(1); if (i > 0) { SET_INTR(&write_intr); - outsw(HD_DATA,CURRENT->buffer,256); + noutsw(HD_DATA,CURRENT->buffer,256); sti(); } else { #if (HD_DELAY > 0) @@ -502,7 +503,7 @@ bad_rw_intr(); goto repeat; } - outsw(HD_DATA,CURRENT->buffer,256); + noutsw(HD_DATA,CURRENT->buffer,256); sti(); return; } --- include/asm/ion.h.orig Tue Feb 8 19:41:32 1994 +++ include/asm/ion.h Tue Feb 8 19:41:32 1994 @@ -0,0 +1,40 @@ +#ifndef _ASM_ION_H +#define _ASM_ION_H + +/* + * This contains versions of ins/outs with interrups enabled. -ot + */ + +#ifdef CONFIG_NO_STI_IO + +#define ninsb insb +#define ninsw insw +#define ninsl insl + +#define noutsb outsb +#define noutsw outsw +#define noutsl outsl + +#else + +#define __NINS(s) \ +extern inline void nins##s(unsigned short port, void * addr, unsigned long count) \ +{ __asm__ __volatile__ ("pushf ; sti ; cld ; rep ; ins" #s "; popf" \ +: "=D" (addr), "=c" (count) : "d" (port),"0" (addr),"1" (count)); } + +#define __NOUTS(s) \ +extern inline void nouts##s(unsigned short port, const void * addr, unsigned long count) \ +{ __asm__ __volatile__ ("pushf; sti ; cld ; rep ; outs" #s "; popf" \ +: "=S" (addr), "=c" (count) : "d" (port),"0" (addr),"1" (count)); } + +__NINS(b) +__NINS(w) +__NINS(l) + +__NOUTS(b) +__NOUTS(w) +__NOUTS(l) + +#endif + +#endif -- olaf titz o olaf@bigred.ka.sub.org praetorius@irc comp.sc.student _>\ _ s_titz@ira.uka.de LINUX - the choice karlsruhe germany (_)<(_) uknf@dkauni2.bitnet of a GNU generation what good is a photograph of you? everytime i look at it it makes me feel blue