Index: sys/dev/ciss/ciss.c =================================================================== --- sys/dev/ciss/ciss.c +++ sys/dev/ciss/ciss.c @@ -1284,9 +1284,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) ? @@ -1420,6 +1420,10 @@ /* sanity-check reply */ ndrives = (ntohl(cll->list_size) / sizeof(union ciss_device_address)); + + ciss_printf(sc, "%d logical drive%s\n", + ndrives, (ndrives > 1 || ndrives == 0) ? "s" : ""); + if ((ndrives < 0) || (ndrives > sc->ciss_cfg->max_logical_supported)) { ciss_printf(sc, "adapter claims to report absurd number of logical drives (%d > %d)\n", ndrives, sc->ciss_cfg->max_logical_supported); @@ -1430,10 +1434,6 @@ /* * Save logical drive information. */ - if (bootverbose) { - ciss_printf(sc, "%d logical drive%s\n", - ndrives, (ndrives > 1 || ndrives == 0) ? "s" : ""); - } sc->ciss_logical = malloc(sc->ciss_max_logical_bus * sizeof(struct ciss_ldrive *), @@ -1508,11 +1508,12 @@ nphys = (ntohl(cll->list_size) / sizeof(union ciss_device_address)); - if (bootverbose) { - ciss_printf(sc, "%d physical device%s\n", + 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 +1596,7 @@ } ciss_filter_physical(sc, cll); + ciss_printf(sc, "max physical target id: %d\n", sc->ciss_max_physical_target); out: if (cll != NULL) @@ -1644,6 +1646,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); @@ -3034,15 +3039,18 @@ 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; + /* make sure max_target is the highest of max_logical_supported or the detected ciss_max_targets */ + cpi->max_target = (sc->ciss_max_physical_target > sc->ciss_cfg->max_logical_supported ? + 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; + /* make sure the initiator_id is outside the range of used targets */ + cpi->initiator_id = 0; /* max(sc->ciss_cfg->max_physical_supported, sc->ciss_cfg->max_logical_supported); */ strlcpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN); strlcpy(cpi->hba_vid, "CISS", HBA_IDLEN); strlcpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN); cpi->unit_number = cam_sim_unit(sim); cpi->bus_id = cam_sim_bus(sim); - cpi->base_transfer_speed = 132 * 1024; /* XXX what to set this to? */ + cpi->base_transfer_speed = 600 * 1000; /* XXX what to set this to? */ cpi->transport = XPORT_SPI; cpi->transport_version = 2; cpi->protocol = PROTO_SCSI; @@ -4173,7 +4181,8 @@ struct ciss_softc *sc; struct ciss_request *cr; struct ciss_notify *cn; - + int got_null = 0; + sc = (struct ciss_softc *)arg; mtx_lock(&sc->ciss_mtx); @@ -4187,25 +4196,27 @@ break; cr = ciss_dequeue_notify(sc); - - if (cr == NULL) - panic("cr null"); - cn = (struct ciss_notify *)cr->cr_data; - - switch (cn->class) { - case CISS_NOTIFY_HOTPLUG: - ciss_notify_hotplug(sc, cn); - break; - case CISS_NOTIFY_LOGICAL: - ciss_notify_logical(sc, cn); - break; - case CISS_NOTIFY_PHYSICAL: - ciss_notify_physical(sc, cn); - break; + if (cr == NULL) { +#if 1 + ciss_printf(sc, "ciss_notify_thread: Got NULL cr from ciss_dequeue_notify"); + if (got_null++ > 3) +#endif + panic("cr null"); + } else { + cn = (struct ciss_notify *)cr->cr_data; + switch (cn->class) { + case CISS_NOTIFY_HOTPLUG: + ciss_notify_hotplug(sc, cn); + break; + case CISS_NOTIFY_LOGICAL: + ciss_notify_logical(sc, cn); + break; + case CISS_NOTIFY_PHYSICAL: + ciss_notify_physical(sc, cn); + break; + } + ciss_release_request(cr); } - - ciss_release_request(cr); - } sc->ciss_notify_thread = NULL; wakeup(&sc->ciss_notify_thread); 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;