Home
Developer Resources
QNX RTOS v4
QNX RTOS v4 Knowledge Base

QNX RTOS v4 Knowledge Base

Foundry27
Foundry27
QNX RTOS v4 project
Resources

QNX RTOS v4 Knowledge Base

Title Problems booting QNX2.21 on fast Pentium systems.
Ref. No. QNX.000004547
Category(ies) Utilities, Installation, Filesystem, Configuration
Issue For some time, we have been bothered by problems running QNX2.21 on fast Pentium processors.  As soon as the clock speed exceeds 100 MHz, either the machine would not boot from the floppy disk, could not restore from a Wangtek tape drive, or both. 

The problem is only related to booting from a floppy drive.  Booting from a hard drive works fine.

The symptoms suggest a problem either during operation of the boot loader or immediately after - the PC reads the floppy, the (horizontal) arrow is printed in the screen suggesting that QNX has started to load and then everything stops!  The floppy stops spinning and the machine needs re-booting.
Some time ago, we received a patch for the boot loader for fast machines but this is no help, the symptoms are totally unchanged.

Are there any upgrades (other than QNX4) recently issued that address this problem? 






Solution QNX has a mandate to maintain QNX2 for the life of its use.  Maintenance is described as keeping existing functionality alive up to the limits of the hardware QNX2 was designed for. This limit is currently at 486 class machines, although many people have had success with pci-based pentium 100/133 machines.

Things you can try
------------------
QNX2.21 was developed when a 386 was a rocket. What is happening is that not a large enough window is being allocated for a floppy access. What you have to do is go into the BIOS and disable any shadow caching or any optimization that you can find. Increase all latency timers to their greates value.  Slow the system down as much as you can in the cmos before booting.

The floppy controller problem can sometimes be solved with the speed_patch program. Make the os image max out on speed index, copy the modified image to a boot floppy, make the image bootable and then try to boot it.  The speed_correct program is available in our Free Software section at /usr/free2/qnx2.21/qnx_utils/

Below is a description of how it works.

CPU_Speed Index Wrap
==============================================================================

At boot time, QNX2 calculates the CPU speed index (an unsigned int). You can see this index when you type 'tsk info'. Both fsys and dev use this speed index for some timing operations: fsys uses it in timing for the floppy driver, dev uses it for some timed polling on the parallel port.
Problem:
On very fast machines (e.g. 486/100 or P90) the CPU index can wrap around back to zero and begin counting again. So, for example, rather than having a speed index of 80000 let's say (which cannot be represented in a 16-bit unsigned int, which can only go up to 65535) you would instead get a wrap around and the speed index would be 80000 - 65535 = 14465. This could cause problems with floppy/parallel port access as well as any user programs that use the cpu_speed for computation.

Solution?
To keep backwards compatibility we must keep the speed index as an unsigned int (max of 65535).  What we can do is to force the speed to be 65535 if we determine that the index has wrapped around.  Rather than have to make a new os image, we can 'patch' the speed index numbers in task, fsys and dev AFTER the os has loaded.  This approach should be fine for fast machines ... in the os the speed index is used as an 'estimate' for timing; there is enough leeway in the timing code.

speed_correct

This is a new utility that you can place as the first command in your sys.init file. It will check the machine to see if it is fast and if the cpu speed index has wrapped) and then force a 65535 into the speed_index values for task, fsys and dev.
Here's the usage message:
        "use: speed_correct  [+verbose*] [o=max_counter]",
        "      ",
        "    - use multiple +v commands for increasing verbosity.",
        "              e.g. speed_correct +v +v",
        "    - use o= to specify the cutoff value for forcing speed index",
        "      to 0xffff. Default for o= is 14.",
        "      e.g. speed_index o=10 will force the speed to 0xffff if",
        "            the calculated speed wraps around 10 times.",
        " ",
        "Description:",
        "On very fast machines, the cpu_speed index in QNX2 could wrap beyond",        "65535 (max of unsigned int). This could happen on Pentium90 machines",x09x09"and up.  What this program does is calculate what the real speed of",
        "the machine is and then, if a wrap might have occurred, it will stuff",
        "a maximum value (0xffff) into the speed variables in task, fsys and dev.",
        "This is no guarantee that QNX2 will work correctly on very fast machines",
    "but it should help in the areas of a floppy control, parallel port I/O etc.",
        "To use this command, place it as the first command in your sysinit so",
    "that it will force the speed high as soon after you bootup as possible."

e.g.
in your sys.init, put the command:
    speed_correct

Source to this utility is provided so you can see what it does.
For the executable and source, you can ftp into "ftp.qnx.com"
login: anonymous
password: quest

You can find this in "/usr/free2/qnx2.21/qnx_utils"