Lines Matching full:esp

27 			shost_printk(KERN_DEBUG, esp->host, f, ##a);	\
92 struct esp *esp; member
96 static void pci_esp_dma_drain(struct esp *esp);
98 static inline struct pci_esp_priv *pci_esp_get_priv(struct esp *esp) in pci_esp_get_priv() argument
100 return dev_get_drvdata(esp->dev); in pci_esp_get_priv()
103 static void pci_esp_write8(struct esp *esp, u8 val, unsigned long reg) in pci_esp_write8() argument
105 iowrite8(val, esp->regs + (reg * 4UL)); in pci_esp_write8()
108 static u8 pci_esp_read8(struct esp *esp, unsigned long reg) in pci_esp_read8() argument
110 return ioread8(esp->regs + (reg * 4UL)); in pci_esp_read8()
113 static void pci_esp_write32(struct esp *esp, u32 val, unsigned long reg) in pci_esp_write32() argument
115 return iowrite32(val, esp->regs + (reg * 4UL)); in pci_esp_write32()
118 static int pci_esp_irq_pending(struct esp *esp) in pci_esp_irq_pending() argument
120 struct pci_esp_priv *pep = pci_esp_get_priv(esp); in pci_esp_irq_pending()
122 pep->dma_status = pci_esp_read8(esp, ESP_DMA_STATUS); in pci_esp_irq_pending()
134 static void pci_esp_reset_dma(struct esp *esp) in pci_esp_reset_dma() argument
139 static void pci_esp_dma_drain(struct esp *esp) in pci_esp_dma_drain() argument
145 if ((esp->sreg & ESP_STAT_PMASK) == ESP_DOP || in pci_esp_dma_drain()
146 (esp->sreg & ESP_STAT_PMASK) == ESP_DIP) in pci_esp_dma_drain()
151 resid = pci_esp_read8(esp, ESP_FFLAGS) & ESP_FF_FBYTES; in pci_esp_dma_drain()
165 pci_esp_write8(esp, ESP_DMA_CMD_DIR | ESP_DMA_CMD_BLAST, ESP_DMA_CMD); in pci_esp_dma_drain()
166 while (pci_esp_read8(esp, ESP_DMA_STATUS) & ESP_DMA_STAT_BCMPLT) { in pci_esp_dma_drain()
171 pci_esp_write8(esp, ESP_DMA_CMD_DIR | ESP_DMA_CMD_IDLE, ESP_DMA_CMD); in pci_esp_dma_drain()
175 struct esp_cmd_entry *ent = esp->active_cmd; in pci_esp_dma_drain()
181 static void pci_esp_dma_invalidate(struct esp *esp) in pci_esp_dma_invalidate() argument
183 struct pci_esp_priv *pep = pci_esp_get_priv(esp); in pci_esp_dma_invalidate()
187 pci_esp_write8(esp, ESP_DMA_CMD_IDLE, ESP_DMA_CMD); in pci_esp_dma_invalidate()
191 static int pci_esp_dma_error(struct esp *esp) in pci_esp_dma_error() argument
193 struct pci_esp_priv *pep = pci_esp_get_priv(esp); in pci_esp_dma_error()
196 u8 dma_cmd = pci_esp_read8(esp, ESP_DMA_CMD); in pci_esp_dma_error()
199 pci_esp_write8(esp, ESP_DMA_CMD_ABORT, ESP_DMA_CMD); in pci_esp_dma_error()
204 pci_esp_write8(esp, ESP_DMA_CMD_IDLE, ESP_DMA_CMD); in pci_esp_dma_error()
205 pep->dma_status = pci_esp_read8(esp, ESP_DMA_CMD); in pci_esp_dma_error()
211 static void pci_esp_send_dma_cmd(struct esp *esp, u32 addr, u32 esp_count, in pci_esp_send_dma_cmd() argument
214 struct pci_esp_priv *pep = pci_esp_get_priv(esp); in pci_esp_send_dma_cmd()
225 pci_esp_write8(esp, ESP_DMA_CMD_IDLE | val, ESP_DMA_CMD); in pci_esp_send_dma_cmd()
227 pci_esp_write8(esp, (esp_count >> 0) & 0xff, ESP_TCLOW); in pci_esp_send_dma_cmd()
228 pci_esp_write8(esp, (esp_count >> 8) & 0xff, ESP_TCMED); in pci_esp_send_dma_cmd()
229 if (esp->config2 & ESP_CONFIG2_FENAB) in pci_esp_send_dma_cmd()
230 pci_esp_write8(esp, (esp_count >> 16) & 0xff, ESP_TCHI); in pci_esp_send_dma_cmd()
232 pci_esp_write32(esp, esp_count, ESP_DMA_STC); in pci_esp_send_dma_cmd()
233 pci_esp_write32(esp, addr, ESP_DMA_SPA); in pci_esp_send_dma_cmd()
238 scsi_esp_cmd(esp, cmd); in pci_esp_send_dma_cmd()
240 pci_esp_write8(esp, ESP_DMA_CMD_START | val, ESP_DMA_CMD); in pci_esp_send_dma_cmd()
243 static u32 pci_esp_dma_length_limit(struct esp *esp, u32 dma_addr, u32 dma_len) in pci_esp_dma_length_limit() argument
252 if (esp->config2 & ESP_CONFIG2_FENAB) in pci_esp_dma_length_limit()
347 static void dc390_check_eeprom(struct esp *esp) in dc390_check_eeprom() argument
349 struct pci_dev *pdev = to_pci_dev(esp->dev); in dc390_check_eeprom()
365 esp->scsi_id = EEbuf[DC390_EE_ADAPT_SCSI_ID]; in dc390_check_eeprom()
366 esp->num_tags = 2 << EEbuf[DC390_EE_TAG_CMD_NUM]; in dc390_check_eeprom()
368 esp->config4 |= ESP_CONFIG4_RADE | ESP_CONFIG4_RAE; in dc390_check_eeprom()
377 struct esp *esp; in pci_esp_probe_one() local
391 shost = scsi_host_alloc(hostt, sizeof(struct esp)); in pci_esp_probe_one()
407 esp = shost_priv(shost); in pci_esp_probe_one()
408 esp->host = shost; in pci_esp_probe_one()
409 esp->dev = &pdev->dev; in pci_esp_probe_one()
410 esp->ops = &pci_esp_ops; in pci_esp_probe_one()
416 esp->flags |= ESP_FLAG_USE_FIFO; in pci_esp_probe_one()
421 esp->config2 |= ESP_CONFIG2_FENAB; in pci_esp_probe_one()
423 pep->esp = esp; in pci_esp_probe_one()
431 esp->regs = pci_iomap(pdev, 0, pci_resource_len(pdev, 0)); in pci_esp_probe_one()
432 if (!esp->regs) { in pci_esp_probe_one()
437 esp->dma_regs = esp->regs; in pci_esp_probe_one()
441 esp->command_block = dma_alloc_coherent(&pdev->dev, 16, in pci_esp_probe_one()
442 &esp->command_block_dma, GFP_KERNEL); in pci_esp_probe_one()
443 if (!esp->command_block) { in pci_esp_probe_one()
453 DRV_MODULE_NAME, esp); in pci_esp_probe_one()
459 esp->scsi_id = 7; in pci_esp_probe_one()
460 dc390_check_eeprom(esp); in pci_esp_probe_one()
462 shost->this_id = esp->scsi_id; in pci_esp_probe_one()
468 esp->scsi_id_mask = (1 << esp->scsi_id); in pci_esp_probe_one()
470 esp->cfreq = 40000000; in pci_esp_probe_one()
472 err = scsi_esp_register(esp); in pci_esp_probe_one()
479 free_irq(pdev->irq, esp); in pci_esp_probe_one()
482 dma_free_coherent(&pdev->dev, 16, esp->command_block, in pci_esp_probe_one()
483 esp->command_block_dma); in pci_esp_probe_one()
485 pci_iounmap(pdev, esp->regs); in pci_esp_probe_one()
501 struct esp *esp = pep->esp; in pci_esp_remove_one() local
503 scsi_esp_unregister(esp); in pci_esp_remove_one()
504 free_irq(pdev->irq, esp); in pci_esp_remove_one()
506 dma_free_coherent(&pdev->dev, 16, esp->command_block, in pci_esp_remove_one()
507 esp->command_block_dma); in pci_esp_remove_one()
508 pci_iounmap(pdev, esp->regs); in pci_esp_remove_one()
513 scsi_host_put(esp->host); in pci_esp_remove_one()