mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-10 00:26:34 +00:00
[POWERPC] Split out the ioid fetching/checking logic
Split out the ioid fetching and checking logic so we can use it elsewhere in a subsequent patch. Signed-off-by: Michael Ellerman <michael@ellerman.id.au> Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Paul Mackerras <paulus@samba.org>
This commit is contained in:
parent
4134791728
commit
c96b51265a
1 changed files with 17 additions and 6 deletions
|
@ -443,25 +443,36 @@ static struct iommu_window *find_window(struct cbe_iommu *iommu,
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static inline u32 cell_iommu_get_ioid(struct device_node *np)
|
||||||
|
{
|
||||||
|
const u32 *ioid;
|
||||||
|
|
||||||
|
ioid = of_get_property(np, "ioid", NULL);
|
||||||
|
if (ioid == NULL) {
|
||||||
|
printk(KERN_WARNING "iommu: missing ioid for %s using 0\n",
|
||||||
|
np->full_name);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return *ioid;
|
||||||
|
}
|
||||||
|
|
||||||
static struct iommu_window * __init
|
static struct iommu_window * __init
|
||||||
cell_iommu_setup_window(struct cbe_iommu *iommu, struct device_node *np,
|
cell_iommu_setup_window(struct cbe_iommu *iommu, struct device_node *np,
|
||||||
unsigned long offset, unsigned long size,
|
unsigned long offset, unsigned long size,
|
||||||
unsigned long pte_offset)
|
unsigned long pte_offset)
|
||||||
{
|
{
|
||||||
struct iommu_window *window;
|
struct iommu_window *window;
|
||||||
const unsigned int *ioid;
|
u32 ioid;
|
||||||
|
|
||||||
ioid = of_get_property(np, "ioid", NULL);
|
ioid = cell_iommu_get_ioid(np);
|
||||||
if (ioid == NULL)
|
|
||||||
printk(KERN_WARNING "iommu: missing ioid for %s using 0\n",
|
|
||||||
np->full_name);
|
|
||||||
|
|
||||||
window = kmalloc_node(sizeof(*window), GFP_KERNEL, iommu->nid);
|
window = kmalloc_node(sizeof(*window), GFP_KERNEL, iommu->nid);
|
||||||
BUG_ON(window == NULL);
|
BUG_ON(window == NULL);
|
||||||
|
|
||||||
window->offset = offset;
|
window->offset = offset;
|
||||||
window->size = size;
|
window->size = size;
|
||||||
window->ioid = ioid ? *ioid : 0;
|
window->ioid = ioid;
|
||||||
window->iommu = iommu;
|
window->iommu = iommu;
|
||||||
window->pte_offset = pte_offset;
|
window->pte_offset = pte_offset;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue