Re: [PATCH] 2.3.99pre7-1 - From dev->resource[x].start to pci_resource_start(dev, x)

From: Jeff Garzik (jgarzik@mandrakesoft.com)
Date: Tue May 02 2000 - 13:26:40 EST


Jes Sorensen wrote:
>
> >>>>> "Jeff" == Jeff Garzik <jgarzik@mandrakesoft.com> writes:
>
> Jeff> diff -u --recursive --new-file
> Jeff> linux-2.3.99pre7-1.orig/drivers/net/acenic.c
> Jeff> linux-2.3.99pre7-1/drivers/net/acenic.c
> Jeff> --- linux-2.3.99pre7-1.orig/drivers/net/acenic.c Fri Apr 28
> Jeff> 20:59:43 2000
> Jeff> +++ linux-2.3.99pre7-1/drivers/net/acenic.c Sat Apr 29 16:23:24 2000
> Jeff> @@ -497,7 +497,7 @@
> Jeff> #if (LINUX_VERSION_CODE < 0x02030d)
> Jeff> dev->base_addr = pdev->base_address[0];
> Jeff> #else
> Jeff> - dev->base_addr = pdev->resource[0].start;
> Jeff> + dev->base_addr = pci_resource_start(pdev, 0);
> Jeff>
>
> Uhm no, this should go in the compat interface before you start doing
> things like that.

thank you for restating my point :)

> Jeff> ** ug, this driver needs to test IORESOURCE_xxx against the
> Jeff> value in dev-> resource[].flags
>
> Why? It'll never to IO port mapping.

You misunderstand. The current test in drivers/net/fc/iph5526.c is

        if ( (pdev->resource[0].flags & PCI_BASE_ADDRESS_SPACE)
        != PCI_BASE_ADDRESS_SPACE_MEMORY) {

In English this test is

        if (PCI BAR #0 is an I/O port)

This test is totally wrong because of the values in struct resource
'flags':

proper:
#define IORESOURCE_IO 0x00000100 /* Resource type */
#define IORESOURCE_MEM
0x00000200

current:
#define PCI_BASE_ADDRESS_SPACE 0x01
#define PCI_BASE_ADDRESS_SPACE_MEMORY 0x00

-- 
Jeff Garzik              | Nothing cures insomnia like the
Building 1024            | realization that it's time to get up.
MandrakeSoft, Inc.       |        -- random fortune

- 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 : Sun May 07 2000 - 21:00:10 EST