Commit bf656998 authored by David S. Miller's avatar David S. Miller

Merge branch 'sparc32_generic_io_h'

Sam Ravnborg says:

====================
sparc32: introduce asm-generic

Inspired by Michal Simek <monstr@monstr.eu> this patch-set
introduces asm-generic/io.h for sparc32.

As the diff-stat tells this was a nice code-reduction.

The changes are done on top of the previous sent sparse warning cleanup.
But I do not expect any difficult conflicts if applied alone.

leon_pci + pcic are touched because they had local
and identical implementations of functiones that are
static inline in asm-generic/io.h

leon_pci_grpci1 + leon_pci_grpci2 are touched becuse they
used a sparc spacific implmentation of swab32.
They have just been changed to use the global variant.

I also looked at sparc64 - but there were to many
sparc64 assembler implementations of the io
functons - and the generic io.h did not support this mix.

The last patch kills a few defines in io.h for sbus.
I assume they were introduced before the functions
were all shifted over to __iomem style pointers.
The same could be done for sparc64 - but then
there were even more of the same so I left
this for another time.

The patch-set has been build tested only.
My attempts to test this using qemu have failed as
the qemu version I have errors out.
And my fedora box are mssing some libs to build
qemu from source :-(
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 8cf749a8 c3373da9
This diff is collapsed.
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
/* BIO layer definitions. */ /* BIO layer definitions. */
extern unsigned long kern_base, kern_size; extern unsigned long kern_base, kern_size;
#define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT)
static inline u8 _inb(unsigned long addr) static inline u8 _inb(unsigned long addr)
{ {
......
#ifndef ___ASM_SPARC_PAGE_H #ifndef ___ASM_SPARC_PAGE_H
#define ___ASM_SPARC_PAGE_H #define ___ASM_SPARC_PAGE_H
#define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT)
#if defined(__sparc__) && defined(__arch64__) #if defined(__sparc__) && defined(__arch64__)
#include <asm/page_64.h> #include <asm/page_64.h>
#else #else
......
...@@ -98,82 +98,3 @@ resource_size_t pcibios_align_resource(void *data, const struct resource *res, ...@@ -98,82 +98,3 @@ resource_size_t pcibios_align_resource(void *data, const struct resource *res,
{ {
return res->start; return res->start;
} }
/* in/out routines taken from pcic.c
*
* This probably belongs here rather than ioport.c because
* we do not want this crud linked into SBus kernels.
* Also, think for a moment about likes of floppy.c that
* include architecture specific parts. They may want to redefine ins/outs.
*
* We do not use horrible macros here because we want to
* advance pointer by sizeof(size).
*/
void outsb(unsigned long addr, const void *src, unsigned long count)
{
while (count) {
count -= 1;
outb(*(const char *)src, addr);
src += 1;
/* addr += 1; */
}
}
EXPORT_SYMBOL(outsb);
void outsw(unsigned long addr, const void *src, unsigned long count)
{
while (count) {
count -= 2;
outw(*(const short *)src, addr);
src += 2;
/* addr += 2; */
}
}
EXPORT_SYMBOL(outsw);
void outsl(unsigned long addr, const void *src, unsigned long count)
{
while (count) {
count -= 4;
outl(*(const long *)src, addr);
src += 4;
/* addr += 4; */
}
}
EXPORT_SYMBOL(outsl);
void insb(unsigned long addr, void *dst, unsigned long count)
{
while (count) {
count -= 1;
*(unsigned char *)dst = inb(addr);
dst += 1;
/* addr += 1; */
}
}
EXPORT_SYMBOL(insb);
void insw(unsigned long addr, void *dst, unsigned long count)
{
while (count) {
count -= 2;
*(unsigned short *)dst = inw(addr);
dst += 2;
/* addr += 2; */
}
}
EXPORT_SYMBOL(insw);
void insl(unsigned long addr, void *dst, unsigned long count)
{
while (count) {
count -= 4;
/*
* XXX I am sure we are in for an unaligned trap here.
*/
*(unsigned long *)dst = inl(addr);
dst += 4;
/* addr += 4; */
}
}
EXPORT_SYMBOL(insl);
...@@ -144,7 +144,7 @@ static int grpci1_cfg_r32(struct grpci1_priv *priv, unsigned int bus, ...@@ -144,7 +144,7 @@ static int grpci1_cfg_r32(struct grpci1_priv *priv, unsigned int bus,
grpci1_cfg_w32(priv, TGT, 0, PCI_COMMAND, tmp); grpci1_cfg_w32(priv, TGT, 0, PCI_COMMAND, tmp);
} else { } else {
/* Bus always little endian (unaffected by byte-swapping) */ /* Bus always little endian (unaffected by byte-swapping) */
*val = flip_dword(tmp); *val = swab32(tmp);
} }
return 0; return 0;
...@@ -197,7 +197,7 @@ static int grpci1_cfg_w32(struct grpci1_priv *priv, unsigned int bus, ...@@ -197,7 +197,7 @@ static int grpci1_cfg_w32(struct grpci1_priv *priv, unsigned int bus,
pci_conf = (unsigned int *) (priv->pci_conf | pci_conf = (unsigned int *) (priv->pci_conf |
(devfn << 8) | (where & 0xfc)); (devfn << 8) | (where & 0xfc));
LEON3_BYPASS_STORE_PA(pci_conf, flip_dword(val)); LEON3_BYPASS_STORE_PA(pci_conf, swab32(val));
return 0; return 0;
} }
......
...@@ -270,7 +270,7 @@ static int grpci2_cfg_r32(struct grpci2_priv *priv, unsigned int bus, ...@@ -270,7 +270,7 @@ static int grpci2_cfg_r32(struct grpci2_priv *priv, unsigned int bus,
*val = 0xffffffff; *val = 0xffffffff;
} else { } else {
/* Bus always little endian (unaffected by byte-swapping) */ /* Bus always little endian (unaffected by byte-swapping) */
*val = flip_dword(tmp); *val = swab32(tmp);
} }
return 0; return 0;
...@@ -328,7 +328,7 @@ static int grpci2_cfg_w32(struct grpci2_priv *priv, unsigned int bus, ...@@ -328,7 +328,7 @@ static int grpci2_cfg_w32(struct grpci2_priv *priv, unsigned int bus,
pci_conf = (unsigned int *) (priv->pci_conf | pci_conf = (unsigned int *) (priv->pci_conf |
(devfn << 8) | (where & 0xfc)); (devfn << 8) | (where & 0xfc));
LEON3_BYPASS_STORE_PA(pci_conf, flip_dword(val)); LEON3_BYPASS_STORE_PA(pci_conf, swab32(val));
/* Wait until GRPCI2 signals that CFG access is done, it should be /* Wait until GRPCI2 signals that CFG access is done, it should be
* done instantaneously unless a DMA operation is ongoing... * done instantaneously unless a DMA operation is ongoing...
......
...@@ -783,7 +783,7 @@ int pcibios_enable_device(struct pci_dev *pdev, int mask) ...@@ -783,7 +783,7 @@ int pcibios_enable_device(struct pci_dev *pdev, int mask)
void pcic_nmi(unsigned int pend, struct pt_regs *regs) void pcic_nmi(unsigned int pend, struct pt_regs *regs)
{ {
pend = flip_dword(pend); pend = swab32(pend);
if (!pcic_speculative || (pend & PCI_SYS_INT_PENDING_PIO) == 0) { if (!pcic_speculative || (pend & PCI_SYS_INT_PENDING_PIO) == 0) {
/* /*
...@@ -875,82 +875,4 @@ void __init sun4m_pci_init_IRQ(void) ...@@ -875,82 +875,4 @@ void __init sun4m_pci_init_IRQ(void)
sparc_config.load_profile_irq = pcic_load_profile_irq; sparc_config.load_profile_irq = pcic_load_profile_irq;
} }
/*
* This probably belongs here rather than ioport.c because
* we do not want this crud linked into SBus kernels.
* Also, think for a moment about likes of floppy.c that
* include architecture specific parts. They may want to redefine ins/outs.
*
* We do not use horrible macros here because we want to
* advance pointer by sizeof(size).
*/
void outsb(unsigned long addr, const void *src, unsigned long count)
{
while (count) {
count -= 1;
outb(*(const char *)src, addr);
src += 1;
/* addr += 1; */
}
}
EXPORT_SYMBOL(outsb);
void outsw(unsigned long addr, const void *src, unsigned long count)
{
while (count) {
count -= 2;
outw(*(const short *)src, addr);
src += 2;
/* addr += 2; */
}
}
EXPORT_SYMBOL(outsw);
void outsl(unsigned long addr, const void *src, unsigned long count)
{
while (count) {
count -= 4;
outl(*(const long *)src, addr);
src += 4;
/* addr += 4; */
}
}
EXPORT_SYMBOL(outsl);
void insb(unsigned long addr, void *dst, unsigned long count)
{
while (count) {
count -= 1;
*(unsigned char *)dst = inb(addr);
dst += 1;
/* addr += 1; */
}
}
EXPORT_SYMBOL(insb);
void insw(unsigned long addr, void *dst, unsigned long count)
{
while (count) {
count -= 2;
*(unsigned short *)dst = inw(addr);
dst += 2;
/* addr += 2; */
}
}
EXPORT_SYMBOL(insw);
void insl(unsigned long addr, void *dst, unsigned long count)
{
while (count) {
count -= 4;
/*
* XXX I am sure we are in for an unaligned trap here.
*/
*(unsigned long *)dst = inl(addr);
dst += 4;
/* addr += 4; */
}
}
EXPORT_SYMBOL(insl);
subsys_initcall(pcic_init); subsys_initcall(pcic_init);
...@@ -41,7 +41,7 @@ lib-$(CONFIG_SPARC64) += GENpatch.o GENpage.o GENbzero.o ...@@ -41,7 +41,7 @@ lib-$(CONFIG_SPARC64) += GENpatch.o GENpage.o GENbzero.o
lib-$(CONFIG_SPARC64) += copy_in_user.o user_fixup.o memmove.o lib-$(CONFIG_SPARC64) += copy_in_user.o user_fixup.o memmove.o
lib-$(CONFIG_SPARC64) += mcount.o ipcsum.o xor.o hweight.o ffs.o lib-$(CONFIG_SPARC64) += mcount.o ipcsum.o xor.o hweight.o ffs.o
obj-y += iomap.o obj-$(CONFIG_SPARC64) += iomap.o
obj-$(CONFIG_SPARC32) += atomic32.o ucmpdi2.o obj-$(CONFIG_SPARC32) += atomic32.o ucmpdi2.o
obj-y += ksyms.o obj-y += ksyms.o
obj-$(CONFIG_SPARC64) += PeeCeeI.o obj-$(CONFIG_SPARC64) += PeeCeeI.o
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment