[OpenBIOS] ANNOUNCE: Collecting OpenBIOS patches

Jeff Garzik jgarzik at mandrakesoft.com
Mon Jan 24 10:43:11 CET 2000


Jens Dreger wrote:
> I absolutely agree. Unfortunately I have no experience with
> programming Bioses whatsoever, but I'm very interested to learn more
> about this. I do have all kinds of Pentium-based Mainboards. Could you
> give me some hints on where to start looking into this topic ? Is
> there any kind of HOWTO or any introductory material freely available?


Jens,

If you have a bunch of main boards you are off to an excellent start. 
You need to find out what motherboard chipset is used on each mainboard
you have.  Sometimes all you have to do is look for the largest chipset
on the motherboard that is not the CPU.  Sometimes you will have to take
the motherboard model, go to the OEM's website, and look up the
motherboard chipset from there.

Once you have the motherboard chipset, you need to obtain the
motherboard datasheet.  This lists the registers on the mainboard which
you will need to set in order to have OpenBIOS boot that motherboard.

After you know the chipset and have its datasheet, you can begin coding.

Your best reference is the existing source code in
openbios/drivers/chipset.  Newcomers often want a document instead of
the source code, but don't worry... the source code is easy to read. 
You just have to take your time, and have an assembly language reference
on hand.  Following the logic -- motherboard initialization is actually
really easy!

Since there are no real docs about this stuff, here is a short
introduction.  Please pass this along, or ask questions.  Ask plenty of
questions!  We may not be able to respond in the same day, or even same
week :), but you will get a response generally.

Talking to your motherboard
---------------------------
Your motherboard's core logic chipset, also called a "northbridge",
controls everything in the computer.  It controls the CPU timings, RAM
timings, cache timing and setup.  Basically everything you see in your
BIOS setup screen, and more.

Most modern PCI motherboards are controlled by setting up the PCI
configuration registers.  This makes things easy, because your
motherboard code looks like this:

* module to read/write PCI configuration registers
* chipset init module, which can be as simple as writing a list of
constant values to the motherboard's PCI configuration registers
* memory init module.  You gotta figure out how obtain the amount of RAM
and cache RAM installed on the motherboard.

Typically writing to the PCI configuration registers means sending a
8/16/32-bit value to a PIO port.  (A PIO port is accessed like your
printer data port, or serial data port...)

To make things even easier, you can write a small program to read your
motherboard's current PCI configuration.  For testing and initial setup,
you can simply plug these values straight into the chipset init code
(the "register value table").


Memory sizing
-------------
This is probably the most difficult part of adding motherboard chipset
support to OpenBIOS.  The standard method of finding out the amount of
memory installed is to write a value to a memory location, such as
0x1A1A2D2D, and then reading that value back.  If the value read back is
the same, and not 0 or 0xFFFFFFF or another bogus value, that memory is
valid and addressable.

You might have to go to protected mode to size memory beyond 64MB in
this manner.

Most chipsets provide a better way to size RAM.  The Intel i430FX
chipset, for example, provides a set of registers which allow you to
determine the total memory installed in each DRAM bank.  This makes
memory sizing really easy.


Configuring the motherboard
---------------------------
Motherboard chipsets, after power-on, are reset to a default state which
is generally sane.  It is your task to take the chipset from the
power-on default state to the fully-initialized state.  To do this you
must configure DRAM setup, cache setup, and peripheral setup.  Power
management or other advanced features might need to be set up as well.

As mentioned above, the easiest way is to read your motherboard's
existing configuration, and store that in an assembly language data
table.  This data represents a list of registers and register values
which are written to the motherboard when it boots your BIOS.  Be aware
that you may need to play around with the ordering of the register
settings, or simply omit some register settings, in order to get things
working.

In general, you want to start out with the most conservative (ie.
SLOWEST) settings for your cache, DRAM, etc.  Be warned that your system
will be very slow with all caching turned off.  After you get things
working, slowly begin to turn on and tune the motherboard configuration
the way you want.


Configuring the peripherals
---------------------------
In addition to the motherboard init code in openbios/drivers/chipset,
there is the peripheral init code in openbios/drivers/superio.

Most modern motherboards contains built-in facilities for parallel
ports, serial ports, and similar features.  You need to initalize the
super I/O chip.  Look at the source code for the existing motherboard
super I/O chipsets for guidance.  The source code is always your best
documentation.  (don't forget to ask questions, though!)



It can be intimidating to add support for your motherboard to OpenBIOS,
but it is really a straightforward task.  The key is your motherboard's
datasheet or specification.  If you don't have that, you will be lost...

Post all questions to the OpenBIOS list please!


-- 
Jeff Garzik         | Andre the Giant has a posse.
Building 1024       |
MandrakeSoft, Inc.  |
-
To unsubscribe: send mail to majordomo at freiburg.linux.de
with 'unsubscribe openbios' in the body of the message



More information about the openbios mailing list