linux-4.4.1/of_dma_configure()
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
|
ログイン
]
開始行:
*参照元 [#a0fb0b65]
#backlinks
*説明 [#g730935a]
-パス: [[linux-4.4.1/drivers/of/device.c]]
-FIXME: これは何?
--説明
**引数 [#b4bd8743]
-struct device *dev
--
--[[linux-4.4.1/device]]
-struct device_node *np
--
--[[linux-4.4.1/device_node]]
**返り値 [#e8e15dbd]
-なし
**参考 [#jf8cc011]
*実装 [#nf6bb5d1]
/**
* of_dma_configure - Setup DMA configuration
* @dev: Device to apply DMA configuration
* @np: Pointer to OF node having DMA configurat...
*
* Try to get devices's DMA configuration from DT and up...
* accordingly.
*
* If platform code needs to use its own special DMA con...
* can use a platform bus notifier and handle BUS_NOTIFY...
* to fix up DMA configuration.
*/
void of_dma_configure(struct device *dev, struct device_...
{
u64 dma_addr, paddr, size;
int ret;
bool coherent;
unsigned long offset;
struct iommu_ops *iommu;
-
--[[linux-4.4.1/iommu_ops]]
/*
* Set default coherent_dma_mask to 32 bit. Dri...
* setup the correct supported mask.
*/
if (!dev->coherent_dma_mask)
dev->coherent_dma_mask = DMA_BIT_MASK(32);
-
--[[linux-4.4.1/DMA_BIT_MASK()]]
/*
* Set it to coherent_dma_mask by default if the...
* code has not set it.
*/
if (!dev->dma_mask)
dev->dma_mask = &dev->coherent_dma_mask;
ret = of_dma_get_range(np, &dma_addr, &paddr, &s...
-
--[[linux-4.4.1/of_dma_get_range()]]
if (ret < 0) {
dma_addr = offset = 0;
size = dev->coherent_dma_mask + 1;
} else {
offset = PFN_DOWN(paddr - dma_addr);
-
--[[linux-4.4.1/PFN_DOWN()]]
/*
* Add a work around to treat the size a...
* it is defined in DT as a mask.
*/
if (size & 1) {
dev_warn(dev, "Invalid size 0x%l...
size);
size = size + 1;
}
if (!size) {
dev_err(dev, "Adjusted size 0x%l...
return;
}
dev_dbg(dev, "dma_pfn_offset(%#08lx)\n",...
-
--[[linux-4.4.1/dev_warn()]]
--[[linux-4.4.1/dev_err()]]
--[[linux-4.4.1/dev_dbg()]]
}
dev->dma_pfn_offset = offset;
/*
* Limit coherent and dma mask based on size and...
* set by the driver.
*/
dev->coherent_dma_mask = min(dev->coherent_dma_m...
DMA_BIT_MASK(ilog2(...
*dev->dma_mask = min((*dev->dma_mask),
DMA_BIT_MASK(ilog2(dma_addr...
-
--[[linux-4.4.1/min()]]
--[[linux-4.4.1/ilog2()]]
coherent = of_dma_is_coherent(np);
dev_dbg(dev, "device is%sdma coherent\n",
coherent ? " " : " not ");
-
--[[linux-4.4.1/of_dma_is_coherent()]]
iommu = of_iommu_configure(dev, np);
dev_dbg(dev, "device is%sbehind an iommu\n",
iommu ? " " : " not ");
-
--[[linux-4.4.1/of_iommu_configure()]]
arch_setup_dma_ops(dev, dma_addr, size, iommu, c...
-
--[[linux-4.4.1/arch_setup_dma_ops()]]
}
EXPORT_SYMBOL_GPL(of_dma_configure);
-
--[[linux-4.4.1/EXPORT_SYMBOL_GPL()]]
*コメント [#wb45eb11]
終了行:
*参照元 [#a0fb0b65]
#backlinks
*説明 [#g730935a]
-パス: [[linux-4.4.1/drivers/of/device.c]]
-FIXME: これは何?
--説明
**引数 [#b4bd8743]
-struct device *dev
--
--[[linux-4.4.1/device]]
-struct device_node *np
--
--[[linux-4.4.1/device_node]]
**返り値 [#e8e15dbd]
-なし
**参考 [#jf8cc011]
*実装 [#nf6bb5d1]
/**
* of_dma_configure - Setup DMA configuration
* @dev: Device to apply DMA configuration
* @np: Pointer to OF node having DMA configurat...
*
* Try to get devices's DMA configuration from DT and up...
* accordingly.
*
* If platform code needs to use its own special DMA con...
* can use a platform bus notifier and handle BUS_NOTIFY...
* to fix up DMA configuration.
*/
void of_dma_configure(struct device *dev, struct device_...
{
u64 dma_addr, paddr, size;
int ret;
bool coherent;
unsigned long offset;
struct iommu_ops *iommu;
-
--[[linux-4.4.1/iommu_ops]]
/*
* Set default coherent_dma_mask to 32 bit. Dri...
* setup the correct supported mask.
*/
if (!dev->coherent_dma_mask)
dev->coherent_dma_mask = DMA_BIT_MASK(32);
-
--[[linux-4.4.1/DMA_BIT_MASK()]]
/*
* Set it to coherent_dma_mask by default if the...
* code has not set it.
*/
if (!dev->dma_mask)
dev->dma_mask = &dev->coherent_dma_mask;
ret = of_dma_get_range(np, &dma_addr, &paddr, &s...
-
--[[linux-4.4.1/of_dma_get_range()]]
if (ret < 0) {
dma_addr = offset = 0;
size = dev->coherent_dma_mask + 1;
} else {
offset = PFN_DOWN(paddr - dma_addr);
-
--[[linux-4.4.1/PFN_DOWN()]]
/*
* Add a work around to treat the size a...
* it is defined in DT as a mask.
*/
if (size & 1) {
dev_warn(dev, "Invalid size 0x%l...
size);
size = size + 1;
}
if (!size) {
dev_err(dev, "Adjusted size 0x%l...
return;
}
dev_dbg(dev, "dma_pfn_offset(%#08lx)\n",...
-
--[[linux-4.4.1/dev_warn()]]
--[[linux-4.4.1/dev_err()]]
--[[linux-4.4.1/dev_dbg()]]
}
dev->dma_pfn_offset = offset;
/*
* Limit coherent and dma mask based on size and...
* set by the driver.
*/
dev->coherent_dma_mask = min(dev->coherent_dma_m...
DMA_BIT_MASK(ilog2(...
*dev->dma_mask = min((*dev->dma_mask),
DMA_BIT_MASK(ilog2(dma_addr...
-
--[[linux-4.4.1/min()]]
--[[linux-4.4.1/ilog2()]]
coherent = of_dma_is_coherent(np);
dev_dbg(dev, "device is%sdma coherent\n",
coherent ? " " : " not ");
-
--[[linux-4.4.1/of_dma_is_coherent()]]
iommu = of_iommu_configure(dev, np);
dev_dbg(dev, "device is%sbehind an iommu\n",
iommu ? " " : " not ");
-
--[[linux-4.4.1/of_iommu_configure()]]
arch_setup_dma_ops(dev, dma_addr, size, iommu, c...
-
--[[linux-4.4.1/arch_setup_dma_ops()]]
}
EXPORT_SYMBOL_GPL(of_dma_configure);
-
--[[linux-4.4.1/EXPORT_SYMBOL_GPL()]]
*コメント [#wb45eb11]
ページ名: