This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Kernel's determination of DRAM size

I am looking for clarification of the kernel's means of determining the DRAM size.  For background, our board is closely derived from the AM3517evm, and has 512MB DRAM.

We define our DRAM size as 512MB in our u-boot config header file in a symbol called CONFIG_SYS_CS0_SIZE.  Until recently, we were passing the DRAM size to the kernel via bootargs with 'mem=512M'.

But, we observed that even without the bootargs/mem arg, the kernel correctly figures out the DRAM size.  It appears that the kernel must read the DRAM configuration register written by u-boot, to figure out DRAM size on its own.

That suggests the only point of the bootargs/mem arg is if one wants the kernel to override that u-boot DRAM setup for some reason.  If one is content with the u-boot setup, then the bootargs/mem arg may be safely omitted.

Is that correct?

Thanks,
Ron

  • Hey Ron,

    u-boot passes a set of parameters to the kernel through a mechanism known as ATAG. It's basically just a list of structs with various info about the system. One of the parameters it can pass (and is required to pass) is called ATAG_MEM. This parameter defines the physical RAM layout that Linux uses. If you look in the u-boot source code in:

    cpu/arm_cortexa8/omap3/emif4.c

    You will see that the dram_init() function calls get_sdr_cs_size(), which returns CONFIG_SYS_CS0_SIZE, which you said you defined as 512 MB. dram_init() then loads the board struct's bi_dram members using that returned value.

    Later, in lib_arm/bootm.c, in setup_memory_tags() it takes that board struct and creates ATAG_MEM parameters that end up being passed to the kernel.

    So I don't think the kernel is actually doing anything like looking at the controller registers -- it's just using the ATAG_MEM struct passed to it. I'd say you're definitely safe omitting the mem arg. I don't think I'm using it on the Craneboard...

    Hope this helps,

    Doug

  • Doug,

    Thank you for your response.  That's great information, and gives me what I needed.  I expect it will help out in other areas downstream, also.

    Ron