summaryrefslogtreecommitdiffstats
path: root/Documentation/io-mapping.txt
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@s-opensource.com>2017-05-14 13:32:35 -0400
committerJonathan Corbet <corbet@lwn.net>2017-07-14 15:51:38 -0400
commit9cf5116d5b10793b5105f962fa3d899b2d6cb5f6 (patch)
treedfb38c3b07c8292c3f7da2dfe0c83c44e0859a80 /Documentation/io-mapping.txt
parent45d85146269f711b8fbfdda017a033676caf29ab (diff)
io-mapping.txt: standardize document format
Each text file under Documentation follows a different format. Some doesn't even have titles! Change its representation to follow the adopted standard, using ReST markups for it to be parseable by Sphinx: - Add a title for the document and for API chapter; - mark literal blocks; - Adjust whitespacing. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com> Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Diffstat (limited to 'Documentation/io-mapping.txt')
-rw-r--r--Documentation/io-mapping.txt67
1 files changed, 41 insertions, 26 deletions
diff --git a/Documentation/io-mapping.txt b/Documentation/io-mapping.txt
index 5ca78426f54c..a966239f04e4 100644
--- a/Documentation/io-mapping.txt
+++ b/Documentation/io-mapping.txt
@@ -1,66 +1,81 @@
1========================
2The io_mapping functions
3========================
4
5API
6===
7
1The io_mapping functions in linux/io-mapping.h provide an abstraction for 8The io_mapping functions in linux/io-mapping.h provide an abstraction for
2efficiently mapping small regions of an I/O device to the CPU. The initial 9efficiently mapping small regions of an I/O device to the CPU. The initial
3usage is to support the large graphics aperture on 32-bit processors where 10usage is to support the large graphics aperture on 32-bit processors where
4ioremap_wc cannot be used to statically map the entire aperture to the CPU 11ioremap_wc cannot be used to statically map the entire aperture to the CPU
5as it would consume too much of the kernel address space. 12as it would consume too much of the kernel address space.
6 13
7A mapping object is created during driver initialization using 14A mapping object is created during driver initialization using::
8 15
9 struct io_mapping *io_mapping_create_wc(unsigned long base, 16 struct io_mapping *io_mapping_create_wc(unsigned long base,
10 unsigned long size) 17 unsigned long size)
11 18
12 'base' is the bus address of the region to be made 19'base' is the bus address of the region to be made
13 mappable, while 'size' indicates how large a mapping region to 20mappable, while 'size' indicates how large a mapping region to
14 enable. Both are in bytes. 21enable. Both are in bytes.
15 22
16 This _wc variant provides a mapping which may only be used 23This _wc variant provides a mapping which may only be used
17 with the io_mapping_map_atomic_wc or io_mapping_map_wc. 24with the io_mapping_map_atomic_wc or io_mapping_map_wc.
18 25
19With this mapping object, individual pages can be mapped either atomically 26With this mapping object, individual pages can be mapped either atomically
20or not, depending on the necessary scheduling environment. Of course, atomic 27or not, depending on the necessary scheduling environment. Of course, atomic
21maps are more efficient: 28maps are more efficient::
22 29
23 void *io_mapping_map_atomic_wc(struct io_mapping *mapping, 30 void *io_mapping_map_atomic_wc(struct io_mapping *mapping,
24 unsigned long offset) 31 unsigned long offset)
25 32
26 'offset' is the offset within the defined mapping region. 33'offset' is the offset within the defined mapping region.
27 Accessing addresses beyond the region specified in the 34Accessing addresses beyond the region specified in the
28 creation function yields undefined results. Using an offset 35creation function yields undefined results. Using an offset
29 which is not page aligned yields an undefined result. The 36which is not page aligned yields an undefined result. The
30 return value points to a single page in CPU address space. 37return value points to a single page in CPU address space.
38
39This _wc variant returns a write-combining map to the
40page and may only be used with mappings created by
41io_mapping_create_wc
31 42
32 This _wc variant returns a write-combining map to the 43Note that the task may not sleep while holding this page
33 page and may only be used with mappings created by 44mapped.
34 io_mapping_create_wc
35 45
36 Note that the task may not sleep while holding this page 46::
37 mapped.
38 47
39 void io_mapping_unmap_atomic(void *vaddr) 48 void io_mapping_unmap_atomic(void *vaddr)
40 49
41 'vaddr' must be the value returned by the last 50'vaddr' must be the value returned by the last
42 io_mapping_map_atomic_wc call. This unmaps the specified 51io_mapping_map_atomic_wc call. This unmaps the specified
43 page and allows the task to sleep once again. 52page and allows the task to sleep once again.
44 53
45If you need to sleep while holding the lock, you can use the non-atomic 54If you need to sleep while holding the lock, you can use the non-atomic
46variant, although they may be significantly slower. 55variant, although they may be significantly slower.
47 56
57::
58
48 void *io_mapping_map_wc(struct io_mapping *mapping, 59 void *io_mapping_map_wc(struct io_mapping *mapping,
49 unsigned long offset) 60 unsigned long offset)
50 61
51 This works like io_mapping_map_atomic_wc except it allows 62This works like io_mapping_map_atomic_wc except it allows
52 the task to sleep while holding the page mapped. 63the task to sleep while holding the page mapped.
64
65
66::
53 67
54 void io_mapping_unmap(void *vaddr) 68 void io_mapping_unmap(void *vaddr)
55 69
56 This works like io_mapping_unmap_atomic, except it is used 70This works like io_mapping_unmap_atomic, except it is used
57 for pages mapped with io_mapping_map_wc. 71for pages mapped with io_mapping_map_wc.
58 72
59At driver close time, the io_mapping object must be freed: 73At driver close time, the io_mapping object must be freed::
60 74
61 void io_mapping_free(struct io_mapping *mapping) 75 void io_mapping_free(struct io_mapping *mapping)
62 76
63Current Implementation: 77Current Implementation
78======================
64 79
65The initial implementation of these functions uses existing mapping 80The initial implementation of these functions uses existing mapping
66mechanisms and so provides only an abstraction layer and no new 81mechanisms and so provides only an abstraction layer and no new