diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Kconfig | 30 | ||||
-rw-r--r-- | lib/pci_iomap.c | 35 |
2 files changed, 45 insertions, 20 deletions
diff --git a/lib/Kconfig b/lib/Kconfig index cb9758e0ba0c..87da53bb1fef 100644 --- a/lib/Kconfig +++ b/lib/Kconfig | |||
@@ -23,7 +23,7 @@ config HAVE_ARCH_BITREVERSE | |||
23 | have this capability. | 23 | have this capability. |
24 | 24 | ||
25 | config RATIONAL | 25 | config RATIONAL |
26 | boolean | 26 | bool |
27 | 27 | ||
28 | config GENERIC_STRNCPY_FROM_USER | 28 | config GENERIC_STRNCPY_FROM_USER |
29 | bool | 29 | bool |
@@ -48,14 +48,14 @@ config GENERIC_IOMAP | |||
48 | select GENERIC_PCI_IOMAP | 48 | select GENERIC_PCI_IOMAP |
49 | 49 | ||
50 | config GENERIC_IO | 50 | config GENERIC_IO |
51 | boolean | 51 | bool |
52 | default n | 52 | default n |
53 | 53 | ||
54 | config STMP_DEVICE | 54 | config STMP_DEVICE |
55 | bool | 55 | bool |
56 | 56 | ||
57 | config PERCPU_RWSEM | 57 | config PERCPU_RWSEM |
58 | boolean | 58 | bool |
59 | 59 | ||
60 | config ARCH_USE_CMPXCHG_LOCKREF | 60 | config ARCH_USE_CMPXCHG_LOCKREF |
61 | bool | 61 | bool |
@@ -266,7 +266,7 @@ config DECOMPRESS_LZ4 | |||
266 | # Generic allocator support is selected if needed | 266 | # Generic allocator support is selected if needed |
267 | # | 267 | # |
268 | config GENERIC_ALLOCATOR | 268 | config GENERIC_ALLOCATOR |
269 | boolean | 269 | bool |
270 | 270 | ||
271 | # | 271 | # |
272 | # reed solomon support is select'ed if needed | 272 | # reed solomon support is select'ed if needed |
@@ -275,16 +275,16 @@ config REED_SOLOMON | |||
275 | tristate | 275 | tristate |
276 | 276 | ||
277 | config REED_SOLOMON_ENC8 | 277 | config REED_SOLOMON_ENC8 |
278 | boolean | 278 | bool |
279 | 279 | ||
280 | config REED_SOLOMON_DEC8 | 280 | config REED_SOLOMON_DEC8 |
281 | boolean | 281 | bool |
282 | 282 | ||
283 | config REED_SOLOMON_ENC16 | 283 | config REED_SOLOMON_ENC16 |
284 | boolean | 284 | bool |
285 | 285 | ||
286 | config REED_SOLOMON_DEC16 | 286 | config REED_SOLOMON_DEC16 |
287 | boolean | 287 | bool |
288 | 288 | ||
289 | # | 289 | # |
290 | # BCH support is selected if needed | 290 | # BCH support is selected if needed |
@@ -293,7 +293,7 @@ config BCH | |||
293 | tristate | 293 | tristate |
294 | 294 | ||
295 | config BCH_CONST_PARAMS | 295 | config BCH_CONST_PARAMS |
296 | boolean | 296 | bool |
297 | help | 297 | help |
298 | Drivers may select this option to force specific constant | 298 | Drivers may select this option to force specific constant |
299 | values for parameters 'm' (Galois field order) and 't' | 299 | values for parameters 'm' (Galois field order) and 't' |
@@ -329,7 +329,7 @@ config BCH_CONST_T | |||
329 | # Textsearch support is select'ed if needed | 329 | # Textsearch support is select'ed if needed |
330 | # | 330 | # |
331 | config TEXTSEARCH | 331 | config TEXTSEARCH |
332 | boolean | 332 | bool |
333 | 333 | ||
334 | config TEXTSEARCH_KMP | 334 | config TEXTSEARCH_KMP |
335 | tristate | 335 | tristate |
@@ -341,10 +341,10 @@ config TEXTSEARCH_FSM | |||
341 | tristate | 341 | tristate |
342 | 342 | ||
343 | config BTREE | 343 | config BTREE |
344 | boolean | 344 | bool |
345 | 345 | ||
346 | config INTERVAL_TREE | 346 | config INTERVAL_TREE |
347 | boolean | 347 | bool |
348 | help | 348 | help |
349 | Simple, embeddable, interval-tree. Can find the start of an | 349 | Simple, embeddable, interval-tree. Can find the start of an |
350 | overlapping range in log(n) time and then iterate over all | 350 | overlapping range in log(n) time and then iterate over all |
@@ -372,18 +372,18 @@ config ASSOCIATIVE_ARRAY | |||
372 | for more information. | 372 | for more information. |
373 | 373 | ||
374 | config HAS_IOMEM | 374 | config HAS_IOMEM |
375 | boolean | 375 | bool |
376 | depends on !NO_IOMEM | 376 | depends on !NO_IOMEM |
377 | select GENERIC_IO | 377 | select GENERIC_IO |
378 | default y | 378 | default y |
379 | 379 | ||
380 | config HAS_IOPORT_MAP | 380 | config HAS_IOPORT_MAP |
381 | boolean | 381 | bool |
382 | depends on HAS_IOMEM && !NO_IOPORT_MAP | 382 | depends on HAS_IOMEM && !NO_IOPORT_MAP |
383 | default y | 383 | default y |
384 | 384 | ||
385 | config HAS_DMA | 385 | config HAS_DMA |
386 | boolean | 386 | bool |
387 | depends on !NO_DMA | 387 | depends on !NO_DMA |
388 | default y | 388 | default y |
389 | 389 | ||
diff --git a/lib/pci_iomap.c b/lib/pci_iomap.c index 0d83ea8a9605..bcce5f149310 100644 --- a/lib/pci_iomap.c +++ b/lib/pci_iomap.c | |||
@@ -10,10 +10,11 @@ | |||
10 | 10 | ||
11 | #ifdef CONFIG_PCI | 11 | #ifdef CONFIG_PCI |
12 | /** | 12 | /** |
13 | * pci_iomap - create a virtual mapping cookie for a PCI BAR | 13 | * pci_iomap_range - create a virtual mapping cookie for a PCI BAR |
14 | * @dev: PCI device that owns the BAR | 14 | * @dev: PCI device that owns the BAR |
15 | * @bar: BAR number | 15 | * @bar: BAR number |
16 | * @maxlen: length of the memory to map | 16 | * @offset: map memory at the given offset in BAR |
17 | * @maxlen: max length of the memory to map | ||
17 | * | 18 | * |
18 | * Using this function you will get a __iomem address to your device BAR. | 19 | * Using this function you will get a __iomem address to your device BAR. |
19 | * You can access it using ioread*() and iowrite*(). These functions hide | 20 | * You can access it using ioread*() and iowrite*(). These functions hide |
@@ -21,16 +22,21 @@ | |||
21 | * you expect from them in the correct way. | 22 | * you expect from them in the correct way. |
22 | * | 23 | * |
23 | * @maxlen specifies the maximum length to map. If you want to get access to | 24 | * @maxlen specifies the maximum length to map. If you want to get access to |
24 | * the complete BAR without checking for its length first, pass %0 here. | 25 | * the complete BAR from offset to the end, pass %0 here. |
25 | * */ | 26 | * */ |
26 | void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen) | 27 | void __iomem *pci_iomap_range(struct pci_dev *dev, |
28 | int bar, | ||
29 | unsigned long offset, | ||
30 | unsigned long maxlen) | ||
27 | { | 31 | { |
28 | resource_size_t start = pci_resource_start(dev, bar); | 32 | resource_size_t start = pci_resource_start(dev, bar); |
29 | resource_size_t len = pci_resource_len(dev, bar); | 33 | resource_size_t len = pci_resource_len(dev, bar); |
30 | unsigned long flags = pci_resource_flags(dev, bar); | 34 | unsigned long flags = pci_resource_flags(dev, bar); |
31 | 35 | ||
32 | if (!len || !start) | 36 | if (len <= offset || !start) |
33 | return NULL; | 37 | return NULL; |
38 | len -= offset; | ||
39 | start += offset; | ||
34 | if (maxlen && len > maxlen) | 40 | if (maxlen && len > maxlen) |
35 | len = maxlen; | 41 | len = maxlen; |
36 | if (flags & IORESOURCE_IO) | 42 | if (flags & IORESOURCE_IO) |
@@ -43,6 +49,25 @@ void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen) | |||
43 | /* What? */ | 49 | /* What? */ |
44 | return NULL; | 50 | return NULL; |
45 | } | 51 | } |
52 | EXPORT_SYMBOL(pci_iomap_range); | ||
46 | 53 | ||
54 | /** | ||
55 | * pci_iomap - create a virtual mapping cookie for a PCI BAR | ||
56 | * @dev: PCI device that owns the BAR | ||
57 | * @bar: BAR number | ||
58 | * @maxlen: length of the memory to map | ||
59 | * | ||
60 | * Using this function you will get a __iomem address to your device BAR. | ||
61 | * You can access it using ioread*() and iowrite*(). These functions hide | ||
62 | * the details if this is a MMIO or PIO address space and will just do what | ||
63 | * you expect from them in the correct way. | ||
64 | * | ||
65 | * @maxlen specifies the maximum length to map. If you want to get access to | ||
66 | * the complete BAR without checking for its length first, pass %0 here. | ||
67 | * */ | ||
68 | void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen) | ||
69 | { | ||
70 | return pci_iomap_range(dev, bar, 0, maxlen); | ||
71 | } | ||
47 | EXPORT_SYMBOL(pci_iomap); | 72 | EXPORT_SYMBOL(pci_iomap); |
48 | #endif /* CONFIG_PCI */ | 73 | #endif /* CONFIG_PCI */ |