* Re: IO delay, port 0x80, and BIOS POST codes [not found] ` <Pine.LNX.4.33.0203151243430.1477-100000@biker.pdb.fsc.net.suse.lists.linux.kernel> @ 2002-03-15 11:51 ` Andi Kleen 2002-03-15 12:47 ` Martin Wilck 0 siblings, 1 reply; 16+ messages in thread From: Andi Kleen @ 2002-03-15 11:51 UTC (permalink / raw) To: Martin Wilck; +Cc: linux-kernel Martin Wilck <Martin.Wilck@fujitsu-siemens.com> writes: > On Thu, 14 Mar 2002, Thunder from the hill wrote: > > > I also remember this been discussed anually. Making it configurable with > > a warning might be a solution, but that's nothing we could decide. Maybe > > add a config option? It night be a [DANGEROUS] one, so the guys and gals > > who might compile are warned of changing this. > > It doesn't even have to be a config option - a line > > /* Port used for dummy writes for I/O delays */ > /* Change this only if you know what you're doing ! */ > #define DUMMY_IO_PORT 0x80 > > in a header file would perfectly suffice. That effectively already exists. You just need to change the __SLOW_DOWN_IO macro in include/asm-i387/io.h -Andi ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: IO delay, port 0x80, and BIOS POST codes 2002-03-15 11:51 ` IO delay, port 0x80, and BIOS POST codes Andi Kleen @ 2002-03-15 12:47 ` Martin Wilck 2002-03-15 12:52 ` Andi Kleen 0 siblings, 1 reply; 16+ messages in thread From: Martin Wilck @ 2002-03-15 12:47 UTC (permalink / raw) To: Andi Kleen; +Cc: Martin Wilck, linux-kernel On 15 Mar 2002, Andi Kleen wrote: > > It doesn't even have to be a config option - a line > > > > /* Port used for dummy writes for I/O delays */ > > /* Change this only if you know what you're doing ! */ > > #define DUMMY_IO_PORT 0x80 > > > > in a header file would perfectly suffice. > > That effectively already exists. You just need to change the __SLOW_DOWN_IO > macro in include/asm-i387/io.h No, that doesn't cover all accesses to port 80. I am still searching. -- Martin Wilck Phone: +49 5251 8 15113 Fujitsu Siemens Computers Fax: +49 5251 8 20409 Heinz-Nixdorf-Ring 1 mailto:Martin.Wilck@Fujitsu-Siemens.com D-33106 Paderborn http://www.fujitsu-siemens.com/primergy ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: IO delay, port 0x80, and BIOS POST codes 2002-03-15 12:47 ` Martin Wilck @ 2002-03-15 12:52 ` Andi Kleen 2002-03-15 17:41 ` [PATCH] Cleanup port 0x80 use (was: Re: IO delay ...) Martin Wilck 0 siblings, 1 reply; 16+ messages in thread From: Andi Kleen @ 2002-03-15 12:52 UTC (permalink / raw) To: Martin Wilck; +Cc: Andi Kleen, linux-kernel On Fri, Mar 15, 2002 at 01:47:39PM +0100, Martin Wilck wrote: > On 15 Mar 2002, Andi Kleen wrote: > > > > It doesn't even have to be a config option - a line > > > > > > /* Port used for dummy writes for I/O delays */ > > > /* Change this only if you know what you're doing ! */ > > > #define DUMMY_IO_PORT 0x80 > > > > > > in a header file would perfectly suffice. > > > > That effectively already exists. You just need to change the __SLOW_DOWN_IO > > macro in include/asm-i387/io.h > > No, that doesn't cover all accesses to port 80. I am still searching. It should. I would consider all other accesses a bug. It is possible that some driver used it for private debugging and left it in by mistake. These should be removed. -Andi ^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH] Cleanup port 0x80 use (was: Re: IO delay ...) 2002-03-15 12:52 ` Andi Kleen @ 2002-03-15 17:41 ` Martin Wilck 2002-03-15 18:05 ` Alan Cox 2002-03-15 18:57 ` Andreas Dilger 0 siblings, 2 replies; 16+ messages in thread From: Martin Wilck @ 2002-03-15 17:41 UTC (permalink / raw) To: Linux Kernel mailing list; +Cc: Martin Wilck Hi, this patch makes the use of the "dummy" port 0x80 globally configurable through a macro in the (new) file asm-i386/iodelay.h. I think nobody wants to see this in the configuration menus. I have tried to capture all accesses to port 0x80, although some may have escaped. Even if nobody wants to use anything other than 0x80 in the near future, I think the patch is useful because grepping the source for 0x80 is really no fun. With the patch, our BIOS post code LEDs really stand still. I am still wondering, though, why this method of getting a delay is used so often. IMO in most places one could use udelay(1) instead, with much less risk of doing wrong. Martin -- Martin Wilck Phone: +49 5251 8 15113 Fujitsu Siemens Computers Fax: +49 5251 8 20409 Heinz-Nixdorf-Ring 1 mailto:Martin.Wilck@Fujitsu-Siemens.com D-33106 Paderborn http://www.fujitsu-siemens.com/primergy --- ./include/asm-i386/io.h.orig Fri Mar 15 17:23:15 2002 +++ ./include/asm-i386/io.h Fri Mar 15 18:30:03 2002 @@ -221,17 +221,9 @@ #endif /* __KERNEL__ */ -#ifdef SLOW_IO_BY_JUMPING -#define __SLOW_DOWN_IO "\njmp 1f\n1:\tjmp 1f\n1:" -#else -#define __SLOW_DOWN_IO "\noutb %%al,$0x80" -#endif - -#ifdef REALLY_SLOW_IO -#define __FULL_SLOW_DOWN_IO __SLOW_DOWN_IO __SLOW_DOWN_IO __SLOW_DOWN_IO __SLOW_DOWN_IO -#else -#define __FULL_SLOW_DOWN_IO __SLOW_DOWN_IO -#endif +/* Moved the __SLOW_DOWN_IO macros to a separate file + * that can be included by setup.S */ +#include <asm/iodelay.h> #ifdef CONFIG_MULTIQUAD extern void *xquad_portio; /* Where the IO area was mapped */ --- ./include/asm-i386/floppy.h.orig Fri Mar 15 17:23:15 2002 +++ ./include/asm-i386/floppy.h Fri Mar 15 17:55:04 2002 @@ -89,8 +89,7 @@ jmp 5f 4: movb (%2),%0 outb %b0,%w4 -5: decw %w4 - outb %0,$0x80 +5: decw %w4" __SLOW_DOWN_IO " decl %1 incl %2 testl %1,%1 --- ./include/asm-i386/iodelay.h.orig Fri Mar 15 18:31:01 2002 +++ ./include/asm-i386/iodelay.h Fri Mar 15 18:30:36 2002 @@ -0,0 +1,25 @@ +#ifndef _ASM_IODELAY_H +#define _ASM_IODELAY_H + +#ifdef SLOW_IO_BY_JUMPING +#define __SLOW_DOWN_IO "\njmp 1f\n1:\tjmp 1f\n1:" +#else + + /* + * The dummy IO port to use for delays. + * Change only if you really know what you're doing + * Default value: 0x80 + * Other values that have been suggested: 0x19, 0x42, 0xe2, 0xed + * Both macros must be changed to capture all I/O delays in the kernel. + */ +#define __SLOW_DOWN_IO_PORT 0x80 +#define __SLOW_DOWN_IO "\noutb %%al,$0x80" +#endif + +#ifdef REALLY_SLOW_IO +#define __FULL_SLOW_DOWN_IO __SLOW_DOWN_IO __SLOW_DOWN_IO __SLOW_DOWN_IO __SLOW_DOWN_IO +#else +#define __FULL_SLOW_DOWN_IO __SLOW_DOWN_IO +#endif + +#endif --- ./drivers/char/serial.c.orig Fri Mar 15 17:23:15 2002 +++ ./drivers/char/serial.c Fri Mar 15 17:24:13 2002 @@ -3661,12 +3661,12 @@ scratch = serial_inp(info, UART_IER); serial_outp(info, UART_IER, 0); #ifdef __i386__ - outb(0xff, 0x080); + outb(0xff,__SLOW_DOWN_IO_PORT); #endif scratch2 = serial_inp(info, UART_IER); serial_outp(info, UART_IER, 0x0F); #ifdef __i386__ - outb(0, 0x080); + outb(0xff,__SLOW_DOWN_IO_PORT); #endif scratch3 = serial_inp(info, UART_IER); serial_outp(info, UART_IER, scratch); --- ./drivers/char/riscom8.c.orig Fri Mar 15 17:23:15 2002 +++ ./drivers/char/riscom8.c Fri Mar 15 17:24:13 2002 @@ -278,10 +278,10 @@ /* Are the I/O ports here ? */ rc_out(bp, CD180_PPRL, 0x5a); - outb(0xff, 0x80); + outb(0xff, __SLOW_DOWN_IO_PORT); val1 = rc_in(bp, CD180_PPRL); rc_out(bp, CD180_PPRL, 0xa5); - outb(0x00, 0x80); + outb(0x00, __SLOW_DOWN_IO_PORT); val2 = rc_in(bp, CD180_PPRL); if ((val1 != 0x5a) || (val2 != 0xa5)) { --- ./drivers/scsi/atp870u.c.orig Fri Mar 15 17:23:15 2002 +++ ./drivers/scsi/atp870u.c Fri Mar 15 17:24:13 2002 @@ -1042,7 +1042,7 @@ tmport = dev->ioport + 0x1b; outb(0x02, tmport); - outb(0, 0x80); + outb(0, __SLOW_DOWN_IO_PORT); val = 0x0080; /* bsy */ tmport = dev->ioport + 0x1c; @@ -1051,7 +1051,7 @@ outw(val, tmport); val |= 0x0004; /* msg */ outw(val, tmport); - inb(0x80); /* 2 deskew delay(45ns*2=90ns) */ + inb(__SLOW_DOWN_IO_PORT); /* 2 deskew delay(45ns*2=90ns) */ val &= 0x007f; /* no bsy */ outw(val, tmport); mydlyu(0xffff); /* recommanded SCAM selection response time */ @@ -1062,7 +1062,7 @@ if ((inb(tmport) & 0x04) != 0) { goto wait_nomsg; } - outb(1, 0x80); + outb(1, __SLOW_DOWN_IO_PORT); mydlyu(100); for (n = 0; n < 0x30000; n++) { if ((inb(tmport) & 0x80) != 0) { /* bsy ? */ @@ -1078,13 +1078,13 @@ } goto TCM_SYNC; wait_io1: - inb(0x80); + inb(__SLOW_DOWN_IO_PORT); val |= 0x8003; /* io,cd,db7 */ outw(val, tmport); - inb(0x80); + inb(__SLOW_DOWN_IO_PORT); val &= 0x00bf; /* no sel */ outw(val, tmport); - outb(2, 0x80); + outb(2, __SLOW_DOWN_IO_PORT); TCM_SYNC: mydlyu(0x800); if ((inb(tmport) & 0x80) == 0x00) { /* bsy ? */ @@ -1103,18 +1103,18 @@ val &= 0x00ff; /* synchronization */ val |= 0x3f00; fun_scam(dev, &val); - outb(3, 0x80); + outb(3, __SLOW_DOWN_IO_PORT); val &= 0x00ff; /* isolation */ val |= 0x2000; fun_scam(dev, &val); - outb(4, 0x80); + outb(4, __SLOW_DOWN_IO_PORT); i = 8; j = 0; TCM_ID: if ((inw(tmport) & 0x2000) == 0) { goto TCM_ID; } - outb(5, 0x80); + outb(5, __SLOW_DOWN_IO_PORT); val &= 0x00ff; /* get ID_STRING */ val |= 0x2000; k = fun_scam(dev, &val); --- ./drivers/video/sis/sis_main.c.orig Fri Mar 15 17:23:15 2002 +++ ./drivers/video/sis/sis_main.c Fri Mar 15 17:27:16 2002 @@ -2308,7 +2308,7 @@ u8 reg; int nRes; - outb (0x77, 0x80); + outb (0x77, __SLOW_DOWN_IO_PORT); if (sisfb_off) return -ENXIO; --- ./arch/i386/boot/setup.S.orig Fri Mar 15 17:23:15 2002 +++ ./arch/i386/boot/setup.S Fri Mar 15 18:33:12 2002 @@ -54,6 +54,7 @@ #include <asm/boot.h> #include <asm/e820.h> #include <asm/page.h> +#include <asm/iodelay.h> /* Signature words to ensure LILO loaded us right */ #define SIG1 0xAA55 @@ -65,6 +66,7 @@ # ... and the former contents of CS DELTA_INITSEG = SETUPSEG - INITSEG # 0x0020 +DELAY_PORT = __SLOW_DOWN_IO_PORT # port for IO delay (0x80) .code16 .globl begtext, begdata, begbss, endtext, enddata, endbss @@ -1001,7 +1003,7 @@ # Delay is needed after doing I/O delay: - outb %al,$0x80 + outb %al,$DELAY_PORT ret # Descriptor tables ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] Cleanup port 0x80 use (was: Re: IO delay ...) 2002-03-15 17:41 ` [PATCH] Cleanup port 0x80 use (was: Re: IO delay ...) Martin Wilck @ 2002-03-15 18:05 ` Alan Cox 2002-03-15 20:41 ` H. Peter Anvin 2002-03-15 18:57 ` Andreas Dilger 1 sibling, 1 reply; 16+ messages in thread From: Alan Cox @ 2002-03-15 18:05 UTC (permalink / raw) To: Martin Wilck; +Cc: Linux Kernel mailing list, Martin Wilck > I am still wondering, though, why this method of getting a delay > is used so often. IMO in most places one could use udelay(1) instead, > with much less risk of doing wrong. udelay(1) I don't believe is enough. Unfortunately I can't find my documentation on the ISA bus which covers the timeout for acknowledging an address cycle. Otherwise for tsc capable boxes I agree entirely. ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] Cleanup port 0x80 use (was: Re: IO delay ...) 2002-03-15 18:05 ` Alan Cox @ 2002-03-15 20:41 ` H. Peter Anvin 2002-03-15 21:33 ` Linus Torvalds 2002-03-15 21:37 ` Alan Cox 0 siblings, 2 replies; 16+ messages in thread From: H. Peter Anvin @ 2002-03-15 20:41 UTC (permalink / raw) To: linux-kernel Followup to: <E16lw5V-0004ES-00@the-village.bc.nu> By author: Alan Cox <alan@lxorguk.ukuu.org.uk> In newsgroup: linux.dev.kernel > > > I am still wondering, though, why this method of getting a delay > > is used so often. IMO in most places one could use udelay(1) instead, > > with much less risk of doing wrong. > > udelay(1) I don't believe is enough. Unfortunately I can't find my > documentation on the ISA bus which covers the timeout for acknowledging an > address cycle. Otherwise for tsc capable boxes I agree entirely. > The ISA bus doesn't time out; a cycle on the ISA bus just happens, and the fact that noone is there to listen doesn't seem to matter. The delay is something like 8 cycles @ 8.3 MHz or around 1 ms. However, an important thing to note is that this delay applies *at the southbridge*. An OUT is a fully synchronizing operation, so it doesn't just give a 1 ms delay due to the ISA bus cycle, but it also makes sure everything else in the system is completed before the timing counter even starts to tick. Of course, if all you're doing is IOIO (on an x86!) it doesn't matter -- IOIO is fully synchronizing anyway. -hpa -- <hpa@transmeta.com> at work, <hpa@zytor.com> in private! "Unix gives you enough rope to shoot yourself in the foot." http://www.zytor.com/~hpa/puzzle.txt <amsp@zytor.com> ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] Cleanup port 0x80 use (was: Re: IO delay ...) 2002-03-15 20:41 ` H. Peter Anvin @ 2002-03-15 21:33 ` Linus Torvalds 2002-03-15 21:37 ` Alan Cox 1 sibling, 0 replies; 16+ messages in thread From: Linus Torvalds @ 2002-03-15 21:33 UTC (permalink / raw) To: linux-kernel In article <a6tm95$c55$1@cesium.transmeta.com>, H. Peter Anvin <hpa@zytor.com> wrote: > >The ISA bus doesn't time out; a cycle on the ISA bus just happens, and >the fact that noone is there to listen doesn't seem to matter. The ISA bus doesn't time out, but the PCI access before it gets forwarded to the ISA bus _does_, if the ISA bus is decoded using nagative decoding. This is why it's important that there not be a motherboard PCI device that can decode the port - because if there is, the access is potentially a much faster PCI-only decode. Note that this really only matters on low-end machines anyway, as the whole "inb_p()" thing tends to be used only for old ISA devices. If you have a new machine that is all PCI, I doubt that port 80h access matters not at all. (Another way of saying it: if you have a machine with a PCI POST card, none of this will matter) Linus ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] Cleanup port 0x80 use (was: Re: IO delay ...) 2002-03-15 20:41 ` H. Peter Anvin 2002-03-15 21:33 ` Linus Torvalds @ 2002-03-15 21:37 ` Alan Cox 2002-03-16 0:01 ` H. Peter Anvin 1 sibling, 1 reply; 16+ messages in thread From: Alan Cox @ 2002-03-15 21:37 UTC (permalink / raw) To: H. Peter Anvin; +Cc: linux-kernel > > documentation on the ISA bus which covers the timeout for acknowledging an > > address cycle. Otherwise for tsc capable boxes I agree entirely. > > > The ISA bus doesn't time out; a cycle on the ISA bus just happens, and > the fact that noone is there to listen doesn't seem to matter. Not so simple. I found my IEEE draft 8) The address out comes from the chipset (southbridge now days). The sequence is BALE high Output address BALE low Set IORC/IOWC etc Wait for NOWS while watching IOCHRDY NOWS low says - card now ready IOCHRDY high suppresses the wait state timer count The default timeout is 4 wait states, which is 6 bus clocks for a failure Maybe 7 - Im not clear if the final cycle to recover and start again is always there. > The delay is something like 8 cycles @ 8.3 MHz or around 1 ms. 1uS ? Alan ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] Cleanup port 0x80 use (was: Re: IO delay ...) 2002-03-15 21:37 ` Alan Cox @ 2002-03-16 0:01 ` H. Peter Anvin 0 siblings, 0 replies; 16+ messages in thread From: H. Peter Anvin @ 2002-03-16 0:01 UTC (permalink / raw) To: Alan Cox; +Cc: linux-kernel Alan Cox wrote: > >>The delay is something like 8 cycles @ 8.3 MHz or around 1 ms. > > 1uS ? > 1 µs, right :-/ -hpa ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] Cleanup port 0x80 use (was: Re: IO delay ...) 2002-03-15 17:41 ` [PATCH] Cleanup port 0x80 use (was: Re: IO delay ...) Martin Wilck 2002-03-15 18:05 ` Alan Cox @ 2002-03-15 18:57 ` Andreas Dilger 2002-03-15 20:17 ` Martin Wilck 1 sibling, 1 reply; 16+ messages in thread From: Andreas Dilger @ 2002-03-15 18:57 UTC (permalink / raw) To: Martin Wilck; +Cc: Linux Kernel mailing list On Mar 15, 2002 18:41 +0100, Martin Wilck wrote: > +#define __SLOW_DOWN_IO_PORT 0x80 > +#define __SLOW_DOWN_IO "\noutb %%al,$0x80" You may want to change the above to: #define __SLOW_DOWN_IO_ASM "\noutb %%al,$__SLOW_DOWN_IO_PORT" > + outb(3, __SLOW_DOWN_IO_PORT); You may also want to replace the above entirely with a macro, like: #define __SLOW_DOWN_IO outb(3, __SLOW_DOWN_IO_PORT) so that on architectures that don't need/have this ISA nonsense can just replace __SLOW_DOWN_IO with something else like udelay. > --- ./arch/i386/boot/setup.S.orig Fri Mar 15 17:23:15 2002 > +++ ./arch/i386/boot/setup.S Fri Mar 15 18:33:12 2002 > @@ -65,6 +66,7 @@ > # ... and the former contents of CS > > DELTA_INITSEG = SETUPSEG - INITSEG # 0x0020 > +DELAY_PORT = __SLOW_DOWN_IO_PORT # port for IO delay (0x80) > > .code16 > .globl begtext, begdata, begbss, endtext, enddata, endbss May as well just stick with a single define here (i.e. remove DELAY_PORT). > @@ -1001,7 +1003,7 @@ > > # Delay is needed after doing I/O > delay: > - outb %al,$0x80 > + outb %al,$DELAY_PORT > ret And use __SLOW_DOWN_IO_ASM here. Cheers, Andreas -- Andreas Dilger \ "If a man ate a pound of pasta and a pound of antipasto, \ would they cancel out, leaving him still hungry?" http://www-mddsp.enel.ucalgary.ca/People/adilger/ -- Dogbert ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] Cleanup port 0x80 use (was: Re: IO delay ...) 2002-03-15 18:57 ` Andreas Dilger @ 2002-03-15 20:17 ` Martin Wilck 2002-03-17 2:01 ` Jamie Lokier 0 siblings, 1 reply; 16+ messages in thread From: Martin Wilck @ 2002-03-15 20:17 UTC (permalink / raw) To: Andreas Dilger; +Cc: Martin Wilck, Linux Kernel mailing list On Fri, 15 Mar 2002, Andreas Dilger wrote: > > +#define __SLOW_DOWN_IO_PORT 0x80 > > +#define __SLOW_DOWN_IO "\noutb %%al,$0x80" > > You may want to change the above to: > #define __SLOW_DOWN_IO_ASM "\noutb %%al,$__SLOW_DOWN_IO_PORT" Won't work, cpp doesn't substitute between double quotes. (at least the one I'm using). Or am I gettimng something wrong here?? > You may also want to replace the above entirely with a macro, like: > #define __SLOW_DOWN_IO outb(3, __SLOW_DOWN_IO_PORT) > > so that on architectures that don't need/have this ISA nonsense can > just replace __SLOW_DOWN_IO with something else like udelay. I wanted to change as little as possible, generated code was intended to be binary-identical with old code if the port is set to 0x80. Currently source files can #define "SLOW_IO_BY_JUMPING" to avoid writing to the dummy port. Perhaps someone should introduce SLOW_IO_BY_UDELAY or so. > May as well just stick with a single define here (i.e. remove DELAY_PORT). OK. Please take a look at the new version below. (Changed only setup.S code, and some comments). Martin -- Martin Wilck Phone: +49 5251 8 15113 Fujitsu Siemens Computers Fax: +49 5251 8 20409 Heinz-Nixdorf-Ring 1 mailto:Martin.Wilck@Fujitsu-Siemens.com D-33106 Paderborn http://www.fujitsu-siemens.com/primergy --- ./include/asm-i386/io.h.orig Fri Mar 15 17:23:15 2002 +++ ./include/asm-i386/io.h Fri Mar 15 18:30:03 2002 @@ -221,17 +221,9 @@ #endif /* __KERNEL__ */ -#ifdef SLOW_IO_BY_JUMPING -#define __SLOW_DOWN_IO "\njmp 1f\n1:\tjmp 1f\n1:" -#else -#define __SLOW_DOWN_IO "\noutb %%al,$0x80" -#endif - -#ifdef REALLY_SLOW_IO -#define __FULL_SLOW_DOWN_IO __SLOW_DOWN_IO __SLOW_DOWN_IO __SLOW_DOWN_IO __SLOW_DOWN_IO -#else -#define __FULL_SLOW_DOWN_IO __SLOW_DOWN_IO -#endif +/* Moved the __SLOW_DOWN_IO macros to a separate file + * that can be included by setup.S */ +#include <asm/iodelay.h> #ifdef CONFIG_MULTIQUAD extern void *xquad_portio; /* Where the IO area was mapped */ --- ./include/asm-i386/floppy.h.orig Fri Mar 15 17:23:15 2002 +++ ./include/asm-i386/floppy.h Fri Mar 15 17:55:04 2002 @@ -89,8 +89,7 @@ jmp 5f 4: movb (%2),%0 outb %b0,%w4 -5: decw %w4 - outb %0,$0x80 +5: decw %w4" __SLOW_DOWN_IO " decl %1 incl %2 testl %1,%1 --- ./include/asm-i386/iodelay.h.orig Fri Mar 15 18:31:01 2002 +++ ./include/asm-i386/iodelay.h Fri Mar 15 21:14:17 2002 @@ -0,0 +1,28 @@ +#ifndef _ASM_IODELAY_H +#define _ASM_IODELAY_H + +/* File suitable for inclusion by setup.S, normally included via <asm/io.h> */ + +#ifdef SLOW_IO_BY_JUMPING +#define __SLOW_DOWN_IO "\njmp 1f\n1:\tjmp 1f\n1:" +#else + +/* + * The dummy IO port to use for delays. + * Change only if you really know what you're doing + * Default value: 0x80 + * Other values that have been suggested: 0x19, 0x42, 0xe2, 0xed + * Both macros must be changed to modify all IO delays in the kernel. + */ + +#define __SLOW_DOWN_IO_PORT 0x80 +#define __SLOW_DOWN_IO "\noutb %%al,$0x80" +#endif + +#ifdef REALLY_SLOW_IO +#define __FULL_SLOW_DOWN_IO __SLOW_DOWN_IO __SLOW_DOWN_IO __SLOW_DOWN_IO __SLOW_DOWN_IO +#else +#define __FULL_SLOW_DOWN_IO __SLOW_DOWN_IO +#endif + +#endif --- ./drivers/char/serial.c.orig Fri Mar 15 17:23:15 2002 +++ ./drivers/char/serial.c Fri Mar 15 17:24:13 2002 @@ -3661,12 +3661,12 @@ scratch = serial_inp(info, UART_IER); serial_outp(info, UART_IER, 0); #ifdef __i386__ - outb(0xff, 0x080); + outb(0xff,__SLOW_DOWN_IO_PORT); #endif scratch2 = serial_inp(info, UART_IER); serial_outp(info, UART_IER, 0x0F); #ifdef __i386__ - outb(0, 0x080); + outb(0xff,__SLOW_DOWN_IO_PORT); #endif scratch3 = serial_inp(info, UART_IER); serial_outp(info, UART_IER, scratch); --- ./drivers/char/riscom8.c.orig Fri Mar 15 17:23:15 2002 +++ ./drivers/char/riscom8.c Fri Mar 15 17:24:13 2002 @@ -278,10 +278,10 @@ /* Are the I/O ports here ? */ rc_out(bp, CD180_PPRL, 0x5a); - outb(0xff, 0x80); + outb(0xff, __SLOW_DOWN_IO_PORT); val1 = rc_in(bp, CD180_PPRL); rc_out(bp, CD180_PPRL, 0xa5); - outb(0x00, 0x80); + outb(0x00, __SLOW_DOWN_IO_PORT); val2 = rc_in(bp, CD180_PPRL); if ((val1 != 0x5a) || (val2 != 0xa5)) { --- ./drivers/scsi/atp870u.c.orig Fri Mar 15 17:23:15 2002 +++ ./drivers/scsi/atp870u.c Fri Mar 15 17:24:13 2002 @@ -1042,7 +1042,7 @@ tmport = dev->ioport + 0x1b; outb(0x02, tmport); - outb(0, 0x80); + outb(0, __SLOW_DOWN_IO_PORT); val = 0x0080; /* bsy */ tmport = dev->ioport + 0x1c; @@ -1051,7 +1051,7 @@ outw(val, tmport); val |= 0x0004; /* msg */ outw(val, tmport); - inb(0x80); /* 2 deskew delay(45ns*2=90ns) */ + inb(__SLOW_DOWN_IO_PORT); /* 2 deskew delay(45ns*2=90ns) */ val &= 0x007f; /* no bsy */ outw(val, tmport); mydlyu(0xffff); /* recommanded SCAM selection response time */ @@ -1062,7 +1062,7 @@ if ((inb(tmport) & 0x04) != 0) { goto wait_nomsg; } - outb(1, 0x80); + outb(1, __SLOW_DOWN_IO_PORT); mydlyu(100); for (n = 0; n < 0x30000; n++) { if ((inb(tmport) & 0x80) != 0) { /* bsy ? */ @@ -1078,13 +1078,13 @@ } goto TCM_SYNC; wait_io1: - inb(0x80); + inb(__SLOW_DOWN_IO_PORT); val |= 0x8003; /* io,cd,db7 */ outw(val, tmport); - inb(0x80); + inb(__SLOW_DOWN_IO_PORT); val &= 0x00bf; /* no sel */ outw(val, tmport); - outb(2, 0x80); + outb(2, __SLOW_DOWN_IO_PORT); TCM_SYNC: mydlyu(0x800); if ((inb(tmport) & 0x80) == 0x00) { /* bsy ? */ @@ -1103,18 +1103,18 @@ val &= 0x00ff; /* synchronization */ val |= 0x3f00; fun_scam(dev, &val); - outb(3, 0x80); + outb(3, __SLOW_DOWN_IO_PORT); val &= 0x00ff; /* isolation */ val |= 0x2000; fun_scam(dev, &val); - outb(4, 0x80); + outb(4, __SLOW_DOWN_IO_PORT); i = 8; j = 0; TCM_ID: if ((inw(tmport) & 0x2000) == 0) { goto TCM_ID; } - outb(5, 0x80); + outb(5, __SLOW_DOWN_IO_PORT); val &= 0x00ff; /* get ID_STRING */ val |= 0x2000; k = fun_scam(dev, &val); --- ./drivers/video/sis/sis_main.c.orig Fri Mar 15 17:23:15 2002 +++ ./drivers/video/sis/sis_main.c Fri Mar 15 17:27:16 2002 @@ -2308,7 +2308,7 @@ u8 reg; int nRes; - outb (0x77, 0x80); + outb (0x77, __SLOW_DOWN_IO_PORT); if (sisfb_off) return -ENXIO; --- ./arch/i386/boot/setup.S.orig Fri Mar 15 17:23:15 2002 +++ ./arch/i386/boot/setup.S Fri Mar 15 20:50:13 2002 @@ -54,6 +54,7 @@ #include <asm/boot.h> #include <asm/e820.h> #include <asm/page.h> +#include <asm/iodelay.h> /* Signature words to ensure LILO loaded us right */ #define SIG1 0xAA55 @@ -1001,7 +1002,7 @@ # Delay is needed after doing I/O delay: - outb %al,$0x80 + outb %al,$__SLOW_DOWN_IO_PORT ret # Descriptor tables ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] Cleanup port 0x80 use (was: Re: IO delay ...) 2002-03-15 20:17 ` Martin Wilck @ 2002-03-17 2:01 ` Jamie Lokier 2002-03-18 9:18 ` Martin Wilck 0 siblings, 1 reply; 16+ messages in thread From: Jamie Lokier @ 2002-03-17 2:01 UTC (permalink / raw) To: Martin Wilck; +Cc: Andreas Dilger, Linux Kernel mailing list Martin Wilck wrote: > > > +#define __SLOW_DOWN_IO_PORT 0x80 > > > +#define __SLOW_DOWN_IO "\noutb %%al,$0x80" > > > > You may want to change the above to: > > #define __SLOW_DOWN_IO_ASM "\noutb %%al,$__SLOW_DOWN_IO_PORT" > > Won't work, cpp doesn't substitute between double quotes. > (at least the one I'm using). Or am I gettimng something wrong here?? As long as __SLOW_DOWN_IO_PORT is a simple constant, you can just use this instead: #define __SLOW_DOWN_IO_ASM "\noutb %%al,$" #__SLOW_DOWN_IO_PORT -- Jamie ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] Cleanup port 0x80 use (was: Re: IO delay ...) 2002-03-17 2:01 ` Jamie Lokier @ 2002-03-18 9:18 ` Martin Wilck 2002-03-18 9:39 ` Keith Owens 2002-03-18 15:22 ` Jamie Lokier 0 siblings, 2 replies; 16+ messages in thread From: Martin Wilck @ 2002-03-18 9:18 UTC (permalink / raw) To: Jamie Lokier; +Cc: Martin Wilck, Andreas Dilger, Linux Kernel mailing list On Sun, 17 Mar 2002, Jamie Lokier wrote: > As long as __SLOW_DOWN_IO_PORT is a simple constant, you can just use > this instead: > > #define __SLOW_DOWN_IO_ASM "\noutb %%al,$" #__SLOW_DOWN_IO_PORT What cpp are you guys using? Mine does stringification (#s) only with arguments of function-like macros. However #define __SLOW_DOWN_IO_P(p) "\noutb %%al,%" #p #define __SLOW_DOWN_IO __SLOW_DOWN_IO(__SLOW_DOWN_IO_PORT) won't work, either, because cpp does not recursively substitute macros for stringification, so in the above _SLOW_DOWN_IO wuold evaluate as "\noutb %%al,$__SLOW_DOWN_IO_PORT" - bad. I have tried a number of things to make this a single cpp line, but they all don't work. The only way would be to change the way the inb_p ... macros are coded. It is possible to write #define __SLOW_DOWN_IO __asm__ ("outb %%al, %0" : : "i" (__SLOW_DOWN_IO_PORT)); but only if one modifies the definitions of inb_p etc which are so complex that I don't dare touch them now. Please note that, as an intermediate solution, my patch reduces explicit usage of the constant 0x80 from ~20 in 8 different source files to 2 immediately following each other in 1 source file. Martin -- Martin Wilck Phone: +49 5251 8 15113 Fujitsu Siemens Computers Fax: +49 5251 8 20409 Heinz-Nixdorf-Ring 1 mailto:Martin.Wilck@Fujitsu-Siemens.com D-33106 Paderborn http://www.fujitsu-siemens.com/primergy ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] Cleanup port 0x80 use (was: Re: IO delay ...) 2002-03-18 9:18 ` Martin Wilck @ 2002-03-18 9:39 ` Keith Owens 2002-03-18 11:20 ` Martin Wilck 2002-03-18 15:22 ` Jamie Lokier 1 sibling, 1 reply; 16+ messages in thread From: Keith Owens @ 2002-03-18 9:39 UTC (permalink / raw) To: Martin Wilck; +Cc: Jamie Lokier, Andreas Dilger, Linux Kernel mailing list On Mon, 18 Mar 2002 10:18:06 +0100 (CET), Martin Wilck <Martin.Wilck@fujitsu-siemens.com> wrote: >On Sun, 17 Mar 2002, Jamie Lokier wrote: > >> As long as __SLOW_DOWN_IO_PORT is a simple constant, you can just use >> this instead: >> >> #define __SLOW_DOWN_IO_ASM "\noutb %%al,$" #__SLOW_DOWN_IO_PORT > >What cpp are you guys using? Mine does stringification (#s) only with >arguments of function-like macros. However Recent 2.4 and 2.5 kernels have include/linux/stringify.h. This should work. #define __SLOW_DOWN_IO_ASM "\noutb %%al,$" __stringify(__SLOW_DOWN_IO_PORT) ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] Cleanup port 0x80 use (was: Re: IO delay ...) 2002-03-18 9:39 ` Keith Owens @ 2002-03-18 11:20 ` Martin Wilck 0 siblings, 0 replies; 16+ messages in thread From: Martin Wilck @ 2002-03-18 11:20 UTC (permalink / raw) To: Keith Owens Cc: Martin Wilck, Jamie Lokier, Andreas Dilger, Linux Kernel mailing list On Mon, 18 Mar 2002, Keith Owens wrote: > Recent 2.4 and 2.5 kernels have include/linux/stringify.h. This should > work. OK, that's it. Thanks a lot Keith! Please find the new patch below. Martin -- Martin Wilck Phone: +49 5251 8 15113 Fujitsu Siemens Computers Fax: +49 5251 8 20409 Heinz-Nixdorf-Ring 1 mailto:Martin.Wilck@Fujitsu-Siemens.com D-33106 Paderborn http://www.fujitsu-siemens.com/primergy --- ./include/asm-i386/io.h.orig Fri Mar 15 17:23:15 2002 +++ ./include/asm-i386/io.h Fri Mar 15 18:30:03 2002 @@ -221,17 +221,9 @@ #endif /* __KERNEL__ */ -#ifdef SLOW_IO_BY_JUMPING -#define __SLOW_DOWN_IO "\njmp 1f\n1:\tjmp 1f\n1:" -#else -#define __SLOW_DOWN_IO "\noutb %%al,$0x80" -#endif - -#ifdef REALLY_SLOW_IO -#define __FULL_SLOW_DOWN_IO __SLOW_DOWN_IO __SLOW_DOWN_IO __SLOW_DOWN_IO __SLOW_DOWN_IO -#else -#define __FULL_SLOW_DOWN_IO __SLOW_DOWN_IO -#endif +/* Moved the __SLOW_DOWN_IO macros to a separate file + * that can be included by setup.S */ +#include <asm/iodelay.h> #ifdef CONFIG_MULTIQUAD extern void *xquad_portio; /* Where the IO area was mapped */ --- ./include/asm-i386/floppy.h.orig Fri Mar 15 17:23:15 2002 +++ ./include/asm-i386/floppy.h Fri Mar 15 17:55:04 2002 @@ -89,8 +89,7 @@ jmp 5f 4: movb (%2),%0 outb %b0,%w4 -5: decw %w4 - outb %0,$0x80 +5: decw %w4" __SLOW_DOWN_IO " decl %1 incl %2 testl %1,%1 --- ./include/asm-i386/iodelay.h.orig Fri Mar 15 18:31:01 2002 +++ ./include/asm-i386/iodelay.h Mon Mar 18 12:17:20 2002 @@ -0,0 +1,25 @@ +#ifndef _ASM_IODELAY_H +#define _ASM_IODELAY_H + +/* + * The dummy IO port to use for delays. + * Change only if you really know what you're doing !! + * Default value: 0x80. + * Other values that have been suggested: 0x19, 0x42, 0xe2, 0xed. + */ +#define __SLOW_DOWN_IO_PORT 0x80 + +#ifdef SLOW_IO_BY_JUMPING +#define __SLOW_DOWN_IO "\njmp 1f\n1:\tjmp 1f\n1:" +#else +#include <linux/stringify.h> +#define __SLOW_DOWN_IO "\noutb %%al,$" __stringify(__SLOW_DOWN_IO_PORT) +#endif + +#ifdef REALLY_SLOW_IO +#define __FULL_SLOW_DOWN_IO __SLOW_DOWN_IO __SLOW_DOWN_IO __SLOW_DOWN_IO __SLOW_DOWN_IO +#else +#define __FULL_SLOW_DOWN_IO __SLOW_DOWN_IO +#endif + +#endif --- ./drivers/char/serial.c.orig Fri Mar 15 17:23:15 2002 +++ ./drivers/char/serial.c Fri Mar 15 17:24:13 2002 @@ -3661,12 +3661,12 @@ scratch = serial_inp(info, UART_IER); serial_outp(info, UART_IER, 0); #ifdef __i386__ - outb(0xff, 0x080); + outb(0xff,__SLOW_DOWN_IO_PORT); #endif scratch2 = serial_inp(info, UART_IER); serial_outp(info, UART_IER, 0x0F); #ifdef __i386__ - outb(0, 0x080); + outb(0xff,__SLOW_DOWN_IO_PORT); #endif scratch3 = serial_inp(info, UART_IER); serial_outp(info, UART_IER, scratch); --- ./drivers/char/riscom8.c.orig Fri Mar 15 17:23:15 2002 +++ ./drivers/char/riscom8.c Fri Mar 15 17:24:13 2002 @@ -278,10 +278,10 @@ /* Are the I/O ports here ? */ rc_out(bp, CD180_PPRL, 0x5a); - outb(0xff, 0x80); + outb(0xff, __SLOW_DOWN_IO_PORT); val1 = rc_in(bp, CD180_PPRL); rc_out(bp, CD180_PPRL, 0xa5); - outb(0x00, 0x80); + outb(0x00, __SLOW_DOWN_IO_PORT); val2 = rc_in(bp, CD180_PPRL); if ((val1 != 0x5a) || (val2 != 0xa5)) { --- ./drivers/scsi/atp870u.c.orig Fri Mar 15 17:23:15 2002 +++ ./drivers/scsi/atp870u.c Fri Mar 15 17:24:13 2002 @@ -1042,7 +1042,7 @@ tmport = dev->ioport + 0x1b; outb(0x02, tmport); - outb(0, 0x80); + outb(0, __SLOW_DOWN_IO_PORT); val = 0x0080; /* bsy */ tmport = dev->ioport + 0x1c; @@ -1051,7 +1051,7 @@ outw(val, tmport); val |= 0x0004; /* msg */ outw(val, tmport); - inb(0x80); /* 2 deskew delay(45ns*2=90ns) */ + inb(__SLOW_DOWN_IO_PORT); /* 2 deskew delay(45ns*2=90ns) */ val &= 0x007f; /* no bsy */ outw(val, tmport); mydlyu(0xffff); /* recommanded SCAM selection response time */ @@ -1062,7 +1062,7 @@ if ((inb(tmport) & 0x04) != 0) { goto wait_nomsg; } - outb(1, 0x80); + outb(1, __SLOW_DOWN_IO_PORT); mydlyu(100); for (n = 0; n < 0x30000; n++) { if ((inb(tmport) & 0x80) != 0) { /* bsy ? */ @@ -1078,13 +1078,13 @@ } goto TCM_SYNC; wait_io1: - inb(0x80); + inb(__SLOW_DOWN_IO_PORT); val |= 0x8003; /* io,cd,db7 */ outw(val, tmport); - inb(0x80); + inb(__SLOW_DOWN_IO_PORT); val &= 0x00bf; /* no sel */ outw(val, tmport); - outb(2, 0x80); + outb(2, __SLOW_DOWN_IO_PORT); TCM_SYNC: mydlyu(0x800); if ((inb(tmport) & 0x80) == 0x00) { /* bsy ? */ @@ -1103,18 +1103,18 @@ val &= 0x00ff; /* synchronization */ val |= 0x3f00; fun_scam(dev, &val); - outb(3, 0x80); + outb(3, __SLOW_DOWN_IO_PORT); val &= 0x00ff; /* isolation */ val |= 0x2000; fun_scam(dev, &val); - outb(4, 0x80); + outb(4, __SLOW_DOWN_IO_PORT); i = 8; j = 0; TCM_ID: if ((inw(tmport) & 0x2000) == 0) { goto TCM_ID; } - outb(5, 0x80); + outb(5, __SLOW_DOWN_IO_PORT); val &= 0x00ff; /* get ID_STRING */ val |= 0x2000; k = fun_scam(dev, &val); --- ./drivers/video/sis/sis_main.c.orig Fri Mar 15 17:23:15 2002 +++ ./drivers/video/sis/sis_main.c Fri Mar 15 17:27:16 2002 @@ -2308,7 +2308,7 @@ u8 reg; int nRes; - outb (0x77, 0x80); + outb (0x77, __SLOW_DOWN_IO_PORT); if (sisfb_off) return -ENXIO; --- ./arch/i386/boot/setup.S.orig Fri Mar 15 17:23:15 2002 +++ ./arch/i386/boot/setup.S Fri Mar 15 20:50:13 2002 @@ -54,6 +54,7 @@ #include <asm/boot.h> #include <asm/e820.h> #include <asm/page.h> +#include <asm/iodelay.h> /* Signature words to ensure LILO loaded us right */ #define SIG1 0xAA55 @@ -1001,7 +1002,7 @@ # Delay is needed after doing I/O delay: - outb %al,$0x80 + outb %al,$__SLOW_DOWN_IO_PORT ret # Descriptor tables ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] Cleanup port 0x80 use (was: Re: IO delay ...) 2002-03-18 9:18 ` Martin Wilck 2002-03-18 9:39 ` Keith Owens @ 2002-03-18 15:22 ` Jamie Lokier 1 sibling, 0 replies; 16+ messages in thread From: Jamie Lokier @ 2002-03-18 15:22 UTC (permalink / raw) To: Martin Wilck; +Cc: Andreas Dilger, Linux Kernel mailing list Martin Wilck wrote: > > As long as __SLOW_DOWN_IO_PORT is a simple constant, you can just use > > this instead: > > > > #define __SLOW_DOWN_IO_ASM "\noutb %%al,$" #__SLOW_DOWN_IO_PORT > > What cpp are you guys using? Mine does stringification (#s) only with > arguments of function-like macros. You're right, my error. You need to use an argument, as has already been pointed out -- <linux/stringify.h>. -- Jamie ^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2002-03-18 15:22 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <3C90E983.5AC769B8@ngforever.de.suse.lists.linux.kernel>
[not found] ` <Pine.LNX.4.33.0203151243430.1477-100000@biker.pdb.fsc.net.suse.lists.linux.kernel>
2002-03-15 11:51 ` IO delay, port 0x80, and BIOS POST codes Andi Kleen
2002-03-15 12:47 ` Martin Wilck
2002-03-15 12:52 ` Andi Kleen
2002-03-15 17:41 ` [PATCH] Cleanup port 0x80 use (was: Re: IO delay ...) Martin Wilck
2002-03-15 18:05 ` Alan Cox
2002-03-15 20:41 ` H. Peter Anvin
2002-03-15 21:33 ` Linus Torvalds
2002-03-15 21:37 ` Alan Cox
2002-03-16 0:01 ` H. Peter Anvin
2002-03-15 18:57 ` Andreas Dilger
2002-03-15 20:17 ` Martin Wilck
2002-03-17 2:01 ` Jamie Lokier
2002-03-18 9:18 ` Martin Wilck
2002-03-18 9:39 ` Keith Owens
2002-03-18 11:20 ` Martin Wilck
2002-03-18 15:22 ` Jamie Lokier
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox