Linux驱动开发之DMA驱动

作者

QQ群:852283276
微信:arm80x86
微信公众号:青儿创客基地
B站:主页 https://space.bilibili.com/208826118

64bit DMA on 32bit CPU

sg列表中使用dma_addr_t

struct scatterlist {
#ifdef CONFIG_DEBUG_SG
	unsigned long	sg_magic;
#endif
	unsigned long	page_link;
	unsigned int	offset;
	unsigned int	length;
	dma_addr_t	dma_address;
#ifdef CONFIG_NEED_SG_DMA_LENGTH
	unsigned int	dma_length;
#endif
};

dma_addr_t定义,

#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
typedef u64 dma_addr_t;
#else
typedef u32 dma_addr_t;
#endif /* dma_addr_t */

CONFIG_ARCH_DMA_ADDR_T_64BIT在下面文件中使用,

---- ARCH_DMA_ADDR_T_64BIT Matches (5 in 4 files) ----
bus.c (drivers\pci) line 101 : #ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
pci_bus_alloc_resource in bus.c (drivers\pci) : #ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
tegra_cursor_plane_update in dc.c (drivers\gpu\drm\tegra) : #ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
starfire.c (drivers\net\ethernet\adaptec) line 139 : #ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
types.h (include\linux) line 146 : #ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT

config ARCH_DMA_ADDR_T_64BIT
	bool "Support for the Large DMA Address"

多了几个警告,修补修正无所谓,不影响其实,

In file included from drivers/gpu/drm/xilinx/xilinx_drm_plane.c:18:0:
drivers/gpu/drm/xilinx/xilinx_drm_plane.c: In function 'xilinx_drm_plane_mode_set':
drivers/gpu/drm/xilinx/xilinx_drm_plane.c:255:39: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
         src_w, crtc_x, src_h, crtc_y, (void *)obj->paddr);
                                       ^
include/drm/drmP.h:202:41: note: in definition of macro 'DRM_DEBUG_KMS'
    drm_ut_debug_printk(__func__, fmt, ##args); \

drivers/net/ethernet/xilinx/xilinx_emacps.c: In function 'xemacps_descriptor_init':
drivers/net/ethernet/xilinx/xilinx_emacps.c:1800:2: warning: format '%x' expects argument of type 'unsigned int', but argument 5 has type 'dma_addr_t' [-Wformat=]
  dev_dbg(&lp->pdev->dev, "RX ring %d bytes at 0x%x mapped %p\n",
  ^
drivers/net/ethernet/xilinx/xilinx_emacps.c:1842:2: warning: format '%x' expects argument of type 'unsigned int', but argument 5 has type 'dma_addr_t' [-Wformat=]
  dev_dbg(&lp->pdev->dev, "TX ring %d bytes at 0x%x mapped %p\n",
  ^
In file included from include/linux/pm_qos.h:10:0,
                 from include/linux/netdevice.h:28,
                 from drivers/net/ethernet/xilinx/xilinx_emacps.c:26:
drivers/net/ethernet/xilinx/xilinx_emacps.c:1860:14: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
   lp->tx_bd, (void *)lp->tx_bd_dma, lp->tx_skb);
              ^
include/linux/device.h:1121:41: note: in definition of macro 'dev_dbg'
   dev_printk(KERN_DEBUG, dev, format, ##arg); \
                                         ^
drivers/net/ethernet/xilinx/xilinx_emacps.c:1863:14: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
   lp->rx_bd, (void *)lp->rx_bd_dma, lp->rx_skb);
              ^
include/linux/device.h:1121:41: note: in definition of macro 'dev_dbg'
   dev_printk(KERN_DEBUG, dev, format, ##arg); \

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值