[PATCH] ARM: use memblock memory regions for "System RAM" I/O resources

Russell King - ARM Linux linux at arm.linux.org.uk
Wed Jan 12 18:52:23 EST 2011


On Wed, Jan 12, 2011 at 03:22:40PM -0800, Dima Zavin wrote:
> @@ -518,8 +518,9 @@ setup_ramdisk(int doload, int prompt, int image_start, unsigned int rd_sz)
>  }
>  
>  static void __init
> -request_standard_resources(struct meminfo *mi, struct machine_desc *mdesc)
> +request_standard_resources(struct machine_desc *mdesc)

Almost there.  This line can now be combined with the preceding line
without wrapping over the 80 column limit.

>  {
> +	struct memblock_type *mem = &memblock.memory;
>  	struct resource *res;
>  	int i;
>  
> @@ -528,14 +529,11 @@ request_standard_resources(struct meminfo *mi, struct machine_desc *mdesc)
>  	kernel_data.start   = virt_to_phys(_sdata);
>  	kernel_data.end     = virt_to_phys(_end - 1);
>  
> -	for (i = 0; i < mi->nr_banks; i++) {
> -		if (mi->bank[i].size == 0)
> -			continue;
> -
> +	for (i = 0; i < mem->cnt; i++) {

Hmm, probably shouldn't rely on that - we should be using the accessors
which memblock people have provided for us.

	for_each_memblock(memory, mem) {

>  		res = alloc_bootmem_low(sizeof(*res));
>  		res->name  = "System RAM";
> -		res->start = mi->bank[i].start;
> -		res->end   = mi->bank[i].start + mi->bank[i].size - 1;
> +		res->start = mem->regions[i].base;
> +		res->end   = mem->regions[i].base + mem->regions[i].size - 1;

		res->start = __pfn_to_phys(memblock_region_memory_base_pfn(mem));
		res->end   = __pfn_to_phys(memblock_region_memory_end_pfn(mem)) - 1;

And I'd say ignore the 80-column limit on that because of the excessively
long memblock function names.



More information about the linux-arm-kernel mailing list