[openib-general] Re: mthca and LinuxBIOS

Linus Torvalds torvalds at osdl.org
Fri Aug 5 13:38:37 PDT 2005


Hmm.. This looks half-way sane, but too ugly for words.

I'd much rather see that when we detect a 64-bit resource, we always mark 
the next resource as being reserved some way, and then we just make 
pci_update_resource() ignore such reserved resources.

The

		if((resno & 1)==1) {
			/* check if previous reg is 64 mem */
			..

stuff is really too ugly.

Greg? Ivan?

		Linus


On Fri, 5 Aug 2005, yhlu wrote:
>
> please check the patch for fix overwrite upper 32bit 
> 
> YH
> 
> --- drivers/pci/setup-res.c.orig        2005-08-05 10:08:45.000000000 -0700
> +++ drivers/pci/setup-res.c     2005-08-05 13:25:06.000000000 -0700
> @@ -33,6 +33,18 @@
>         u32 new, check, mask;
>         int reg;
> 
> +        if (resno < 6) {
> +                reg = PCI_BASE_ADDRESS_0 + 4 * resno;
> +                if((resno & 1)==1) {
> +                        /* check if previous reg is 64 mem */
> +                        pci_read_config_dword(dev, reg-4, &check );
> +                        if ((check &
> (PCI_BASE_ADDRESS_SPACE|PCI_BASE_ADDRESS_MEM_TYPE_MASK)) ==
> +                           
> (PCI_BASE_ADDRESS_SPACE_MEMORY|PCI_BASE_ADDRESS_MEM_TYPE_64))
> +                                return;
> +                }
> +
> +        }
> +
>         pcibios_resource_to_bus(dev, &region, res);
> 
>         pr_debug("  got res [%lx:%lx] bus [%lx:%lx] flags %lx for "
> @@ -67,7 +79,7 @@
> 
>         if ((new & (PCI_BASE_ADDRESS_SPACE|PCI_BASE_ADDRESS_MEM_TYPE_MASK)) ==
>             (PCI_BASE_ADDRESS_SPACE_MEMORY|PCI_BASE_ADDRESS_MEM_TYPE_64)) {
> -               new = 0; /* currently everyone zeros the high address */
> +               new = region.start >> 32 ;
>                 pci_write_config_dword(dev, reg + 4, new);
>                 pci_read_config_dword(dev, reg + 4, &check);
>                 if (check != new) {
> 



More information about the general mailing list