/* Set the PowerSavingControlBits. * Bitvalues: * 0 => unset the bit * 1 => set the bit * -1 => calculate the bit */ void bcm43xx_power_saving_ctl_bits(struct bcm43xx_wldev *dev, int bit25, int bit26) { int i; u32 status; //FIXME: Force 25 to off and 26 to on for now: bit25 = 0; bit26 = 1; if (bit25 == -1) { //TODO: If powersave is not off and FIXME is not set and we are not in adhoc // and thus is not an AP and we are associated, set bit 25 } if (bit26 == -1) { //TODO: If the device is awake or this is an AP, or we are scanning, or FIXME, // or we are associated, or FIXME, or the latest PS-Poll packet sent was // successful, set bit26 } status = bcm43xx_read32(dev, BCM43xx_MMIO_STATUS_BITFIELD); if (bit25) status |= BCM43xx_SBF_PS1; else status &= ~BCM43xx_SBF_PS1; if (bit26) status |= BCM43xx_SBF_PS2; else status &= ~BCM43xx_SBF_PS2; bcm43xx_write32(dev, BCM43xx_MMIO_STATUS_BITFIELD, status); if (bit26 && dev->dev->id.revision >= 5) { for (i = 0; i < 100; i++) { if (bcm43xx_shm_read32(dev, BCM43xx_SHM_SHARED, 0x0040) != 4) break; udelay(10); } } }
static ssize_t devinfo_read_file(struct file *file, char __user *userbuf, size_t count, loff_t *ppos) { const size_t len = REALLY_BIG_BUFFER_SIZE; struct bcm43xx_private *bcm = file->private_data; char *buf = really_big_buffer; size_t pos = 0; ssize_t res; struct net_device *net_dev; struct pci_dev *pci_dev; unsigned long flags; u16 tmp16; int i; down(&big_buffer_sem); bcm43xx_lock_mmio(bcm, flags); if (!bcm->initialized) { fappend("Board not initialized.\n"); goto out; } net_dev = bcm->net_dev; pci_dev = bcm->pci_dev; /* This is where the information is written to the "devinfo" file */ fappend("*** %s devinfo ***\n", net_dev->name); fappend("vendor: 0x%04x device: 0x%04x\n", pci_dev->vendor, pci_dev->device); fappend("subsystem_vendor: 0x%04x subsystem_device: 0x%04x\n", pci_dev->subsystem_vendor, pci_dev->subsystem_device); fappend("IRQ: %d\n", bcm->irq); fappend("mmio_addr: 0x%p mmio_len: %u\n", bcm->mmio_addr, bcm->mmio_len); fappend("chip_id: 0x%04x chip_rev: 0x%02x\n", bcm->chip_id, bcm->chip_rev); if ((bcm->core_80211[0].rev >= 3) && (bcm43xx_read32(bcm, 0x0158) & (1 << 16))) fappend("Radio disabled by hardware!\n"); if ((bcm->core_80211[0].rev < 3) && !(bcm43xx_read16(bcm, 0x049A) & (1 << 4))) fappend("Radio disabled by hardware!\n"); fappend("board_vendor: 0x%04x board_type: 0x%04x\n", bcm->board_vendor, bcm->board_type); fappend("\nCores:\n"); #define fappend_core(name, info) fappend("core \"" name "\" %s, %s, id: 0x%04x, " \ "rev: 0x%02x, index: 0x%02x\n", \ (info).available \ ? "available" : "nonavailable", \ (info).enabled \ ? "enabled" : "disabled", \ (info).id, (info).rev, (info).index) fappend_core("CHIPCOMMON", bcm->core_chipcommon); fappend_core("PCI", bcm->core_pci); fappend_core("first 80211", bcm->core_80211[0]); fappend_core("second 80211", bcm->core_80211[1]); #undef fappend_core tmp16 = bcm43xx_read16(bcm, BCM43xx_MMIO_GPIO_CONTROL); fappend("LEDs: "); for (i = 0; i < BCM43xx_NR_LEDS; i++) fappend("%d ", !!(tmp16 & (1 << i))); fappend("\n"); out: bcm43xx_unlock_mmio(bcm, flags); res = simple_read_from_buffer(userbuf, count, ppos, buf, pos); up(&big_buffer_sem); return res; }