Commit 2083f681 authored by Anton Blanchard's avatar Anton Blanchard Committed by Benjamin Herrenschmidt

powerpc: of_parse_dma_window should take a __be32 *dma_window

We pass dma_window to of_parse_dma_window as a void * and then
run through hoops to cast it back to a u32 array. In the process
we lose endian annotation.

Simplify it by just passing a __be32 * down.
Signed-off-by: default avatarAnton Blanchard <anton@samba.org>
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
parent d213dd53
...@@ -38,8 +38,9 @@ extern unsigned long pci_address_to_pio(phys_addr_t address); ...@@ -38,8 +38,9 @@ extern unsigned long pci_address_to_pio(phys_addr_t address);
/* Parse the ibm,dma-window property of an OF node into the busno, phys and /* Parse the ibm,dma-window property of an OF node into the busno, phys and
* size parameters. * size parameters.
*/ */
void of_parse_dma_window(struct device_node *dn, const void *dma_window_prop, void of_parse_dma_window(struct device_node *dn, const __be32 *dma_window,
unsigned long *busno, unsigned long *phys, unsigned long *size); unsigned long *busno, unsigned long *phys,
unsigned long *size);
extern void kdump_move_device_tree(void); extern void kdump_move_device_tree(void);
......
...@@ -7,28 +7,27 @@ ...@@ -7,28 +7,27 @@
#include <linux/of_address.h> #include <linux/of_address.h>
#include <asm/prom.h> #include <asm/prom.h>
void of_parse_dma_window(struct device_node *dn, const void *dma_window_prop, void of_parse_dma_window(struct device_node *dn, const __be32 *dma_window,
unsigned long *busno, unsigned long *phys, unsigned long *size) unsigned long *busno, unsigned long *phys,
unsigned long *size)
{ {
const u32 *dma_window;
u32 cells; u32 cells;
const unsigned char *prop; const __be32 *prop;
dma_window = dma_window_prop;
/* busno is always one cell */ /* busno is always one cell */
*busno = *(dma_window++); *busno = of_read_number(dma_window, 1);
dma_window++;
prop = of_get_property(dn, "ibm,#dma-address-cells", NULL); prop = of_get_property(dn, "ibm,#dma-address-cells", NULL);
if (!prop) if (!prop)
prop = of_get_property(dn, "#address-cells", NULL); prop = of_get_property(dn, "#address-cells", NULL);
cells = prop ? *(u32 *)prop : of_n_addr_cells(dn); cells = prop ? of_read_number(prop, 1) : of_n_addr_cells(dn);
*phys = of_read_number(dma_window, cells); *phys = of_read_number(dma_window, cells);
dma_window += cells; dma_window += cells;
prop = of_get_property(dn, "ibm,#dma-size-cells", NULL); prop = of_get_property(dn, "ibm,#dma-size-cells", NULL);
cells = prop ? *(u32 *)prop : of_n_size_cells(dn); cells = prop ? of_read_number(prop, 1) : of_n_size_cells(dn);
*size = of_read_number(dma_window, cells); *size = of_read_number(dma_window, cells);
} }
...@@ -1153,7 +1153,7 @@ EXPORT_SYMBOL(vio_h_cop_sync); ...@@ -1153,7 +1153,7 @@ EXPORT_SYMBOL(vio_h_cop_sync);
static struct iommu_table *vio_build_iommu_table(struct vio_dev *dev) static struct iommu_table *vio_build_iommu_table(struct vio_dev *dev)
{ {
const unsigned char *dma_window; const __be32 *dma_window;
struct iommu_table *tbl; struct iommu_table *tbl;
unsigned long offset, size; unsigned long offset, size;
......
...@@ -697,7 +697,7 @@ static int __init cell_iommu_get_window(struct device_node *np, ...@@ -697,7 +697,7 @@ static int __init cell_iommu_get_window(struct device_node *np,
unsigned long *base, unsigned long *base,
unsigned long *size) unsigned long *size)
{ {
const void *dma_window; const __be32 *dma_window;
unsigned long index; unsigned long index;
/* Use ibm,dma-window if available, else, hard code ! */ /* Use ibm,dma-window if available, else, hard code ! */
......
...@@ -530,7 +530,7 @@ static void iommu_table_setparms(struct pci_controller *phb, ...@@ -530,7 +530,7 @@ static void iommu_table_setparms(struct pci_controller *phb,
static void iommu_table_setparms_lpar(struct pci_controller *phb, static void iommu_table_setparms_lpar(struct pci_controller *phb,
struct device_node *dn, struct device_node *dn,
struct iommu_table *tbl, struct iommu_table *tbl,
const void *dma_window) const __be32 *dma_window)
{ {
unsigned long offset, size; unsigned long offset, size;
...@@ -630,7 +630,7 @@ static void pci_dma_bus_setup_pSeriesLP(struct pci_bus *bus) ...@@ -630,7 +630,7 @@ static void pci_dma_bus_setup_pSeriesLP(struct pci_bus *bus)
struct iommu_table *tbl; struct iommu_table *tbl;
struct device_node *dn, *pdn; struct device_node *dn, *pdn;
struct pci_dn *ppci; struct pci_dn *ppci;
const void *dma_window = NULL; const __be32 *dma_window = NULL;
dn = pci_bus_to_OF_node(bus); dn = pci_bus_to_OF_node(bus);
...@@ -1152,7 +1152,7 @@ static void pci_dma_dev_setup_pSeriesLP(struct pci_dev *dev) ...@@ -1152,7 +1152,7 @@ static void pci_dma_dev_setup_pSeriesLP(struct pci_dev *dev)
{ {
struct device_node *pdn, *dn; struct device_node *pdn, *dn;
struct iommu_table *tbl; struct iommu_table *tbl;
const void *dma_window = NULL; const __be32 *dma_window = NULL;
struct pci_dn *pci; struct pci_dn *pci;
pr_debug("pci_dma_dev_setup_pSeriesLP: %s\n", pci_name(dev)); pr_debug("pci_dma_dev_setup_pSeriesLP: %s\n", pci_name(dev));
...@@ -1201,7 +1201,7 @@ static int dma_set_mask_pSeriesLP(struct device *dev, u64 dma_mask) ...@@ -1201,7 +1201,7 @@ static int dma_set_mask_pSeriesLP(struct device *dev, u64 dma_mask)
bool ddw_enabled = false; bool ddw_enabled = false;
struct device_node *pdn, *dn; struct device_node *pdn, *dn;
struct pci_dev *pdev; struct pci_dev *pdev;
const void *dma_window = NULL; const __be32 *dma_window = NULL;
u64 dma_offset; u64 dma_offset;
if (!dev->dma_mask) if (!dev->dma_mask)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment