* [PATCH 2.6.11.7] Remove iopa()
@ 2005-05-09 20:57 McMullan, Jason
2005-05-10 11:03 ` Pantelis Antoniou
0 siblings, 1 reply; 3+ messages in thread
From: McMullan, Jason @ 2005-05-09 20:57 UTC (permalink / raw)
To: PPC_LINUX
[-- Attachment #1.1: Type: text/plain, Size: 109 bytes --]
iopa() is stupid. Remove it.
--
Jason McMullan <jason.mcmullan@timesys.com>
TimeSys Corporation
[-- Attachment #1.2: iopa-removal.patch --]
[-- Type: text/x-patch, Size: 6678 bytes --]
--- linux-2.6.11.7/arch/ppc/8xx_io/fec.c 2005-05-09 16:53:52.000000000 -0400
+++ linux-2.6.11.7-noiopa/arch/ppc/8xx_io/fec.c 2005-05-09 16:51:27.000000000 -0400
@@ -1835,8 +1835,8 @@
/* Set receive and transmit descriptor base.
*/
- fecp->fec_r_des_start = iopa((uint)(fep->rx_bd_base));
- fecp->fec_x_des_start = iopa((uint)(fep->tx_bd_base));
+ fecp->fec_r_des_start = virt_to_phys(fep->rx_bd_base);
+ fecp->fec_x_des_start = virt_to_phys(fep->tx_bd_base);
fep->dirty_tx = fep->cur_tx = fep->tx_bd_base;
fep->cur_rx = fep->rx_bd_base;
--- linux-2.6.11.7/arch/ppc/kernel/ppc_ksyms.c 2005-05-09 16:53:52.000000000 -0400
+++ linux-2.6.11.7-noiopa/arch/ppc/kernel/ppc_ksyms.c 2005-05-09 16:43:53.000000000 -0400
@@ -146,8 +146,10 @@
EXPORT_SYMBOL(_outsw_ns);
EXPORT_SYMBOL(_insl_ns);
EXPORT_SYMBOL(_outsl_ns);
-EXPORT_SYMBOL(iopa);
-EXPORT_SYMBOL(mm_ptov);
+#ifdef CONFIG_APUS
+EXPORT_SYMBOL(virt_to_bus);
+EXPORT_SYMBOL(bus_to_virt);
+#endif
EXPORT_SYMBOL(ioremap);
#ifdef CONFIG_44x
EXPORT_SYMBOL(ioremap64);
--- linux-2.6.11.7/arch/ppc/mm/pgtable.c 2005-05-09 16:53:52.000000000 -0400
+++ linux-2.6.11.7-noiopa/arch/ppc/mm/pgtable.c 2005-05-09 16:49:35.000000000 -0400
@@ -403,10 +403,11 @@
return(retval);
}
+#ifdef CONFIG_APUS
/* Find physical address for this virtual address. Normally used by
* I/O functions, but anyone can call it.
*/
-unsigned long iopa(unsigned long addr)
+unsigned long virt_to_bus(void *addr)
{
unsigned long pa;
@@ -441,18 +442,11 @@
return(pa);
}
-/* This is will find the virtual address for a physical one....
- * Swiped from APUS, could be dangerous :-).
- * This is only a placeholder until I really find a way to make this
- * work. -- Dan
- */
-unsigned long
-mm_ptov (unsigned long paddr)
+void *bus_to_virt(unsigned long paddr)
{
- unsigned long ret;
-#if 0
+ void *ret;
if (paddr < 16*1024*1024)
- ret = ZTWO_VADDR(paddr);
+ ret = (void *)ZTWO_VADDR(paddr);
else {
int i;
@@ -466,16 +460,13 @@
goto exit;
}
}
-
- ret = (unsigned long) __va(paddr);
+
+ ret = (void *) __va(paddr);
}
exit:
#ifdef DEBUGPV
printk ("PTOV(%lx)=%lx\n", paddr, ret);
#endif
-#else
- ret = (unsigned long)paddr + KERNELBASE;
-#endif
return ret;
}
-
+#endif /* CONFIG_APUS */
--- linux-2.6.11.7/arch/ppc/platforms/apus_setup.c 2005-05-09 16:53:52.000000000 -0400
+++ linux-2.6.11.7-noiopa/arch/ppc/platforms/apus_setup.c 2005-05-09 16:47:38.000000000 -0400
@@ -385,34 +385,6 @@
}
}
-unsigned long mm_ptov (unsigned long paddr)
-{
- unsigned long ret;
- if (paddr < 16*1024*1024)
- ret = ZTWO_VADDR(paddr);
- else {
- int i;
-
- for (i = 0; i < kmap_chunk_count;){
- unsigned long phys = kmap_chunks[i++];
- unsigned long size = kmap_chunks[i++];
- unsigned long virt = kmap_chunks[i++];
- if (paddr >= phys
- && paddr < (phys + size)){
- ret = virt + paddr - phys;
- goto exit;
- }
- }
-
- ret = (unsigned long) __va(paddr);
- }
-exit:
-#ifdef DEBUGPV
- printk ("PTOV(%lx)=%lx\n", paddr, ret);
-#endif
- return ret;
-}
-
int mm_end_of_chunk (unsigned long addr, int len)
{
if (memory[0].addr + memory[0].size == addr + len)
--- linux-2.6.11.7/arch/ppc/syslib/m8260_pci_erratum9.c 2005-05-09 16:53:52.000000000 -0400
+++ linux-2.6.11.7-noiopa/arch/ppc/syslib/m8260_pci_erratum9.c 2005-05-09 16:44:59.000000000 -0400
@@ -261,7 +261,7 @@
int readb(volatile unsigned char *addr)
{
u8 val;
- unsigned long pa = iopa((unsigned long) addr);
+ unsigned long pa = virt_to_bus(addr);
if (!is_pci_mem(pa))
return in_8(addr);
@@ -273,7 +273,7 @@
int readw(volatile unsigned short *addr)
{
u16 val;
- unsigned long pa = iopa((unsigned long) addr);
+ unsigned long pa = virt_to_bus(addr);
if (!is_pci_mem(pa))
return in_le16(addr);
@@ -285,7 +285,7 @@
unsigned readl(volatile unsigned *addr)
{
u32 val;
- unsigned long pa = iopa((unsigned long) addr);
+ unsigned long pa = virt_to_bus(addr);
if (!is_pci_mem(pa))
return in_le32(addr);
--- linux-2.6.11.7/drivers/net/fec_8xx/fec_main.c 2005-05-09 16:53:52.000000000 -0400
+++ linux-2.6.11.7-noiopa/drivers/net/fec_8xx/fec_main.c 2005-05-09 16:52:52.000000000 -0400
@@ -278,8 +278,8 @@
/*
* Set receive and transmit descriptor base.
*/
- FW(fecp, r_des_start, iopa((__u32) (fep->rx_bd_base)));
- FW(fecp, x_des_start, iopa((__u32) (fep->tx_bd_base)));
+ FW(fecp, r_des_start, virt_to_bus(fep->rx_bd_base));
+ FW(fecp, x_des_start, virt_to_bus(fep->tx_bd_base));
fep->dirty_tx = fep->cur_tx = fep->tx_bd_base;
fep->tx_free = fep->tx_ring;
--- linux-2.6.11.7/include/asm-ppc/io.h 2005-05-09 16:53:52.000000000 -0400
+++ linux-2.6.11.7-noiopa/include/asm-ppc/io.h 2005-05-09 16:40:39.000000000 -0400
@@ -376,8 +376,6 @@
#endif
#define ioremap_nocache(addr, size) ioremap((addr), (size))
extern void iounmap(volatile void __iomem *addr);
-extern unsigned long iopa(unsigned long addr);
-extern unsigned long mm_ptov(unsigned long addr) __attribute_const__;
extern void io_block_mapping(unsigned long virt, phys_addr_t phys,
unsigned int size, int flags);
@@ -388,27 +386,24 @@
* address from the PCI point of view, thus buffer addresses also
* have to be modified [mapped] appropriately.
*/
+#ifdef CONFIG_APUS
+extern unsigned long virt_to_bus(volatile void * address);
+extern void * bus_to_virt(unsigned long address);
+#else
extern inline unsigned long virt_to_bus(volatile void * address)
{
-#ifndef CONFIG_APUS
if (address == (void *)0)
return 0;
return (unsigned long)address - KERNELBASE + PCI_DRAM_OFFSET;
-#else
- return iopa ((unsigned long) address);
-#endif
}
extern inline void * bus_to_virt(unsigned long address)
{
-#ifndef CONFIG_APUS
if (address == 0)
return NULL;
return (void *)(address - PCI_DRAM_OFFSET + KERNELBASE);
-#else
- return (void*) mm_ptov (address);
-#endif
}
+#endif
/*
* Change virtual addresses to physical addresses and vv, for
--- linux-2.6.11.7/include/asm-ppc/pgtable.h 2005-05-09 16:53:52.000000000 -0400
+++ linux-2.6.11.7-noiopa/include/asm-ppc/pgtable.h 2005-05-09 16:38:44.000000000 -0400
@@ -691,7 +691,6 @@
extern void cache_clear(__u32 addr, int length);
extern void cache_push(__u32 addr, int length);
extern int mm_end_of_chunk (unsigned long addr, int len);
-extern unsigned long iopa(unsigned long addr);
extern unsigned long mm_ptov(unsigned long addr) __attribute_const__;
/* Values for nocacheflag and cmode */
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH 2.6.11.7] Remove iopa()
2005-05-09 20:57 [PATCH 2.6.11.7] Remove iopa() McMullan, Jason
@ 2005-05-10 11:03 ` Pantelis Antoniou
2005-05-10 11:10 ` Pantelis Antoniou
0 siblings, 1 reply; 3+ messages in thread
From: Pantelis Antoniou @ 2005-05-10 11:03 UTC (permalink / raw)
To: McMullan, Jason; +Cc: PPC_LINUX
McMullan, Jason wrote:
> iopa() is stupid. Remove it.
>
>
>
Jason take a look at virt_to_phys...
extern inline unsigned long virt_to_phys(volatile void * address)
{
#ifndef CONFIG_APUS
return (unsigned long) address - KERNELBASE;
#else
return iopa ((unsigned long) address);
#endif
}
Maybe virt_to_xxx needs to go too?
Regards
Pantelis
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH 2.6.11.7] Remove iopa()
2005-05-10 11:03 ` Pantelis Antoniou
@ 2005-05-10 11:10 ` Pantelis Antoniou
0 siblings, 0 replies; 3+ messages in thread
From: Pantelis Antoniou @ 2005-05-10 11:10 UTC (permalink / raw)
To: Pantelis Antoniou; +Cc: PPC_LINUX
Pantelis Antoniou wrote:
> McMullan, Jason wrote:
>
>> iopa() is stupid. Remove it.
>>
>>
>>
>
> Jason take a look at virt_to_phys...
>
> extern inline unsigned long virt_to_phys(volatile void * address)
> {
> #ifndef CONFIG_APUS
> return (unsigned long) address - KERNELBASE;
> #else
> return iopa ((unsigned long) address);
> #endif
> }
>
> Maybe virt_to_xxx needs to go too?
>
Oops sorry. Maybe APUS needs to go instead :)
Regards
Pantelis
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2005-05-10 11:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-09 20:57 [PATCH 2.6.11.7] Remove iopa() McMullan, Jason
2005-05-10 11:03 ` Pantelis Antoniou
2005-05-10 11:10 ` Pantelis Antoniou
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).