Adding BIOS Routines

Only for programmers and BIOS gurus with technical questions.
Post Reply
KachiWachi
The New Guy
Posts: 1451
Joined: Fri Mar 29, 2002 10:32 pm
Location: Pennsylvania, USA

Hi All!!

Is it possible to add code to a BIOS to do "setup" prior to booting?

You all know my DFI BIOS has been patched for the K6-2/III+ series CPU's. There are functions though that are not set natively by the BIOS.

There have been utilities written to this after the system has booted, or from DOS, but could these utilities somehow be merged into the BIOS as seperate sub-routines, and added to the "setup screens" so that you could adjust them at the BIOS level manually? Automatic detection is not a requirement.

Mostly we are just talking an MSR register setting, so I invision this as adding a BIOS menu item with a selection "box" to a BIOS setup screen with available space, plus code that sets the actual MSR.

Setting for SCE - ON, OFF (1 bit)
Setting for EWB - None, Speculative, Global (2 bits)
Setting for UC/UW - None, Uncacheable, Write-Combined (2 bits)

Entry for MTRR - Hardest to do...as you need to make a data entry here manually for the MTRR registers. This one will use the most code space, especially if you tried to do it automatically, or added helpful menu settings. (30 bits)

The UC/UW/MTRR would be done twice, for a total of 64 bits.

Thoughts?
atang1
BIOS Newbie
Posts: 17
Joined: Sat Jan 01, 2005 7:18 pm
Location: Framingham, Ma.

Are you working with 1 mb roms? You are having all the fun.

Since bios is shadowed, you can patch in the shadowed dram area, even changed dynamically much easier and logical too.

I have suggested to Bill Gates a few years back; that they should do the dynamic adjustments to run the cpu at overclocked speeds. Then adjust the speed to cool the cpu when the diode in the cpu got too hot. When my computers have autoupdate from windows update, these computers run faster 20-30%, as tested by Sandra.

So, I encourage you to think further, and don't stop at just convenience, but actually dynamically adjust the cpu and other components in the computer directly from the shadowed bios. You still boot from the original bios safely.
KachiWachi
The New Guy
Posts: 1451
Joined: Fri Mar 29, 2002 10:32 pm
Location: Pennsylvania, USA

I'd still use the DOS/Real mode utilities if it wasn't for the fact that I now run W2K on the machine...so this is no longer possible.
atang1
BIOS Newbie
Posts: 17
Joined: Sat Jan 01, 2005 7:18 pm
Location: Framingham, Ma.

Win2k and WinNT has better dos commands then 98 and ME?
KachiWachi
The New Guy
Posts: 1451
Joined: Fri Mar 29, 2002 10:32 pm
Location: Pennsylvania, USA

The HAL layer prevents the utilities from working...
maman
Master Flasher
Posts: 173
Joined: Sun Mar 31, 2002 2:08 pm
Location: Taka Bonerate National Park, Indonesia
Contact:

I think what you need here is an NT kernel mode driver to access the hardware. It's not that hard to make one an make works in win 2K/XP. I've made one it in the past to tweak my chipset's memory controller ;)
KachiWachi
The New Guy
Posts: 1451
Joined: Fri Mar 29, 2002 10:32 pm
Location: Pennsylvania, USA

I currently use WAMonitor v.57 to set the MSR's to my liking, however, I wanted to add the routines to the BIOS, which was the intent of this post.

I'm not smart enough to do that...and I really don't know how much space this would even require code-wise.

WAMonitor uses MSRTOUCH.EXE to set the MSR's...and the file length is 2,592 bytes. The application itself is 368,640 bytes, though I don't think much of this would be needed in the BIOS itself, since you wouldn't need all of the display stuff, etc... Would BIOS code be about the same length?

Anyone have more thoughts on this?
maman
Master Flasher
Posts: 173
Joined: Sun Mar 31, 2002 2:08 pm
Location: Taka Bonerate National Park, Indonesia
Contact:

I've added routines to my BIOS (Award BIOS v4.51). Using a technique that I call "POST jump table hacking". For a couple of months it's stable enough, but recently I found that there still some minor issue. You might want to check it out :
Award Bios "POST Jump Table" Hacking

I don't know for sure if you are using award bios, but the basic idea might be applicable to your testbed too.
Last edited by maman on Tue Mar 08, 2005 6:06 am, edited 1 time in total.
KachiWachi
The New Guy
Posts: 1451
Joined: Fri Mar 29, 2002 10:32 pm
Location: Pennsylvania, USA

Yes...the BIOS is AWARD v4.51, and has had "jump to" routines added by BiosMan Jan to patch out the HDD bugs, and to add the K6+ routines.

Again...I just don't know that much about assembly, etc... so it is something I cannot do. I don't even know if this has been tried yet, as most BIOSes do not have these particular features to begin with. So it isn't just a matter of "borrowing" known code and patching it in place...

Thanks for the article. Looks like interesting reading.
apple_rom
Use my patch at your own risk!!
Posts: 125
Joined: Tue Jan 07, 2003 11:39 am
Location: Minsk
Contact:

1. Which _code_ have to adding?
2. BIOSPatcher can adding "user-subroutines" to patched bios (ask to me, how to do).
3. Or get directly link on bios for insert this code manual (need data).
Post Reply