- if(i2o_install_handler(&i2o_scsi_handler)<0)
- {
- printk(KERN_ERR "i2o_scsi: Unable to install OSM handler.\n");
- return 0;
- }
- scsi_context = i2o_scsi_handler.context;
-
- if((sg_chain_pool = kmalloc(SG_CHAIN_POOL_SZ, GFP_KERNEL)) == NULL)
- {
- printk(KERN_INFO "i2o_scsi: Unable to alloc %d byte SG chain buffer pool.\n", SG_CHAIN_POOL_SZ);
- printk(KERN_INFO "i2o_scsi: SG chaining DISABLED!\n");
- sg_max_frags = 11;
- }
- else
- {
- printk(KERN_INFO " chain_pool: %d bytes @ %p\n", SG_CHAIN_POOL_SZ, sg_chain_pool);
- printk(KERN_INFO " (%d byte buffers X %d can_queue X %d i2o controllers)\n",
- SG_CHAIN_BUF_SZ, I2O_SCSI_CAN_QUEUE, i2o_num_controllers);
- sg_max_frags = SG_MAX_FRAGS; // 64
- }
-
- init_timer(&retry_timer);
- retry_timer.data = 0UL;
- retry_timer.function = i2o_retry_run;
-
-// printk("SCSI OSM at %d.\n", scsi_context);
-
- for (count = 0, i = 0; i < MAX_I2O_CONTROLLERS; i++)
- {
- struct i2o_controller *c=i2o_find_controller(i);
- struct i2o_device *d;
- /*
- * This controller doesn't exist.
- */
-
- if(c==NULL)
- continue;
-
- /*
- * Fixme - we need some altered device locking. This
- * is racing with device addition in theory. Easy to fix.
- */
-
- for(d=c->devices;d!=NULL;d=d->next)
- {
- /*
- * bus_adapter, SCSI (obsolete), or FibreChannel busses only
- */
- if( (d->lct_data.class_id!=I2O_CLASS_BUS_ADAPTER_PORT) // bus_adapter
-// && (d->lct_data.class_id!=I2O_CLASS_FIBRE_CHANNEL_PORT) // FC_PORT
- )
- continue;
-
- shpnt = scsi_register(tpnt, sizeof(struct i2o_scsi_host));
- if(shpnt==NULL)
- continue;
- shpnt->unique_id = (u32)d;
- shpnt->io_port = 0;
- shpnt->n_io_port = 0;
- shpnt->irq = 0;
- shpnt->this_id = /* Good question */15;
- i2o_scsi_init(c, d, shpnt);
- count++;
- }
- }
- i2o_scsi_hosts = count;
-
- if(count==0)
- {
- if(sg_chain_pool!=NULL)
- {
- kfree(sg_chain_pool);
- sg_chain_pool = NULL;
- }
- flush_pending();
- del_timer(&retry_timer);
- i2o_remove_handler(&i2o_scsi_handler);