Index: sys/dev/ciss/ciss.c =================================================================== --- sys/dev/ciss/ciss.c +++ sys/dev/ciss/ciss.c @@ -244,15 +244,30 @@ .d_name = "ciss", }; +SYSCTL_NODE(_hw, OID_AUTO, ciss, CTLFLAG_RD, 0, "CISS sysctl tunables"); + /* + * This tunable can be set make the driver be more verbose + */ +static int ciss_verbose = 0; +SYSCTL_INT(_hw_ciss, OID_AUTO, verbose, CTLFLAG_RWTUN, &ciss_verbose, 0, + "enable verbose messages"); + +/* * This tunable can be set at boot time and controls whether physical devices * that are marked hidden by the firmware should be exposed anyways. */ static unsigned int ciss_expose_hidden_physical = 0; TUNABLE_INT("hw.ciss.expose_hidden_physical", &ciss_expose_hidden_physical); +SYSCTL_INT(_hw_ciss, OID_AUTO, expose_hidden_physical, CTLFLAG_RWTUN, + &ciss_expose_hidden_physical, 0, + "expose hidden physical drives"); static unsigned int ciss_nop_message_heartbeat = 0; TUNABLE_INT("hw.ciss.nop_message_heartbeat", &ciss_nop_message_heartbeat); +SYSCTL_INT(_hw_ciss, OID_AUTO, nop_message_heartbeat, CTLFLAG_RWTUN, + &ciss_nop_message_heartbeat, 0, + "nop heartbeat messages"); /* * This tunable can force a particular transport to be used: @@ -262,6 +277,9 @@ */ static int ciss_force_transport = 0; TUNABLE_INT("hw.ciss.force_transport", &ciss_force_transport); +SYSCTL_INT(_hw_ciss, OID_AUTO, force_transport, CTLFLAG_RDTUN, + &ciss_force_transport, 0, + "use default (0), force simple (1) or force performant (2) transport"); /* * This tunable can force a particular interrupt delivery method to be used: @@ -271,8 +289,12 @@ */ static int ciss_force_interrupt = 0; TUNABLE_INT("hw.ciss.force_interrupt", &ciss_force_interrupt); +SYSCTL_INT(_hw_ciss, OID_AUTO, force_interrupt, CTLFLAG_RDTUN, + &ciss_force_interrupt, 0, + "use default (0), force INTx (1) or force MSIx(2) interrupts"); + /************************************************************************ * CISS adapters amazingly don't have a defined programming interface * value. (One could say some very despairing things about PCI and @@ -908,7 +930,7 @@ } sc->ciss_msi = val; - if (bootverbose) + if (bootverbose || ciss_verbose) ciss_printf(sc, "Using %d MSIX interrupt%s\n", val, (val != 1) ? "s" : ""); @@ -1126,7 +1148,7 @@ debug_called(1); - if (bootverbose) + if (bootverbose || ciss_verbose) ciss_printf(sc, "using %d of %d available commands\n", sc->ciss_max_requests, sc->ciss_cfg->max_outstanding_commands); @@ -1258,7 +1280,7 @@ if (sc->ciss_cfg->max_physical_supported == 0) sc->ciss_cfg->max_physical_supported = CISS_MAX_PHYSICAL; /* print information */ - if (bootverbose) { + if (bootverbose || ciss_verbose) { ciss_printf(sc, " %d logical drive%s configured\n", sc->ciss_id->configured_logical_drives, (sc->ciss_id->configured_logical_drives == 1) ? "" : "s"); @@ -1284,9 +1306,9 @@ "\20\1ultra2\2ultra3\10fibre1\11fibre2\n"); ciss_printf(sc, " server name '%.16s'\n", sc->ciss_cfg->server_name); ciss_printf(sc, " heartbeat 0x%x\n", sc->ciss_cfg->heartbeat); - ciss_printf(sc, " max logical logical volumes: %d\n", sc->ciss_cfg->max_logical_supported); - ciss_printf(sc, " max physical disks supported: %d\n", sc->ciss_cfg->max_physical_supported); - ciss_printf(sc, " max physical disks per logical volume: %d\n", sc->ciss_cfg->max_physical_per_logical); + ciss_printf(sc, " max logical volumes supported: %d\n", sc->ciss_cfg->max_logical_supported); + ciss_printf(sc, " max physical drives supported: %d\n", sc->ciss_cfg->max_physical_supported); + ciss_printf(sc, " max physical drives per logical volume: %d\n", sc->ciss_cfg->max_physical_per_logical); ciss_printf(sc, " JBOD Support is %s\n", (sc->ciss_id->uiYetMoreControllerFlags & YMORE_CONTROLLER_FLAGS_JBOD_SUPPORTED) ? "Available" : "Unavailable"); ciss_printf(sc, " JBOD Mode is %s\n", (sc->ciss_id->PowerUPNvramFlags & PWR_UP_FLAG_JBOD_ENABLED) ? @@ -1430,7 +1452,7 @@ /* * Save logical drive information. */ - if (bootverbose) { + if (bootverbose || ciss_verbose) { ciss_printf(sc, "%d logical drive%s\n", ndrives, (ndrives > 1 || ndrives == 0) ? "s" : ""); } @@ -1508,11 +1530,14 @@ nphys = (ntohl(cll->list_size) / sizeof(union ciss_device_address)); - if (bootverbose) { + if (bootverbose || ciss_verbose) { ciss_printf(sc, "%d physical device%s\n", nphys, (nphys > 1 || nphys == 0) ? "s" : ""); } + /* Per-controller highest target number seen */ + sc->ciss_max_physical_target = 0; + /* * Figure out the bus mapping. * Logical buses include both the local logical bus for local arrays and @@ -1595,6 +1620,8 @@ } ciss_filter_physical(sc, cll); + if (bootverbose || ciss_verbose) + ciss_printf(sc, "max physical target id: %d\n", sc->ciss_max_physical_target); out: if (cll != NULL) @@ -1644,6 +1671,9 @@ target = CISS_EXTRA_TARGET2(ea); sc->ciss_physical[bus][target].cp_address = cll->lun[i]; sc->ciss_physical[bus][target].cp_online = 1; + + if (target > sc->ciss_max_physical_target) + sc->ciss_max_physical_target = target; } return (0); @@ -1776,7 +1806,7 @@ /* * Print the drive's basic characteristics. */ - if (bootverbose) { + if (bootverbose || ciss_verbose) { ciss_printf(sc, "logical drive (b%dt%d): %s, %dMB ", CISS_LUN_TO_BUS(ld->cl_address.logical.lun), CISS_LUN_TO_TARGET(ld->cl_address.logical.lun), @@ -2342,7 +2372,7 @@ *scsi_status = -1; } } - if (bootverbose) + if (bootverbose || ciss_verbose > 1) ciss_printf(cr->cr_sc, "command status 0x%x (%s) scsi status 0x%x\n", ce->command_status, ciss_name_command_status(ce->command_status), ce->scsi_status); @@ -3034,9 +3064,9 @@ cpi->hba_inquiry = PI_TAG_ABLE; /* XXX is this correct? */ cpi->target_sprt = 0; cpi->hba_misc = 0; - cpi->max_target = sc->ciss_cfg->max_logical_supported; + cpi->max_target = MAX(sc->ciss_max_physical_target, sc->ciss_cfg->max_logical_supported); cpi->max_lun = 0; /* 'logical drive' channel only */ - cpi->initiator_id = sc->ciss_cfg->max_logical_supported; + cpi->initiator_id = CAM_TARGET_WILDCARD; strlcpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN); strlcpy(cpi->hba_vid, "CISS", HBA_IDLEN); strlcpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN); @@ -4188,8 +4218,19 @@ cr = ciss_dequeue_notify(sc); - if (cr == NULL) + if (cr == NULL) { +#if 1 + /* + * We get a NULL message sometimes when unplugging/replugging stuff + */ + if (ciss_verbose) + ciss_printf(sc, "NULL notify event received\n"); + continue; +#else panic("cr null"); +#endif + } + cn = (struct ciss_notify *)cr->cr_data; switch (cn->class) { Index: sys/dev/ciss/cissvar.h =================================================================== --- sys/dev/ciss/cissvar.h +++ sys/dev/ciss/cissvar.h @@ -238,6 +238,7 @@ int ciss_max_bus_number; /* maximum bus number */ int ciss_max_logical_bus; int ciss_max_physical_bus; + int ciss_max_physical_target; /* highest physical target number */ struct cam_devq *ciss_cam_devq; struct cam_sim **ciss_cam_sim;