isa_virt_to_bus and co. on alpha (take 2)

From: Jakub Bogusz
Date: Thu Feb 26 2004 - 19:01:33 EST


Once again (as I previously mentioned in
http://www.ussg.iu.edu/hypermail/linux/kernel/0402.3/0442.html) the
problem is that on alpha CONFIG_ISA is set (to y), but isa_virt_to_bus,
isa_page_to_bus, isa_bus_to_virt are not defined, which results in the
following unresolved symbols:

*** Warning: "isa_virt_to_bus" [drivers/scsi/wd7000.ko] undefined!
*** Warning: "isa_page_to_bus" [drivers/scsi/wd7000.ko] undefined!
*** Warning: "isa_bus_to_virt" [drivers/scsi/wd7000.ko] undefined!
*** Warning: "isa_virt_to_bus" [drivers/char/tpqic02.ko] undefined!
*** Warning: "isa_virt_to_bus" [drivers/char/synclink.ko] undefined!
*** Warning: "isa_bus_to_virt" [drivers/net/ni65.ko] undefined!
*** Warning: "isa_virt_to_bus" [drivers/net/ni65.ko] undefined!
*** Warning: "isa_bus_to_virt" [drivers/net/ni52.ko] undefined!
*** Warning: "isa_virt_to_bus" [net/irda/irda.ko] undefined!
*** Warning: "isa_virt_to_bus" [drivers/net/cs89x0.ko] undefined!
*** Warning: "isa_bus_to_virt" [drivers/net/3c515.ko] undefined!
*** Warning: "isa_virt_to_bus" [drivers/net/3c515.ko] undefined!
*** Warning: "isa_virt_to_bus" [drivers/net/3c505.ko] undefined!

After some investigation (comparing changes in include/asm-i386/io.h,
drivers/scsi/wd7000.c and code in include/asm-alpha/io.h with probably
missing changes) I see that previous proposal was probably incorrect,
and this one should be better...

isa_virt_to_bus and isa_bus_to_virt defines are based on changes for
i386 (where virt_to_bus and bus_to_virt defines have been basically
renamed to isa_virt_to_bus and isa_bus_to_virt - the only difference
is that on alpha virt_to_bus/bus_to_virt and virt_to_phys/phys_to_virt
are not 1:1).

Unlike on i386, on alpha there was no page_to_bus - but I see that it's
something like phys_to_bus(page_to_phys) - so I wrote one basing on
virt_to_bus().

But I'm still not sure - are these changes correct?


--
Jakub Bogusz http://cyber.cs.net.pl/~qboosh/
PLD Team http://www.pld-linux.org/
--- linux-2.6.3/include/asm-alpha/io.h.orig 2004-02-18 04:59:27.000000000 +0100
+++ linux-2.6.3/include/asm-alpha/io.h 2004-02-25 13:42:10.000000000 +0100
@@ -118,6 +118,15 @@
return (long)address <= 0 ? NULL : virt;
}

+#define isa_virt_to_bus virt_to_bus
+#define isa_bus_to_virt bus_to_virt
+static inline unsigned long isa_page_to_bus(struct page *page)
+{
+ unsigned long phys = page_to_phys(page);
+ unsigned long bus = phys + __direct_map_base;
+ return phys <= __direct_map_size ? bus : 0;
+}
+
#else /* !__KERNEL__ */

/*