[POWERPC] Remove more iSeries-specific stuff from vio.c
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Paul Mackerras <paulus@samba.org>
This commit is contained in:
Родитель
1670b2b271
Коммит
dd9b67ab37
|
@ -48,61 +48,33 @@ static struct vio_dev vio_bus_device = { /* fake "parent" device */
|
||||||
.dev.bus = &vio_bus_type,
|
.dev.bus = &vio_bus_type,
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef CONFIG_PPC_ISERIES
|
|
||||||
static struct iommu_table veth_iommu_table;
|
|
||||||
struct iommu_table vio_iommu_table;
|
|
||||||
|
|
||||||
static void __init iommu_vio_init(void)
|
|
||||||
{
|
|
||||||
iommu_table_getparms_iSeries(255, 0, 0xff, &veth_iommu_table);
|
|
||||||
veth_iommu_table.it_size /= 2;
|
|
||||||
vio_iommu_table = veth_iommu_table;
|
|
||||||
vio_iommu_table.it_offset += veth_iommu_table.it_size;
|
|
||||||
|
|
||||||
if (!iommu_init_table(&veth_iommu_table, -1))
|
|
||||||
printk("Virtual Bus VETH TCE table failed.\n");
|
|
||||||
if (!iommu_init_table(&vio_iommu_table, -1))
|
|
||||||
printk("Virtual Bus VIO TCE table failed.\n");
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
static void __init iommu_vio_init(void)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static struct iommu_table *vio_build_iommu_table(struct vio_dev *dev)
|
static struct iommu_table *vio_build_iommu_table(struct vio_dev *dev)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_PPC_ISERIES
|
const unsigned char *dma_window;
|
||||||
if (firmware_has_feature(FW_FEATURE_ISERIES)) {
|
struct iommu_table *tbl;
|
||||||
if (strcmp(dev->type, "network") == 0)
|
unsigned long offset, size;
|
||||||
return &veth_iommu_table;
|
|
||||||
return &vio_iommu_table;
|
|
||||||
} else
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
const unsigned char *dma_window;
|
|
||||||
struct iommu_table *tbl;
|
|
||||||
unsigned long offset, size;
|
|
||||||
|
|
||||||
dma_window = of_get_property(dev->dev.archdata.of_node,
|
if (firmware_has_feature(FW_FEATURE_ISERIES))
|
||||||
"ibm,my-dma-window", NULL);
|
return vio_build_iommu_table_iseries(dev);
|
||||||
if (!dma_window)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
tbl = kmalloc(sizeof(*tbl), GFP_KERNEL);
|
dma_window = of_get_property(dev->dev.archdata.of_node,
|
||||||
|
"ibm,my-dma-window", NULL);
|
||||||
|
if (!dma_window)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
of_parse_dma_window(dev->dev.archdata.of_node, dma_window,
|
tbl = kmalloc(sizeof(*tbl), GFP_KERNEL);
|
||||||
&tbl->it_index, &offset, &size);
|
|
||||||
|
|
||||||
/* TCE table size - measured in tce entries */
|
of_parse_dma_window(dev->dev.archdata.of_node, dma_window,
|
||||||
tbl->it_size = size >> IOMMU_PAGE_SHIFT;
|
&tbl->it_index, &offset, &size);
|
||||||
/* offset for VIO should always be 0 */
|
|
||||||
tbl->it_offset = offset >> IOMMU_PAGE_SHIFT;
|
|
||||||
tbl->it_busno = 0;
|
|
||||||
tbl->it_type = TCE_VB;
|
|
||||||
|
|
||||||
return iommu_init_table(tbl, -1);
|
/* TCE table size - measured in tce entries */
|
||||||
}
|
tbl->it_size = size >> IOMMU_PAGE_SHIFT;
|
||||||
|
/* offset for VIO should always be 0 */
|
||||||
|
tbl->it_offset = offset >> IOMMU_PAGE_SHIFT;
|
||||||
|
tbl->it_busno = 0;
|
||||||
|
tbl->it_type = TCE_VB;
|
||||||
|
|
||||||
|
return iommu_init_table(tbl, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
|
|
||||||
#include <asm/iommu.h>
|
#include <asm/iommu.h>
|
||||||
|
#include <asm/vio.h>
|
||||||
#include <asm/tce.h>
|
#include <asm/tce.h>
|
||||||
#include <asm/machdep.h>
|
#include <asm/machdep.h>
|
||||||
#include <asm/abs_addr.h>
|
#include <asm/abs_addr.h>
|
||||||
|
@ -191,7 +192,8 @@ void iommu_devnode_init_iSeries(struct pci_dev *pdev, struct device_node *dn)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern struct iommu_table vio_iommu_table;
|
static struct iommu_table veth_iommu_table;
|
||||||
|
static struct iommu_table vio_iommu_table;
|
||||||
|
|
||||||
void *iseries_hv_alloc(size_t size, dma_addr_t *dma_handle, gfp_t flag)
|
void *iseries_hv_alloc(size_t size, dma_addr_t *dma_handle, gfp_t flag)
|
||||||
{
|
{
|
||||||
|
@ -219,6 +221,26 @@ void iseries_hv_unmap(dma_addr_t dma_handle, size_t size,
|
||||||
iommu_unmap_single(&vio_iommu_table, dma_handle, size, direction);
|
iommu_unmap_single(&vio_iommu_table, dma_handle, size, direction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void __init iommu_vio_init(void)
|
||||||
|
{
|
||||||
|
iommu_table_getparms_iSeries(255, 0, 0xff, &veth_iommu_table);
|
||||||
|
veth_iommu_table.it_size /= 2;
|
||||||
|
vio_iommu_table = veth_iommu_table;
|
||||||
|
vio_iommu_table.it_offset += veth_iommu_table.it_size;
|
||||||
|
|
||||||
|
if (!iommu_init_table(&veth_iommu_table, -1))
|
||||||
|
printk("Virtual Bus VETH TCE table failed.\n");
|
||||||
|
if (!iommu_init_table(&vio_iommu_table, -1))
|
||||||
|
printk("Virtual Bus VIO TCE table failed.\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
struct iommu_table *vio_build_iommu_table_iseries(struct vio_dev *dev)
|
||||||
|
{
|
||||||
|
if (strcmp(dev->type, "network") == 0)
|
||||||
|
return &veth_iommu_table;
|
||||||
|
return &vio_iommu_table;
|
||||||
|
}
|
||||||
|
|
||||||
void iommu_init_early_iSeries(void)
|
void iommu_init_early_iSeries(void)
|
||||||
{
|
{
|
||||||
ppc_md.tce_build = tce_build_iSeries;
|
ppc_md.tce_build = tce_build_iSeries;
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
struct pci_dev;
|
struct pci_dev;
|
||||||
|
struct vio_dev;
|
||||||
struct device_node;
|
struct device_node;
|
||||||
struct iommu_table;
|
struct iommu_table;
|
||||||
|
|
||||||
|
@ -34,4 +35,7 @@ extern void iommu_table_getparms_iSeries(unsigned long busno,
|
||||||
unsigned char slotno, unsigned char virtbus,
|
unsigned char slotno, unsigned char virtbus,
|
||||||
struct iommu_table *tbl);
|
struct iommu_table *tbl);
|
||||||
|
|
||||||
|
extern struct iommu_table *vio_build_iommu_table_iseries(struct vio_dev *dev);
|
||||||
|
extern void iommu_vio_init(void);
|
||||||
|
|
||||||
#endif /* _ASM_POWERPC_ISERIES_IOMMU_H */
|
#endif /* _ASM_POWERPC_ISERIES_IOMMU_H */
|
||||||
|
|
Загрузка…
Ссылка в новой задаче