[comp.os.minix] Rework instructions for IBM-PC

dtynan@sultra.UUCP (Der Tynan) (10/18/88)

OK, I've got enough responses to warrant posting the rework instructions.  If
you DON'T own a vanilla 4.77MHz IBM-PC, then press 'n' now...

These instructions should give a big speed win.  As I said earlier, a getpid()
benchmark I wrote which used to take 126 seconds now takes 73, and I'm still
not really finished!  Feel free to send me e-mail, if you have any questions or
problems.  I would also like to know how everyone who applies these changes
get's on.
						- Der
---------- CUT HERE ---------- CUT HERE ---------- CUT HERE ----------

			REWORK INSTRUCTIONS FOR IBM-PC/XT
			---------------------------------

Basically, the speed increases to the IBM-PC are in two distinct parts.  The
first, is a simple replacement of the CPU (I8088-5MHz), with a NEC V20 (8 MHz).
The reason for the faster chip will be apparent in a moment...
This chip works fine with Minix, as far as I can tell -- I've had no problems.
My original benchmark took 126 seconds.  When I replaced the CPU with the V20,
the time went down to 108 seconds.  Also, the peephole optimizer (posted here,
some time ago & available from the archives), which I have yet to install, has
some extra speedups, if you have a V20 -- This should effectively improve this
speed, also.  The Intel part is socketed, so besides temporarily removing some
cables, and maybe one or two add-on cards, this is a simple change.  WARNING:
EXERCISE EXTREME CAUTION WHEN HANDLING THESE IC's -- THEY ARE EXTREMELY
SENSITIVE TO STATIC ELECTRICITY -- OBSERVE PROPER HANDLING PROCEDURES.
After completing this one, it is best to put the system back together, real
quickly, and verify that it still works.  If you are at all nervous about the
next part, I suggest you strike it from your list of things-to-do, and be
content with the speedup you now have.

The second part of the speedup involves replacing the 8253 timer chip, with a
faster version.  Then, replacing the master crystal with something better.
There are a lot of pitfalls to be wary of.  First off, the parts you need, are
an 8254-2 (Yes, the part number IS different).  This is an advanced version
of the timer chip used in the PC.  The -2 postfix means the part can handle
10MHz.  You don't need this fast a chip -- the 8254 (no postfix) will do just
as well.  See below.  Also, you need a range of HC18 crystals (these are the
medium-sized crystals -- not oscillators!).  I picked 16Mhz, 20Mhz and 24MHz.
If you feel extravagant, you can get thim is smaller sized increments.  The
idea here, is to try progressively faster crystals, until the system no longer
works.  Not very scientific, but hey!  The first thing to do, is pull the whole
motherboard out.  Disconnect everything.  Then, cut the 8253 out of the board
(they didn't socket it on mine).  This is a *very* tricky manueover.  Cut the
IC pins as close to the IC as possible, thus leaving 24 pins protruding from
the PC.  Remove each pin carefully, making sure not to damage the pads.  The
Vcc and Gnd pins are the hardest, because the planes act as heat sinks.  Having
removed all the pins, clear the holes.  To do this, I usually put more, fresh
solder over the hole (this is counter-intuitive).  Then, using solder wick, and
a freshly tinned tip, I clear out the holes.  Your methods may be different.
Experience is essential.  Finally, insert a 24-pin solder socket into the PC,
and solder it in place.  Make a quick check to make sure no pads are damaged.
Insert the 8254 into the socket, put the system back together, and boot it up.
This, again, is to make sure that everything still works.  Finally, clip the
leads to the crystal (this is the one nearest the power-supply).  Again, clip
them as close to the crystal as possible.  It is quicker if you leave the
motherboard in, to do this.  Tack-solder a 16MHz crystal in place of the old
14.31818 crystal.  Again, power-up the system, and check it out (I have found,
that if the system boots at all, it is OK -- your mileage may vary).  If the
system still works, try the 20MHz crystal.  If THAT works, then go to 24MHz.
As an aside, my system stopped working at 24MHz, but worked at 20MHz, just
fine.  Try different values of crystals, until you are happy with the fastest.
Now, once again, remove the motherboard, and install your new crystal.  There's
no need to socket it.  Rebuild your system, and run the FULL Minix test suite.
No problems?  Congratulations -- your system is now running TURBO.  You *still*
need to make another change, however.  If you check your benchmarks, you'll
notice that there is NO speed increase, since you changed the crystal.  Why?
Well, if you're like me, you are using the system clock to time the benchmark.
This is no longer correct.  The system clock is derived from the crystal you
just replaced, so it too is now running faster.  The minix source-code needs
to be changed, to initialize this device to a different heart-beat.  The code
is in the file kernel/clock.c.  There is a #define, which is set to 1193182L
This constant is the OLD crystal frequency, divided by 12.  You now need to
figure out the new value.  In my case, it is 1666666L, which sets the clock
correctly.  For 24MHz, it is 2000000L.  Recompile the kernel, and reboot.
As a test, I typed "sleep 600" at the console.  Exactly 10 minutes and 0
seconds, the prompt came back!  Now run your benchmarks.

Here are some warnings/notes:
I noticed that the system would not work correctly, unless everything was
screwed down.  At first I thought I had damaged the system, but it just
turned out that there was a ground loop someplace, and the system would read
the floppy boot sector, and die.  Make sure the motherboard is bolted to the
chassis, before running any tests.  Also, it is best just to rebuild the
system hardware, before testing your work (A pain, I know!).  There are
some caveats about DRAM speed;  My system (from IBM), had 64K soldered into
the motherboard.  These little turkeys are rated for 200ns.  The rest of the
256K was socketed, and filled with 150ns parts.  My AST SixPack was also
filled with 150ns parts.  I believe it is probably the 200ns parts that
stopped me from getting beyond 20MHz.  Maybe some day, I'll replace them,
and try a higher clock speed.  Check to see what the *slowest* DRAM's in
your system are.  These will probably be the deciding factor in system speed.
The reason *I* used a 10MHz V20 (~$20 -- the 8MHz version is ~$10), and a
10MHz 8254-2, was so that I could possibly crank the crystal up to 30MHz!!!
Basically, the crystal is divided by three, before being fed to the clock
chip and CPU.  Therefore, 8MHz parts are just find, right up to 24MHz.  It is
a good idea to get a few crystals in the 20->24MHz range, so that you can find
the best speed.  Beware, however, that this may not be digital (in that the
higher clock speeds may cause failures that are hard to detect immediately).
At 20MHz, my system is performing just fine -- no problems at all.  When I
put a 24MHz crystal in there, it was completely dead.  Not even a cursor.  If
you try varying frequencies in this range, it may not be as clear-cut.  As
a final note, I have not tried the system under MS-DOS (I'd like to know what
the new Norton System Index is, however!), so I can't guarantee that everything
will work.  On clone systems, the clock speed is switchable, so that if you
have some piece of sh*t program that can't handle the speed, you can set the
switch.  In the MINIX environment, however, we have source for everything, so
who needs it?  Also, nothing I have run on Minix so far had a problem with the
new speed.  However, the bell sounds distinctly different!  This could be
changed in the tty.c driver, but I like the *new sound*, it reminds me of
the turbo speed!!
Let me know how you get on.  Ie, what crystal speed you settled for, what your
DRAM speeds are, and what kind of improvements you've seen.

	 					Dermot Tynan,
						Tynan Computers,
						660 Gail Ave, #A24,
						Sunnyvale, CA   94086
-- 
Reply:	dtynan@sultra.UUCP		(Der Tynan @ Tynan Computers)
	{mips,pyramid}!sultra!dtynan
	Cast a cold eye on life, on death.  Horseman, pass by...    [WBY]