static void dma_init_read(struct NCR_ESP *esp, __u32 addr, int length) { struct fastlane_dma_registers *dregs = (struct fastlane_dma_registers *) (esp->dregs); unsigned long *t; cache_clear(addr, length); dma_clear(esp); t = (unsigned long *)((addr & 0x00ffffff) + esp->edev); dregs->clear_strobe = 0; *t = addr; ctrl_data = (ctrl_data & FASTLANE_DMA_MASK) | FASTLANE_DMA_ENABLE; dregs->ctrl_reg = ctrl_data; }
/***************************************************************** Detection */ int __init fastlane_esp_detect(Scsi_Host_Template *tpnt) { struct NCR_ESP *esp; struct zorro_dev *z = NULL; unsigned long address; if ((z = zorro_find_device(ZORRO_PROD_PHASE5_BLIZZARD_1230_II_FASTLANE_Z3_CYBERSCSI_CYBERSTORM060, z))) { unsigned long board = z->resource.start; if (request_mem_region(board+FASTLANE_ESP_ADDR, sizeof(struct ESP_regs), "NCR53C9x")) { /* Check if this is really a fastlane controller. The problem * is that also the cyberstorm and blizzard controllers use * this ID value. Fortunately only Fastlane maps in Z3 space */ if (board < 0x1000000) { goto err_release; } esp = esp_allocate(tpnt, (void *)board+FASTLANE_ESP_ADDR); /* Do command transfer with programmed I/O */ esp->do_pio_cmds = 1; /* Required functions */ esp->dma_bytes_sent = &dma_bytes_sent; esp->dma_can_transfer = &dma_can_transfer; esp->dma_dump_state = &dma_dump_state; esp->dma_init_read = &dma_init_read; esp->dma_init_write = &dma_init_write; esp->dma_ints_off = &dma_ints_off; esp->dma_ints_on = &dma_ints_on; esp->dma_irq_p = &dma_irq_p; esp->dma_ports_p = &dma_ports_p; esp->dma_setup = &dma_setup; /* Optional functions */ esp->dma_barrier = 0; esp->dma_drain = 0; esp->dma_invalidate = 0; esp->dma_irq_entry = 0; esp->dma_irq_exit = &dma_irq_exit; esp->dma_led_on = &dma_led_on; esp->dma_led_off = &dma_led_off; esp->dma_poll = 0; esp->dma_reset = 0; /* Initialize the portBits (enable IRQs) */ ctrl_data = (FASTLANE_DMA_FCODE | #ifndef NODMAIRQ FASTLANE_DMA_EDI | #endif FASTLANE_DMA_ESI); /* SCSI chip clock */ esp->cfreq = 40000000; /* Map the physical address space into virtual kernel space */ address = (unsigned long) ioremap_nocache(board, z->resource.end-board+1); if(!address){ printk("Could not remap Fastlane controller memory!"); goto err_unregister; } /* The DMA registers on the Fastlane are mapped * relative to the device (i.e. in the same Zorro * I/O block). */ esp->dregs = (void *)(address + FASTLANE_DMA_ADDR); /* ESP register base */ esp->eregs = (struct ESP_regs *)(address + FASTLANE_ESP_ADDR); /* Board base */ esp->edev = (void *) address; /* Set the command buffer */ esp->esp_command = (volatile unsigned char*) cmd_buffer; esp->esp_command_dvma = virt_to_bus(cmd_buffer); esp->irq = IRQ_AMIGA_PORTS; esp->slot = board+FASTLANE_ESP_ADDR; if (request_irq(IRQ_AMIGA_PORTS, esp_intr, SA_SHIRQ, "Fastlane SCSI", esp_intr)) { printk(KERN_WARNING "Fastlane: Could not get IRQ%d, aborting.\n", IRQ_AMIGA_PORTS); goto err_unmap; } /* Controller ID */ esp->scsi_id = 7; /* We don't have a differential SCSI-bus. */ esp->diff = 0; dma_clear(esp); esp_initialize(esp); printk("ESP: Total of %d ESP hosts found, %d actually in use.\n", nesps, esps_in_use); esps_running = esps_in_use; return esps_in_use; } } return 0; err_unmap: iounmap((void *)address); err_unregister: scsi_unregister (esp->ehost); err_release: release_mem_region(z->resource.start+FASTLANE_ESP_ADDR, sizeof(struct ESP_regs)); return 0; }
/***************************************************************** Detection */ int fastlane_esp_detect(Scsi_Host_Template *tpnt) { struct NCR_ESP *esp; const struct ConfigDev *esp_dev; unsigned int key; unsigned long address; if ((key = zorro_find(ZORRO_PROD_PHASE5_BLIZZARD_1230_II_FASTLANE_Z3_CYBERSCSI_CYBERSTORM060, 0, 0))){ esp_dev = zorro_get_board(key); /* Check if this is really a fastlane controller. The problem * is that also the cyberstorm and blizzard controllers use * this ID value. Fortunately only Fastlane maps in Z3 space */ if((unsigned long)esp_dev->cd_BoardAddr < 0x1000000) return 0; esp = esp_allocate(tpnt, (void *) esp_dev); /* Do command transfer with programmed I/O */ esp->do_pio_cmds = 1; /* Required functions */ esp->dma_bytes_sent = &dma_bytes_sent; esp->dma_can_transfer = &dma_can_transfer; esp->dma_dump_state = &dma_dump_state; esp->dma_init_read = &dma_init_read; esp->dma_init_write = &dma_init_write; esp->dma_ints_off = &dma_ints_off; esp->dma_ints_on = &dma_ints_on; esp->dma_irq_p = &dma_irq_p; esp->dma_ports_p = &dma_ports_p; esp->dma_setup = &dma_setup; /* Optional functions */ esp->dma_barrier = 0; esp->dma_drain = 0; esp->dma_invalidate = 0; esp->dma_irq_entry = 0; esp->dma_irq_exit = &dma_irq_exit; esp->dma_led_on = &dma_led_on; esp->dma_led_off = &dma_led_off; esp->dma_poll = 0; esp->dma_reset = 0; /* Initialize the portBits (enable IRQs) */ ctrl_data = (FASTLANE_DMA_FCODE | #ifndef NODMAIRQ FASTLANE_DMA_EDI | #endif FASTLANE_DMA_ESI); /* SCSI chip clock */ esp->cfreq = 40000000; /* Map the physical address space into virtual kernel space */ address = (unsigned long) kernel_map((unsigned long)esp_dev->cd_BoardAddr, esp_dev->cd_BoardSize, KERNELMAP_NOCACHE_SER, NULL); if(!address){ printk("Could not remap Fastlane controller memory!"); scsi_unregister (esp->ehost); return 0; } /* The DMA registers on the Fastlane are mapped * relative to the device (i.e. in the same Zorro * I/O block). */ esp->dregs = (void *)(address + FASTLANE_DMA_ADDR); /* ESP register base */ esp->eregs = (struct ESP_regs *)(address + FASTLANE_ESP_ADDR); /* Board base */ esp->edev = (void *) address; /* Set the command buffer */ esp->esp_command = (volatile unsigned char*) cmd_buffer; esp->esp_command_dvma = virt_to_bus((unsigned long) cmd_buffer); esp->irq = IRQ_AMIGA_PORTS; request_irq(IRQ_AMIGA_PORTS, esp_intr, 0, "Fastlane SCSI", esp_intr); /* Controller ID */ esp->scsi_id = 7; /* Check for differential SCSI-bus */ /* What is this stuff? */ esp->diff = 0; dma_clear(esp); esp_initialize(esp); zorro_config_board(key, 0); printk("\nESP: Total of %d ESP hosts found, %d actually in use.\n", nesps,esps_in_use); esps_running = esps_in_use; return esps_in_use; } return 0; }