SIFMAP - struct ifmap portability API issue

From: Russell King (rmk@arm.linux.org.uk)
Date: Sat May 13 2000 - 13:58:57 EDT

  • Next message: Russell King: "Re: procfs bug (was: Re: bttv (or PCI subsystem?) still broken in 2.3.99-pre8)"

    Hi,

    There is an API issue surrounding the following structure in
    linux/include/linux/if.h, which has been in the kernel since 2.0
    days:

    struct ifmap
    {
            unsigned long mem_start;
            unsigned long mem_end;
            unsigned short base_addr;
            unsigned char irq;
            unsigned char dma;
            unsigned char port;
            /* 3 bytes spare */
    };

    The problem area is base_addr. It appears to assume that you always have
    a maximum of a 64K IO space, which is obviously broken for 64-bit
    architectures and other machines which have more than a 64K IO space.

    What's even more strange is that "base_addr" is initialised from the
    base_addr element of struct net_device, which is declared as an
    unsigned long (it was an unsigned short back in the older days of Linux
    though):

    struct net_device
    {
    ...
            unsigned long base_addr; /* device I/O address */

    Obviously on an architecture which does make use of the full 32-bits
    or 64-bits of IO address range, things are not going to work as expected.

    It would be desirable to fix this, especially as its certainly far from
    obsolete - ifconfig has recently had support added for setting the above
    information, and there is some limited support in the kernel for accepting
    this information.

    I propose that we need to obsolete the current SIOC[SG]IFMAP ioctls and
    introduce new ones which supply a 32-bit version of the base address
    (and explicitly pad the structure, rather than just commenting that
    there are 3 bytes spare).

    Comments anyone?
       _____
      |_____| ------------------------------------------------- ---+---+-
      | | Russell King rmk@arm.linux.org.uk --- ---
      | | | | http://www.arm.linux.org.uk/~rmk/aboutme.html / / |
      | +-+-+ --- -+-
      / | THE developer of ARM Linux |+| /|\
     / | | | --- |
        +-+-+ ------------------------------------------------- /\\\ |

    -
    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 : Sat May 13 2000 - 14:09:51 EDT