• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/components/opensource/linux/linux-2.6.36/drivers/misc/

Lines Matching refs:hw

66 static int fifo_enqueue(struct ilo_hwinfo *hw, char *fifobar, int entry)
72 spin_lock_irqsave(&hw->fifo_lock, flags);
80 spin_unlock_irqrestore(&hw->fifo_lock, flags);
85 static int fifo_dequeue(struct ilo_hwinfo *hw, char *fifobar, int *entry)
92 spin_lock_irqsave(&hw->fifo_lock, flags);
103 spin_unlock_irqrestore(&hw->fifo_lock, flags);
108 static int fifo_check_recv(struct ilo_hwinfo *hw, char *fifobar)
115 spin_lock_irqsave(&hw->fifo_lock, flags);
119 spin_unlock_irqrestore(&hw->fifo_lock, flags);
124 static int ilo_pkt_enqueue(struct ilo_hwinfo *hw, struct ccb *ccb,
136 return fifo_enqueue(hw, fifobar, entry);
139 static int ilo_pkt_dequeue(struct ilo_hwinfo *hw, struct ccb *ccb,
154 ret = fifo_dequeue(hw, fifobar, &entry);
168 static int ilo_pkt_recv(struct ilo_hwinfo *hw, struct ccb *ccb)
172 return fifo_check_recv(hw, fifobar);
231 /* complicated dance to tell the hw we are stopping */
250 /* clear the hw ccb */
257 static int ilo_ccb_setup(struct ilo_hwinfo *hw, struct ccb_data *data, int slot)
270 data->dma_va = pci_alloc_consistent(hw->ilo_dev, data->dma_size,
316 driver_ccb->ccb_u5.db_base = hw->db_vaddr + (slot << L2_DB_SIZE);
317 ilo_ccb->ccb_u5.db_base = NULL; /* hw ccb's doorbell is not used */
322 static void ilo_ccb_open(struct ilo_hwinfo *hw, struct ccb_data *data, int slot)
329 (hw->ram_vaddr + (slot * ILOHW_CCB_SZ));
335 ilo_pkt_enqueue(hw, driver_ccb, SENDQ, pkt_id, pkt_sz);
341 ilo_pkt_enqueue(hw, driver_ccb, RECVQ, pkt_id, pkt_sz);
347 static int ilo_ccb_verify(struct ilo_hwinfo *hw, struct ccb_data *data)
354 if (ilo_pkt_dequeue(hw, driver_ccb, SENDQ, &pkt_id, NULL, NULL))
360 dev_err(&hw->ilo_dev->dev, "Open could not dequeue a packet\n");
364 ilo_pkt_enqueue(hw, driver_ccb, SENDQ, pkt_id, 0);
381 static inline int get_device_outbound(struct ilo_hwinfo *hw)
383 return ioread32(&hw->mmio_vaddr[DB_OUT]);
391 static inline int is_device_reset(struct ilo_hwinfo *hw)
394 return is_db_reset(get_device_outbound(hw));
397 static inline void clear_pending_db(struct ilo_hwinfo *hw, int clr)
399 iowrite32(clr, &hw->mmio_vaddr[DB_OUT]);
402 static inline void clear_device(struct ilo_hwinfo *hw)
405 clear_pending_db(hw, -1);
408 static inline void ilo_enable_interrupts(struct ilo_hwinfo *hw)
410 iowrite8(ioread8(&hw->mmio_vaddr[DB_IRQ]) | 1, &hw->mmio_vaddr[DB_IRQ]);
413 static inline void ilo_disable_interrupts(struct ilo_hwinfo *hw)
415 iowrite8(ioread8(&hw->mmio_vaddr[DB_IRQ]) & ~1,
416 &hw->mmio_vaddr[DB_IRQ]);
419 static void ilo_set_reset(struct ilo_hwinfo *hw)
428 if (!hw->ccb_alloc[slot])
430 set_channel_reset(&hw->ccb_alloc[slot]->driver_ccb);
440 struct ilo_hwinfo *hw = data->ilo_hw;
461 found = ilo_pkt_dequeue(hw, driver_ccb, RECVQ, &pkt_id,
479 ilo_pkt_enqueue(hw, driver_ccb, RECVQ, pkt_id, desc_mem_sz(1));
490 struct ilo_hwinfo *hw = data->ilo_hw;
497 if (!ilo_pkt_dequeue(hw, driver_ccb, SENDQ, &pkt_id, &pkt_len, &pkt))
510 ilo_pkt_enqueue(hw, driver_ccb, SENDQ, pkt_id, len);
535 struct ilo_hwinfo *hw;
539 hw = container_of(ip->i_cdev, struct ilo_hwinfo, cdev);
541 spin_lock(&hw->open_lock);
543 if (hw->ccb_alloc[slot]->ccb_cnt == 1) {
547 spin_lock_irqsave(&hw->alloc_lock, flags);
548 hw->ccb_alloc[slot] = NULL;
549 spin_unlock_irqrestore(&hw->alloc_lock, flags);
551 ilo_ccb_close(hw->ilo_dev, data);
555 hw->ccb_alloc[slot]->ccb_cnt--;
557 spin_unlock(&hw->open_lock);
566 struct ilo_hwinfo *hw;
570 hw = container_of(ip->i_cdev, struct ilo_hwinfo, cdev);
577 spin_lock(&hw->open_lock);
579 /* each fd private_data holds sw/hw view of ccb */
580 if (hw->ccb_alloc[slot] == NULL) {
582 error = ilo_ccb_setup(hw, data, slot);
590 data->ilo_hw = hw;
593 /* write the ccb to hw */
594 spin_lock_irqsave(&hw->alloc_lock, flags);
595 ilo_ccb_open(hw, data, slot);
596 hw->ccb_alloc[slot] = data;
597 spin_unlock_irqrestore(&hw->alloc_lock, flags);
600 error = ilo_ccb_verify(hw, data);
603 spin_lock_irqsave(&hw->alloc_lock, flags);
604 hw->ccb_alloc[slot] = NULL;
605 spin_unlock_irqrestore(&hw->alloc_lock, flags);
607 ilo_ccb_close(hw->ilo_dev, data);
615 if (fp->f_flags & O_EXCL || hw->ccb_alloc[slot]->ccb_excl) {
623 hw->ccb_alloc[slot]->ccb_cnt++;
628 spin_unlock(&hw->open_lock);
631 fp->private_data = hw->ccb_alloc[slot];
647 struct ilo_hwinfo *hw = data;
650 spin_lock(&hw->alloc_lock);
653 pending = get_device_outbound(hw);
655 spin_unlock(&hw->alloc_lock);
662 ilo_set_reset(hw);
666 if (!hw->ccb_alloc[i])
669 wake_up_interruptible(&hw->ccb_alloc[i]->ccb_waitq);
673 clear_pending_db(hw, pending);
675 spin_unlock(&hw->alloc_lock);
680 static void ilo_unmap_device(struct pci_dev *pdev, struct ilo_hwinfo *hw)
682 pci_iounmap(pdev, hw->db_vaddr);
683 pci_iounmap(pdev, hw->ram_vaddr);
684 pci_iounmap(pdev, hw->mmio_vaddr);
687 static int __devinit ilo_map_device(struct pci_dev *pdev, struct ilo_hwinfo *hw)
692 hw->mmio_vaddr = pci_iomap(pdev, 1, 0);
693 if (hw->mmio_vaddr == NULL) {
699 hw->ram_vaddr = pci_iomap(pdev, 2, MAX_CCB * ILOHW_CCB_SZ);
700 if (hw->ram_vaddr == NULL) {
706 hw->db_vaddr = pci_iomap(pdev, 3, MAX_CCB * ONE_DB_SIZE);
707 if (hw->db_vaddr == NULL) {
714 pci_iounmap(pdev, hw->ram_vaddr);
716 pci_iounmap(pdev, hw->mmio_vaddr);