Re: Semi up to date JOBS list

From: Geert Uytterhoeven (geert@linux-m68k.org)
Date: Wed Jun 14 2000 - 05:42:23 EST


On Tue, 13 Jun 2000, Jeff Garzik wrote:
> Alan Cox wrote:
> > To Check
> > --------
> > Some FB drivers check the A000 area and find it busy then bomb out
>
> checked and fixed as of 2.3.99-preXX

On a related issue: using request_mem_region() to request the A0000 region
works on PC only. On other machines ISA memory space doesn't start at CPU
physical address 0. On my CHRP LongTrail /proc/iomem says:

| 00000000-08000000 : RAM
| c0000000-f6ffffff : GG2 PCI mem
| c0000000-c0000fff : ATI Technologies Inc 3D Rage I/II 215GT [Mach64 GT]
| c1000000-c107ffff : Apple Computer Inc. Hydra Mac I/O
| c1080000-c108007f : Digital Equipment Corporation DECchip 21041 [Tulip Pass 3]
| c1080000-c108007f : eth0
| c2000000-c2ffffff : ATI Technologies Inc 3D Rage I/II 215GT [Mach64 GT]
| c2000000-c2ffffff : atyfb
| c3000000-c30000ff : Symbios Logic Inc. (formerly NCR) 53c875
| c3001000-c3001fff : Symbios Logic Inc. (formerly NCR) 53c875
| c4000000-c7ffffff : S3 Inc. 86c764/765 [Trio32/64/64V+]
| f7000000-f7ffffff : GG2 ISA mem
  ^^^^^^^^^^^^^^^^^
  ISA memory space is here!
| f70e0000-f70e7fff : NVRAM
| f8000000-f8ffffff : GG2 PCI I/O
  ^^^^^^^^^^^^^^^^^
  PCI/ISA memory space is here!
| fec00000-fec7ffff : GG2 PCI cfg
| ff000000-ff7fffff : ROM exp
| fff80000-ffffffff : Flash ROM

Hence you need an isa_request_mem_region() function to fix this.

A small patch (untested in real life!) that takes into account the offset for
ia32 and PPC is below.

Another related issue: on non-PC boxes with memory mapped I/O, it's quite
difficult to access ISA I/O (and memory) space from userspace since you need to
know at which offset it resides, which of course depends upon the machine type.
This is a problem for XFree86 (the hardware banging user app :-) on at least
PPC and MIPS.

I see two possible solutions:

  - Create /dev/isaio and /dev/isamem so you can mmap() ISA I/O and memory
    space.

  - Create /proc/bus/isa/map which contains e.g.

    | IO f8000000 f8ffffff
    | MEM f7000000 f7ffffff

    so user space can mmap() those ranges using /dev/mem, or fall back to
    I/O instructions (inb() and friends on ia32. Note that inb() on PPC needs
    the base pointer isa_io_base, cfr. include/asm-ppc/io.h) for the I/O part
    if it doesn't exist..

If you tell me which one you prefer, I'll cook a patch.

--- isa-2.4.0-test1/drivers/video/clgenfb.c.orig Fri May 12 08:50:43 2000
+++ isa-2.4.0-test1/drivers/video/clgenfb.c Sat Jun 3 15:26:05 2000
@@ -2566,7 +2566,7 @@
         release_mem_region(info->fbmem_phys, info->size);
 
 #if 0 /* if system didn't claim this region, we would... */
- release_mem_region(0xA0000, 65535);
+ isa_release_mem_region(0xA0000, 65535);
 #endif
         if (release_io_ports)
                 release_region(0x3C0, 32);
@@ -2658,7 +2658,7 @@
                 return -1;
         }
 #if 0 /* if the system didn't claim this region, we would... */
- if (!request_mem_region(0xA0000, 65535, "clgenfb")) {
+ if (!isa_request_mem_region(0xA0000, 65535, "clgenfb")) {
                 pci_write_config_word (pdev, PCI_COMMAND, tmp16);
                 printk(KERN_ERR "clgen: cannot reserve region 0x%lx, abort\n",
                        0xA0000L);
--- isa-2.4.0-test1/include/asm-i386/io.h.orig Tue Feb 15 21:49:25 2000
+++ isa-2.4.0-test1/include/asm-i386/io.h Sat Jun 3 15:24:56 2000
@@ -205,6 +205,13 @@
 #define isa_memcpy_fromio(a,b,c) memcpy_fromio((a),__ISA_IO_base + (b),(c))
 #define isa_memcpy_toio(a,b,c) memcpy_toio(__ISA_IO_base + (a),(b),(c))
 
+#define isa_request_mem_region(start,n,name) \
+ request_mem_region(__ISA_IO_base+(start),(n),(name))
+#define isa_check_mem_region(start,n) \
+ check_mem_region(__ISA_IO_base+(start),(n))
+#define isa_release_mem_region(start,n) \
+ release_mem_region(__ISA_IO_base+(start),(n))
+
 
 /*
  * Again, i386 does not require mem IO specific function.
--- isa-2.4.0-test1/include/asm-ppc/io.h.orig Fri May 12 08:50:47 2000
+++ isa-2.4.0-test1/include/asm-ppc/io.h Sat Jun 3 15:24:00 2000
@@ -54,6 +54,23 @@
 #define writel(b,addr) out_le32((volatile u32 *)(addr),(b))
 #endif
 
+#define isa_readb(a) readb(isa_mem_base+(a))
+#define isa_readw(a) readw(isa_mem_base+(a))
+#define isa_readl(a) readl(isa_mem_base+(a))
+#define isa_writeb(b,a) writeb(b,isa_mem_base+(a))
+#define isa_writew(w,a) writeb(w,isa_mem_base+(a))
+#define isa_writel(l,a) writeb(l,isa_mem_base+(a))
+#define isa_memset_io(a,b,c) memset_io(isa_mem_base+(a),(b),(c))
+#define isa_memcpy_fromio(a,b,c) memcpy_fromio((a),isa_mem_base+(b),(c))
+#define isa_memcpy_toio(a,b,c) memcpy_toio(isa_mem_base+(a),(b),(c))
+
+#define isa_request_mem_region(start,n,name) \
+ request_mem_region(isa_mem_base+(start),(n),(name))
+#define isa_check_mem_region(start,n) \
+ check_mem_region(isa_mem_base+(start),(n))
+#define isa_release_mem_region(start,n) \
+ release_mem_region(isa_mem_base+(start),(n))
+
 /*
  * The insw/outsw/insl/outsl macros don't do byte-swapping.
  * They are only used in practice for transferring buffers which

Gr{oetje,eeting}s,

                                                Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvald - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Thu Jun 15 2000 - 21:00:31 EST