This is a re-write of a two year old patch that Jacek Zapala made
for the v1.0.9 kernel. It essentially just cleares the reserved
flag on memory pages within the regions that you specify. By default
linux marks all pages within 640kB -> 1MB as "reserved". As described
below, it is up to you to actually make sure there is useable ram
located within the regions that you clear the reserved flag on.

It also gives you another 4kB block for free that linux doesn't
touch by default due to dain-bramage in the IBM ThinkPad. IBM pulled
a no-brainer and decided to use 636kB -> 640kB for their own purpose.
Look for the "#ifdef BROKEN_STINKPAD" in the patch if you are curious.

After installing this patch, you need to run "make config" again and
say "y" when it asks "Upper Memory Block Support". Then set up your
chipset enabler, and "umb=" boot argument as described below.

Although I have severely changed the patch to accomodate the changes
in the kernel code and source file layout, most of Jacek's original
comments still hold. So I have appended mine to them rather than
re-write the same cruft..

This is Jacek's original README, to which I have appended my notes
and updates inside square brackets [ like this ].

						Paul.
--------------------------------------------------------------------------

This patch allows Linux to utilize memory from range A0000-F0000 (or even
F8000) not used by adapters cards (known under DOS as Upper Memory Blocks).
Some main boards' chipsets are able to reallocate unused memory from this
range to the end of phisical memory, but most of them aren't. 

[ Your chipset may have the option, but it can be hidden -- eg. for
  AMI BIOS, use "amise270.zip" to check for hidden BIOS options. If your
  chipset remaps 256kB or the full 384kB to the end of physical memory,
  then you don't need this patch.]

If you want to use your wasted memory under Linux, you must enable it first.

[ The patch will test the boundaries of each 4kB UMB page to see if there
  actually has been useable read-write memory mapped into that address
  before actually letting the kernel use it. ]

This patch *WILL NOT* give you more memory unless you have a way to actually
map read-write ram into the area between 640K ( A0000 ) and 1M ( 100000 ) 
through your CMOS setup or some other program provided by your system or 
chipset manufacturer, or a memory expansion card that maps ram into that
area on the AT bus. The are some shareware programs (UMB_DRVR by Christopher
Blum, CompuServe: 76625,1041, The Last Byte Memory Manager by ...) that can
do it. Of course these programs run under DOS and you need boot Linux using
a program like loadlin or (older) bootlin.

[ The chipset enabler that is mentioned above, by Blum is `umbdr522.zip' 
  and can be found (amongst others) on any SimTel ftp mirror, in the 
  dir `msdos/memutil'. You probably want to grab that even if only to
  read the documentation on UMBs. ]

NOTE: I have heard that the system BIOS brand 'MRBIOS' from Microid Research
includes the capability to set up your memory this way if your chipset
supports it.

If you already have some RAM in range A0000-F8000 that you want use in
Linux, you should pass a parameter 'umb=from,to' to the kernel. This way
this patch wouldn't conflict with for example network cards.

[ Now accepts multiple regions on one command line. Using a second "umb="
  command line will overwrite the info you gave with the first though,
  so use "umb=start1,end1,start2,end2,start3,end3"  ]

Example (from my config.sys):

    DEVICE=c:\umb\umb_drvr.sys /C=09
    shell=c:\loadlin\loadlin.exe @c:\loadlin\param117.umb

param117.umb:

c:\loadlin\zimage
vga=2
root=/dev/hda4
ro
umb=0xc8000,0xf0000

This gives me (Trident SVGA, no network card) additional 160kB of memory
under Linux.

[ I have used "umb=0xb0000,0xb3fff,0xc8000,0xeffff" -- my patch will treat
  0xeffff and 0xf0000 as equivalent. Output from my patch at boot from an
  old C&T 386dx, s3-911, wd8013 net card mapped in at 0xac000->0xaffff:

		--------------------------
  Calibrating delay loop.. ok - 6.60 BogoMIPS
  umb: adding region(s): 0xb0000->0xb3fff 0xc8000->0xeffff.
  umb: scavenged 176kB in total.
  Memory: 7100k/8192k available (540k kernel code, 208k reserved, 344k data)
		--------------------------

  Note 384 - 176 = 208kB which is the amount left as "reserved". 

  PS: A note to the brave: You can even enable mem in the EGA/MONO
  areas and use that as an "UMB", if your "enabler" supports it.
  You must leave your VGA adapter in CGA 80x25 text mode, and avoid
  any programs that use svgalib, or X servers, or even programs like
  "setfont" that will try to use or alter EGA/MONO memory regions. 
  Using any of the above will result in memory corruption and a crash.
  For example with "umb=0xa0000,0xabfff,0xb0000,0xb7fff,0xc8000,0xeffff"
  I get the following:

		--------------------------
  Calibrating delay loop.. ok - 6.60 BogoMIPS
  umb: adding region(s): 0xa0000->0xabfff 0xb0000->0xb7fff 0xc8000->0xeffff.
  umb: scavenged 240kB in total.
  Memory: 7160k/8192k available (544k kernel code, 144k reserved, 344k data)
		--------------------------

  As you can see, I've left a 16kB hole at 0xac000, and put the ethercard
  at that address. If you have a PIO card like an ne2k, you don't need to.
  The hole at 0xb8000->0xc8000 is the CGA ram window and the VGA BIOS ROM. ]

Patch is against 1.1.17, but works fine with 1.0.9.

[ This patch is against v2.0.20, but should go fine against all 2.0.x
  kernels, and most likely early v2.1.x kernels (when released)... 
  Have fun with it.  -- Paul.                                       ]

