Bug in virt_to_bus() in 2.2.14 and 2.3.46?

From: Rask Ingemann Lambertsen (rask@kampsax.k-net.dk)
Date: Sat Feb 26 2000 - 02:03:55 EST


   It looks as if virt_to_bus() and virt_to_phys() don't work on
addresses that point to module code. I'm using this in a driver:

#define firmware_size 547

static char firmware_data[] = {
   233,253, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* ... */
};

        if (net_debug >= 2)
                printk ("ne3200: Uploading firmware (virt = 0x%08lx, bus = 0x%08lx, phys = 0x%08lx, size = 0x%04x)...\n",
                        (unsigned long) firmware_data, virt_to_bus (firmware_data), virt_to_phys (firmware_data), firmware_size);

        fwcopy = kmalloc (firmware_size, GFP_KERNEL);
        memcpy (fwcopy, firmware_data, firmware_size);

        if (net_debug >= 2)
                printk ("ne3200: Uploading firmware (virt = 0x%08lx, bus = 0x%08lx, phys = 0x%08lx, size = 0x%04x)...\n",
                        (unsigned long) fwcopy, virt_to_bus (fwcopy), virt_to_phys (fwcopy), firmware_size);

which results in (dmesg, linux 2.3.46, but same problem in 2.2.14):

ne3200: Uploading firmware (virt = 0xc1824284, bus = 0x01824284, phys = 0x01824284, size = 0x0223)...
ne3200: Uploading firmware (virt = 0xc0e5d000, bus = 0x00e5d000, phys = 0x00e5d000, size = 0x0223)...

   This is on a 486 PC with 16 MB of memory, so obviously the first set of
bus and physical addresses are wrong. The second set works as expected.

   The question is: Is this a virt_to_bus()/virt_to_phys() bug or just
undocumented behaviour?

Regards,

/ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻTŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ\
| Rask Ingemann Lambertsen | E-mail: mailto:rask@kampsax.k-net.dk |
| Registered Phase5 developer | WWW: http://www.gbar.dtu.dk/~c948374/ |
| A4000, 896 kkeys/s (RC5-64) | "ThrustMe" on XPilot, ARCnet and IRC |
| To err is human, but to really mess things up you need a computer. |

-
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 : Tue Feb 29 2000 - 21:00:15 EST