[SeaBIOS] How much RAM is required?
Markus Armbruster
armbru at redhat.com
Mon Aug 13 11:00:36 CEST 2012
"Kevin O'Connor" <kevin at koconnor.net> writes:
> On Fri, Aug 10, 2012 at 04:54:06PM +0200, Markus Armbruster wrote:
>> Peter Stuge <peter at stuge.se> writes:
>> > Markus Armbruster wrote:
>> >> Could SeaBIOS fail more cleanly when it detects insufficient RAM?
>> >
>> > What would you propose?
>>
>> Fail POST with panic("Not enough RAM")?
>
> The amount of memory is communicated from QEMU to SeaBIOS via nvram
> variables. As far as I know, those variables can only communicate ram
> sizes in 1meg chunks - so there is no way to communicate (and/or
> detect) a ramsize of under 1 meg.
Not true, the variables *can* communicate more.
Here's what QEMU stores in the RTC's NVRAM ("CMOS memory") on RAM:
addr size meaning [unit]
0x15 2 base memory (below 1MiB) [KiB]
0x17 2 extended memory (between 1MiB and 64MiB) [KiB]
0x30 2 copy of 0x17/0x18
0x34 2 memory between 16MiB and 4GiB [64KiB]
0x5b 3 memory above 4GiB [64KiB]
Thus, memory sizes up to 16MiB can be declared with 1KiB granularity,
and up to 1TiB with 64KiB granularity.
Note that RAM 0xa0000..0xfffff is inaccessible.
However, the values QEMU *currently* stores are buggy for RAM sizes
under 640KiB: base memory is set to 640KiB, and extended memory
underflows. Code is pc_cmos_init() in hw/pc.c. I'll try to get that
fixed, either by storing correct values, or by enforcing a 1MiB minimum.
Here's how SeaBIOS uses this information, in ram_probe():
1. read memory above 16MiB from 0x34/0x35.
2. if non-zero, add 16MiB,
else read memory between 1MiB and 64MiB from 0x30/0x31, add 1MiB
3. read memory above 4GiB
SeaBIOS doesn't read 0x15/0x16 at all. However, this SeaBIOS
shortcoming is currently masked by the QEMU bug.
More information about the SeaBIOS
mailing list