[POWERPC] Fix initialization and usage of dma_mask

powerpc has a couple of bugs in the usage of dma_masks that tend to
break when drivers explicitly try to set a 32-bit mask for example.

First, the code that generates the pci devices from the OF device-tree
doesn't initialize the mask properly, then our implementation of
set_dma_mask() was trying to validate the -previous- mask value, not the
one passed in as an argument.

This fixes these problems.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>

authored by Benjamin Herrenschmidt and committed by Paul Mackerras 8f2ea1fd 939e60f6

+2 -1
+1
arch/powerpc/kernel/pci_64.c
··· 313 313 314 314 dev->current_state = 4; /* unknown power state */ 315 315 dev->error_state = pci_channel_io_normal; 316 + dev->dma_mask = 0xffffffff; 316 317 317 318 if (!strcmp(type, "pci") || !strcmp(type, "pciex")) { 318 319 /* a PCI-PCI bridge */
+1 -1
include/asm-powerpc/dma-mapping.h
··· 95 95 return -EIO; 96 96 if (dma_ops->set_dma_mask != NULL) 97 97 return dma_ops->set_dma_mask(dev, dma_mask); 98 - if (!dev->dma_mask || !dma_supported(dev, *dev->dma_mask)) 98 + if (!dev->dma_mask || !dma_supported(dev, dma_mask)) 99 99 return -EIO; 100 100 *dev->dma_mask = dma_mask; 101 101 return 0;