# This is a BitKeeper generated patch for the following project: # Project Name: Linux kernel tree # This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas: # ChangeSet 1.1814 -> 1.1815 # drivers/scsi/qla2xxx/qla_os.h 1.2 -> 1.3 # drivers/scsi/qla2xxx/qla_os.c 1.6 -> 1.7 # # The following is the BitKeeper ChangeSet Log # -------------------------------------------- # 04/03/22 mort@tomahawk.engr.sgi.com 1.1815 # Update qla2xxx to export a few attributes to sysfs using # the Transport attributes API # -------------------------------------------- # diff -Nru a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c --- a/drivers/scsi/qla2xxx/qla_os.c Mon Mar 22 09:13:23 2004 +++ b/drivers/scsi/qla2xxx/qla_os.c Mon Mar 22 09:13:23 2004 @@ -175,6 +175,8 @@ .max_sectors = 0xFFFF, }; +static struct scsi_transport_template *qla2xxx_transport_template = NULL; + static void qla2x00_display_fc_names(scsi_qla_host_t *); void qla2x00_blink_led(scsi_qla_host_t *); @@ -1766,7 +1768,7 @@ } /************************************************************************** -* qla2x00_slave_configure +* qla2xxx_slave_configure * * Description: **************************************************************************/ @@ -2061,6 +2063,8 @@ host->max_cmd_len = MAX_CMDSZ; host->max_channel = ha->ports - 1; host->max_lun = ha->max_luns; + BUG_ON(qla2xxx_transport_template == NULL); + host->transportt = qla2xxx_transport_template; host->unique_id = ha->instance; host->max_id = ha->max_targets; @@ -4448,6 +4452,64 @@ return -ETIMEDOUT; } +static void +qla2xxx_get_port_id(struct scsi_device *sdev) +{ + scsi_qla_host_t *ha = to_qla_host(sdev->host); + struct fc_port *fc; + + list_for_each_entry(fc, &ha->fcports, list) { + if (fc->os_target_id == sdev->id) { + fc_port_id(sdev) = fc->d_id.b.domain << 16 | + fc->d_id.b.area << 8 | + fc->d_id.b.al_pa; + return; + } + } + fc_port_id(sdev) = -1; +} + +static void +qla2xxx_get_port_name(struct scsi_device *sdev) +{ + scsi_qla_host_t *ha = to_qla_host(sdev->host); + struct fc_port *fc; + + list_for_each_entry(fc, &ha->fcports, list) { + if (fc->os_target_id == sdev->id) { + fc_port_name(sdev) = + __be64_to_cpu(*(uint64_t *)fc->port_name); + return; + } + } + fc_port_name(sdev) = -1; +} + +static void +qla2xxx_get_node_name(struct scsi_device *sdev) +{ + scsi_qla_host_t *ha = to_qla_host(sdev->host); + struct fc_port *fc; + + list_for_each_entry(fc, &ha->fcports, list) { + if (fc->os_target_id == sdev->id) { + fc_node_name(sdev) = + __be64_to_cpu(*(uint64_t *)fc->node_name); + return; + } + } + fc_node_name(sdev) = -1; +} + +static struct fc_function_template qla2xxx_transport_functions = { + .get_port_id = qla2xxx_get_port_id, + .show_port_id = 1, + .get_port_name = qla2xxx_get_port_name, + .show_port_name = 1, + .get_node_name = qla2xxx_get_node_name, + .show_node_name = 1, +}; + /** * qla2x00_module_init - Module initialization. **/ @@ -4470,6 +4532,10 @@ return -ENOMEM; } + qla2xxx_transport_template = fc_attach_transport(&qla2xxx_transport_functions); + if (!qla2xxx_transport_template) + return -ENODEV; + printk(KERN_INFO "QLogic Fibre Channel HBA Driver (%p)\n", qla2x00_set_info); @@ -4491,6 +4557,8 @@ } srb_cachep = NULL; } + + fc_release_transport(qla2xxx_transport_template); } module_init(qla2x00_module_init); diff -Nru a/drivers/scsi/qla2xxx/qla_os.h b/drivers/scsi/qla2xxx/qla_os.h --- a/drivers/scsi/qla2xxx/qla_os.h Mon Mar 22 09:13:23 2004 +++ b/drivers/scsi/qla2xxx/qla_os.h Mon Mar 22 09:13:23 2004 @@ -45,6 +45,7 @@ #include #include #include +#include #include @@ -62,6 +63,8 @@ #include #include +#include +#include //TODO Fix this!!! /*