Lines Matching refs:bl

28 #define PhysToVirt(n) ((void *) (((uint32) n) + bl->phys_to_virt))
29 #define VirtToPhys(n) (((uint32) n) + bl->virt_to_phys)
104 BusLogic *bl = (BusLogic *) data; in scsi_int_dispatch() local
113 bl->done = 1; in scsi_int_dispatch()
125 while(bl->in_boxes[bl->in_nextbox].completion_code){ in scsi_int_dispatch()
127 PhysToVirt(unLE(bl->in_boxes[bl->in_nextbox].ccb_phys)); in scsi_int_dispatch()
131 unLE(bl->in_boxes[bl->in_nextbox].ccb_phys), (uint32) bl_ccb, in scsi_int_dispatch()
132 bl->in_boxes[bl->in_nextbox].completion_code); in scsi_int_dispatch()
136 bl->in_boxes[bl->in_nextbox].completion_code = 0; in scsi_int_dispatch()
137 bl->in_nextbox++; in scsi_int_dispatch()
138 if(bl->in_nextbox == bl->box_count) bl->in_nextbox = 0; in scsi_int_dispatch()
152 static int bl_execute(BusLogic *bl, uchar command, in bl_execute() argument
244 static long init_buslogic(BusLogic *bl) in init_buslogic() argument
249 char *str = bl->productname; in init_buslogic()
282 if(bl_execute(bl, 0x04, NULL, 0, id, 4)){ in init_buslogic()
291 if(bl_execute(bl, 0x8d, id, 1, id, 14)){ in init_buslogic()
298 if(id[13] & 0x01) bl->wide = 1; in init_buslogic()
299 else bl->wide = 0; in init_buslogic()
306 *str++ = bl->wide ? '5' : '4'; in init_buslogic()
320 if(bl_execute(bl, 0x0B, NULL, 0, id, 3)){ in init_buslogic()
324 bl->scsi_id = id[2]; in init_buslogic()
325 d_printf("buslogic: Adapter SCSI ID = %d\n",bl->scsi_id); in init_buslogic()
327 if(install_io_interrupt_handler(bl->irq, scsi_int_dispatch, bl, 0) in init_buslogic()
331 bl->done = 0; in init_buslogic()
335 if(bl->done) { in init_buslogic()
344 if(bl_execute(bl,0x8F, id, 1, NULL, 0)){ in init_buslogic()
350 id[0] = bl->box_count; in init_buslogic()
351 { int mbaddr = toLE(bl->phys_mailboxes); in init_buslogic()
354 if(bl_execute(bl, 0x81, id, 5, NULL, 0)){ in init_buslogic()
359 bl->box_count, (uint) bl->out_boxes, bl->phys_mailboxes); in init_buslogic()
370 static long sim_invalid(BusLogic *bl, CCB_HEADER *ccbh) in sim_invalid() argument
383 static long sim_execute_scsi_io(BusLogic *bl, CCB_HEADER *ccbh) in sim_execute_scsi_io() argument
399 req = atomic_add(&(bl->reqid),1); in sim_execute_scsi_io()
410 acquire_sem(bl->ccb_count); in sim_execute_scsi_io()
413 acquire_sem(bl->ccb_lock); in sim_execute_scsi_io()
414 bl_ccb = bl->first_ccb; in sim_execute_scsi_io()
415 bl->first_ccb = bl_ccb->next; in sim_execute_scsi_io()
416 release_sem(bl->ccb_lock); in sim_execute_scsi_io()
488 acquire_sem(bl->ccb_lock); in sim_execute_scsi_io()
489 bl_ccb->next = bl->first_ccb; in sim_execute_scsi_io()
490 bl->first_ccb = bl_ccb; in sim_execute_scsi_io()
491 release_sem(bl->ccb_lock); in sim_execute_scsi_io()
492 release_sem(bl->ccb_count); in sim_execute_scsi_io()
519 acquire_sem(bl->ccb_lock); in sim_execute_scsi_io()
520 bl_ccb->next = bl->first_ccb; in sim_execute_scsi_io()
521 bl->first_ccb = bl_ccb; in sim_execute_scsi_io()
522 release_sem(bl->ccb_lock); in sim_execute_scsi_io()
523 release_sem(bl->ccb_count); in sim_execute_scsi_io()
540 acquire_sem(bl->hw_lock); in sim_execute_scsi_io()
543 bl->out_boxes[bl->out_nextbox].ccb_phys = toLE(bl_ccb_phys); in sim_execute_scsi_io()
544 bl->out_boxes[bl->out_nextbox].action_code = BL_ActionCode_Start; in sim_execute_scsi_io()
545 bl->out_nextbox++; in sim_execute_scsi_io()
546 if(bl->out_nextbox == bl->box_count) bl->out_nextbox = 0; in sim_execute_scsi_io()
550 release_sem(bl->hw_lock); in sim_execute_scsi_io()
559 release_sem(bl->hw_lock); in sim_execute_scsi_io()
606 acquire_sem(bl->ccb_lock); in sim_execute_scsi_io()
607 bl_ccb->next = bl->first_ccb; in sim_execute_scsi_io()
608 bl->first_ccb = bl_ccb; in sim_execute_scsi_io()
609 release_sem(bl->ccb_lock); in sim_execute_scsi_io()
610 release_sem(bl->ccb_count); in sim_execute_scsi_io()
617 acquire_sem(bl->ccb_lock); in sim_execute_scsi_io()
618 bl_ccb->next = bl->first_ccb; in sim_execute_scsi_io()
619 bl->first_ccb = bl_ccb; in sim_execute_scsi_io()
620 release_sem(bl->ccb_lock); in sim_execute_scsi_io()
621 release_sem(bl->ccb_count); in sim_execute_scsi_io()
629 static long sim_path_inquiry(BusLogic *bl, CCB_HEADER *ccbh) in sim_path_inquiry() argument
642 ccb->cam_initiator_id = bl->scsi_id; in sim_path_inquiry()
643 ccb->cam_hba_inquiry = bl->wide ? PI_WIDE_16 : 0; in sim_path_inquiry()
655 static long sim_extended_path_inquiry(BusLogic *bl, CCB_HEADER *ccbh) in sim_extended_path_inquiry() argument
659 sim_path_inquiry(bl, ccbh); in sim_extended_path_inquiry()
664 strncpy(ccb->cam_controller_type, bl->productname, TYPE_ID); in sim_extended_path_inquiry()
672 static long sim_sim_release_queue(BusLogic *bl, CCB_HEADER *ccbh) in sim_sim_release_queue() argument
683 static long sim_set_async_callback(BusLogic *bl, CCB_HEADER *ccbh) in sim_set_async_callback() argument
693 static long sim_abort(BusLogic *bl, CCB_HEADER *ccbh) in sim_abort() argument
703 static long sim_reset_bus(BusLogic *bl, CCB_HEADER *ccbh) in sim_reset_bus() argument
714 static long sim_reset_device(BusLogic *bl, CCB_HEADER *ccbh) in sim_reset_device() argument
728 static long sim_terminate_process(BusLogic *bl, CCB_HEADER *ccbh) in sim_terminate_process() argument
741 static long sim_action(BusLogic *bl, CCB_HEADER *ccbh) in sim_action() argument
780 return sim_extended_path_inquiry(bl, ccbh); in sim_action()
782 return (*sim_functions [op])(bl, ccbh); in sim_action()
800 BusLogic *bl = (BusLogic *) malloc(sizeof(BusLogic)); in create_cardinfo() local
811 bl->id = num; in create_cardinfo()
812 bl->iobase = iobase; in create_cardinfo()
813 bl->irq = irq; in create_cardinfo()
814 bl->out_nextbox = bl->in_nextbox = 0; in create_cardinfo()
825 bl->box_count = 4; in create_cardinfo()
827 free(bl); in create_cardinfo()
833 bl->box_count = MAX_CCB_COUNT; in create_cardinfo()
837 free(bl); in create_cardinfo()
844 bl->phys_to_virt = ((uint) a) - ((uint) entries[0].address); in create_cardinfo()
845 bl->virt_to_phys = (((uint) entries[0].address - (uint) a)); in create_cardinfo()
846 bl->phys_mailboxes = (uint) entries[0].address; in create_cardinfo()
849 bl->out_boxes = (BL_Out_Mailbox32 *) a; in create_cardinfo()
850 bl->in_boxes = (BL_In_Mailbox32 *) (a + (8 * bl->box_count)); in create_cardinfo()
851 for(i=0;i<bl->box_count;i++){ in create_cardinfo()
852 bl->out_boxes[i].action_code = BL_ActionCode_NotInUse; in create_cardinfo()
853 bl->in_boxes[i].completion_code = BL_CompletionCode_NotInUse; in create_cardinfo()
858 bl->ccb = (BL_CCB32 *) (((uchar *)a) + 1024); in create_cardinfo()
860 bl->ccb = (BL_CCB32 *) (((uchar *)a) + 4096); in create_cardinfo()
862 bl->first_ccb = NULL; in create_cardinfo()
863 for(i=0;i<bl->box_count;i++){ in create_cardinfo()
866 bl->ccb[i].done = create_sem(0, name); in create_cardinfo()
867 bl->ccb[i].next = bl->first_ccb; in create_cardinfo()
868 bl->first_ccb = &(bl->ccb[i]); in create_cardinfo()
871 bl->hw_lock = create_sem(1, "bl_hw_lock"); in create_cardinfo()
872 bl->ccb_lock = create_sem(1, "bl_ccb_lock"); in create_cardinfo()
873 bl->ccb_count = create_sem(MAX_CCB_COUNT, "bl_ccb_count"); in create_cardinfo()
874 bl->reqid = 0; in create_cardinfo()
876 return bl; in create_cardinfo()