public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: "David S. Miller" <davem@redhat.com>
Cc: paulus@samba.org, torvalds@transmeta.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] fix ppc ioremap prototype
Date: Thu, 4 Sep 2003 11:29:15 +0200	[thread overview]
Message-ID: <20030904092915.GA16344@lst.de> (raw)
In-Reply-To: <20030904010940.5fa0e560.davem@redhat.com>

On Thu, Sep 04, 2003 at 01:09:40AM -0700, David S. Miller wrote:
> On Thu, 4 Sep 2003 09:38:45 +0200
> Christoph Hellwig <hch@lst.de> wrote:
> 
> > Umm, right, so the typedef name is also completly bogus, if we're
> > going to go that route it needs to be something likeb iocookie_t.
> 
> My suggestion is to just pass a resource and an offset to ioremap().

Here's a ioremap_resource implementation.  Tested on ppc32 with a
converted sungem driver.


--- 1.13/arch/ppc/mm/pgtable.c	Wed Sep  3 14:16:34 2003
+++ edited/arch/ppc/mm/pgtable.c	Thu Sep  4 10:53:17 2003
@@ -27,6 +27,7 @@
 #include <linux/vmalloc.h>
 #include <linux/init.h>
 #include <linux/highmem.h>
+#include <linux/ioport.h>
 
 #include <asm/pgtable.h>
 #include <asm/pgalloc.h>
@@ -62,6 +63,10 @@
 #define PGDIR_ORDER	0
 #endif
 
+#ifndef CONFIG_44x
+#define fixup_bigphys_addr(addr, size)	(addr)
+#endif
+
 pgd_t *pgd_alloc(struct mm_struct *mm)
 {
 	pgd_t *ret;
@@ -117,27 +122,18 @@
 	__free_page(pte);
 }
 
-#ifndef CONFIG_44x
 void *
-ioremap(phys_addr_t addr, unsigned long size)
+ioremap_resource(struct resource *res, unsigned long offset, unsigned long size)
 {
-	return __ioremap(addr, size, _PAGE_NO_CACHE);
-}
-#else /* CONFIG_44x */
-void *
-ioremap64(unsigned long long addr, unsigned long size)
-{
-	return __ioremap(addr, size, _PAGE_NO_CACHE);
+	return __ioremap(res->start + offset, size, _PAGE_NO_CACHE);
 }
 
 void *
-ioremap(phys_addr_t addr, unsigned long size)
+ioremap(unsigned long addr, unsigned long size)
 {
 	phys_addr_t addr64 = fixup_bigphys_addr(addr, size);;
-
-	return ioremap64(addr64, size);
+	return __ioremap(addr64, size, _PAGE_NO_CACHE);
 }
-#endif /* CONFIG_44x */
 
 void *
 __ioremap(phys_addr_t addr, unsigned long size, unsigned long flags)
--- 1.14/include/asm-alpha/io.h	Mon Feb 17 09:27:53 2003
+++ edited/include/asm-alpha/io.h	Thu Sep  4 10:40:25 2003
@@ -325,6 +325,7 @@
 {
 	return (void *) __ioremap(offset, size);
 } 
+#define ioremap_resource(res, off, size)	ioremap((res)->start + (off), (size))
 
 static inline void iounmap(void *addr)
 {
===== include/asm-arm/io.h 1.15 vs edited =====
--- 1.15/include/asm-arm/io.h	Sat Jan 25 19:32:47 2003
+++ edited/include/asm-arm/io.h	Thu Sep  4 10:40:34 2003
@@ -274,6 +274,7 @@
 #define ioremap_nocache(cookie,size)	__arch_ioremap((cookie),(size),0,1)
 #define iounmap(cookie)			__arch_iounmap(cookie)
 #endif
+#define ioremap_resource(res, off, size)	ioremap((res)->start + (off), (size))
 
 /*
  * can the hardware map this into one segment or not, given no other
===== include/asm-arm26/io.h 1.1 vs edited =====
--- 1.1/include/asm-arm26/io.h	Wed Jun  4 13:14:10 2003
+++ edited/include/asm-arm26/io.h	Thu Sep  4 10:40:44 2003
@@ -397,6 +397,7 @@
 #define ioremap_nocache(cookie,size)	__arch_ioremap((cookie),(size),0,1)
 #define iounmap(cookie)			__arch_iounmap(cookie)
 #endif
+#define ioremap_resource(res, off, size)	ioremap((res)->start + (off), (size))
 
 /*
  * DMA-consistent mapping functions.  These allocate/free a region of
===== include/asm-cris/io.h 1.8 vs edited =====
--- 1.8/include/asm-cris/io.h	Fri Jul  4 12:35:55 2003
+++ edited/include/asm-cris/io.h	Thu Sep  4 10:40:48 2003
@@ -24,6 +24,7 @@
 {
 	return __ioremap(offset, size, 0);
 }
+#define ioremap_resource(res, off, size)	ioremap((res)->start + (off), (size))
 
 extern void iounmap(void *addr);
 
===== include/asm-h8300/io.h 1.3 vs edited =====
--- 1.3/include/asm-h8300/io.h	Thu Aug 21 17:55:15 2003
+++ edited/include/asm-h8300/io.h	Thu Sep  4 10:40:55 2003
@@ -165,6 +165,7 @@
 {
 	return __ioremap(physaddr, size, IOMAP_FULL_CACHING);
 }
+#define ioremap_resource(res, off, size)	ioremap((res)->start + (off), (size))
 
 extern void iounmap(void *addr);
 
===== include/asm-i386/io.h 1.24 vs edited =====
--- 1.24/include/asm-i386/io.h	Mon Mar 24 18:23:37 2003
+++ edited/include/asm-i386/io.h	Thu Sep  4 10:41:01 2003
@@ -98,6 +98,7 @@
 #define page_to_phys(page)    ((dma_addr_t)page_to_pfn(page) << PAGE_SHIFT)
 
 extern void * __ioremap(unsigned long offset, unsigned long size, unsigned long flags);
+#define ioremap_resource(res, off, size)	__ioremap((res)->start + (off), (size), 0)
 
 /**
  * ioremap     -   map bus memory into CPU space
===== include/asm-ia64/io.h 1.17 vs edited =====
--- 1.17/include/asm-ia64/io.h	Wed Aug 20 08:13:39 2003
+++ edited/include/asm-ia64/io.h	Thu Sep  4 10:35:56 2003
@@ -383,6 +383,7 @@
 {
 	return (void *) (__IA64_UNCACHED_OFFSET | (offset));
 }
+#define ioremap_resource(res, off, size)	ioremap((res)->start + (off), (size))
 
 static inline void
 iounmap (void *addr)
===== include/asm-m68k/io.h 1.8 vs edited =====
--- 1.8/include/asm-m68k/io.h	Wed Mar  5 14:19:40 2003
+++ edited/include/asm-m68k/io.h	Thu Sep  4 10:36:30 2003
@@ -303,6 +303,7 @@
 {
 	return __ioremap(physaddr, size, IOMAP_FULL_CACHING);
 }
+#define ioremap_resource(res, off, size)	ioremap((res)->start + (off), (size))
 
 
 /* m68k caches aren't DMA coherent */
===== include/asm-m68knommu/io.h 1.2 vs edited =====
--- 1.2/include/asm-m68knommu/io.h	Thu Jul  3 03:18:30 2003
+++ edited/include/asm-m68knommu/io.h	Thu Sep  4 10:36:38 2003
@@ -157,6 +157,7 @@
 {
 	return __ioremap(physaddr, size, IOMAP_FULL_CACHING);
 }
+#define ioremap_resource(res, off, size)	ioremap((res)->start + (off), (size))
 
 extern void iounmap(void *addr);
 
===== include/asm-mips/io.h 1.5 vs edited =====
--- 1.5/include/asm-mips/io.h	Tue Jul 29 03:38:07 2003
+++ edited/include/asm-mips/io.h	Thu Sep  4 10:37:17 2003
@@ -190,6 +190,8 @@
  */
 #define ioremap(offset, size)						\
 	__ioremap((offset), (size), _CACHE_UNCACHED)
+#define ioremap_resource(res, off, size) \
+	__ioremap((res)->start + (off), (size), _CACHE_UNCACHED)
 
 /*
  * ioremap_nocache     -   map bus memory into CPU space
===== include/asm-parisc/io.h 1.4 vs edited =====
--- 1.4/include/asm-parisc/io.h	Sat Jan 11 17:46:56 2003
+++ edited/include/asm-parisc/io.h	Thu Sep  4 10:37:12 2003
@@ -26,6 +26,7 @@
 /* Memory mapped IO */
 
 extern void * __ioremap(unsigned long offset, unsigned long size, unsigned long flags);
+#define ioremap_resource(res, off, size)	__ioremap((res)->start + (off), (size), 0)
 
 extern inline void * ioremap(unsigned long offset, unsigned long size)
 {
===== include/asm-ppc/io.h 1.14 vs edited =====
--- 1.14/include/asm-ppc/io.h	Wed Sep  3 14:16:34 2003
+++ edited/include/asm-ppc/io.h	Thu Sep  4 10:46:59 2003
@@ -199,12 +199,12 @@
  * Map in an area of physical address space, for accessing
  * I/O devices etc.
  */
+struct resource;
 extern void *__ioremap(phys_addr_t address, unsigned long size,
 		       unsigned long flags);
-extern void *ioremap(phys_addr_t address, unsigned long size);
-#ifdef CONFIG_44x
-extern void *ioremap64(unsigned long long address, unsigned long size);
-#endif
+extern void *ioremap_resource(struct resource *res, unsigned long offset,
+			      unsigned long size);
+extern void *ioremap(unsigned long address, unsigned long size);
 #define ioremap_nocache(addr, size)	ioremap((addr), (size))
 extern void iounmap(void *addr);
 extern unsigned long iopa(unsigned long addr);
===== include/asm-ppc64/io.h 1.8 vs edited =====
--- 1.8/include/asm-ppc64/io.h	Sun Apr 27 23:32:15 2003
+++ edited/include/asm-ppc64/io.h	Thu Sep  4 10:37:44 2003
@@ -118,6 +118,7 @@
 		       unsigned long flags);
 extern void *ioremap(unsigned long address, unsigned long size);
 #define ioremap_nocache(addr, size)	ioremap((addr), (size))
+#define ioremap_resource(res, off, size)	ioremap((res)->start + (off), (size))
 extern void iounmap(void *addr);
 
 /*
===== include/asm-s390/io.h 1.6 vs edited =====
--- 1.6/include/asm-s390/io.h	Mon Apr 14 21:11:58 2003
+++ edited/include/asm-s390/io.h	Thu Sep  4 10:38:00 2003
@@ -53,6 +53,7 @@
 #define page_to_phys(page)	((page - mem_map) << PAGE_SHIFT)
 
 extern void * __ioremap(unsigned long offset, unsigned long size, unsigned long flags);
+#define ioremap_resource(res, off, size)	__ioremap((res)->start + (off), (size), 0)
 
 extern inline void * ioremap (unsigned long offset, unsigned long size)
 {
===== include/asm-sh/io.h 1.5 vs edited =====
--- 1.5/include/asm-sh/io.h	Sun May  4 17:30:01 2003
+++ edited/include/asm-sh/io.h	Thu Sep  4 10:39:18 2003
@@ -72,6 +72,8 @@
 # define __ioremap(a,s)	sh_mv.mv_ioremap((a), (s))
 # define __iounmap(a)	sh_mv.mv_iounmap((a))
 
+# define ioremap_resource(res, off, size)	ioremap((res)->start + (off), (size))
+
 # define __isa_port2addr(a)	sh_mv.mv_isa_port2addr(a)
 
 # define inb		__inb
@@ -399,6 +401,7 @@
 {
 	return __ioremap(offset, size);
 }
+#define ioremap_resource(res, off, size)	__ioremap((res)->start + (off), (size))
 
 static __inline__ void iounmap(void *addr)
 {
===== include/asm-sparc/io.h 1.5 vs edited =====
--- 1.5/include/asm-sparc/io.h	Mon Dec  2 09:23:54 2002
+++ edited/include/asm-sparc/io.h	Thu Sep  4 10:39:56 2003
@@ -176,7 +176,8 @@
  * This is why we have no bus number argument to ioremap().
  */
 extern void *ioremap(unsigned long offset, unsigned long size);
-#define ioremap_nocache(X,Y)	ioremap((X),(Y))
+#define ioremap_nocache(X,Y)	ioremap((X),(Y)) 
+#define ioremap_resource(res, off, size)	ioremap((res)->start + (off), (size))
 extern void iounmap(void *addr);
 
 /*
===== include/asm-sparc64/io.h 1.7 vs edited =====
--- 1.7/include/asm-sparc64/io.h	Sat Dec 21 03:02:57 2002
+++ edited/include/asm-sparc64/io.h	Thu Sep  4 10:40:03 2003
@@ -435,6 +435,7 @@
  */
 #define ioremap(__offset, __size)	((void *)(__offset))
 #define ioremap_nocache(X,Y)		ioremap((X),(Y))
+#define ioremap_resource(res, off, size)	ioremap((res)->start + (off), (size))
 #define iounmap(__addr)			do { (void)(__addr); } while(0)
 
 /* Similarly for SBUS. */
===== include/asm-v850/io.h 1.2 vs edited =====
--- 1.2/include/asm-v850/io.h	Tue Jun 17 07:23:12 2003
+++ edited/include/asm-v850/io.h	Thu Sep  4 10:40:13 2003
@@ -97,6 +97,7 @@
 #define ioremap_nocache(physaddr, size)		(physaddr)
 #define ioremap_writethrough(physaddr, size)	(physaddr)
 #define ioremap_fullcache(physaddr, size)	(physaddr)
+#define ioremap_resource(res, off, size)	ioremap((res)->start + (off), (size))
 
 #define page_to_phys(page)      ((page - mem_map) << PAGE_SHIFT)
 #if 0
===== include/asm-x86_64/io.h 1.9 vs edited =====
--- 1.9/include/asm-x86_64/io.h	Fri Jul 11 13:34:21 2003
+++ edited/include/asm-x86_64/io.h	Thu Sep  4 10:40:18 2003
@@ -152,6 +152,7 @@
 {
 	return __ioremap(offset, size, 0);
 }
+#define ioremap_resource(res, off, size)	ioremap((res)->start + (off), (size))
 
 /*
  * This one maps high address device memory and turns off caching for that area.

  parent reply	other threads:[~2003-09-04  9:29 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-03 20:32 [PATCH] fix ppc ioremap prototype Christoph Hellwig
2003-09-04  0:33 ` Paul Mackerras
2003-09-04  7:13   ` Christoph Hellwig
2003-09-04  7:25     ` David S. Miller
2003-09-04  7:30     ` Russell King
2003-09-04  7:38       ` Christoph Hellwig
2003-09-04  8:09         ` David S. Miller
2003-09-04  8:12           ` Linus Torvalds
2003-09-04  8:10             ` David S. Miller
2003-09-04  8:28               ` Christoph Hellwig
2003-09-04 10:06                 ` Benjamin Herrenschmidt
2003-09-04 11:03                 ` Paul Mackerras
2003-09-04 12:21                   ` Geert Uytterhoeven
2003-09-04 12:41                     ` Paul Mackerras
2003-09-04 12:41                       ` David S. Miller
2003-09-04 12:57                       ` Geert Uytterhoeven
2003-09-04 15:58                         ` Deepak Saxena
2003-09-04 16:15                           ` Geert Uytterhoeven
2003-09-04 16:36                           ` Jes Sorensen
2003-09-04 23:18                         ` Paul Mackerras
2003-09-05 20:56                           ` Geert Uytterhoeven
2003-09-04 16:41                     ` Linus Torvalds
2003-09-04 16:43                       ` David S. Miller
2003-09-04 17:06                         ` Linus Torvalds
2003-09-04 17:03                           ` David S. Miller
2003-09-04 17:16                             ` Linus Torvalds
2003-09-04 17:13                       ` Jeff Garzik
2003-09-04 17:24                         ` Linus Torvalds
2003-09-05  8:02                       ` Eric W. Biederman
2003-09-04  8:22             ` Christoph Hellwig
2003-09-04  9:29           ` Christoph Hellwig [this message]
2003-09-04 10:07             ` Benjamin Herrenschmidt
2003-09-04  9:21       ` Paul Mackerras
2003-09-04  9:36         ` David S. Miller
2003-09-04  9:48           ` Russell King
2003-09-04  9:51             ` Christoph Hellwig
2003-09-04 12:38               ` Paul Mackerras
2003-09-04 12:59             ` Paul Mackerras
2003-09-04 13:01               ` David S. Miller
2003-09-04 14:15                 ` Matt Porter
2003-09-04 14:12                   ` David S. Miller
2003-09-04 13:30               ` Russell King
2003-09-04 15:50               ` Deepak Saxena
2003-09-04 16:09                 ` David S. Miller
2003-09-04 10:34           ` Alan Cox
2003-09-04 10:33             ` David S. Miller
2003-09-04 12:42             ` Jeff Garzik
2003-09-04 12:43               ` David S. Miller
2003-09-04 14:36           ` Matt Porter
2003-09-04 14:30             ` David S. Miller
2003-09-04 15:26               ` Matt Porter
2003-09-04 16:03                 ` David S. Miller
2003-09-04 15:35             ` Linus Torvalds

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030904092915.GA16344@lst.de \
    --to=hch@lst.de \
    --cc=davem@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paulus@samba.org \
    --cc=torvalds@transmeta.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox