[ARM] 3016/1: Replace map_desc.physical with map_desc.pfn

Patch from Deepak Saxena

Convert map_desc.physical to map_desc.pfn. This allows us to add
support for 36-bit addressed physical devices in the static maps
without having to resort to u64 variables.

Signed-off-by: Deepak Saxena <dsaxena@plexity.net>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
This commit is contained in:
Deepak Saxena 2005-10-28 15:19:11 +01:00 committed by Russell King
parent c8d2729858
commit 9769c2468d
3 changed files with 14 additions and 11 deletions

View File

@ -262,8 +262,8 @@ bootmem_init_node(int node, int initrd_node, struct meminfo *mi)
if (end_pfn < end) if (end_pfn < end)
end_pfn = end; end_pfn = end;
map.physical = mi->bank[i].start; map.pfn = __phys_to_pfn(mi->bank[i].start);
map.virtual = __phys_to_virt(map.physical); map.virtual = __phys_to_virt(mi->bank[i].start);
map.length = mi->bank[i].size; map.length = mi->bank[i].size;
map.type = MT_MEMORY; map.type = MT_MEMORY;
@ -365,7 +365,7 @@ static void __init bootmem_init(struct meminfo *mi)
#ifdef CONFIG_XIP_KERNEL #ifdef CONFIG_XIP_KERNEL
#error needs fixing #error needs fixing
p->physical = CONFIG_XIP_PHYS_ADDR & PMD_MASK; p->pfn = __phys_to_pfn(CONFIG_XIP_PHYS_ADDR & PMD_MASK);
p->virtual = (unsigned long)&_stext & PMD_MASK; p->virtual = (unsigned long)&_stext & PMD_MASK;
p->length = ((unsigned long)&_etext - p->virtual + ~PMD_MASK) & PMD_MASK; p->length = ((unsigned long)&_etext - p->virtual + ~PMD_MASK) & PMD_MASK;
p->type = MT_ROM; p->type = MT_ROM;
@ -439,14 +439,14 @@ static void __init devicemaps_init(struct machine_desc *mdesc)
* Map the cache flushing regions. * Map the cache flushing regions.
*/ */
#ifdef FLUSH_BASE #ifdef FLUSH_BASE
map.physical = FLUSH_BASE_PHYS; map.pfn = __phys_to_pfn(FLUSH_BASE_PHYS);
map.virtual = FLUSH_BASE; map.virtual = FLUSH_BASE;
map.length = PGDIR_SIZE; map.length = PGDIR_SIZE;
map.type = MT_CACHECLEAN; map.type = MT_CACHECLEAN;
create_mapping(&map); create_mapping(&map);
#endif #endif
#ifdef FLUSH_BASE_MINICACHE #ifdef FLUSH_BASE_MINICACHE
map.physical = FLUSH_BASE_PHYS + PGDIR_SIZE; map.pfn = __phys_to_pfn(FLUSH_BASE_PHYS + PGDIR_SIZE);
map.virtual = FLUSH_BASE_MINICACHE; map.virtual = FLUSH_BASE_MINICACHE;
map.length = PGDIR_SIZE; map.length = PGDIR_SIZE;
map.type = MT_MINICLEAN; map.type = MT_MINICLEAN;
@ -464,7 +464,7 @@ static void __init devicemaps_init(struct machine_desc *mdesc)
* location (0xffff0000). If we aren't using high-vectors, also * location (0xffff0000). If we aren't using high-vectors, also
* create a mapping at the low-vectors virtual address. * create a mapping at the low-vectors virtual address.
*/ */
map.physical = virt_to_phys(vectors); map.pfn = __phys_to_pfn(virt_to_phys(vectors));
map.virtual = 0xffff0000; map.virtual = 0xffff0000;
map.length = PAGE_SIZE; map.length = PAGE_SIZE;
map.type = MT_HIGH_VECTORS; map.type = MT_HIGH_VECTORS;

View File

@ -483,7 +483,7 @@ void __init create_mapping(struct map_desc *md)
if (md->virtual != vectors_base() && md->virtual < TASK_SIZE) { if (md->virtual != vectors_base() && md->virtual < TASK_SIZE) {
printk(KERN_WARNING "BUG: not creating mapping for " printk(KERN_WARNING "BUG: not creating mapping for "
"0x%08lx at 0x%08lx in user region\n", "0x%08lx at 0x%08lx in user region\n",
md->physical, md->virtual); __pfn_to_phys(md->pfn), md->virtual);
return; return;
} }
@ -491,7 +491,7 @@ void __init create_mapping(struct map_desc *md)
md->virtual >= PAGE_OFFSET && md->virtual < VMALLOC_END) { md->virtual >= PAGE_OFFSET && md->virtual < VMALLOC_END) {
printk(KERN_WARNING "BUG: mapping for 0x%08lx at 0x%08lx " printk(KERN_WARNING "BUG: mapping for 0x%08lx at 0x%08lx "
"overlaps vmalloc space\n", "overlaps vmalloc space\n",
md->physical, md->virtual); __pfn_to_phys(md->pfn), md->virtual);
} }
domain = mem_types[md->type].domain; domain = mem_types[md->type].domain;
@ -500,14 +500,14 @@ void __init create_mapping(struct map_desc *md)
prot_sect = mem_types[md->type].prot_sect | PMD_DOMAIN(domain); prot_sect = mem_types[md->type].prot_sect | PMD_DOMAIN(domain);
virt = md->virtual; virt = md->virtual;
off = md->physical - virt; off = __pfn_to_phys(md->pfn) - virt;
length = md->length; length = md->length;
if (mem_types[md->type].prot_l1 == 0 && if (mem_types[md->type].prot_l1 == 0 &&
(virt & 0xfffff || (virt + off) & 0xfffff || (virt + length) & 0xfffff)) { (virt & 0xfffff || (virt + off) & 0xfffff || (virt + length) & 0xfffff)) {
printk(KERN_WARNING "BUG: map for 0x%08lx at 0x%08lx can not " printk(KERN_WARNING "BUG: map for 0x%08lx at 0x%08lx can not "
"be mapped using pages, ignoring.\n", "be mapped using pages, ignoring.\n",
md->physical, md->virtual); __pfn_to_phys(md->pfn), md->virtual);
return; return;
} }

View File

@ -11,7 +11,7 @@
*/ */
struct map_desc { struct map_desc {
unsigned long virtual; unsigned long virtual;
unsigned long physical; unsigned long pfn;
unsigned long length; unsigned long length;
unsigned int type; unsigned int type;
}; };
@ -27,6 +27,9 @@ struct meminfo;
#define MT_ROM 6 #define MT_ROM 6
#define MT_IXP2000_DEVICE 7 #define MT_IXP2000_DEVICE 7
#define __phys_to_pfn(paddr) (paddr >> PAGE_SHIFT)
#define __pfn_to_phys(pfn) (pfn << PAGE_SHIFT)
extern void create_memmap_holes(struct meminfo *); extern void create_memmap_holes(struct meminfo *);
extern void memtable_init(struct meminfo *); extern void memtable_init(struct meminfo *);
extern void iotable_init(struct map_desc *, int); extern void iotable_init(struct map_desc *, int);