Skip to contentSkip to conversation

page_to_phys

DISCUSSION Kristoffer Glembo 2 participants 3 messages Oct 9, 2009 – Oct 11, 2009

lore
Share & tools
lore
#0 lore raw

Hi,

Currently in io_32.h page_to_phys is defined as:

#define page_to_phys(page) (((page) - mem_map) << PAGE_SHIFT)

Should it not be:

#define page_to_phys(page) ((((page) - mem_map) << PAGE_SHIFT) + phys_base)

or perhaps:

#define page_to_phys(page) ((dma_addr_t)page_to_pfn(page) << PAGE_SHIFT)

Best regards,
Kristoffer Glembo

#1 lore raw

From: Kristoffer Glembo <[email protected]>
Date: Fri, 09 Oct 2009 16:02:14 +0200

Quoted 6 lines

Currently in io_32.h page_to_phys is defined as:

#define page_to_phys(page) (((page) - mem_map) << PAGE_SHIFT)

Should it not be:

Quoted 7 lines

#define page_to_phys(page) ((((page) - mem_map) << PAGE_SHIFT) + #phys_base)

or perhaps:

#define page_to_phys(page) ((dma_addr_t)page_to_pfn(page) << #PAGE_SHIFT)

Sparc 32-bit doesn't offset the mem_map at phys_base.

What is offset by phys_base is what gets mapped at PAGE_OFFSET virtually.

That's why the things that translate between virtual and physical addresses do take phys_base into account.