Linux/Documentation/io-mapping.txt

Chinese translated version of Linux/Documentation/io-mapping.txt

If you have any comment or update to the content, please contact theoriginal document maintainer directly.  However, if you have a problem
communicating in English you can also ask the Chinese 

maintainer forhelp.  Contact the Chinese maintainer if this translation is outdatedor if there is a problem with the translation.


Chinese maintainer: 张凯 zhangking520@gmail.com 
---------------------------------------------------------------------

Linux/Documentation/io-mapping.txt的中文翻译




如果想评论或更新本文的内容,请直接联系原文档的维护者。如果你使用英文
交流有困难的话,也可以向中文版维护者求助。如果本翻译更新不及时或者翻
译存在问题,请联系中文版维护者。

中文版维护者:张凯 zhangking520@gmail.com
中文版翻译者: 张凯 zhangking520@gmail.com


以下为正文


---------------------------------------------------------------------

The io_mapping functions in linux/io-mapping.h provide an abstraction for
efficiently mapping small regions of an I/O device to the CPU. The initial
usage is to support the large graphics aperture on 32-bit processors where
ioremap_wc cannot be used to statically map the entire aperture to the CPU
as it would consume too much of the kernel address space.s
在linux/io-mappin文件里io-mapping函数提供了个抽象为有效映射到cpu的io设备的小区域。
最初的用法是支持32位机器上ioremapwc不能静态映射的cpu的孔而导致消耗大量的内核地址。

A mapping object is created during driver initialization using
  一个映射对象是在驱动初始化的时候被创建的。
       struct io_mapping *io_mapping_create_wc(unsigned long base,
                                               unsigned long size)
 
               'base' is the bus address of the region to be made
               mappable, while 'size' indicates how large a mapping region to
               enable. Both are in bytes.
  base参数表示可映射的区域总线地址,size参数表示映射区域的有效范围。
                This _wc variant provides a mapping which may only be used
                with the io_mapping_map_atomic_wc or io_mapping_map_wc.
wc变量提供一个只能被io_mapping_map_atomic_wc 或者 io_mapping_map_wc使用的映射。
  With this mapping object, individual pages can be mapped either atomically
  or not, depending on the necessary scheduling environment. Of course, atomic
  maps are more efficient:
  有了这个映射对象,根据所需的环境,个别页能够原子级别的映射。原子映射更加高效。
          void *io_mapping_map_atomic_wc(struct io_mapping *mapping,
                                         unsigned long offset)
 
  'offset' is the offset within the defined mapping region.
  Accessing addresses beyond the region specified in the
  creation function yields undefined results. Using an offset
  which is not page aligned yields an undefined result. The
  return value points to a single page in CPU address space.
 offest参数表示所定义的映射区域的偏移,在指定的区域范围内访问地址
  创建函数产生不确定的结果,使用的偏移量 。 这是不是页对齐产生未定义的结果。返回值指向cpu地址空间的一个单页。
  This _wc variant returns a write-combining map to the
  page and may only be used with mappings created by
  io_mapping_create_wc
 wc变量返回一个到页的写结合映射,也可能被io_mapping_create_wc所创造的映射使用

  Note that the task may not sleep while holding this page
  mapped.
 
  void io_mapping_unmap_atomic(void *vaddr)
 
  'vaddr' must be the the value returned by the last
   io_mapping_map_atomic_wc call. This unmaps the specified
   page and allows the task to sleep once again.
 vaddr必须是io_mapping_map_atomic_wc做后一次调用返回的结果。这取消映射指定
   页面,并且允许任务再次入睡。
  If you need to sleep while holding the lock, you can use the non-atomic
  variant, although they may be significantly slower.
  如果你在加锁的时候睡眠, 你需要使用non-atomic变量,尽管这可能导致变慢。
        void *io_mapping_map_wc(struct io_mapping *mapping,
                                unsigned long offset)

    This works like io_mapping_map_atomic_wc except it allows
    the task to sleep while holding the page mapped.
    像io-mapping-map-atomic-wc一样的工作期待它允许任务在拥有页映射时睡眠
      void io_mapping_unmap(void *vaddr)
 
     This works like io_mapping_unmap_atomic, except it is used
     for pages mapped with io_mapping_map_wc.
     像io-mapping-map-atomic-wc一样的工作期待被页映射使用

     At driver close time, the io_mapping object must be freed:
 
        void io_mapping_free(struct io_mapping *mapping)
 
  Current Implementation:
 
  The initial implementation of these functions uses existing mapping
  mechanisms and so provides only an abstraction layer and no new
  functionality.
  这些函数的初始接口使用存在的映射机制,提供一个没有新功能的抽象层。
 On 64-bit processors, io_mapping_create_wc calls ioremap_wc for the whole
 range, creating a permanent kernel-visible mapping to the resource. The
 map_atomic and map functions add the requested offset to the base of the
 virtual address returned by ioremap_wc.
 在64位处理器,io_mapping_create_wc调用ioremap_wc的整个范围,建立一个永久性的内核可见映射到资源。kmap_atomic的映射功能添 加所需的偏移的虚拟地址的基础上由ioremap_wc返回。
  On 32-bit processors with HIGHMEM defined, io_mapping_map_atomic_wc uses
  kmap_atomic_pfn to map the specified page in an atomic fashion;
  kmap_atomic_pfn isn't really supposed to be used with device pages, but it
  provides an efficient mapping for this usage.
  在32位处理器与HIGHMEM定义,io_mapping_map_atomic_wc使用kmap_atomic的PFN以原子方式映射到指定的页面; kmap_atomic_pfn不  是真的应该用于与设备的网页,但它提供了一个高效的映射。
  On 32-bit processors without HIGHMEM defined, io_mapping_map_atomic_wc and
  io_mapping_map_wc both use ioremap_wc, a terribly inefficient function which
  performs an IPI to inform all processors about the new mapping. This results
  i在32位处理器没有HIGHMEM定义,io_mapping_map_atomic_wc
  io_mapping_map_wc使用ioremap_wc,一个非常低效的功能
  进行IPI告知所有处理器的新的映射。这样导致
  一个显着的性能损失。
 
 
 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值