From 76c356f36509a72638ee794fc271e562bf991960 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Fri, 3 Dec 1999 15:46:17 +0000 Subject: Patch from Aleksey (Quality Quorum ) to change the delay loop in this BSP. Here is his response to a question about the patch: Yes, or that other machine has a different chipset with different timing requirements on enabling Gate 20. I am strongly suspecting that it may some how related to the video card I am using (on my old P-75 target it was plain PCI VGA, on my new one it is Diamond Stealth 3D 2000). --- c/src/lib/libbsp/i386/pc386/start/start16.S | 25 +++++++++++++++++++++++-- c/src/lib/libbsp/i386/pc386/startup/ldsegs.S | 27 +++++++++++++++++++++++---- 2 files changed, 46 insertions(+), 6 deletions(-) diff --git a/c/src/lib/libbsp/i386/pc386/start/start16.S b/c/src/lib/libbsp/i386/pc386/start/start16.S index 4b12408cd6..92e04468de 100644 --- a/c/src/lib/libbsp/i386/pc386/start/start16.S +++ b/c/src/lib/libbsp/i386/pc386/start/start16.S @@ -115,6 +115,10 @@ _start16: outb %al, $0x60 call empty_8042 + call delay + call delay + call delay + movl %cs:HDRSTART + HDROFF, %eax # pushl %eax # jump to start of 32 bit code ret # @@ -122,13 +126,29 @@ _start16: /*----------------------------------------------------------------------------+ | delay +------------------------------------------------------------------------------ -| Delay is needed after doing I/O. We do it by writing to a non-existent port. +| Delay is needed after doing I/O. +| +| The outb version is OK on most machines BUT the loop version ... +| +| will delay for 1us on 1Gz machine, it will take a little bit +| longer on slower machines, however, it does not matter because we +| are going to call this function only a few times + +----------------------------------------------------------------------------*/ + .p2align 4 .globl _delay .globl delay delay: _delay: - outb %al, $0xED # about 1uS delay +/* + outb %al, $0xED # about 1uS delay on most machines +*/ +/* + + movl $0x200, %eax +delay1: + dec %eax + jnz delay1 ret /*----------------------------------------------------------------------------+ @@ -139,6 +159,7 @@ _delay: | No timeout is used - if this hangs there is something wrong with the machine, | and we probably couldn't proceed anyway. +----------------------------------------------------------------------------*/ + .p2align 4 .globl _empty_8042 .globl empty_8042 empty_8042: diff --git a/c/src/lib/libbsp/i386/pc386/startup/ldsegs.S b/c/src/lib/libbsp/i386/pc386/startup/ldsegs.S index 8e082909d7..63f5052f80 100644 --- a/c/src/lib/libbsp/i386/pc386/startup/ldsegs.S +++ b/c/src/lib/libbsp/i386/pc386/startup/ldsegs.S @@ -52,16 +52,35 @@ BEGIN_CODE EXTERN (Timer_exit) EXTERN (clockOff) - .p2align 4 /*----------------------------------------------------------------------------+ | delay +------------------------------------------------------------------------------ -| Delay is needed after doing I/O. We do it by writing to a non-existent port. +| Delay is needed after doing I/O. +| +| The outb version is OK on most machines BUT the loop version ... +| +| will delay for 1us on 1Gz machine, it will take a little bit +| longer on slower machines, however, it does not matter because we +| are going to call this function only a few times + +----------------------------------------------------------------------------*/ -SYM(delay): - outb al, $0x80 # about 1uS delay + .p2align 4 + .globl _delay + .globl delay +delay: +_delay: +/* + outb %al, $0xED # about 1uS delay on most machines +*/ +/* + + movl $0x200, %eax +delay1: + dec %eax + jnz delay1 ret + /*-------------------------------------------------------------------------+ | Function: _load_segments | Description: Current environment is standard PC booted by grub. -- cgit v1.2.3