Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 136815
b: refs/heads/master
c: 976e8f6
h: refs/heads/master
i:
  136813: 4b1315d
  136811: f143b96
  136807: aa1978d
  136799: 87405f0
v: v3
  • Loading branch information
Jeremy Fitzhardinge committed Feb 6, 2009
1 parent 68a8b37 commit 00629ed
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 95 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 26c8e3179933c5c9071b16db76ab6de58a787d06
refs/heads/master: 976e8f677e42757e5586ea04a9ac8bb8ddaa037e
59 changes: 59 additions & 0 deletions trunk/arch/x86/include/asm/io.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

#include <linux/compiler.h>
#include <asm-generic/int-ll64.h>
#include <asm/page.h>

#define build_mmio_read(name, size, type, reg, barrier) \
static inline type name(const volatile void __iomem *addr) \
Expand Down Expand Up @@ -80,6 +81,64 @@ static inline void writeq(__u64 val, volatile void __iomem *addr)
#define readq readq
#define writeq writeq

/**
* virt_to_phys - map virtual addresses to physical
* @address: address to remap
*
* The returned physical address is the physical (CPU) mapping for
* the memory address given. It is only valid to use this function on
* addresses directly mapped or allocated via kmalloc.
*
* This function does not give bus mappings for DMA transfers. In
* almost all conceivable cases a device driver should not be using
* this function
*/

static inline phys_addr_t virt_to_phys(volatile void *address)
{
return __pa(address);
}

/**
* phys_to_virt - map physical address to virtual
* @address: address to remap
*
* The returned virtual address is a current CPU mapping for
* the memory address given. It is only valid to use this function on
* addresses that have a kernel mapping
*
* This function does not handle bus mappings for DMA transfers. In
* almost all conceivable cases a device driver should not be using
* this function
*/

static inline void *phys_to_virt(phys_addr_t address)
{
return __va(address);
}

/*
* Change "struct page" to physical address.
*/
#define page_to_phys(page) ((dma_addr_t)page_to_pfn(page) << PAGE_SHIFT)

/*
* ISA I/O bus memory addresses are 1:1 with the physical address.
*/
#define isa_virt_to_bus virt_to_phys
#define isa_page_to_bus page_to_phys
#define isa_bus_to_virt phys_to_virt

/*
* However PCI ones are not necessarily 1:1 and therefore these interfaces
* are forbidden in portable PCI drivers.
*
* Allow them on x86 for legacy drivers, though.
*/
#define virt_to_bus virt_to_phys
#define bus_to_virt phys_to_virt


#ifdef CONFIG_X86_32
# include "io_32.h"
#else
Expand Down
57 changes: 0 additions & 57 deletions trunk/arch/x86/include/asm/io_32.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,47 +53,6 @@
*/
#define xlate_dev_kmem_ptr(p) p

/**
* virt_to_phys - map virtual addresses to physical
* @address: address to remap
*
* The returned physical address is the physical (CPU) mapping for
* the memory address given. It is only valid to use this function on
* addresses directly mapped or allocated via kmalloc.
*
* This function does not give bus mappings for DMA transfers. In
* almost all conceivable cases a device driver should not be using
* this function
*/

static inline unsigned long virt_to_phys(volatile void *address)
{
return __pa(address);
}

/**
* phys_to_virt - map physical address to virtual
* @address: address to remap
*
* The returned virtual address is a current CPU mapping for
* the memory address given. It is only valid to use this function on
* addresses that have a kernel mapping
*
* This function does not handle bus mappings for DMA transfers. In
* almost all conceivable cases a device driver should not be using
* this function
*/

static inline void *phys_to_virt(unsigned long address)
{
return __va(address);
}

/*
* Change "struct page" to physical address.
*/
#define page_to_phys(page) ((dma_addr_t)page_to_pfn(page) << PAGE_SHIFT)

/**
* ioremap - map bus memory into CPU space
* @offset: bus address of the memory
Expand Down Expand Up @@ -123,22 +82,6 @@ static inline void __iomem *ioremap(resource_size_t offset, unsigned long size)

extern void iounmap(volatile void __iomem *addr);

/*
* ISA I/O bus memory addresses are 1:1 with the physical address.
*/
#define isa_virt_to_bus virt_to_phys
#define isa_page_to_bus page_to_phys
#define isa_bus_to_virt phys_to_virt

/*
* However PCI ones are not necessarily 1:1 and therefore these interfaces
* are forbidden in portable PCI drivers.
*
* Allow them on x86 for legacy drivers, though.
*/
#define virt_to_bus virt_to_phys
#define bus_to_virt phys_to_virt

static inline void
memset_io(volatile void __iomem *addr, unsigned char val, int count)
{
Expand Down
37 changes: 0 additions & 37 deletions trunk/arch/x86/include/asm/io_64.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,27 +142,6 @@ __OUTS(l)

#include <linux/vmalloc.h>

#ifndef __i386__
/*
* Change virtual addresses to physical addresses and vv.
* These are pretty trivial
*/
static inline unsigned long virt_to_phys(volatile void *address)
{
return __pa(address);
}

static inline void *phys_to_virt(unsigned long address)
{
return __va(address);
}
#endif

/*
* Change "struct page" to physical address.
*/
#define page_to_phys(page) ((dma_addr_t)page_to_pfn(page) << PAGE_SHIFT)

#include <asm-generic/iomap.h>

/*
Expand All @@ -187,22 +166,6 @@ extern void iounmap(volatile void __iomem *addr);

extern void __iomem *fix_ioremap(unsigned idx, unsigned long phys);

/*
* ISA I/O bus memory addresses are 1:1 with the physical address.
*/
#define isa_virt_to_bus virt_to_phys
#define isa_page_to_bus page_to_phys
#define isa_bus_to_virt phys_to_virt

/*
* However PCI ones are not necessarily 1:1 and therefore these interfaces
* are forbidden in portable PCI drivers.
*
* Allow them on x86 for legacy drivers, though.
*/
#define virt_to_bus virt_to_phys
#define bus_to_virt phys_to_virt

void __memcpy_fromio(void *, unsigned long, unsigned);
void __memcpy_toio(unsigned long, const void *, unsigned);

Expand Down

0 comments on commit 00629ed

Please sign in to comment.