aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorMichael Buesch <mb@bu3sch.de>2008-06-19 13:38:32 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-06-26 16:49:18 -0400
commitefa275822b50ab942c79ba26f053f9a0cd220e9e (patch)
treef6cd22fbe934b8f64d40962378638aa9a0d752fa /drivers
parent6bbc321a96d4d3533eb136b981baba6c8248d635 (diff)
b43: Add mask/set capability to debugfs MMIO interface
This adds an atomic mask/set capability to the debugfs MMIO interface. This is needed to support mask and/or set operations from the userspace debugging tools. Signed-off-by: Michael Buesch <mb@bu3sch.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/b43/debugfs.c38
1 files changed, 30 insertions, 8 deletions
diff --git a/drivers/net/wireless/b43/debugfs.c b/drivers/net/wireless/b43/debugfs.c
index dd40ad826c78..cfe8e202e4c3 100644
--- a/drivers/net/wireless/b43/debugfs.c
+++ b/drivers/net/wireless/b43/debugfs.c
@@ -267,6 +267,8 @@ static int mmio16read__write_file(struct b43_wldev *dev,
267 return -EINVAL; 267 return -EINVAL;
268 if (addr > B43_MAX_MMIO_ACCESS) 268 if (addr > B43_MAX_MMIO_ACCESS)
269 return -EADDRNOTAVAIL; 269 return -EADDRNOTAVAIL;
270 if ((addr % 2) != 0)
271 return -EINVAL;
270 272
271 dev->dfsentry->mmio16read_next = addr; 273 dev->dfsentry->mmio16read_next = addr;
272 274
@@ -276,17 +278,26 @@ static int mmio16read__write_file(struct b43_wldev *dev,
276static int mmio16write__write_file(struct b43_wldev *dev, 278static int mmio16write__write_file(struct b43_wldev *dev,
277 const char *buf, size_t count) 279 const char *buf, size_t count)
278{ 280{
279 unsigned int addr, val; 281 unsigned int addr, mask, set;
280 int res; 282 int res;
283 u16 val;
281 284
282 res = sscanf(buf, "0x%X = 0x%X", &addr, &val); 285 res = sscanf(buf, "0x%X 0x%X 0x%X", &addr, &mask, &set);
283 if (res != 2) 286 if (res != 3)
284 return -EINVAL; 287 return -EINVAL;
285 if (addr > B43_MAX_MMIO_ACCESS) 288 if (addr > B43_MAX_MMIO_ACCESS)
286 return -EADDRNOTAVAIL; 289 return -EADDRNOTAVAIL;
287 if (val > 0xFFFF) 290 if ((mask > 0xFFFF) || (set > 0xFFFF))
288 return -E2BIG; 291 return -E2BIG;
292 if ((addr % 2) != 0)
293 return -EINVAL;
289 294
295 if (mask == 0)
296 val = 0;
297 else
298 val = b43_read16(dev, addr);
299 val &= mask;
300 val |= set;
290 b43_write16(dev, addr, val); 301 b43_write16(dev, addr, val);
291 302
292 return 0; 303 return 0;
@@ -320,6 +331,8 @@ static int mmio32read__write_file(struct b43_wldev *dev,
320 return -EINVAL; 331 return -EINVAL;
321 if (addr > B43_MAX_MMIO_ACCESS) 332 if (addr > B43_MAX_MMIO_ACCESS)
322 return -EADDRNOTAVAIL; 333 return -EADDRNOTAVAIL;
334 if ((addr % 4) != 0)
335 return -EINVAL;
323 336
324 dev->dfsentry->mmio32read_next = addr; 337 dev->dfsentry->mmio32read_next = addr;
325 338
@@ -329,17 +342,26 @@ static int mmio32read__write_file(struct b43_wldev *dev,
329static int mmio32write__write_file(struct b43_wldev *dev, 342static int mmio32write__write_file(struct b43_wldev *dev,
330 const char *buf, size_t count) 343 const char *buf, size_t count)
331{ 344{
332 unsigned int addr, val; 345 unsigned int addr, mask, set;
333 int res; 346 int res;
347 u32 val;
334 348
335 res = sscanf(buf, "0x%X = 0x%X", &addr, &val); 349 res = sscanf(buf, "0x%X 0x%X 0x%X", &addr, &mask, &set);
336 if (res != 2) 350 if (res != 3)
337 return -EINVAL; 351 return -EINVAL;
338 if (addr > B43_MAX_MMIO_ACCESS) 352 if (addr > B43_MAX_MMIO_ACCESS)
339 return -EADDRNOTAVAIL; 353 return -EADDRNOTAVAIL;
340 if (val > 0xFFFFFFFF) 354 if ((mask > 0xFFFFFFFF) || (set > 0xFFFFFFFF))
341 return -E2BIG; 355 return -E2BIG;
356 if ((addr % 4) != 0)
357 return -EINVAL;
342 358
359 if (mask == 0)
360 val = 0;
361 else
362 val = b43_read32(dev, addr);
363 val &= mask;
364 val |= set;
343 b43_write32(dev, addr, val); 365 b43_write32(dev, addr, val);
344 366
345 return 0; 367 return 0;