Lines Matching refs:pHba

153 static inline int dpt_dma64(adpt_hba *pHba)  in dpt_dma64()  argument
155 return (sizeof(dma_addr_t) > 4 && (pHba)->dma64); in dpt_dma64()
193 adpt_hba *pHba; in adpt_detect() local
212 for (pHba = hba_chain; pHba; pHba = next) { in adpt_detect()
213 next = pHba->next; in adpt_detect()
215 if (adpt_i2o_activate_hba(pHba) < 0) { in adpt_detect()
216 adpt_i2o_delete_hba(pHba); in adpt_detect()
239 for (pHba = hba_chain; pHba; pHba = pHba->next) { in adpt_detect()
240 if (adpt_i2o_online_hba(pHba) < 0) { in adpt_detect()
241 adpt_i2o_delete_hba(pHba); in adpt_detect()
250 for (pHba = hba_chain; pHba; pHba = next) { in adpt_detect()
251 next = pHba->next; in adpt_detect()
252 printk(KERN_INFO"%s: Reading the hardware resource table.\n", pHba->name); in adpt_detect()
253 if (adpt_i2o_lct_get(pHba) < 0){ in adpt_detect()
254 adpt_i2o_delete_hba(pHba); in adpt_detect()
258 if (adpt_i2o_parse_lct(pHba) < 0){ in adpt_detect()
259 adpt_i2o_delete_hba(pHba); in adpt_detect()
262 adpt_inquiry(pHba); in adpt_detect()
271 for (pHba = hba_chain; pHba; pHba = next) { in adpt_detect()
272 next = pHba->next; in adpt_detect()
273 if (adpt_scsi_host_alloc(pHba, sht) < 0){ in adpt_detect()
274 adpt_i2o_delete_hba(pHba); in adpt_detect()
277 pHba->initialized = TRUE; in adpt_detect()
278 pHba->state &= ~DPTI_STATE_RESET; in adpt_detect()
281 NULL, MKDEV(DPTI_I2O_MAJOR, pHba->unit), NULL, in adpt_detect()
282 "dpti%d", pHba->unit); in adpt_detect()
286 pHba->unit); in adpt_detect()
307 adpt_hba* pHba = (adpt_hba*) host->hostdata[0]; in adpt_release() local
309 adpt_i2o_delete_hba(pHba); in adpt_release()
315 static void adpt_inquiry(adpt_hba* pHba) in adpt_inquiry() argument
330 buf = dma_alloc_coherent(&pHba->pDev->dev, 80, &addr, GFP_KERNEL); in adpt_inquiry()
332 printk(KERN_ERR"%s: Could not allocate buffer\n",pHba->name); in adpt_inquiry()
341 if (dpt_dma64(pHba)) in adpt_inquiry()
377 if (dpt_dma64(pHba)) { in adpt_inquiry()
389 rcode = adpt_i2o_post_wait(pHba, msg, reqlen<<2, 120); in adpt_inquiry()
391 sprintf(pHba->detail, "Adaptec I2O RAID"); in adpt_inquiry()
392 printk(KERN_INFO "%s: Inquiry Error (%d)\n",pHba->name,rcode); in adpt_inquiry()
394 dma_free_coherent(&pHba->pDev->dev, 80, buf, addr); in adpt_inquiry()
396 memset(pHba->detail, 0, sizeof(pHba->detail)); in adpt_inquiry()
397 memcpy(&(pHba->detail), "Vendor: Adaptec ", 16); in adpt_inquiry()
398 memcpy(&(pHba->detail[16]), " Model: ", 8); in adpt_inquiry()
399 memcpy(&(pHba->detail[24]), (u8*) &buf[16], 16); in adpt_inquiry()
400 memcpy(&(pHba->detail[40]), " FW: ", 4); in adpt_inquiry()
401 memcpy(&(pHba->detail[44]), (u8*) &buf[32], 4); in adpt_inquiry()
402 pHba->detail[48] = '\0'; /* precautionary */ in adpt_inquiry()
403 dma_free_coherent(&pHba->pDev->dev, 80, buf, addr); in adpt_inquiry()
405 adpt_i2o_status_get(pHba); in adpt_inquiry()
413 adpt_hba* pHba; in adpt_slave_configure() local
415 pHba = (adpt_hba *) host->hostdata[0]; in adpt_slave_configure()
426 adpt_hba* pHba = NULL; in adpt_queue_lck() local
443 pHba = (adpt_hba*)cmd->device->host->hostdata[0]; in adpt_queue_lck()
444 if (!pHba) { in adpt_queue_lck()
449 if ((pHba->state) & DPTI_STATE_RESET) in adpt_queue_lck()
460 …if ((pDev = adpt_find_device(pHba, (u32)cmd->device->channel, (u32)cmd->device->id, cmd->device->l… in adpt_queue_lck()
478 return adpt_scsi_to_i2o(pHba, cmd, pDev); in adpt_queue_lck()
537 adpt_hba* pHba; in adpt_info() local
539 pHba = (adpt_hba *) host->hostdata[0]; in adpt_info()
540 return (char *) (pHba->detail); in adpt_info()
548 adpt_hba* pHba; in adpt_show_info() local
553 for (pHba = hba_chain; pHba; pHba = pHba->next) { in adpt_show_info()
554 if (pHba->host == host) { in adpt_show_info()
559 if (pHba == NULL) { in adpt_show_info()
562 host = pHba->host; in adpt_show_info()
565 seq_printf(m, "%s\n", pHba->detail); in adpt_show_info()
567 pHba->host->host_no, pHba->name, host->irq); in adpt_show_info()
569 host->can_queue, (int) pHba->reply_fifo_size , host->sg_tablesize); in adpt_show_info()
574 d = pHba->channel[chan].device[id]; in adpt_show_info()
603 adpt_cmd_from_context(adpt_hba * pHba, u32 context) in adpt_cmd_from_context() argument
611 spin_unlock(pHba->host->host_lock); in adpt_cmd_from_context()
612 shost_for_each_device(d, pHba->host) { in adpt_cmd_from_context()
619 spin_lock(pHba->host->host_lock); in adpt_cmd_from_context()
625 spin_lock(pHba->host->host_lock); in adpt_cmd_from_context()
633 static u32 adpt_ioctl_to_context(adpt_hba * pHba, void *reply) in adpt_ioctl_to_context() argument
641 spin_lock_irqsave(pHba->host->host_lock, flags); in adpt_ioctl_to_context()
642 nr = ARRAY_SIZE(pHba->ioctl_reply_context); in adpt_ioctl_to_context()
644 if (pHba->ioctl_reply_context[i] == NULL) { in adpt_ioctl_to_context()
645 pHba->ioctl_reply_context[i] = reply; in adpt_ioctl_to_context()
649 spin_unlock_irqrestore(pHba->host->host_lock, flags); in adpt_ioctl_to_context()
653 "ioctl commands\n", pHba->name); in adpt_ioctl_to_context()
664 static void *adpt_ioctl_from_context(adpt_hba *pHba, u32 context) in adpt_ioctl_from_context() argument
669 void *p = pHba->ioctl_reply_context[context]; in adpt_ioctl_from_context()
670 pHba->ioctl_reply_context[context] = NULL; in adpt_ioctl_from_context()
683 adpt_hba* pHba = NULL; /* host bus adapter structure */ in adpt_abort() local
691 pHba = (adpt_hba*) cmd->device->host->hostdata[0]; in adpt_abort()
692 printk(KERN_INFO"%s: Trying to Abort\n",pHba->name); in adpt_abort()
694 printk(KERN_ERR "%s: Unable to abort: No device in cmnd\n",pHba->name); in adpt_abort()
704 if (pHba->host) in adpt_abort()
705 spin_lock_irq(pHba->host->host_lock); in adpt_abort()
706 rcode = adpt_i2o_post_wait(pHba, msg, sizeof(msg), FOREVER); in adpt_abort()
707 if (pHba->host) in adpt_abort()
708 spin_unlock_irq(pHba->host->host_lock); in adpt_abort()
711 printk(KERN_INFO"%s: Abort cmd not supported\n",pHba->name); in adpt_abort()
714 printk(KERN_INFO"%s: Abort failed.\n",pHba->name); in adpt_abort()
717 printk(KERN_INFO"%s: Abort complete.\n",pHba->name); in adpt_abort()
728 adpt_hba* pHba; in adpt_device_reset() local
734 pHba = (void*) cmd->device->host->hostdata[0]; in adpt_device_reset()
735 printk(KERN_INFO"%s: Trying to reset device\n",pHba->name); in adpt_device_reset()
737 printk(KERN_INFO"%s: Reset Device: Device Not found\n",pHba->name); in adpt_device_reset()
746 if (pHba->host) in adpt_device_reset()
747 spin_lock_irq(pHba->host->host_lock); in adpt_device_reset()
750 rcode = adpt_i2o_post_wait(pHba, msg,sizeof(msg), FOREVER); in adpt_device_reset()
752 if (pHba->host) in adpt_device_reset()
753 spin_unlock_irq(pHba->host->host_lock); in adpt_device_reset()
756 printk(KERN_INFO"%s: Device reset not supported\n",pHba->name); in adpt_device_reset()
759 printk(KERN_INFO"%s: Device reset failed\n",pHba->name); in adpt_device_reset()
762 printk(KERN_INFO"%s: Device reset successful\n",pHba->name); in adpt_device_reset()
772 adpt_hba* pHba; in adpt_bus_reset() local
776 pHba = (adpt_hba*)cmd->device->host->hostdata[0]; in adpt_bus_reset()
778 …printk(KERN_WARNING"%s: Bus reset: SCSI Bus %d: tid: %d\n",pHba->name, cmd->device->channel,pHba->… in adpt_bus_reset()
780 msg[1] = (I2O_HBA_BUS_RESET<<24|HOST_TID<<12|pHba->channel[cmd->device->channel].tid); in adpt_bus_reset()
783 if (pHba->host) in adpt_bus_reset()
784 spin_lock_irq(pHba->host->host_lock); in adpt_bus_reset()
785 rcode = adpt_i2o_post_wait(pHba, msg,sizeof(msg), FOREVER); in adpt_bus_reset()
786 if (pHba->host) in adpt_bus_reset()
787 spin_unlock_irq(pHba->host->host_lock); in adpt_bus_reset()
789 printk(KERN_WARNING"%s: Bus reset failed.\n",pHba->name); in adpt_bus_reset()
792 printk(KERN_WARNING"%s: Bus reset success.\n",pHba->name); in adpt_bus_reset()
800 adpt_hba* pHba; in __adpt_reset() local
802 pHba = (adpt_hba*)cmd->device->host->hostdata[0]; in __adpt_reset()
803 …printk(KERN_WARNING"%s: Hba Reset: scsi id %d: tid: %d\n",pHba->name,cmd->device->channel,pHba->ch… in __adpt_reset()
804 rcode = adpt_hba_reset(pHba); in __adpt_reset()
806 printk(KERN_WARNING"%s: HBA reset complete\n",pHba->name); in __adpt_reset()
809 printk(KERN_WARNING"%s: HBA reset failed (%x)\n",pHba->name, rcode); in __adpt_reset()
826 static int adpt_hba_reset(adpt_hba* pHba) in adpt_hba_reset() argument
830 pHba->state |= DPTI_STATE_RESET; in adpt_hba_reset()
833 if ((rcode=adpt_i2o_activate_hba(pHba)) < 0) { in adpt_hba_reset()
834 printk(KERN_ERR "%s: Could not activate\n", pHba->name); in adpt_hba_reset()
835 adpt_i2o_delete_hba(pHba); in adpt_hba_reset()
840 adpt_i2o_delete_hba(pHba); in adpt_hba_reset()
843 PDEBUG("%s: in HOLD state\n",pHba->name); in adpt_hba_reset()
845 if ((rcode=adpt_i2o_online_hba(pHba)) < 0) { in adpt_hba_reset()
846 adpt_i2o_delete_hba(pHba); in adpt_hba_reset()
849 PDEBUG("%s: in OPERATIONAL state\n",pHba->name); in adpt_hba_reset()
851 if ((rcode=adpt_i2o_lct_get(pHba)) < 0){ in adpt_hba_reset()
852 adpt_i2o_delete_hba(pHba); in adpt_hba_reset()
856 if ((rcode=adpt_i2o_reparse_lct(pHba)) < 0){ in adpt_hba_reset()
857 adpt_i2o_delete_hba(pHba); in adpt_hba_reset()
860 pHba->state &= ~DPTI_STATE_RESET; in adpt_hba_reset()
862 adpt_fail_posted_scbs(pHba); in adpt_hba_reset()
874 adpt_hba *pHba, *pNext; in adpt_i2o_sys_shutdown() local
883 for (pHba = hba_chain; pHba; pHba = pNext) { in adpt_i2o_sys_shutdown()
884 pNext = pHba->next; in adpt_i2o_sys_shutdown()
885 adpt_i2o_delete_hba(pHba); in adpt_i2o_sys_shutdown()
907 adpt_hba* pHba = NULL; in adpt_install_hba() local
1003 pHba = kzalloc(sizeof(adpt_hba), GFP_KERNEL); in adpt_install_hba()
1004 if (!pHba) { in adpt_install_hba()
1016 p->next = pHba; in adpt_install_hba()
1018 hba_chain = pHba; in adpt_install_hba()
1020 pHba->next = NULL; in adpt_install_hba()
1021 pHba->unit = hba_count; in adpt_install_hba()
1022 sprintf(pHba->name, "dpti%d", hba_count); in adpt_install_hba()
1027 pHba->pDev = pDev; in adpt_install_hba()
1028 pHba->base_addr_phys = base_addr0_phys; in adpt_install_hba()
1031 pHba->base_addr_virt = base_addr_virt; in adpt_install_hba()
1032 pHba->msg_addr_virt = msg_addr_virt; in adpt_install_hba()
1033 pHba->irq_mask = base_addr_virt+0x30; in adpt_install_hba()
1034 pHba->post_port = base_addr_virt+0x40; in adpt_install_hba()
1035 pHba->reply_port = base_addr_virt+0x44; in adpt_install_hba()
1037 pHba->hrt = NULL; in adpt_install_hba()
1038 pHba->lct = NULL; in adpt_install_hba()
1039 pHba->lct_size = 0; in adpt_install_hba()
1040 pHba->status_block = NULL; in adpt_install_hba()
1041 pHba->post_count = 0; in adpt_install_hba()
1042 pHba->state = DPTI_STATE_RESET; in adpt_install_hba()
1043 pHba->pDev = pDev; in adpt_install_hba()
1044 pHba->devices = NULL; in adpt_install_hba()
1045 pHba->dma64 = dma64; in adpt_install_hba()
1048 spin_lock_init(&pHba->state_lock); in adpt_install_hba()
1065 if (request_irq (pDev->irq, adpt_isr, IRQF_SHARED, pHba->name, pHba)) { in adpt_install_hba()
1066 printk(KERN_ERR"%s: Couldn't register IRQ %d\n", pHba->name, pDev->irq); in adpt_install_hba()
1067 adpt_i2o_delete_hba(pHba); in adpt_install_hba()
1075 static void adpt_i2o_delete_hba(adpt_hba* pHba) in adpt_i2o_delete_hba() argument
1090 if(pHba->host){ in adpt_i2o_delete_hba()
1091 free_irq(pHba->host->irq, pHba); in adpt_i2o_delete_hba()
1095 if(p1 == pHba) { in adpt_i2o_delete_hba()
1108 iounmap(pHba->base_addr_virt); in adpt_i2o_delete_hba()
1109 pci_release_regions(pHba->pDev); in adpt_i2o_delete_hba()
1110 if(pHba->msg_addr_virt != pHba->base_addr_virt){ in adpt_i2o_delete_hba()
1111 iounmap(pHba->msg_addr_virt); in adpt_i2o_delete_hba()
1113 if(pHba->FwDebugBuffer_P) in adpt_i2o_delete_hba()
1114 iounmap(pHba->FwDebugBuffer_P); in adpt_i2o_delete_hba()
1115 if(pHba->hrt) { in adpt_i2o_delete_hba()
1116 dma_free_coherent(&pHba->pDev->dev, in adpt_i2o_delete_hba()
1117 pHba->hrt->num_entries * pHba->hrt->entry_len << 2, in adpt_i2o_delete_hba()
1118 pHba->hrt, pHba->hrt_pa); in adpt_i2o_delete_hba()
1120 if(pHba->lct) { in adpt_i2o_delete_hba()
1121 dma_free_coherent(&pHba->pDev->dev, pHba->lct_size, in adpt_i2o_delete_hba()
1122 pHba->lct, pHba->lct_pa); in adpt_i2o_delete_hba()
1124 if(pHba->status_block) { in adpt_i2o_delete_hba()
1125 dma_free_coherent(&pHba->pDev->dev, sizeof(i2o_status_block), in adpt_i2o_delete_hba()
1126 pHba->status_block, pHba->status_block_pa); in adpt_i2o_delete_hba()
1128 if(pHba->reply_pool) { in adpt_i2o_delete_hba()
1129 dma_free_coherent(&pHba->pDev->dev, in adpt_i2o_delete_hba()
1130 pHba->reply_fifo_size * REPLY_FRAME_SIZE * 4, in adpt_i2o_delete_hba()
1131 pHba->reply_pool, pHba->reply_pool_pa); in adpt_i2o_delete_hba()
1134 for(d = pHba->devices; d ; d = next){ in adpt_i2o_delete_hba()
1138 for(i = 0 ; i < pHba->top_scsi_channel ; i++){ in adpt_i2o_delete_hba()
1140 if(pHba->channel[i].device[j] != NULL){ in adpt_i2o_delete_hba()
1141 for(pDev = pHba->channel[i].device[j]; pDev; pDev = pNext){ in adpt_i2o_delete_hba()
1148 pci_dev_put(pHba->pDev); in adpt_i2o_delete_hba()
1151 MKDEV(DPTI_I2O_MAJOR, pHba->unit)); in adpt_i2o_delete_hba()
1152 kfree(pHba); in adpt_i2o_delete_hba()
1163 static struct adpt_device* adpt_find_device(adpt_hba* pHba, u32 chan, u32 id, u64 lun) in adpt_find_device() argument
1170 if( pHba->channel[chan].device == NULL){ in adpt_find_device()
1175 d = pHba->channel[chan].device[id]; in adpt_find_device()
1195 static int adpt_i2o_post_wait(adpt_hba* pHba, u32* msg, int len, int timeout) in adpt_i2o_post_wait() argument
1232 if((status = adpt_i2o_post_this(pHba, msg, len)) == 0){ in adpt_i2o_post_wait()
1234 if(pHba->host) in adpt_i2o_post_wait()
1235 spin_unlock_irq(pHba->host->host_lock); in adpt_i2o_post_wait()
1247 if(pHba->host) in adpt_i2o_post_wait()
1248 spin_lock_irq(pHba->host->host_lock); in adpt_i2o_post_wait()
1253 printk(KERN_INFO"dpti%d: POST WAIT TIMEOUT\n",pHba->unit); in adpt_i2o_post_wait()
1282 static s32 adpt_i2o_post_this(adpt_hba* pHba, u32* data, int len) in adpt_i2o_post_this() argument
1290 m = readl(pHba->post_port); in adpt_i2o_post_this()
1295 printk(KERN_WARNING"dpti%d: Timeout waiting for message frame!\n", pHba->unit); in adpt_i2o_post_this()
1301 msg = pHba->msg_addr_virt + m; in adpt_i2o_post_this()
1306 writel(m, pHba->post_port); in adpt_i2o_post_this()
1350 static s32 adpt_i2o_reset_hba(adpt_hba* pHba) in adpt_i2o_reset_hba() argument
1358 if(pHba->initialized == FALSE) { // First time reset should be quick in adpt_i2o_reset_hba()
1361 adpt_i2o_quiesce_hba(pHba); in adpt_i2o_reset_hba()
1366 m = readl(pHba->post_port); in adpt_i2o_reset_hba()
1377 status = dma_alloc_coherent(&pHba->pDev->dev, 4, &addr, GFP_KERNEL); in adpt_i2o_reset_hba()
1379 adpt_send_nop(pHba, m); in adpt_i2o_reset_hba()
1394 memcpy_toio(pHba->msg_addr_virt+m, msg, sizeof(msg)); in adpt_i2o_reset_hba()
1396 writel(m, pHba->post_port); in adpt_i2o_reset_hba()
1401 printk(KERN_WARNING"%s: IOP Reset Timeout\n",pHba->name); in adpt_i2o_reset_hba()
1413 PDEBUG("%s: Reset in progress...\n", pHba->name); in adpt_i2o_reset_hba()
1418 m = readl(pHba->post_port); in adpt_i2o_reset_hba()
1423 printk(KERN_ERR "%s:Timeout waiting for IOP Reset.\n",pHba->name); in adpt_i2o_reset_hba()
1433 adpt_send_nop(pHba, m); in adpt_i2o_reset_hba()
1435 adpt_i2o_status_get(pHba); in adpt_i2o_reset_hba()
1437 pHba->status_block->iop_state != ADAPTER_STATE_RESET) { in adpt_i2o_reset_hba()
1439 pHba->name); in adpt_i2o_reset_hba()
1441 PDEBUG("%s: Reset completed.\n", pHba->name); in adpt_i2o_reset_hba()
1444 dma_free_coherent(&pHba->pDev->dev, 4, status, addr); in adpt_i2o_reset_hba()
1454 static int adpt_i2o_parse_lct(adpt_hba* pHba) in adpt_i2o_parse_lct() argument
1460 i2o_lct *lct = pHba->lct; in adpt_i2o_parse_lct()
1468 printk(KERN_ERR "%s: LCT is empty???\n",pHba->name); in adpt_i2o_parse_lct()
1492 if(adpt_i2o_query_scalar(pHba, tid, 0x8000, -1, buf, 32)<0) { in adpt_i2o_parse_lct()
1499 printk(KERN_WARNING"%s: Channel number %d out of range \n", pHba->name, bus_no); in adpt_i2o_parse_lct()
1503 printk(KERN_WARNING"%s: SCSI ID %d out of range \n", pHba->name, bus_no); in adpt_i2o_parse_lct()
1506 if(bus_no > pHba->top_scsi_channel){ in adpt_i2o_parse_lct()
1507 pHba->top_scsi_channel = bus_no; in adpt_i2o_parse_lct()
1509 if(scsi_id > pHba->top_scsi_id){ in adpt_i2o_parse_lct()
1510 pHba->top_scsi_id = scsi_id; in adpt_i2o_parse_lct()
1512 if(scsi_lun > pHba->top_scsi_lun){ in adpt_i2o_parse_lct()
1513 pHba->top_scsi_lun = scsi_lun; in adpt_i2o_parse_lct()
1520 printk(KERN_CRIT"%s: Out of memory for I2O device data.\n",pHba->name); in adpt_i2o_parse_lct()
1524 d->controller = pHba; in adpt_i2o_parse_lct()
1531 adpt_i2o_report_hba_unit(pHba, d); in adpt_i2o_parse_lct()
1532 adpt_i2o_install_device(pHba, d); in adpt_i2o_parse_lct()
1535 for(d = pHba->devices; d ; d = d->next) { in adpt_i2o_parse_lct()
1541 if(bus_no > pHba->top_scsi_channel){ in adpt_i2o_parse_lct()
1542 pHba->top_scsi_channel = bus_no; in adpt_i2o_parse_lct()
1544 pHba->channel[bus_no].type = d->lct_data.class_id; in adpt_i2o_parse_lct()
1545 pHba->channel[bus_no].tid = tid; in adpt_i2o_parse_lct()
1546 if(adpt_i2o_query_scalar(pHba, tid, 0x0200, -1, buf, 28)>=0) in adpt_i2o_parse_lct()
1548 pHba->channel[bus_no].scsi_id = buf[1]; in adpt_i2o_parse_lct()
1554 printk(KERN_WARNING"%s: Channel number %d out of range - LCT\n", pHba->name, bus_no); in adpt_i2o_parse_lct()
1561 for(d = pHba->devices; d ; d = d->next) { in adpt_i2o_parse_lct()
1569 if(adpt_i2o_query_scalar(pHba, tid, 0x8000, -1, buf, 32)>=0) { in adpt_i2o_parse_lct()
1579 if( pHba->channel[bus_no].device[scsi_id] == NULL){ in adpt_i2o_parse_lct()
1584 pHba->channel[bus_no].device[scsi_id] = pDev; in adpt_i2o_parse_lct()
1586 for( pDev = pHba->channel[bus_no].device[scsi_id]; in adpt_i2o_parse_lct()
1603 if(scsi_id > pHba->top_scsi_id){ in adpt_i2o_parse_lct()
1604 pHba->top_scsi_id = scsi_id; in adpt_i2o_parse_lct()
1606 if(scsi_lun > pHba->top_scsi_lun){ in adpt_i2o_parse_lct()
1607 pHba->top_scsi_lun = scsi_lun; in adpt_i2o_parse_lct()
1625 static int adpt_i2o_install_device(adpt_hba* pHba, struct i2o_device *d) in adpt_i2o_install_device() argument
1628 d->controller=pHba; in adpt_i2o_install_device()
1630 d->next=pHba->devices; in adpt_i2o_install_device()
1632 if (pHba->devices != NULL){ in adpt_i2o_install_device()
1633 pHba->devices->prev=d; in adpt_i2o_install_device()
1635 pHba->devices=d; in adpt_i2o_install_device()
1645 adpt_hba* pHba; in adpt_open() local
1656 for (pHba = hba_chain; pHba; pHba = pHba->next) { in adpt_open()
1657 if (pHba->unit == minor) { in adpt_open()
1661 if (pHba == NULL) { in adpt_open()
1672 pHba->in_use = 1; in adpt_open()
1682 adpt_hba* pHba; in adpt_close() local
1689 for (pHba = hba_chain; pHba; pHba = pHba->next) { in adpt_close()
1690 if (pHba->unit == minor) { in adpt_close()
1695 if (pHba == NULL) { in adpt_close()
1699 pHba->in_use = 0; in adpt_close()
1705 static int adpt_i2o_passthru(adpt_hba* pHba, u32 __user *arg) in adpt_i2o_passthru() argument
1713 void *sg_list[pHba->sg_tablesize]; in adpt_i2o_passthru()
1748 printk(KERN_WARNING"%s: Could not allocate reply buffer\n",pHba->name); in adpt_i2o_passthru()
1753 msg[3] = adpt_ioctl_to_context(pHba, reply); in adpt_i2o_passthru()
1757 memset(sg_list,0, sizeof(sg_list[0])*pHba->sg_tablesize); in adpt_i2o_passthru()
1762 if (sg_count > pHba->sg_tablesize){ in adpt_i2o_passthru()
1763 printk(KERN_DEBUG"%s:IOCTL SG List too large (%u)\n", pHba->name,sg_count); in adpt_i2o_passthru()
1772 printk(KERN_DEBUG"%s:Bad SG element %d - not simple (%x)\n",pHba->name,i, sg[i].flag_count); in adpt_i2o_passthru()
1778 p = dma_alloc_coherent(&pHba->pDev->dev, sg_size, &addr, GFP_KERNEL); in adpt_i2o_passthru()
1781 pHba->name,sg_size,i,sg_count); in adpt_i2o_passthru()
1790 printk(KERN_DEBUG"%s: Could not copy SG buf %d FROM user\n",pHba->name,i); in adpt_i2o_passthru()
1805 if (pHba->host) { in adpt_i2o_passthru()
1806 scsi_block_requests(pHba->host); in adpt_i2o_passthru()
1807 spin_lock_irqsave(pHba->host->host_lock, flags); in adpt_i2o_passthru()
1809 rcode = adpt_i2o_post_wait(pHba, msg, size, FOREVER); in adpt_i2o_passthru()
1813 if (pHba->host) { in adpt_i2o_passthru()
1814 spin_unlock_irqrestore(pHba->host->host_lock, flags); in adpt_i2o_passthru()
1815 scsi_unblock_requests(pHba->host); in adpt_i2o_passthru()
1858 … printk(KERN_WARNING"%s: Could not copy %p TO user %x\n",pHba->name, sg_list[j], sg[j].addr_bus); in adpt_i2o_passthru()
1870 printk(KERN_WARNING"%s: Could not copy message context FROM user\n",pHba->name); in adpt_i2o_passthru()
1874 printk(KERN_WARNING"%s: Could not copy reply TO user\n",pHba->name); in adpt_i2o_passthru()
1887 dma_free_coherent(&pHba->pDev->dev, in adpt_i2o_passthru()
1991 adpt_hba* pHba; in adpt_ioctl() local
2000 for (pHba = hba_chain; pHba; pHba = pHba->next) { in adpt_ioctl()
2001 if (pHba->unit == minor) { in adpt_ioctl()
2006 if(pHba == NULL){ in adpt_ioctl()
2010 while((volatile u32) pHba->state & DPTI_STATE_RESET ) in adpt_ioctl()
2021 return adpt_i2o_passthru(pHba, argp); in adpt_ioctl()
2030 HbaInfo.drvrHBAnum = pHba->unit; in adpt_ioctl()
2031 HbaInfo.baseAddr = (ulong) pHba->base_addr_phys; in adpt_ioctl()
2032 HbaInfo.blinkState = adpt_read_blink_led(pHba); in adpt_ioctl()
2033 HbaInfo.pciBusNum = pHba->pDev->bus->number; in adpt_ioctl()
2034 HbaInfo.pciDeviceNum=PCI_SLOT(pHba->pDev->devfn); in adpt_ioctl()
2035 HbaInfo.Interrupt = pHba->pDev->irq; in adpt_ioctl()
2038 printk(KERN_WARNING"%s: Could not copy HbaInfo TO user\n",pHba->name); in adpt_ioctl()
2047 value = (u32)adpt_read_blink_led(pHba); in adpt_ioctl()
2054 if(pHba->host) in adpt_ioctl()
2055 spin_lock_irqsave(pHba->host->host_lock, flags); in adpt_ioctl()
2056 adpt_hba_reset(pHba); in adpt_ioctl()
2057 if(pHba->host) in adpt_ioctl()
2058 spin_unlock_irqrestore(pHba->host->host_lock, flags); in adpt_ioctl()
2061 adpt_rescan(pHba); in adpt_ioctl()
2120 adpt_hba* pHba = dev_id; in adpt_isr() local
2128 if (pHba == NULL){ in adpt_isr()
2132 if(pHba->host) in adpt_isr()
2133 spin_lock_irqsave(pHba->host->host_lock, flags); in adpt_isr()
2135 while( readl(pHba->irq_mask) & I2O_INTERRUPT_PENDING_B) { in adpt_isr()
2136 m = readl(pHba->reply_port); in adpt_isr()
2140 m = readl(pHba->reply_port); in adpt_isr()
2147 if (pHba->reply_pool_pa <= m && in adpt_isr()
2148 m < pHba->reply_pool_pa + in adpt_isr()
2149 (pHba->reply_fifo_size * REPLY_FRAME_SIZE * 4)) { in adpt_isr()
2150 reply = (u8 *)pHba->reply_pool + in adpt_isr()
2151 (m - pHba->reply_pool_pa); in adpt_isr()
2162 PDEBUG("%s: Failed message\n",pHba->name); in adpt_isr()
2164 printk(KERN_ERR"%s: Bad preserved MFA (%x)- dropping frame\n",pHba->name,old_m); in adpt_isr()
2165 writel(m,pHba->reply_port); in adpt_isr()
2169 msg = pHba->msg_addr_virt + old_m; in adpt_isr()
2172 adpt_send_nop(pHba, old_m); in adpt_isr()
2176 void *p = adpt_ioctl_from_context(pHba, readl(reply+12)); in adpt_isr()
2190 cmd = adpt_cmd_from_context(pHba, in adpt_isr()
2193 …printk(KERN_WARNING"%s: Apparent SCSI cmd in Post Wait Context - cmd=%p context=%x\n", pHba->name,… in adpt_isr()
2198 cmd = adpt_cmd_from_context (pHba, readl(reply+12)); in adpt_isr()
2206 writel(m, pHba->reply_port); in adpt_isr()
2211 out: if(pHba->host) in adpt_isr()
2212 spin_unlock_irqrestore(pHba->host->host_lock, flags); in adpt_isr()
2216 static s32 adpt_scsi_to_i2o(adpt_hba* pHba, struct scsi_cmnd* cmd, struct adpt_device* d) in adpt_scsi_to_i2o() argument
2259 pHba->name, cmd->cmnd[0]); in adpt_scsi_to_i2o()
2287 if (dpt_dma64(pHba)) { in adpt_scsi_to_i2o()
2308 if (dpt_dma64(pHba)) in adpt_scsi_to_i2o()
2330 rcode = adpt_i2o_post_this(pHba, msg, reqlen<<2); in adpt_scsi_to_i2o()
2338 static s32 adpt_scsi_host_alloc(adpt_hba* pHba, struct scsi_host_template *sht) in adpt_scsi_host_alloc() argument
2344 printk("%s: scsi_host_alloc returned NULL\n", pHba->name); in adpt_scsi_host_alloc()
2347 host->hostdata[0] = (unsigned long)pHba; in adpt_scsi_host_alloc()
2348 pHba->host = host; in adpt_scsi_host_alloc()
2350 host->irq = pHba->pDev->irq; in adpt_scsi_host_alloc()
2359 host->max_channel = pHba->top_scsi_channel + 1; in adpt_scsi_host_alloc()
2361 host->unique_id = (u32)sys_tbl_pa + pHba->unit; in adpt_scsi_host_alloc()
2362 host->sg_tablesize = pHba->sg_tablesize; in adpt_scsi_host_alloc()
2363 host->can_queue = pHba->post_fifo_size; in adpt_scsi_host_alloc()
2372 adpt_hba* pHba; in adpt_i2o_to_scsi() local
2386 pHba = (adpt_hba*) cmd->device->host->hostdata[0]; in adpt_i2o_to_scsi()
2397 printk(KERN_WARNING"%s: SCSI CMD underflow\n",pHba->name); in adpt_i2o_to_scsi()
2410pHba->name, (u32)cmd->device->channel, (u32)cmd->device->id, cmd->device->lun, hba_status, dev_sta… in adpt_i2o_to_scsi()
2422 printk(KERN_WARNING"%s: SCSI CMD parity error\n",pHba->name); in adpt_i2o_to_scsi()
2450pHba->name, detailed_status & I2O_SCSI_DSC_MASK, (u32)cmd->device->channel, (u32)cmd->device->id, … in adpt_i2o_to_scsi()
2467 pHba->name, (u32)cmd->device->channel, (u32)cmd->device->id, cmd->device->lun, in adpt_i2o_to_scsi()
2479 pHba->name, (u32)cmd->device->channel, (u32)cmd->device->id, cmd->device->lun, in adpt_i2o_to_scsi()
2492 static s32 adpt_rescan(adpt_hba* pHba) in adpt_rescan() argument
2497 if(pHba->host) in adpt_rescan()
2498 spin_lock_irqsave(pHba->host->host_lock, flags); in adpt_rescan()
2499 if ((rcode=adpt_i2o_lct_get(pHba)) < 0) in adpt_rescan()
2501 if ((rcode=adpt_i2o_reparse_lct(pHba)) < 0) in adpt_rescan()
2504 out: if(pHba->host) in adpt_rescan()
2505 spin_unlock_irqrestore(pHba->host->host_lock, flags); in adpt_rescan()
2510 static s32 adpt_i2o_reparse_lct(adpt_hba* pHba) in adpt_i2o_reparse_lct() argument
2516 i2o_lct *lct = pHba->lct; in adpt_i2o_reparse_lct()
2525 printk(KERN_ERR "%s: LCT is empty???\n",pHba->name); in adpt_i2o_reparse_lct()
2534 for (d = pHba->devices; d; d = d->next) { in adpt_i2o_reparse_lct()
2542 printk(KERN_INFO "%s: LCT has %d entries.\n", pHba->name,max); in adpt_i2o_reparse_lct()
2553 if(adpt_i2o_query_scalar(pHba, tid, 0x8000, -1, buf, 32)<0) { in adpt_i2o_reparse_lct()
2554 printk(KERN_ERR"%s: Could not query device\n",pHba->name); in adpt_i2o_reparse_lct()
2561 pHba->name, bus_no); in adpt_i2o_reparse_lct()
2567 pDev = pHba->channel[bus_no].device[scsi_id]; in adpt_i2o_reparse_lct()
2584 d->controller = pHba; in adpt_i2o_reparse_lct()
2590 adpt_i2o_report_hba_unit(pHba, d); in adpt_i2o_reparse_lct()
2591 adpt_i2o_install_device(pHba, d); in adpt_i2o_reparse_lct()
2593 pDev = pHba->channel[bus_no].device[scsi_id]; in adpt_i2o_reparse_lct()
2601 pHba->channel[bus_no].device[scsi_id] = pDev; in adpt_i2o_reparse_lct()
2622 if(scsi_id > pHba->top_scsi_id){ in adpt_i2o_reparse_lct()
2623 pHba->top_scsi_id = scsi_id; in adpt_i2o_reparse_lct()
2625 if(scsi_lun > pHba->top_scsi_lun){ in adpt_i2o_reparse_lct()
2626 pHba->top_scsi_lun = scsi_lun; in adpt_i2o_reparse_lct()
2636 pHba->name,bus_no,scsi_id,scsi_lun); in adpt_i2o_reparse_lct()
2658 for (pI2o_dev = pHba->devices; pI2o_dev; pI2o_dev = pI2o_dev->next) { in adpt_i2o_reparse_lct()
2667 …printk(KERN_WARNING"%s: Device (%d,%d,%llu) offline\n",pHba->name,pDev->scsi_channel,pDev->scsi_id… in adpt_i2o_reparse_lct()
2676 static void adpt_fail_posted_scbs(adpt_hba* pHba) in adpt_fail_posted_scbs() argument
2681 shost_for_each_device(d, pHba->host) { in adpt_fail_posted_scbs()
2706 static int adpt_i2o_activate_hba(adpt_hba* pHba) in adpt_i2o_activate_hba() argument
2710 if(pHba->initialized ) { in adpt_i2o_activate_hba()
2711 if (adpt_i2o_status_get(pHba) < 0) { in adpt_i2o_activate_hba()
2712 if((rcode = adpt_i2o_reset_hba(pHba)) != 0){ in adpt_i2o_activate_hba()
2713 printk(KERN_WARNING"%s: Could NOT reset.\n", pHba->name); in adpt_i2o_activate_hba()
2716 if (adpt_i2o_status_get(pHba) < 0) { in adpt_i2o_activate_hba()
2722 if(pHba->status_block->iop_state == ADAPTER_STATE_FAULTED) { in adpt_i2o_activate_hba()
2723 printk(KERN_CRIT "%s: hardware fault\n", pHba->name); in adpt_i2o_activate_hba()
2727 if (pHba->status_block->iop_state == ADAPTER_STATE_READY || in adpt_i2o_activate_hba()
2728 pHba->status_block->iop_state == ADAPTER_STATE_OPERATIONAL || in adpt_i2o_activate_hba()
2729 pHba->status_block->iop_state == ADAPTER_STATE_HOLD || in adpt_i2o_activate_hba()
2730 pHba->status_block->iop_state == ADAPTER_STATE_FAILED) { in adpt_i2o_activate_hba()
2731 adpt_i2o_reset_hba(pHba); in adpt_i2o_activate_hba()
2732 if (adpt_i2o_status_get(pHba) < 0 || pHba->status_block->iop_state != ADAPTER_STATE_RESET) { in adpt_i2o_activate_hba()
2733 printk(KERN_ERR "%s: Failed to initialize.\n", pHba->name); in adpt_i2o_activate_hba()
2738 if((rcode = adpt_i2o_reset_hba(pHba)) != 0){ in adpt_i2o_activate_hba()
2739 printk(KERN_WARNING"%s: Could NOT reset.\n", pHba->name); in adpt_i2o_activate_hba()
2745 if (adpt_i2o_init_outbound_q(pHba) < 0) { in adpt_i2o_activate_hba()
2751 if (adpt_i2o_hrt_get(pHba) < 0) { in adpt_i2o_activate_hba()
2762 static int adpt_i2o_online_hba(adpt_hba* pHba) in adpt_i2o_online_hba() argument
2764 if (adpt_i2o_systab_send(pHba) < 0) { in adpt_i2o_online_hba()
2765 adpt_i2o_delete_hba(pHba); in adpt_i2o_online_hba()
2770 if (adpt_i2o_enable_hba(pHba) < 0) { in adpt_i2o_online_hba()
2771 adpt_i2o_delete_hba(pHba); in adpt_i2o_online_hba()
2779 static s32 adpt_send_nop(adpt_hba*pHba,u32 m) in adpt_send_nop() argument
2786 m = readl(pHba->post_port); in adpt_send_nop()
2791 printk(KERN_ERR "%s: Timeout waiting for message frame!\n",pHba->name); in adpt_send_nop()
2796 msg = (u32 __iomem *)(pHba->msg_addr_virt + m); in adpt_send_nop()
2802 writel(m, pHba->post_port); in adpt_send_nop()
2807 static s32 adpt_i2o_init_outbound_q(adpt_hba* pHba) in adpt_i2o_init_outbound_q() argument
2818 m = readl(pHba->post_port); in adpt_i2o_init_outbound_q()
2824 printk(KERN_WARNING"%s: Timeout waiting for message frame\n",pHba->name); in adpt_i2o_init_outbound_q()
2830 msg=(u32 __iomem *)(pHba->msg_addr_virt+m); in adpt_i2o_init_outbound_q()
2832 status = dma_alloc_coherent(&pHba->pDev->dev, 4, &addr, GFP_KERNEL); in adpt_i2o_init_outbound_q()
2834 adpt_send_nop(pHba, m); in adpt_i2o_init_outbound_q()
2836 pHba->name); in adpt_i2o_init_outbound_q()
2850 writel(m, pHba->post_port); in adpt_i2o_init_outbound_q()
2862 printk(KERN_WARNING"%s: Timeout Initializing\n",pHba->name); in adpt_i2o_init_outbound_q()
2875 dma_free_coherent(&pHba->pDev->dev, 4, status, addr); in adpt_i2o_init_outbound_q()
2878 dma_free_coherent(&pHba->pDev->dev, 4, status, addr); in adpt_i2o_init_outbound_q()
2880 if(pHba->reply_pool != NULL) { in adpt_i2o_init_outbound_q()
2881 dma_free_coherent(&pHba->pDev->dev, in adpt_i2o_init_outbound_q()
2882 pHba->reply_fifo_size * REPLY_FRAME_SIZE * 4, in adpt_i2o_init_outbound_q()
2883 pHba->reply_pool, pHba->reply_pool_pa); in adpt_i2o_init_outbound_q()
2886 pHba->reply_pool = dma_alloc_coherent(&pHba->pDev->dev, in adpt_i2o_init_outbound_q()
2887 pHba->reply_fifo_size * REPLY_FRAME_SIZE * 4, in adpt_i2o_init_outbound_q()
2888 &pHba->reply_pool_pa, GFP_KERNEL); in adpt_i2o_init_outbound_q()
2889 if (!pHba->reply_pool) { in adpt_i2o_init_outbound_q()
2890 printk(KERN_ERR "%s: Could not allocate reply pool\n", pHba->name); in adpt_i2o_init_outbound_q()
2893 memset(pHba->reply_pool, 0 , pHba->reply_fifo_size * REPLY_FRAME_SIZE * 4); in adpt_i2o_init_outbound_q()
2895 for(i = 0; i < pHba->reply_fifo_size; i++) { in adpt_i2o_init_outbound_q()
2896 writel(pHba->reply_pool_pa + (i * REPLY_FRAME_SIZE * 4), in adpt_i2o_init_outbound_q()
2897 pHba->reply_port); in adpt_i2o_init_outbound_q()
2900 adpt_i2o_status_get(pHba); in adpt_i2o_init_outbound_q()
2916 static s32 adpt_i2o_status_get(adpt_hba* pHba) in adpt_i2o_status_get() argument
2923 if(pHba->status_block == NULL) { in adpt_i2o_status_get()
2924 pHba->status_block = dma_alloc_coherent(&pHba->pDev->dev, in adpt_i2o_status_get()
2926 &pHba->status_block_pa, GFP_KERNEL); in adpt_i2o_status_get()
2927 if(pHba->status_block == NULL) { in adpt_i2o_status_get()
2930 pHba->unit); in adpt_i2o_status_get()
2934 memset(pHba->status_block, 0, sizeof(i2o_status_block)); in adpt_i2o_status_get()
2935 status_block = (u8*)(pHba->status_block); in adpt_i2o_status_get()
2939 m = readl(pHba->post_port); in adpt_i2o_status_get()
2945 pHba->name); in adpt_i2o_status_get()
2952 msg=(u32 __iomem *)(pHba->msg_addr_virt+m); in adpt_i2o_status_get()
2960 writel( dma_low(pHba->status_block_pa), &msg[6]); in adpt_i2o_status_get()
2961 writel( dma_high(pHba->status_block_pa), &msg[7]); in adpt_i2o_status_get()
2965 writel(m, pHba->post_port); in adpt_i2o_status_get()
2971 pHba->unit); in adpt_i2o_status_get()
2979 pHba->post_fifo_size = pHba->status_block->max_inbound_frames; in adpt_i2o_status_get()
2980 if (pHba->post_fifo_size > MAX_TO_IOP_MESSAGES) { in adpt_i2o_status_get()
2981 pHba->post_fifo_size = MAX_TO_IOP_MESSAGES; in adpt_i2o_status_get()
2984 pHba->reply_fifo_size = pHba->status_block->max_outbound_frames; in adpt_i2o_status_get()
2985 if (pHba->reply_fifo_size > MAX_FROM_IOP_MESSAGES) { in adpt_i2o_status_get()
2986 pHba->reply_fifo_size = MAX_FROM_IOP_MESSAGES; in adpt_i2o_status_get()
2990 if (dpt_dma64(pHba)) { in adpt_i2o_status_get()
2991 pHba->sg_tablesize in adpt_i2o_status_get()
2992 = ((pHba->status_block->inbound_frame_size * 4 in adpt_i2o_status_get()
2996 pHba->sg_tablesize in adpt_i2o_status_get()
2997 = ((pHba->status_block->inbound_frame_size * 4 in adpt_i2o_status_get()
3001 if (pHba->sg_tablesize > SG_LIST_ELEMENTS) { in adpt_i2o_status_get()
3002 pHba->sg_tablesize = SG_LIST_ELEMENTS; in adpt_i2o_status_get()
3007 printk("dpti%d: State = ",pHba->unit); in adpt_i2o_status_get()
3008 switch(pHba->status_block->iop_state) { in adpt_i2o_status_get()
3031 printk("%x (unknown!!)\n",pHba->status_block->iop_state); in adpt_i2o_status_get()
3040 static int adpt_i2o_lct_get(adpt_hba* pHba) in adpt_i2o_lct_get() argument
3046 if ((pHba->lct_size == 0) || (pHba->lct == NULL)){ in adpt_i2o_lct_get()
3047 pHba->lct_size = pHba->status_block->expected_lct_size; in adpt_i2o_lct_get()
3050 if (pHba->lct == NULL) { in adpt_i2o_lct_get()
3051 pHba->lct = dma_alloc_coherent(&pHba->pDev->dev, in adpt_i2o_lct_get()
3052 pHba->lct_size, &pHba->lct_pa, in adpt_i2o_lct_get()
3054 if(pHba->lct == NULL) { in adpt_i2o_lct_get()
3056 pHba->name); in adpt_i2o_lct_get()
3060 memset(pHba->lct, 0, pHba->lct_size); in adpt_i2o_lct_get()
3068 msg[6] = 0xD0000000|pHba->lct_size; in adpt_i2o_lct_get()
3069 msg[7] = (u32)pHba->lct_pa; in adpt_i2o_lct_get()
3071 if ((ret=adpt_i2o_post_wait(pHba, msg, sizeof(msg), 360))) { in adpt_i2o_lct_get()
3073 pHba->name, ret); in adpt_i2o_lct_get()
3078 if ((pHba->lct->table_size << 2) > pHba->lct_size) { in adpt_i2o_lct_get()
3079 pHba->lct_size = pHba->lct->table_size << 2; in adpt_i2o_lct_get()
3080 dma_free_coherent(&pHba->pDev->dev, pHba->lct_size, in adpt_i2o_lct_get()
3081 pHba->lct, pHba->lct_pa); in adpt_i2o_lct_get()
3082 pHba->lct = NULL; in adpt_i2o_lct_get()
3084 } while (pHba->lct == NULL); in adpt_i2o_lct_get()
3086 PDEBUG("%s: Hardware resource table read.\n", pHba->name); in adpt_i2o_lct_get()
3090 if(adpt_i2o_query_scalar(pHba, 0 , 0x8000, -1, buf, sizeof(buf))>=0) { in adpt_i2o_lct_get()
3091 pHba->FwDebugBufferSize = buf[1]; in adpt_i2o_lct_get()
3092 pHba->FwDebugBuffer_P = ioremap(pHba->base_addr_phys + buf[0], in adpt_i2o_lct_get()
3093 pHba->FwDebugBufferSize); in adpt_i2o_lct_get()
3094 if (pHba->FwDebugBuffer_P) { in adpt_i2o_lct_get()
3095 pHba->FwDebugFlags_P = pHba->FwDebugBuffer_P + in adpt_i2o_lct_get()
3097 pHba->FwDebugBLEDvalue_P = pHba->FwDebugBuffer_P + in adpt_i2o_lct_get()
3099 pHba->FwDebugBLEDflag_P = pHba->FwDebugBLEDvalue_P + 1; in adpt_i2o_lct_get()
3100 pHba->FwDebugStrLength_P = pHba->FwDebugBuffer_P + in adpt_i2o_lct_get()
3102 pHba->FwDebugBuffer_P += buf[2]; in adpt_i2o_lct_get()
3103 pHba->FwDebugFlags = 0; in adpt_i2o_lct_get()
3112 adpt_hba* pHba = hba_chain; in adpt_i2o_build_sys_table() local
3116 dma_free_coherent(&pHba->pDev->dev, sys_tbl_len, in adpt_i2o_build_sys_table()
3122 sys_tbl = dma_alloc_coherent(&pHba->pDev->dev, in adpt_i2o_build_sys_table()
3134 for(pHba = hba_chain; pHba; pHba = pHba->next) { in adpt_i2o_build_sys_table()
3137 if (adpt_i2o_status_get(pHba)) { in adpt_i2o_build_sys_table()
3142 sys_tbl->iops[count].org_id = pHba->status_block->org_id; in adpt_i2o_build_sys_table()
3143 sys_tbl->iops[count].iop_id = pHba->unit + 2; in adpt_i2o_build_sys_table()
3145 sys_tbl->iops[count].i2o_version = pHba->status_block->i2o_version; in adpt_i2o_build_sys_table()
3146 sys_tbl->iops[count].iop_state = pHba->status_block->iop_state; in adpt_i2o_build_sys_table()
3147 sys_tbl->iops[count].msg_type = pHba->status_block->msg_type; in adpt_i2o_build_sys_table()
3148 sys_tbl->iops[count].frame_size = pHba->status_block->inbound_frame_size; in adpt_i2o_build_sys_table()
3150 sys_tbl->iops[count].iop_capabilities = pHba->status_block->iop_capabilities; in adpt_i2o_build_sys_table()
3151 addr = pHba->base_addr_phys + 0x40; in adpt_i2o_build_sys_table()
3177 static void adpt_i2o_report_hba_unit(adpt_hba* pHba, struct i2o_device *d) in adpt_i2o_report_hba_unit() argument
3184 if(adpt_i2o_query_scalar(pHba, unit, 0xF100, 3, buf, 16)>=0) in adpt_i2o_report_hba_unit()
3189 if(adpt_i2o_query_scalar(pHba, unit, 0xF100, 4, buf, 16)>=0) in adpt_i2o_report_hba_unit()
3194 if(adpt_i2o_query_scalar(pHba, unit, 0xF100, 6, buf, 8)>=0) in adpt_i2o_report_hba_unit()
3282 static s32 adpt_i2o_hrt_get(adpt_hba* pHba) in adpt_i2o_hrt_get() argument
3288 if (pHba->hrt == NULL) { in adpt_i2o_hrt_get()
3289 pHba->hrt = dma_alloc_coherent(&pHba->pDev->dev, in adpt_i2o_hrt_get()
3290 size, &pHba->hrt_pa, GFP_KERNEL); in adpt_i2o_hrt_get()
3291 if (pHba->hrt == NULL) { in adpt_i2o_hrt_get()
3292 printk(KERN_CRIT "%s: Hrt Get failed; Out of memory.\n", pHba->name); in adpt_i2o_hrt_get()
3302 msg[5]= (u32)pHba->hrt_pa; /* Dump it here */ in adpt_i2o_hrt_get()
3304 if ((ret = adpt_i2o_post_wait(pHba, msg, sizeof(msg),20))) { in adpt_i2o_hrt_get()
3305 printk(KERN_ERR "%s: Unable to get HRT (status=%#10x)\n", pHba->name, ret); in adpt_i2o_hrt_get()
3309 if (pHba->hrt->num_entries * pHba->hrt->entry_len << 2 > size) { in adpt_i2o_hrt_get()
3310 int newsize = pHba->hrt->num_entries * pHba->hrt->entry_len << 2; in adpt_i2o_hrt_get()
3311 dma_free_coherent(&pHba->pDev->dev, size, in adpt_i2o_hrt_get()
3312 pHba->hrt, pHba->hrt_pa); in adpt_i2o_hrt_get()
3314 pHba->hrt = NULL; in adpt_i2o_hrt_get()
3316 } while(pHba->hrt == NULL); in adpt_i2o_hrt_get()
3323 static int adpt_i2o_query_scalar(adpt_hba* pHba, int tid, in adpt_i2o_query_scalar() argument
3335 resblk_va = dma_alloc_coherent(&pHba->pDev->dev, in adpt_i2o_query_scalar()
3338 printk(KERN_CRIT "%s: query scalar failed; Out of memory.\n", pHba->name); in adpt_i2o_query_scalar()
3342 opblk_va = dma_alloc_coherent(&pHba->pDev->dev, in adpt_i2o_query_scalar()
3345 dma_free_coherent(&pHba->pDev->dev, sizeof(u8) * (8+buflen), in adpt_i2o_query_scalar()
3348 pHba->name); in adpt_i2o_query_scalar()
3355 size = adpt_i2o_issue_params(I2O_CMD_UTIL_PARAMS_GET, pHba, tid, in adpt_i2o_query_scalar()
3358 dma_free_coherent(&pHba->pDev->dev, sizeof(opblk), opblk_va, opblk_pa); in adpt_i2o_query_scalar()
3360 dma_free_coherent(&pHba->pDev->dev, sizeof(u8) * (8+buflen), in adpt_i2o_query_scalar()
3362 printk(KERN_WARNING "%s: issue params failed; Timed out.\n", pHba->name); in adpt_i2o_query_scalar()
3365 dma_free_coherent(&pHba->pDev->dev, sizeof(u8) * (8+buflen), in adpt_i2o_query_scalar()
3367 printk(KERN_WARNING "%s: issue params failed; Interrupted.\n", pHba->name); in adpt_i2o_query_scalar()
3373 dma_free_coherent(&pHba->pDev->dev, sizeof(u8) * (8+buflen), in adpt_i2o_query_scalar()
3390 static int adpt_i2o_issue_params(int cmd, adpt_hba* pHba, int tid, in adpt_i2o_issue_params() argument
3408 if ((wait_status = adpt_i2o_post_wait(pHba, msg, sizeof(msg), 20))) { in adpt_i2o_issue_params()
3416 pHba->name, in adpt_i2o_issue_params()
3427 static s32 adpt_i2o_quiesce_hba(adpt_hba* pHba) in adpt_i2o_quiesce_hba() argument
3432 adpt_i2o_status_get(pHba); in adpt_i2o_quiesce_hba()
3436 if((pHba->status_block->iop_state != ADAPTER_STATE_READY) && in adpt_i2o_quiesce_hba()
3437 (pHba->status_block->iop_state != ADAPTER_STATE_OPERATIONAL)){ in adpt_i2o_quiesce_hba()
3446 if((ret = adpt_i2o_post_wait(pHba, msg, sizeof(msg), 240))) { in adpt_i2o_quiesce_hba()
3448 pHba->unit, -ret); in adpt_i2o_quiesce_hba()
3450 printk(KERN_INFO"dpti%d: Quiesced.\n",pHba->unit); in adpt_i2o_quiesce_hba()
3453 adpt_i2o_status_get(pHba); in adpt_i2o_quiesce_hba()
3461 static int adpt_i2o_enable_hba(adpt_hba* pHba) in adpt_i2o_enable_hba() argument
3466 adpt_i2o_status_get(pHba); in adpt_i2o_enable_hba()
3467 if(!pHba->status_block){ in adpt_i2o_enable_hba()
3471 if(pHba->status_block->iop_state == ADAPTER_STATE_OPERATIONAL) in adpt_i2o_enable_hba()
3474 if(pHba->status_block->iop_state != ADAPTER_STATE_READY) in adpt_i2o_enable_hba()
3482 if ((ret = adpt_i2o_post_wait(pHba, msg, sizeof(msg), 240))) { in adpt_i2o_enable_hba()
3484 pHba->name, ret); in adpt_i2o_enable_hba()
3486 PDEBUG("%s: Enabled.\n", pHba->name); in adpt_i2o_enable_hba()
3489 adpt_i2o_status_get(pHba); in adpt_i2o_enable_hba()
3494 static int adpt_i2o_systab_send(adpt_hba* pHba) in adpt_i2o_systab_send() argument
3503 msg[4] = (0<<16) | ((pHba->unit+2) << 12); /* Host 0 IOP ID (unit + 2) */ in adpt_i2o_systab_send()
3518 if ((ret=adpt_i2o_post_wait(pHba, msg, sizeof(msg), 120))) { in adpt_i2o_systab_send()
3520 pHba->name, ret); in adpt_i2o_systab_send()
3524 PINFO("%s: SysTab set.\n", pHba->name); in adpt_i2o_systab_send()
3572 adpt_hba *pHba, *next; in adpt_init() local
3582 for (pHba = hba_chain; pHba; pHba = pHba->next) { in adpt_init()
3583 error = scsi_add_host(pHba->host, &pHba->pDev->dev); in adpt_init()
3586 scsi_scan_host(pHba->host); in adpt_init()
3590 for (pHba = hba_chain; pHba; pHba = next) { in adpt_init()
3591 next = pHba->next; in adpt_init()
3592 scsi_remove_host(pHba->host); in adpt_init()
3599 adpt_hba *pHba, *next; in adpt_exit() local
3601 for (pHba = hba_chain; pHba; pHba = pHba->next) in adpt_exit()
3602 scsi_remove_host(pHba->host); in adpt_exit()
3603 for (pHba = hba_chain; pHba; pHba = next) { in adpt_exit()
3604 next = pHba->next; in adpt_exit()
3605 adpt_release(pHba->host); in adpt_exit()