iomap.c (2002e90412df17ef7f714be62ed96a3c80b2f907) | iomap.c (67a3e8fe90156d41cd480d3dfbb40f3bc007c262) |
---|---|
1/* 2 * Copyright(c) 2013-2015 Intel Corporation. All rights reserved. 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of version 2 of the GNU General Public License as 6 * published by the Free Software Foundation. 7 * 8 * This program is distributed in the hope that it will be useful, but --- 66 unchanged lines hidden (view full) --- 75 rcu_read_unlock(); 76 if (nfit_res) 77 return (void __iomem *) nfit_res->buf + offset 78 - nfit_res->res->start; 79 return devm_ioremap_nocache(dev, offset, size); 80} 81EXPORT_SYMBOL(__wrap_devm_ioremap_nocache); 82 | 1/* 2 * Copyright(c) 2013-2015 Intel Corporation. All rights reserved. 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of version 2 of the GNU General Public License as 6 * published by the Free Software Foundation. 7 * 8 * This program is distributed in the hope that it will be useful, but --- 66 unchanged lines hidden (view full) --- 75 rcu_read_unlock(); 76 if (nfit_res) 77 return (void __iomem *) nfit_res->buf + offset 78 - nfit_res->res->start; 79 return devm_ioremap_nocache(dev, offset, size); 80} 81EXPORT_SYMBOL(__wrap_devm_ioremap_nocache); 82 |
83void __iomem *__wrap_ioremap_cache(resource_size_t offset, unsigned long size) | 83void *__wrap_devm_memremap(struct device *dev, resource_size_t offset, 84 size_t size, unsigned long flags) |
84{ | 85{ |
85 return __nfit_test_ioremap(offset, size, ioremap_cache); | 86 struct nfit_test_resource *nfit_res; 87 88 rcu_read_lock(); 89 nfit_res = get_nfit_res(offset); 90 rcu_read_unlock(); 91 if (nfit_res) 92 return nfit_res->buf + offset - nfit_res->res->start; 93 return devm_memremap(dev, offset, size, flags); |
86} | 94} |
87EXPORT_SYMBOL(__wrap_ioremap_cache); | 95EXPORT_SYMBOL(__wrap_devm_memremap); |
88 | 96 |
97void *__wrap_memremap(resource_size_t offset, size_t size, 98 unsigned long flags) 99{ 100 struct nfit_test_resource *nfit_res; 101 102 rcu_read_lock(); 103 nfit_res = get_nfit_res(offset); 104 rcu_read_unlock(); 105 if (nfit_res) 106 return nfit_res->buf + offset - nfit_res->res->start; 107 return memremap(offset, size, flags); 108} 109EXPORT_SYMBOL(__wrap_memremap); 110 |
|
89void __iomem *__wrap_ioremap_nocache(resource_size_t offset, unsigned long size) 90{ 91 return __nfit_test_ioremap(offset, size, ioremap_nocache); 92} 93EXPORT_SYMBOL(__wrap_ioremap_nocache); 94 | 111void __iomem *__wrap_ioremap_nocache(resource_size_t offset, unsigned long size) 112{ 113 return __nfit_test_ioremap(offset, size, ioremap_nocache); 114} 115EXPORT_SYMBOL(__wrap_ioremap_nocache); 116 |
95void __iomem *__wrap_ioremap_wt(resource_size_t offset, unsigned long size) 96{ 97 return __nfit_test_ioremap(offset, size, ioremap_wt); 98} 99EXPORT_SYMBOL(__wrap_ioremap_wt); 100 | |
101void __iomem *__wrap_ioremap_wc(resource_size_t offset, unsigned long size) 102{ 103 return __nfit_test_ioremap(offset, size, ioremap_wc); 104} 105EXPORT_SYMBOL(__wrap_ioremap_wc); 106 107void __wrap_iounmap(volatile void __iomem *addr) 108{ 109 struct nfit_test_resource *nfit_res; 110 111 rcu_read_lock(); 112 nfit_res = get_nfit_res((unsigned long) addr); 113 rcu_read_unlock(); 114 if (nfit_res) 115 return; 116 return iounmap(addr); 117} 118EXPORT_SYMBOL(__wrap_iounmap); 119 | 117void __iomem *__wrap_ioremap_wc(resource_size_t offset, unsigned long size) 118{ 119 return __nfit_test_ioremap(offset, size, ioremap_wc); 120} 121EXPORT_SYMBOL(__wrap_ioremap_wc); 122 123void __wrap_iounmap(volatile void __iomem *addr) 124{ 125 struct nfit_test_resource *nfit_res; 126 127 rcu_read_lock(); 128 nfit_res = get_nfit_res((unsigned long) addr); 129 rcu_read_unlock(); 130 if (nfit_res) 131 return; 132 return iounmap(addr); 133} 134EXPORT_SYMBOL(__wrap_iounmap); 135 |
120struct resource *__wrap___request_region(struct resource *parent, 121 resource_size_t start, resource_size_t n, const char *name, 122 int flags) | 136void __wrap_memunmap(void *addr) |
123{ 124 struct nfit_test_resource *nfit_res; 125 | 137{ 138 struct nfit_test_resource *nfit_res; 139 |
140 rcu_read_lock(); 141 nfit_res = get_nfit_res((unsigned long) addr); 142 rcu_read_unlock(); 143 if (nfit_res) 144 return; 145 return memunmap(addr); 146} 147EXPORT_SYMBOL(__wrap_memunmap); 148 149static struct resource *nfit_test_request_region(struct device *dev, 150 struct resource *parent, resource_size_t start, 151 resource_size_t n, const char *name, int flags) 152{ 153 struct nfit_test_resource *nfit_res; 154 |
|
126 if (parent == &iomem_resource) { 127 rcu_read_lock(); 128 nfit_res = get_nfit_res(start); 129 rcu_read_unlock(); 130 if (nfit_res) { 131 struct resource *res = nfit_res->res + 1; 132 133 if (start + n > nfit_res->res->start --- 8 unchanged lines hidden (view full) --- 142 res->end = start + n - 1; 143 res->name = name; 144 res->flags = resource_type(parent); 145 res->flags |= IORESOURCE_BUSY | flags; 146 pr_debug("%s: %pr\n", __func__, res); 147 return res; 148 } 149 } | 155 if (parent == &iomem_resource) { 156 rcu_read_lock(); 157 nfit_res = get_nfit_res(start); 158 rcu_read_unlock(); 159 if (nfit_res) { 160 struct resource *res = nfit_res->res + 1; 161 162 if (start + n > nfit_res->res->start --- 8 unchanged lines hidden (view full) --- 171 res->end = start + n - 1; 172 res->name = name; 173 res->flags = resource_type(parent); 174 res->flags |= IORESOURCE_BUSY | flags; 175 pr_debug("%s: %pr\n", __func__, res); 176 return res; 177 } 178 } |
179 if (dev) 180 return __devm_request_region(dev, parent, start, n, name); |
|
150 return __request_region(parent, start, n, name, flags); 151} | 181 return __request_region(parent, start, n, name, flags); 182} |
183 184struct resource *__wrap___request_region(struct resource *parent, 185 resource_size_t start, resource_size_t n, const char *name, 186 int flags) 187{ 188 return nfit_test_request_region(NULL, parent, start, n, name, flags); 189} |
|
152EXPORT_SYMBOL(__wrap___request_region); 153 | 190EXPORT_SYMBOL(__wrap___request_region); 191 |
192struct resource *__wrap___devm_request_region(struct device *dev, 193 struct resource *parent, resource_size_t start, 194 resource_size_t n, const char *name) 195{ 196 if (!dev) 197 return NULL; 198 return nfit_test_request_region(dev, parent, start, n, name, 0); 199} 200EXPORT_SYMBOL(__wrap___devm_request_region); 201 |
|
154void __wrap___release_region(struct resource *parent, resource_size_t start, 155 resource_size_t n) 156{ 157 struct nfit_test_resource *nfit_res; 158 159 if (parent == &iomem_resource) { 160 rcu_read_lock(); 161 nfit_res = get_nfit_res(start); --- 17 unchanged lines hidden --- | 202void __wrap___release_region(struct resource *parent, resource_size_t start, 203 resource_size_t n) 204{ 205 struct nfit_test_resource *nfit_res; 206 207 if (parent == &iomem_resource) { 208 rcu_read_lock(); 209 nfit_res = get_nfit_res(start); --- 17 unchanged lines hidden --- |