Skip to content

Commit

Permalink
x86-64: Reorganize io_64.h
Browse files Browse the repository at this point in the history
Make it more similar to io_32.h.  No real code changes.

Signed-off-by: Brian Gerst <brgerst@gmail.com>
LKML-Reference: <1265380629-3212-4-git-send-email-brgerst@gmail.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
  • Loading branch information
Brian Gerst authored and H. Peter Anvin committed Feb 5, 2010
1 parent bd2984e commit 2e16fc7
Showing 1 changed file with 49 additions and 41 deletions.
90 changes: 49 additions & 41 deletions arch/x86/include/asm/io_64.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,54 @@
* - Arnaldo Carvalho de Melo <acme@conectiva.com.br>
*/

#ifdef __KERNEL__

#include <asm-generic/iomap.h>

#include <linux/vmalloc.h>

/*
* Convert a virtual cached pointer to an uncached pointer
*/
#define xlate_dev_kmem_ptr(p) p

void memset_io(volatile void __iomem *a, int b, size_t c);

void __memcpy_fromio(void *, unsigned long, unsigned);
static inline void memcpy_fromio(void *to, const volatile void __iomem *from,
unsigned len)
{
__memcpy_fromio(to, (unsigned long)from, len);
}

void __memcpy_toio(unsigned long, const void *, unsigned);
static inline void memcpy_toio(volatile void __iomem *to, const void *from,
unsigned len)
{
__memcpy_toio((unsigned long)to, from, len);
}

/*
* ISA space is 'always mapped' on a typical x86 system, no need to
* explicitly ioremap() it. The fact that the ISA IO space is mapped
* to PAGE_OFFSET is pure coincidence - it does not mean ISA values
* are physical addresses. The following constant pointer can be
* used as the IO-area pointer (it can be iounmapped as well, so the
* analogy with PCI is quite large):
*/
#define __ISA_IO_base ((char __iomem *)(PAGE_OFFSET))

/*
* Cache management
*
* This needed for two cases
* 1. Out of order aware processors
* 2. Accidentally out of order processors (PPro errata #51)
*/
#define flush_write_buffers() do { } while (0)

#endif /* __KERNEL__ */

extern void native_io_delay(void);

extern int io_delay_type;
Expand All @@ -53,6 +101,7 @@ static inline void slow_down_io(void)
native_io_delay();
#endif
}

#endif

/*
Expand Down Expand Up @@ -136,46 +185,5 @@ __OUTS(b)
__OUTS(w)
__OUTS(l)

#if defined(__KERNEL__) && defined(__x86_64__)

#include <linux/vmalloc.h>

#include <asm-generic/iomap.h>

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

static inline void memcpy_fromio(void *to, const volatile void __iomem *from,
unsigned len)
{
__memcpy_fromio(to, (unsigned long)from, len);
}

static inline void memcpy_toio(volatile void __iomem *to, const void *from,
unsigned len)
{
__memcpy_toio((unsigned long)to, from, len);
}

void memset_io(volatile void __iomem *a, int b, size_t c);

/*
* ISA space is 'always mapped' on a typical x86 system, no need to
* explicitly ioremap() it. The fact that the ISA IO space is mapped
* to PAGE_OFFSET is pure coincidence - it does not mean ISA values
* are physical addresses. The following constant pointer can be
* used as the IO-area pointer (it can be iounmapped as well, so the
* analogy with PCI is quite large):
*/
#define __ISA_IO_base ((char __iomem *)(PAGE_OFFSET))

#define flush_write_buffers()

/*
* Convert a virtual cached pointer to an uncached pointer
*/
#define xlate_dev_kmem_ptr(p) p

#endif /* __KERNEL__ */

#endif /* _ASM_X86_IO_64_H */

0 comments on commit 2e16fc7

Please sign in to comment.