aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/bcm43xx
diff options
context:
space:
mode:
authorLarry Finger <Larry.Finger@lwfinger.net>2006-09-07 11:12:11 -0400
committerJohn W. Linville <linville@tuxdriver.com>2006-09-11 19:34:02 -0400
commit87d263271b1bbf344c596ac308417ff692ddc851 (patch)
tree566f6b682e55f6ae68a73da17ee6e78f771035ef /drivers/net/wireless/bcm43xx
parent1ef4583ee3e1efab83d05b6ccdad378c9caaa95f (diff)
[PATCH] bcm43xx: ucode debug status via sysfs
This patch prints out the ucode debug status to sysfs. So, users can watch the microcode status of their hardware. Signed-off-by: Martin Langer <martin-langer@gmx.de> Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/bcm43xx')
-rw-r--r--drivers/net/wireless/bcm43xx/bcm43xx.h9
-rw-r--r--drivers/net/wireless/bcm43xx/bcm43xx_sysfs.c59
2 files changed, 64 insertions, 4 deletions
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx.h b/drivers/net/wireless/bcm43xx/bcm43xx.h
index e7d802157803..6d4ea36bc564 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx.h
+++ b/drivers/net/wireless/bcm43xx/bcm43xx.h
@@ -307,10 +307,11 @@
307#define BCM43xx_SBF_80000000 0x80000000 /*FIXME: fix name*/ 307#define BCM43xx_SBF_80000000 0x80000000 /*FIXME: fix name*/
308 308
309/* Microcode */ 309/* Microcode */
310#define BCM43xx_UCODE_REVISION 0x0000 310#define BCM43xx_UCODE_REVISION 0x0000
311#define BCM43xx_UCODE_PATCHLEVEL 0x0002 311#define BCM43xx_UCODE_PATCHLEVEL 0x0002
312#define BCM43xx_UCODE_DATE 0x0004 312#define BCM43xx_UCODE_DATE 0x0004
313#define BCM43xx_UCODE_TIME 0x0006 313#define BCM43xx_UCODE_TIME 0x0006
314#define BCM43xx_UCODE_STATUS 0x0040
314 315
315/* MicrocodeFlagsBitfield (addr + lo-word values?)*/ 316/* MicrocodeFlagsBitfield (addr + lo-word values?)*/
316#define BCM43xx_UCODEFLAGS_OFFSET 0x005E 317#define BCM43xx_UCODEFLAGS_OFFSET 0x005E
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_sysfs.c b/drivers/net/wireless/bcm43xx/bcm43xx_sysfs.c
index a16400d9ff4b..b2bc5a9b6245 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx_sysfs.c
+++ b/drivers/net/wireless/bcm43xx/bcm43xx_sysfs.c
@@ -376,6 +376,59 @@ static DEVICE_ATTR(phymode, 0644,
376 bcm43xx_attr_phymode_show, 376 bcm43xx_attr_phymode_show,
377 bcm43xx_attr_phymode_store); 377 bcm43xx_attr_phymode_store);
378 378
379static ssize_t bcm43xx_attr_microcode_show(struct device *dev,
380 struct device_attribute *attr,
381 char *buf)
382{
383 unsigned long flags;
384 struct bcm43xx_private *bcm = dev_to_bcm(dev);
385 ssize_t count = 0;
386 u16 status;
387
388 if (!capable(CAP_NET_ADMIN))
389 return -EPERM;
390
391 mutex_lock(&(bcm)->mutex);
392 spin_lock_irqsave(&bcm->irq_lock, flags);
393 status = bcm43xx_shm_read16(bcm, BCM43xx_SHM_SHARED,
394 BCM43xx_UCODE_STATUS);
395
396 spin_unlock_irqrestore(&bcm->irq_lock, flags);
397 mutex_unlock(&(bcm)->mutex);
398 switch (status) {
399 case 0x0000:
400 count = snprintf(buf, PAGE_SIZE, "0x%.4x (invalid)\n",
401 status);
402 break;
403 case 0x0001:
404 count = snprintf(buf, PAGE_SIZE, "0x%.4x (init)\n",
405 status);
406 break;
407 case 0x0002:
408 count = snprintf(buf, PAGE_SIZE, "0x%.4x (active)\n",
409 status);
410 break;
411 case 0x0003:
412 count = snprintf(buf, PAGE_SIZE, "0x%.4x (suspended)\n",
413 status);
414 break;
415 case 0x0004:
416 count = snprintf(buf, PAGE_SIZE, "0x%.4x (asleep)\n",
417 status);
418 break;
419 default:
420 count = snprintf(buf, PAGE_SIZE, "0x%.4x (unknown)\n",
421 status);
422 break;
423 }
424
425 return count;
426}
427
428static DEVICE_ATTR(microcodestatus, 0444,
429 bcm43xx_attr_microcode_show,
430 NULL);
431
379int bcm43xx_sysfs_register(struct bcm43xx_private *bcm) 432int bcm43xx_sysfs_register(struct bcm43xx_private *bcm)
380{ 433{
381 struct device *dev = &bcm->pci_dev->dev; 434 struct device *dev = &bcm->pci_dev->dev;
@@ -395,9 +448,14 @@ int bcm43xx_sysfs_register(struct bcm43xx_private *bcm)
395 err = device_create_file(dev, &dev_attr_phymode); 448 err = device_create_file(dev, &dev_attr_phymode);
396 if (err) 449 if (err)
397 goto err_remove_shortpreamble; 450 goto err_remove_shortpreamble;
451 err = device_create_file(dev, &dev_attr_microcodestatus);
452 if (err)
453 goto err_remove_phymode;
398 454
399out: 455out:
400 return err; 456 return err;
457err_remove_phymode:
458 device_remove_file(dev, &dev_attr_phymode);
401err_remove_shortpreamble: 459err_remove_shortpreamble:
402 device_remove_file(dev, &dev_attr_shortpreamble); 460 device_remove_file(dev, &dev_attr_shortpreamble);
403err_remove_interfmode: 461err_remove_interfmode:
@@ -411,6 +469,7 @@ void bcm43xx_sysfs_unregister(struct bcm43xx_private *bcm)
411{ 469{
412 struct device *dev = &bcm->pci_dev->dev; 470 struct device *dev = &bcm->pci_dev->dev;
413 471
472 device_remove_file(dev, &dev_attr_microcodestatus);
414 device_remove_file(dev, &dev_attr_phymode); 473 device_remove_file(dev, &dev_attr_phymode);
415 device_remove_file(dev, &dev_attr_shortpreamble); 474 device_remove_file(dev, &dev_attr_shortpreamble);
416 device_remove_file(dev, &dev_attr_interference); 475 device_remove_file(dev, &dev_attr_interference);