[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] Re: [PATCH] SeaBIOS/Xen: Compute the low RAM memory size in the BDA according to the e820



On Mon, Nov 14, 2011 at 1:11 AM, Kevin O'Connor <kevin@xxxxxxxxxxxx> wrote:
>
> That wont work reliably - SeaBIOS (and option roms) can grow the EBDA.
> It's not realistic to put a whole in the middle of the first 640k.
>

When you say "grow" do you mean grow downwards ? Because if not, the
ACPI info structure lives in 9F000, so there shouldn't be any problem
reporting the 0-9F000 range as the memory size in the BDA.

> [...]
>> diff --git a/src/memmap.c b/src/memmap.c
>> index 20ccae0..36750f5 100644
>> --- a/src/memmap.c
>> +++ b/src/memmap.c
>> @@ -7,6 +7,7 @@
>> Â#include "memmap.h" // struct e820entry
>> Â#include "util.h" // dprintf.h
>> Â#include "biosvar.h" // SET_EBDA
>> +#include "config.h" // CONFIG_*
>>
>>
>> Â/****************************************************************
>> @@ -133,6 +134,34 @@ add_e820(u64 start, u64 size, u32 type)
>> Â Â Â//dump_map();
>> Â}
>>
>> +// Try to find the size of the usable RAM memory in the
>> +// first megabyte of RAM.
>> +u32
>> +get_lowram_size(void)
>> +{
>> + Â Âu32 lowram_end = 0;
>> +
>> + Â Âint i;
>> + Â Âfor (i=0; i<e820_count; i++) {
>> + Â Â Â Âstruct e820entry *e = &e820_list[i];
>> + Â Â Â Âu64 e_end = e->start + e->size;
>> +
>> + Â Â Â Âif (e->type != E820_RAM)
>> + Â Â Â Â Â Âcontinue;
>> +
>> + Â Â Â Âif (e_end <= 0x100000 && /* 1M */
>> + Â Â Â Â Â Âe_end > lowram_end)
>
> Shouldn't this read (e_end <= BUILD_LOWRAM_END)? ÂOtherwise, if for
> some strange reason an e820 entry pointed to ram above 0xa0000 but
> below 1meg, it would break things.
>

My bad, I just realized that. Maybe a more correct (and simpler)
approach would be to look for the range marked as RAM which starts at
0x0 and simply use its size (and check that it doesn't go past
0xA0000). Would that sound right ?

> [...]
>> --- a/src/post.c
>> +++ b/src/post.c
>> @@ -82,18 +82,21 @@ init_bda(void)
>> Â Â Âstruct bios_data_area_s *bda = MAKE_FLATPTR(SEG_BDA, 0);
>> Â Â Âmemset(bda, 0, sizeof(*bda));
>>
>> - Â Âint esize = EBDA_SIZE_START;
>> - Â ÂSET_BDA(mem_size_kb, BUILD_LOWRAM_END/1024 - esize);
>> Â Â Âu16 ebda_seg = EBDA_SEGMENT_START;
>> Â Â ÂSET_BDA(ebda_seg, ebda_seg);
>
> As above, this doesn't look right - SeaBIOS will still locate the EBDA
> at 9fc00 and nothing will stop it from growing it over the 9f000 area.
>

The EBDA is a standard bios structure, can't we safely assume that
it's size will hardly change ? If not, would you suggest that this
ACPI info structure should be placed at a different location ? The
problem with this is that it has to be in a location with a fixed
address, and preferably in a location which is accessible by any AML
interpreter.

-- 
Julian

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.