diff options
author | Jeff Garzik <jeff@garzik.org> | 2006-04-18 05:39:23 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2006-04-18 05:39:23 -0400 |
commit | 9e73972cef1c0961c78b0e0b61c4ecc275b29f04 (patch) | |
tree | 27907bbd653504d71ff47cb00bdf8cd61e82f126 /Documentation | |
parent | a890b15c0990cc8d686edcc85f5fccde71ad5ce9 (diff) | |
parent | 4741c336d27dec3ea68a35659abb8dc82b142388 (diff) |
Merge branch 'upstream'
Diffstat (limited to 'Documentation')
-rw-r--r-- | Documentation/DMA-API.txt | 49 | ||||
-rw-r--r-- | Documentation/DMA-mapping.txt | 22 | ||||
-rw-r--r-- | Documentation/i2c/busses/i2c-parport | 16 | ||||
-rw-r--r-- | Documentation/networking/xfrm_sync.txt | 166 | ||||
-rw-r--r-- | Documentation/serial/driver | 22 |
5 files changed, 247 insertions, 28 deletions
diff --git a/Documentation/DMA-API.txt b/Documentation/DMA-API.txt index 1af0f2d50220..2ffb0d62f0fe 100644 --- a/Documentation/DMA-API.txt +++ b/Documentation/DMA-API.txt | |||
@@ -33,7 +33,9 @@ pci_alloc_consistent(struct pci_dev *dev, size_t size, | |||
33 | 33 | ||
34 | Consistent memory is memory for which a write by either the device or | 34 | Consistent memory is memory for which a write by either the device or |
35 | the processor can immediately be read by the processor or device | 35 | the processor can immediately be read by the processor or device |
36 | without having to worry about caching effects. | 36 | without having to worry about caching effects. (You may however need |
37 | to make sure to flush the processor's write buffers before telling | ||
38 | devices to read that memory.) | ||
37 | 39 | ||
38 | This routine allocates a region of <size> bytes of consistent memory. | 40 | This routine allocates a region of <size> bytes of consistent memory. |
39 | it also returns a <dma_handle> which may be cast to an unsigned | 41 | it also returns a <dma_handle> which may be cast to an unsigned |
@@ -304,12 +306,12 @@ dma address with dma_mapping_error(). A non zero return value means the mapping | |||
304 | could not be created and the driver should take appropriate action (eg | 306 | could not be created and the driver should take appropriate action (eg |
305 | reduce current DMA mapping usage or delay and try again later). | 307 | reduce current DMA mapping usage or delay and try again later). |
306 | 308 | ||
307 | int | 309 | int |
308 | dma_map_sg(struct device *dev, struct scatterlist *sg, int nents, | 310 | dma_map_sg(struct device *dev, struct scatterlist *sg, |
309 | enum dma_data_direction direction) | 311 | int nents, enum dma_data_direction direction) |
310 | int | 312 | int |
311 | pci_map_sg(struct pci_dev *hwdev, struct scatterlist *sg, | 313 | pci_map_sg(struct pci_dev *hwdev, struct scatterlist *sg, |
312 | int nents, int direction) | 314 | int nents, int direction) |
313 | 315 | ||
314 | Maps a scatter gather list from the block layer. | 316 | Maps a scatter gather list from the block layer. |
315 | 317 | ||
@@ -327,12 +329,33 @@ critical that the driver do something, in the case of a block driver | |||
327 | aborting the request or even oopsing is better than doing nothing and | 329 | aborting the request or even oopsing is better than doing nothing and |
328 | corrupting the filesystem. | 330 | corrupting the filesystem. |
329 | 331 | ||
330 | void | 332 | With scatterlists, you use the resulting mapping like this: |
331 | dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries, | 333 | |
332 | enum dma_data_direction direction) | 334 | int i, count = dma_map_sg(dev, sglist, nents, direction); |
333 | void | 335 | struct scatterlist *sg; |
334 | pci_unmap_sg(struct pci_dev *hwdev, struct scatterlist *sg, | 336 | |
335 | int nents, int direction) | 337 | for (i = 0, sg = sglist; i < count; i++, sg++) { |
338 | hw_address[i] = sg_dma_address(sg); | ||
339 | hw_len[i] = sg_dma_len(sg); | ||
340 | } | ||
341 | |||
342 | where nents is the number of entries in the sglist. | ||
343 | |||
344 | The implementation is free to merge several consecutive sglist entries | ||
345 | into one (e.g. with an IOMMU, or if several pages just happen to be | ||
346 | physically contiguous) and returns the actual number of sg entries it | ||
347 | mapped them to. On failure 0, is returned. | ||
348 | |||
349 | Then you should loop count times (note: this can be less than nents times) | ||
350 | and use sg_dma_address() and sg_dma_len() macros where you previously | ||
351 | accessed sg->address and sg->length as shown above. | ||
352 | |||
353 | void | ||
354 | dma_unmap_sg(struct device *dev, struct scatterlist *sg, | ||
355 | int nhwentries, enum dma_data_direction direction) | ||
356 | void | ||
357 | pci_unmap_sg(struct pci_dev *hwdev, struct scatterlist *sg, | ||
358 | int nents, int direction) | ||
336 | 359 | ||
337 | unmap the previously mapped scatter/gather list. All the parameters | 360 | unmap the previously mapped scatter/gather list. All the parameters |
338 | must be the same as those and passed in to the scatter/gather mapping | 361 | must be the same as those and passed in to the scatter/gather mapping |
diff --git a/Documentation/DMA-mapping.txt b/Documentation/DMA-mapping.txt index 10bf4deb96aa..7c717699032c 100644 --- a/Documentation/DMA-mapping.txt +++ b/Documentation/DMA-mapping.txt | |||
@@ -58,11 +58,15 @@ translating each of those pages back to a kernel address using | |||
58 | something like __va(). [ EDIT: Update this when we integrate | 58 | something like __va(). [ EDIT: Update this when we integrate |
59 | Gerd Knorr's generic code which does this. ] | 59 | Gerd Knorr's generic code which does this. ] |
60 | 60 | ||
61 | This rule also means that you may not use kernel image addresses | 61 | This rule also means that you may use neither kernel image addresses |
62 | (ie. items in the kernel's data/text/bss segment, or your driver's) | 62 | (items in data/text/bss segments), nor module image addresses, nor |
63 | nor may you use kernel stack addresses for DMA. Both of these items | 63 | stack addresses for DMA. These could all be mapped somewhere entirely |
64 | might be mapped somewhere entirely different than the rest of physical | 64 | different than the rest of physical memory. Even if those classes of |
65 | memory. | 65 | memory could physically work with DMA, you'd need to ensure the I/O |
66 | buffers were cacheline-aligned. Without that, you'd see cacheline | ||
67 | sharing problems (data corruption) on CPUs with DMA-incoherent caches. | ||
68 | (The CPU could write to one word, DMA would write to a different one | ||
69 | in the same cache line, and one of them could be overwritten.) | ||
66 | 70 | ||
67 | Also, this means that you cannot take the return of a kmap() | 71 | Also, this means that you cannot take the return of a kmap() |
68 | call and DMA to/from that. This is similar to vmalloc(). | 72 | call and DMA to/from that. This is similar to vmalloc(). |
@@ -284,6 +288,11 @@ There are two types of DMA mappings: | |||
284 | 288 | ||
285 | in order to get correct behavior on all platforms. | 289 | in order to get correct behavior on all platforms. |
286 | 290 | ||
291 | Also, on some platforms your driver may need to flush CPU write | ||
292 | buffers in much the same way as it needs to flush write buffers | ||
293 | found in PCI bridges (such as by reading a register's value | ||
294 | after writing it). | ||
295 | |||
287 | - Streaming DMA mappings which are usually mapped for one DMA transfer, | 296 | - Streaming DMA mappings which are usually mapped for one DMA transfer, |
288 | unmapped right after it (unless you use pci_dma_sync_* below) and for which | 297 | unmapped right after it (unless you use pci_dma_sync_* below) and for which |
289 | hardware can optimize for sequential accesses. | 298 | hardware can optimize for sequential accesses. |
@@ -303,6 +312,9 @@ There are two types of DMA mappings: | |||
303 | 312 | ||
304 | Neither type of DMA mapping has alignment restrictions that come | 313 | Neither type of DMA mapping has alignment restrictions that come |
305 | from PCI, although some devices may have such restrictions. | 314 | from PCI, although some devices may have such restrictions. |
315 | Also, systems with caches that aren't DMA-coherent will work better | ||
316 | when the underlying buffers don't share cache lines with other data. | ||
317 | |||
306 | 318 | ||
307 | Using Consistent DMA mappings. | 319 | Using Consistent DMA mappings. |
308 | 320 | ||
diff --git a/Documentation/i2c/busses/i2c-parport b/Documentation/i2c/busses/i2c-parport index d9f23c0763f1..77b995dfca22 100644 --- a/Documentation/i2c/busses/i2c-parport +++ b/Documentation/i2c/busses/i2c-parport | |||
@@ -12,18 +12,22 @@ meant as a replacement for the older, individual drivers: | |||
12 | teletext adapters) | 12 | teletext adapters) |
13 | 13 | ||
14 | It currently supports the following devices: | 14 | It currently supports the following devices: |
15 | * Philips adapter | 15 | * (type=0) Philips adapter |
16 | * home brew teletext adapter | 16 | * (type=1) home brew teletext adapter |
17 | * Velleman K8000 adapter | 17 | * (type=2) Velleman K8000 adapter |
18 | * ELV adapter | 18 | * (type=3) ELV adapter |
19 | * Analog Devices evaluation boards (ADM1025, ADM1030, ADM1031, ADM1032) | 19 | * (type=4) Analog Devices ADM1032 evaluation board |
20 | * Barco LPT->DVI (K5800236) adapter | 20 | * (type=5) Analog Devices evaluation boards: ADM1025, ADM1030, ADM1031 |
21 | * (type=6) Barco LPT->DVI (K5800236) adapter | ||
21 | 22 | ||
22 | These devices use different pinout configurations, so you have to tell | 23 | These devices use different pinout configurations, so you have to tell |
23 | the driver what you have, using the type module parameter. There is no | 24 | the driver what you have, using the type module parameter. There is no |
24 | way to autodetect the devices. Support for different pinout configurations | 25 | way to autodetect the devices. Support for different pinout configurations |
25 | can be easily added when needed. | 26 | can be easily added when needed. |
26 | 27 | ||
28 | Earlier kernels defaulted to type=0 (Philips). But now, if the type | ||
29 | parameter is missing, the driver will simply fail to initialize. | ||
30 | |||
27 | 31 | ||
28 | Building your own adapter | 32 | Building your own adapter |
29 | ------------------------- | 33 | ------------------------- |
diff --git a/Documentation/networking/xfrm_sync.txt b/Documentation/networking/xfrm_sync.txt new file mode 100644 index 000000000000..8be626f7c0b8 --- /dev/null +++ b/Documentation/networking/xfrm_sync.txt | |||
@@ -0,0 +1,166 @@ | |||
1 | |||
2 | The sync patches work is based on initial patches from | ||
3 | Krisztian <hidden@balabit.hu> and others and additional patches | ||
4 | from Jamal <hadi@cyberus.ca>. | ||
5 | |||
6 | The end goal for syncing is to be able to insert attributes + generate | ||
7 | events so that the an SA can be safely moved from one machine to another | ||
8 | for HA purposes. | ||
9 | The idea is to synchronize the SA so that the takeover machine can do | ||
10 | the processing of the SA as accurate as possible if it has access to it. | ||
11 | |||
12 | We already have the ability to generate SA add/del/upd events. | ||
13 | These patches add ability to sync and have accurate lifetime byte (to | ||
14 | ensure proper decay of SAs) and replay counters to avoid replay attacks | ||
15 | with as minimal loss at failover time. | ||
16 | This way a backup stays as closely uptodate as an active member. | ||
17 | |||
18 | Because the above items change for every packet the SA receives, | ||
19 | it is possible for a lot of the events to be generated. | ||
20 | For this reason, we also add a nagle-like algorithm to restrict | ||
21 | the events. i.e we are going to set thresholds to say "let me | ||
22 | know if the replay sequence threshold is reached or 10 secs have passed" | ||
23 | These thresholds are set system-wide via sysctls or can be updated | ||
24 | per SA. | ||
25 | |||
26 | The identified items that need to be synchronized are: | ||
27 | - the lifetime byte counter | ||
28 | note that: lifetime time limit is not important if you assume the failover | ||
29 | machine is known ahead of time since the decay of the time countdown | ||
30 | is not driven by packet arrival. | ||
31 | - the replay sequence for both inbound and outbound | ||
32 | |||
33 | 1) Message Structure | ||
34 | ---------------------- | ||
35 | |||
36 | nlmsghdr:aevent_id:optional-TLVs. | ||
37 | |||
38 | The netlink message types are: | ||
39 | |||
40 | XFRM_MSG_NEWAE and XFRM_MSG_GETAE. | ||
41 | |||
42 | A XFRM_MSG_GETAE does not have TLVs. | ||
43 | A XFRM_MSG_NEWAE will have at least two TLVs (as is | ||
44 | discussed further below). | ||
45 | |||
46 | aevent_id structure looks like: | ||
47 | |||
48 | struct xfrm_aevent_id { | ||
49 | struct xfrm_usersa_id sa_id; | ||
50 | __u32 flags; | ||
51 | }; | ||
52 | |||
53 | xfrm_usersa_id in this message layout identifies the SA. | ||
54 | |||
55 | flags are used to indicate different things. The possible | ||
56 | flags are: | ||
57 | XFRM_AE_RTHR=1, /* replay threshold*/ | ||
58 | XFRM_AE_RVAL=2, /* replay value */ | ||
59 | XFRM_AE_LVAL=4, /* lifetime value */ | ||
60 | XFRM_AE_ETHR=8, /* expiry timer threshold */ | ||
61 | XFRM_AE_CR=16, /* Event cause is replay update */ | ||
62 | XFRM_AE_CE=32, /* Event cause is timer expiry */ | ||
63 | XFRM_AE_CU=64, /* Event cause is policy update */ | ||
64 | |||
65 | How these flags are used is dependent on the direction of the | ||
66 | message (kernel<->user) as well the cause (config, query or event). | ||
67 | This is described below in the different messages. | ||
68 | |||
69 | The pid will be set appropriately in netlink to recognize direction | ||
70 | (0 to the kernel and pid = processid that created the event | ||
71 | when going from kernel to user space) | ||
72 | |||
73 | A program needs to subscribe to multicast group XFRMNLGRP_AEVENTS | ||
74 | to get notified of these events. | ||
75 | |||
76 | 2) TLVS reflect the different parameters: | ||
77 | ----------------------------------------- | ||
78 | |||
79 | a) byte value (XFRMA_LTIME_VAL) | ||
80 | This TLV carries the running/current counter for byte lifetime since | ||
81 | last event. | ||
82 | |||
83 | b)replay value (XFRMA_REPLAY_VAL) | ||
84 | This TLV carries the running/current counter for replay sequence since | ||
85 | last event. | ||
86 | |||
87 | c)replay threshold (XFRMA_REPLAY_THRESH) | ||
88 | This TLV carries the threshold being used by the kernel to trigger events | ||
89 | when the replay sequence is exceeded. | ||
90 | |||
91 | d) expiry timer (XFRMA_ETIMER_THRESH) | ||
92 | This is a timer value in milliseconds which is used as the nagle | ||
93 | value to rate limit the events. | ||
94 | |||
95 | 3) Default configurations for the parameters: | ||
96 | ---------------------------------------------- | ||
97 | |||
98 | By default these events should be turned off unless there is | ||
99 | at least one listener registered to listen to the multicast | ||
100 | group XFRMNLGRP_AEVENTS. | ||
101 | |||
102 | Programs installing SAs will need to specify the two thresholds, however, | ||
103 | in order to not change existing applications such as racoon | ||
104 | we also provide default threshold values for these different parameters | ||
105 | in case they are not specified. | ||
106 | |||
107 | the two sysctls/proc entries are: | ||
108 | a) /proc/sys/net/core/sysctl_xfrm_aevent_etime | ||
109 | used to provide default values for the XFRMA_ETIMER_THRESH in incremental | ||
110 | units of time of 100ms. The default is 10 (1 second) | ||
111 | |||
112 | b) /proc/sys/net/core/sysctl_xfrm_aevent_rseqth | ||
113 | used to provide default values for XFRMA_REPLAY_THRESH parameter | ||
114 | in incremental packet count. The default is two packets. | ||
115 | |||
116 | 4) Message types | ||
117 | ---------------- | ||
118 | |||
119 | a) XFRM_MSG_GETAE issued by user-->kernel. | ||
120 | XFRM_MSG_GETAE does not carry any TLVs. | ||
121 | The response is a XFRM_MSG_NEWAE which is formatted based on what | ||
122 | XFRM_MSG_GETAE queried for. | ||
123 | The response will always have XFRMA_LTIME_VAL and XFRMA_REPLAY_VAL TLVs. | ||
124 | *if XFRM_AE_RTHR flag is set, then XFRMA_REPLAY_THRESH is also retrieved | ||
125 | *if XFRM_AE_ETHR flag is set, then XFRMA_ETIMER_THRESH is also retrieved | ||
126 | |||
127 | b) XFRM_MSG_NEWAE is issued by either user space to configure | ||
128 | or kernel to announce events or respond to a XFRM_MSG_GETAE. | ||
129 | |||
130 | i) user --> kernel to configure a specific SA. | ||
131 | any of the values or threshold parameters can be updated by passing the | ||
132 | appropriate TLV. | ||
133 | A response is issued back to the sender in user space to indicate success | ||
134 | or failure. | ||
135 | In the case of success, additionally an event with | ||
136 | XFRM_MSG_NEWAE is also issued to any listeners as described in iii). | ||
137 | |||
138 | ii) kernel->user direction as a response to XFRM_MSG_GETAE | ||
139 | The response will always have XFRMA_LTIME_VAL and XFRMA_REPLAY_VAL TLVs. | ||
140 | The threshold TLVs will be included if explicitly requested in | ||
141 | the XFRM_MSG_GETAE message. | ||
142 | |||
143 | iii) kernel->user to report as event if someone sets any values or | ||
144 | thresholds for an SA using XFRM_MSG_NEWAE (as described in #i above). | ||
145 | In such a case XFRM_AE_CU flag is set to inform the user that | ||
146 | the change happened as a result of an update. | ||
147 | The message will always have XFRMA_LTIME_VAL and XFRMA_REPLAY_VAL TLVs. | ||
148 | |||
149 | iv) kernel->user to report event when replay threshold or a timeout | ||
150 | is exceeded. | ||
151 | In such a case either XFRM_AE_CR (replay exceeded) or XFRM_AE_CE (timeout | ||
152 | happened) is set to inform the user what happened. | ||
153 | Note the two flags are mutually exclusive. | ||
154 | The message will always have XFRMA_LTIME_VAL and XFRMA_REPLAY_VAL TLVs. | ||
155 | |||
156 | Exceptions to threshold settings | ||
157 | -------------------------------- | ||
158 | |||
159 | If you have an SA that is getting hit by traffic in bursts such that | ||
160 | there is a period where the timer threshold expires with no packets | ||
161 | seen, then an odd behavior is seen as follows: | ||
162 | The first packet arrival after a timer expiry will trigger a timeout | ||
163 | aevent; i.e we dont wait for a timeout period or a packet threshold | ||
164 | to be reached. This is done for simplicity and efficiency reasons. | ||
165 | |||
166 | -JHS | ||
diff --git a/Documentation/serial/driver b/Documentation/serial/driver index 42ef9970bc86..df82116a9f26 100644 --- a/Documentation/serial/driver +++ b/Documentation/serial/driver | |||
@@ -3,14 +3,11 @@ | |||
3 | -------------------- | 3 | -------------------- |
4 | 4 | ||
5 | 5 | ||
6 | $Id: driver,v 1.10 2002/07/22 15:27:30 rmk Exp $ | ||
7 | |||
8 | |||
9 | This document is meant as a brief overview of some aspects of the new serial | 6 | This document is meant as a brief overview of some aspects of the new serial |
10 | driver. It is not complete, any questions you have should be directed to | 7 | driver. It is not complete, any questions you have should be directed to |
11 | <rmk@arm.linux.org.uk> | 8 | <rmk@arm.linux.org.uk> |
12 | 9 | ||
13 | The reference implementation is contained within serial_amba.c. | 10 | The reference implementation is contained within amba_pl011.c. |
14 | 11 | ||
15 | 12 | ||
16 | 13 | ||
@@ -31,6 +28,11 @@ The serial core provides a few helper functions. This includes identifing | |||
31 | the correct port structure (via uart_get_console) and decoding command line | 28 | the correct port structure (via uart_get_console) and decoding command line |
32 | arguments (uart_parse_options). | 29 | arguments (uart_parse_options). |
33 | 30 | ||
31 | There is also a helper function (uart_write_console) which performs a | ||
32 | character by character write, translating newlines to CRLF sequences. | ||
33 | Driver writers are recommended to use this function rather than implementing | ||
34 | their own version. | ||
35 | |||
34 | 36 | ||
35 | Locking | 37 | Locking |
36 | ------- | 38 | ------- |
@@ -86,6 +88,7 @@ hardware. | |||
86 | - TIOCM_DTR DTR signal. | 88 | - TIOCM_DTR DTR signal. |
87 | - TIOCM_OUT1 OUT1 signal. | 89 | - TIOCM_OUT1 OUT1 signal. |
88 | - TIOCM_OUT2 OUT2 signal. | 90 | - TIOCM_OUT2 OUT2 signal. |
91 | - TIOCM_LOOP Set the port into loopback mode. | ||
89 | If the appropriate bit is set, the signal should be driven | 92 | If the appropriate bit is set, the signal should be driven |
90 | active. If the bit is clear, the signal should be driven | 93 | active. If the bit is clear, the signal should be driven |
91 | inactive. | 94 | inactive. |
@@ -141,6 +144,10 @@ hardware. | |||
141 | enable_ms(port) | 144 | enable_ms(port) |
142 | Enable the modem status interrupts. | 145 | Enable the modem status interrupts. |
143 | 146 | ||
147 | This method may be called multiple times. Modem status | ||
148 | interrupts should be disabled when the shutdown method is | ||
149 | called. | ||
150 | |||
144 | Locking: port->lock taken. | 151 | Locking: port->lock taken. |
145 | Interrupts: locally disabled. | 152 | Interrupts: locally disabled. |
146 | This call must not sleep | 153 | This call must not sleep |
@@ -160,6 +167,8 @@ hardware. | |||
160 | state. Enable the port for reception. It should not activate | 167 | state. Enable the port for reception. It should not activate |
161 | RTS nor DTR; this will be done via a separate call to set_mctrl. | 168 | RTS nor DTR; this will be done via a separate call to set_mctrl. |
162 | 169 | ||
170 | This method will only be called when the port is initially opened. | ||
171 | |||
163 | Locking: port_sem taken. | 172 | Locking: port_sem taken. |
164 | Interrupts: globally disabled. | 173 | Interrupts: globally disabled. |
165 | 174 | ||
@@ -169,6 +178,11 @@ hardware. | |||
169 | RTS nor DTR; this will have already been done via a separate | 178 | RTS nor DTR; this will have already been done via a separate |
170 | call to set_mctrl. | 179 | call to set_mctrl. |
171 | 180 | ||
181 | Drivers must not access port->info once this call has completed. | ||
182 | |||
183 | This method will only be called when there are no more users of | ||
184 | this port. | ||
185 | |||
172 | Locking: port_sem taken. | 186 | Locking: port_sem taken. |
173 | Interrupts: caller dependent. | 187 | Interrupts: caller dependent. |
174 | 188 | ||