Lines Matching refs:h

155 static int start_monitor_thread(ctlr_info_t *h, unsigned char *cmd, 
182 static void start_io( ctlr_info_t *h);
248 ctlr_info_t *h = (ctlr_info_t*)data; in cciss_proc_get_info() local
254 if (h->busy_configuring) { in cciss_proc_get_info()
258 h->busy_configuring = 1; in cciss_proc_get_info()
261 ctlr = h->ctlr; in cciss_proc_get_info()
276 h->devname, in cciss_proc_get_info()
277 h->product_name, in cciss_proc_get_info()
278 (unsigned long)h->board_id, in cciss_proc_get_info()
279 h->firm_ver[0], h->firm_ver[1], h->firm_ver[2], h->firm_ver[3], in cciss_proc_get_info()
280 (unsigned int)h->intr, in cciss_proc_get_info()
281 h->num_luns, in cciss_proc_get_info()
282 h->Qdepth, h->commands_outstanding, in cciss_proc_get_info()
283 h->maxQsinceinit, h->max_outstanding, h->maxSG, in cciss_proc_get_info()
284 MONITOR_PERIOD_VALUE(h), in cciss_proc_get_info()
285 MONITOR_DEADLINE_VALUE(h), in cciss_proc_get_info()
286 CTLR_STATUS(h)); in cciss_proc_get_info()
290 for(i=0; i<=h->highest_lun; i++) { in cciss_proc_get_info()
291 drv = &h->drv[i]; in cciss_proc_get_info()
311 h->busy_configuring = 0; in cciss_proc_get_info()
321 ctlr_info_t *h = (ctlr_info_t *) data; in cciss_proc_write() local
335 rc = cciss_engage_scsi(h->ctlr); in cciss_proc_write()
344 if (START_MONITOR_THREAD(h, cmd, count, cciss_monitor, &rc) == 0) in cciss_proc_write()
380 static CommandList_struct * cmd_alloc(ctlr_info_t *h, int get_from_pool) in cmd_alloc() argument
389 h->pdev, sizeof(CommandList_struct), &cmd_dma_handle); in cmd_alloc()
395 h->pdev, sizeof(ErrorInfo_struct), in cmd_alloc()
400 pci_free_consistent(h->pdev, in cmd_alloc()
408 i = find_first_zero_bit(h->cmd_pool_bits, NR_CMDS); in cmd_alloc()
411 } while(test_and_set_bit(i%32, h->cmd_pool_bits+(i/32)) != 0); in cmd_alloc()
415 c = h->cmd_pool + i; in cmd_alloc()
417 cmd_dma_handle = h->cmd_pool_dhandle in cmd_alloc()
419 c->err_info = h->errinfo_pool + i; in cmd_alloc()
421 err_dma_handle = h->errinfo_pool_dhandle in cmd_alloc()
423 h->nr_allocs++; in cmd_alloc()
432 c->ctlr = h->ctlr; in cmd_alloc()
441 static void cmd_free(ctlr_info_t *h, CommandList_struct *c, int got_from_pool) in cmd_free() argument
449 pci_free_consistent(h->pdev, sizeof(ErrorInfo_struct), in cmd_free()
451 pci_free_consistent(h->pdev, sizeof(CommandList_struct), in cmd_free()
455 i = c - h->cmd_pool; in cmd_free()
456 clear_bit(i%32, h->cmd_pool_bits+(i/32)); in cmd_free()
457 h->nr_frees++; in cmd_free()
967 ctlr_info_t *h = hba[ctlr]; in cciss_ioctl() local
1005 if ((c = cmd_alloc(h , 0)) == NULL) { in cciss_ioctl()
1029 temp64.val = pci_map_single( h->pdev, buff, in cciss_ioctl()
1041 addQ(&h->reqQ, c); in cciss_ioctl()
1042 h->Qdepth++; in cciss_ioctl()
1043 start_io(h); in cciss_ioctl()
1051 pci_unmap_single( h->pdev, (dma_addr_t) temp64.val, in cciss_ioctl()
1059 cmd_free(h, c, 0); in cciss_ioctl()
1068 cmd_free(h, c, 0); in cciss_ioctl()
1073 cmd_free(h, c, 0); in cciss_ioctl()
1079 ctlr_info_t *h = hba[ctlr]; in cciss_ioctl() local
1137 if ((c = cmd_alloc(h , 0)) == NULL) { in cciss_ioctl()
1163 temp64.val = pci_map_single( h->pdev, buff[i], in cciss_ioctl()
1176 addQ(&h->reqQ, c); in cciss_ioctl()
1177 h->Qdepth++; in cciss_ioctl()
1178 start_io(h); in cciss_ioctl()
1185 pci_unmap_single( h->pdev, (dma_addr_t) temp64.val, in cciss_ioctl()
1192 cmd_free(h, c, 0); in cciss_ioctl()
1201 cmd_free(h, c, 0); in cciss_ioctl()
1209 cmd_free(h, c, 0); in cciss_ioctl()
1281 ctlr_info_t *h = hba[ctlr]; in deregister_disk() local
1289 if (h->drv[logvol].usage_count > 1 || h->busy_configuring) { in deregister_disk()
1293 h->busy_configuring = 1; in deregister_disk()
1304 h->sizes[minor] = 0; in deregister_disk()
1310 if (logvol == h->highest_lun) { in deregister_disk()
1313 for(i=0; i<h->highest_lun; i++) { in deregister_disk()
1315 if (h->sizes[i << gdev->minor_shift] != 0) in deregister_disk()
1318 h->highest_lun = newhighest; in deregister_disk()
1321 --h->num_luns; in deregister_disk()
1322 gdev->nr_real = h->highest_lun+1; in deregister_disk()
1324 h->drv[logvol].nr_blocks = 0; in deregister_disk()
1325 h->drv[logvol].block_size = 0; in deregister_disk()
1326 h->drv[logvol].cylinders = 0; in deregister_disk()
1327 h->drv[logvol].LunID = 0; in deregister_disk()
1328 h->busy_configuring = 0; in deregister_disk()
1340 ctlr_info_t *h = hba[ctlr]; in sendcmd_withirq() local
1347 if ((c = cmd_alloc(h , 0)) == NULL) in sendcmd_withirq()
1415 cmd_free(h, c, 1); in sendcmd_withirq()
1431 cmd_free(h, c, 1); in sendcmd_withirq()
1437 cmd_free(h, c, 1); in sendcmd_withirq()
1443 buff_dma_handle.val = (__u64) pci_map_single( h->pdev, in sendcmd_withirq()
1455 addQ(&h->reqQ, c); in sendcmd_withirq()
1456 h->Qdepth++; in sendcmd_withirq()
1457 start_io(h); in sendcmd_withirq()
1536 pci_unmap_single( h->pdev, (dma_addr_t) buff_dma_handle.val, in sendcmd_withirq()
1538 cmd_free(h, c, 0); in sendcmd_withirq()
1544 ctlr_info_t *h = hba[ctlr]; in register_new_disk() local
1567 if (h->num_luns >= CISS_MAX_LUN) { in register_new_disk()
1571 if (h->busy_configuring) { in register_new_disk()
1575 h->busy_configuring = 1; in register_new_disk()
1581 h->busy_configuring = 0; in register_new_disk()
1589 h->busy_configuring = 0; in register_new_disk()
1597 h->busy_configuring = 0; in register_new_disk()
1611 h->busy_configuring = 0; in register_new_disk()
1633 for(j=0; j <= h->highest_lun; j++) { in register_new_disk()
1635 printk("Checking %d %x against %x\n", j,h->drv[j].LunID, in register_new_disk()
1638 if (h->drv[j].LunID == lunid) { in register_new_disk()
1669 h->busy_configuring = 0; in register_new_disk()
1688 h->busy_configuring = 0; in register_new_disk()
1807 h->busy_configuring = 0; in register_new_disk()
2197 static void start_io( ctlr_info_t *h) in start_io() argument
2201 while(( c = h->reqQ) != NULL ) { in start_io()
2203 if ((h->access.fifo_full(h))) { in start_io()
2208 removeQ(&(h->reqQ), c); in start_io()
2209 h->Qdepth--; in start_io()
2212 h->access.submit_command(h, c); in start_io()
2215 addQ (&(h->cmpQ), c); in start_io()
2234 static inline void resend_cciss_cmd( ctlr_info_t *h, CommandList_struct *c) in resend_cciss_cmd() argument
2240 addQ(&(h->reqQ),c); in resend_cciss_cmd()
2241 h->Qdepth++; in resend_cciss_cmd()
2242 if (h->Qdepth > h->maxQsinceinit) in resend_cciss_cmd()
2243 h->maxQsinceinit = h->Qdepth; in resend_cciss_cmd()
2245 start_io(h); in resend_cciss_cmd()
2250 static inline void complete_command( ctlr_info_t *h, CommandList_struct *cmd, in complete_command() argument
2354 resend_cciss_cmd(h,cmd); in complete_command()
2374 cmd_free(h,cmd,1); in complete_command()
2427 ctlr_info_t *h= q->queuedata; in do_cciss_request() local
2449 if( h->ctlr != map_major_to_ctlr[MAJOR(creq->rq_dev)] ) { in do_cciss_request()
2451 h->ctlr, creq->rq_dev, creq); in do_cciss_request()
2459 if (!CTLR_IS_ALIVE(h)) { in do_cciss_request()
2460 printk(KERN_WARNING "cciss%d: I/O quit ", h->ctlr); in do_cciss_request()
2467 if (( c = cmd_alloc(h, 1)) == NULL) in do_cciss_request()
2483 c->Header.LUN.LogDev.VolId= hba[h->ctlr]->drv[log_unit].LunID; in do_cciss_request()
2492 start_blk = hba[h->ctlr]->hd[MINOR(creq->rq_dev)].start_sect + creq->sector; in do_cciss_request()
2525 temp64.val = pci_map_page(h->pdev, tmp_sg[i].page, in do_cciss_request()
2532 if (seg > h->maxSG) in do_cciss_request()
2533 h->maxSG = seg; in do_cciss_request()
2552 addQ(&(h->reqQ),c); in do_cciss_request()
2553 h->Qdepth++; in do_cciss_request()
2554 if (h->Qdepth > h->maxQsinceinit) in do_cciss_request()
2555 h->maxQsinceinit = h->Qdepth; in do_cciss_request()
2560 start_io(h); in do_cciss_request()
2565 ctlr_info_t *h = dev_id; in do_cciss_intr() local
2572 if ((h->access.intr_pending(h) == 0) || (h->interrupts_enabled == 0)) in do_cciss_intr()
2580 while( h->access.intr_pending(h)) { in do_cciss_intr()
2581 while((a = h->access.command_completed(h)) != FIFO_EMPTY) { in do_cciss_intr()
2584 if ((c = h->cmpQ) == NULL) { in do_cciss_intr()
2590 if (c == h->cmpQ) in do_cciss_intr()
2598 removeQ(&h->cmpQ, c); in do_cciss_intr()
2600 complete_command(h, c, 0); in do_cciss_intr()
2616 do_cciss_request(BLK_DEFAULT_QUEUE(h->major)); in do_cciss_intr()
3108 ctlr_info_t *h = hba[ctlr]; in fail_all_cmds() local
3112 printk(KERN_WARNING "cciss%d: controller not responding.\n", h->ctlr); in fail_all_cmds()
3113 h->alive = 0; /* the controller apparently died... */ in fail_all_cmds()
3117 pci_disable_device(h->pdev); /* Make sure it is really dead. */ in fail_all_cmds()
3120 while( (c = h->reqQ) != NULL ) { in fail_all_cmds()
3121 removeQ(&(h->reqQ), c); in fail_all_cmds()
3122 h->Qdepth--; in fail_all_cmds()
3123 addQ (&(h->cmpQ), c); in fail_all_cmds()
3127 while( (c = h->cmpQ) != NULL ) { in fail_all_cmds()
3128 removeQ(&h->cmpQ, c); in fail_all_cmds()
3131 complete_command(h, c, 0); in fail_all_cmds()
3151 ctlr_info_t *h = (ctlr_info_t *) ctlr; in cciss_monitor() local
3159 printk("cciss%d: Monitor thread starting.\n", h->ctlr); in cciss_monitor()
3164 sprintf(current->comm, "ccissmon%d", h->ctlr); in cciss_monitor()
3165 h->monitor_thread = current; in cciss_monitor()
3167 init_timer(&h->watchdog); in cciss_monitor()
3168 h->watchdog.function = fail_all_cmds; in cciss_monitor()
3169 h->watchdog.data = (unsigned long) h->ctlr; in cciss_monitor()
3172 current_timer = readl(&h->cfgtable->HeartBeat); in cciss_monitor()
3175 fail_all_cmds(h->ctlr); in cciss_monitor()
3182 schedule_timeout(h->monitor_period * HZ); in cciss_monitor()
3183 h->watchdog.expires = jiffies + HZ * h->monitor_deadline; in cciss_monitor()
3184 add_timer(&h->watchdog); in cciss_monitor()
3186 rc = sendcmd_withirq(3, h->ctlr, NULL, 0, 0, 0, 0, TYPE_MSG); in cciss_monitor()
3187 del_timer(&h->watchdog); in cciss_monitor()
3188 if (!CTLR_IS_ALIVE(h)) in cciss_monitor()
3195 if (h->monitor_period == 0) /* zero period means exit thread */ in cciss_monitor()
3200 h->monitor_started = 0; in cciss_monitor()
3201 h->monitor_thread = NULL; in cciss_monitor()
3205 static int start_monitor_thread(ctlr_info_t *h, unsigned char *cmd, in start_monitor_thread() argument
3214 new_deadline = h->monitor_deadline; in start_monitor_thread()
3219 new_period = h->monitor_period; in start_monitor_thread()
3232 if (h->monitor_started != 0) { in start_monitor_thread()
3233 old_period = h->monitor_period; in start_monitor_thread()
3234 old_deadline = h->monitor_deadline; in start_monitor_thread()
3235 h->monitor_period = new_period; in start_monitor_thread()
3236 h->monitor_deadline = new_deadline; in start_monitor_thread()
3240 h->ctlr); in start_monitor_thread()
3247 h->ctlr, old_period, new_period); in start_monitor_thread()
3251 h->ctlr, old_deadline, new_deadline); in start_monitor_thread()
3255 h->monitor_started = 1; in start_monitor_thread()
3256 h->monitor_period = new_period; in start_monitor_thread()
3257 h->monitor_deadline = new_deadline; in start_monitor_thread()
3259 kernel_thread(cciss_monitor, h, 0); in start_monitor_thread()
3264 static void kill_monitor_thread(ctlr_info_t *h) in kill_monitor_thread() argument
3266 if (h->monitor_thread) in kill_monitor_thread()
3267 send_sig(SIGKILL, h->monitor_thread, 1); in kill_monitor_thread()
3270 #define kill_monitor_thread(h) argument