Deleted Added
sdiff udiff text old ( 232854 ) new ( 245459 )
full compact
1/*-
2 * Copyright (c) 2001 Michael Smith
3 * Copyright (c) 2004 Paul Saab
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 10 unchanged lines hidden (view full) ---

19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 *
27 * $FreeBSD: head/sys/dev/ciss/ciss.c 232854 2012-03-12 08:03:51Z scottl $
28 */
29
30/*
31 * Common Interface for SCSI-3 Support driver.
32 *
33 * CISS claims to provide a common interface between a generic SCSI
34 * transport and an intelligent host adapter.
35 *

--- 1162 unchanged lines hidden (view full) ---

1198#if 0
1199 /* XXX later revisions may not need this */
1200 sc->ciss_flags |= CISS_FLAG_FAKE_SYNCH;
1201#endif
1202
1203 /* XXX only really required for old 5300 adapters? */
1204 sc->ciss_flags |= CISS_FLAG_BMIC_ABORT;
1205
1206 /* print information */
1207 if (bootverbose) {
1208#if 0 /* XXX proxy volumes??? */
1209 ciss_printf(sc, " %d logical drive%s configured\n",
1210 sc->ciss_id->configured_logical_drives,
1211 (sc->ciss_id->configured_logical_drives == 1) ? "" : "s");
1212#endif
1213 ciss_printf(sc, " firmware %4.4s\n", sc->ciss_id->running_firmware_revision);
1214 ciss_printf(sc, " %d SCSI channels\n", sc->ciss_id->scsi_bus_count);
1215
1216 ciss_printf(sc, " signature '%.4s'\n", sc->ciss_cfg->signature);
1217 ciss_printf(sc, " valence %d\n", sc->ciss_cfg->valence);
1218 ciss_printf(sc, " supported I/O methods 0x%b\n",
1219 sc->ciss_cfg->supported_methods,
1220 "\20\1READY\2simple\3performant\4MEMQ\n");

--- 6 unchanged lines hidden (view full) ---

1227 ciss_printf(sc, " interrupt coalesce count %d\n",
1228 sc->ciss_cfg->interrupt_coalesce_count);
1229 ciss_printf(sc, " max outstanding commands %d\n",
1230 sc->ciss_cfg->max_outstanding_commands);
1231 ciss_printf(sc, " bus types 0x%b\n", sc->ciss_cfg->bus_types,
1232 "\20\1ultra2\2ultra3\10fibre1\11fibre2\n");
1233 ciss_printf(sc, " server name '%.16s'\n", sc->ciss_cfg->server_name);
1234 ciss_printf(sc, " heartbeat 0x%x\n", sc->ciss_cfg->heartbeat);
1235 }
1236
1237out:
1238 if (error) {
1239 if (sc->ciss_id != NULL) {
1240 free(sc->ciss_id, CISS_MALLOC_CLASS);
1241 sc->ciss_id = NULL;
1242 }

--- 71 unchanged lines hidden (view full) ---

1314 */
1315 ciss_report_request(cr, &command_status, NULL);
1316 switch(command_status) {
1317 case CISS_CMD_STATUS_SUCCESS: /* buffer right size */
1318 case CISS_CMD_STATUS_DATA_UNDERRUN: /* buffer too large, not bad */
1319 break;
1320 case CISS_CMD_STATUS_DATA_OVERRUN:
1321 ciss_printf(sc, "WARNING: more units than driver limit (%d)\n",
1322 CISS_MAX_LOGICAL);
1323 break;
1324 default:
1325 ciss_printf(sc, "error detecting logical drive configuration (%s)\n",
1326 ciss_name_command_status(command_status));
1327 error = EIO;
1328 goto out;
1329 }
1330 ciss_release_request(cr);

--- 17 unchanged lines hidden (view full) ---

1348{
1349 struct ciss_lun_report *cll;
1350 int error = 0, i, j;
1351 int ndrives;
1352
1353 debug_called(1);
1354
1355 cll = ciss_report_luns(sc, CISS_OPCODE_REPORT_LOGICAL_LUNS,
1356 CISS_MAX_LOGICAL);
1357 if (cll == NULL) {
1358 error = ENXIO;
1359 goto out;
1360 }
1361
1362 /* sanity-check reply */
1363 ndrives = (ntohl(cll->list_size) / sizeof(union ciss_device_address));
1364 if ((ndrives < 0) || (ndrives > CISS_MAX_LOGICAL)) {
1365 ciss_printf(sc, "adapter claims to report absurd number of logical drives (%d > %d)\n",
1366 ndrives, CISS_MAX_LOGICAL);
1367 error = ENXIO;
1368 goto out;
1369 }
1370
1371 /*
1372 * Save logical drive information.
1373 */
1374 if (bootverbose) {

--- 6 unchanged lines hidden (view full) ---

1381 CISS_MALLOC_CLASS, M_NOWAIT | M_ZERO);
1382 if (sc->ciss_logical == NULL) {
1383 error = ENXIO;
1384 goto out;
1385 }
1386
1387 for (i = 0; i <= sc->ciss_max_logical_bus; i++) {
1388 sc->ciss_logical[i] =
1389 malloc(CISS_MAX_LOGICAL * sizeof(struct ciss_ldrive),
1390 CISS_MALLOC_CLASS, M_NOWAIT | M_ZERO);
1391 if (sc->ciss_logical[i] == NULL) {
1392 error = ENXIO;
1393 goto out;
1394 }
1395
1396 for (j = 0; j < CISS_MAX_LOGICAL; j++)
1397 sc->ciss_logical[i][j].cl_status = CISS_LD_NONEXISTENT;
1398 }
1399
1400
1401 for (i = 0; i < CISS_MAX_LOGICAL; i++) {
1402 if (i < ndrives) {
1403 struct ciss_ldrive *ld;
1404 int bus, target;
1405
1406 bus = CISS_LUN_TO_BUS(cll->lun[i].logical.lun);
1407 target = CISS_LUN_TO_TARGET(cll->lun[i].logical.lun);
1408 ld = &sc->ciss_logical[bus][target];
1409

--- 25 unchanged lines hidden (view full) ---

1435 int bus, target;
1436
1437 debug_called(1);
1438
1439 bus = 0;
1440 target = 0;
1441
1442 cll = ciss_report_luns(sc, CISS_OPCODE_REPORT_PHYSICAL_LUNS,
1443 CISS_MAX_PHYSICAL);
1444 if (cll == NULL) {
1445 error = ENXIO;
1446 goto out;
1447 }
1448
1449 nphys = (ntohl(cll->list_size) / sizeof(union ciss_device_address));
1450
1451 if (bootverbose) {

--- 526 unchanged lines hidden (view full) ---

1978 if (sc->ciss_reply_dmat)
1979 bus_dma_tag_destroy(sc->ciss_reply_dmat);
1980
1981 /* destroy DMA tags */
1982 if (sc->ciss_parent_dmat)
1983 bus_dma_tag_destroy(sc->ciss_parent_dmat);
1984 if (sc->ciss_logical) {
1985 for (i = 0; i <= sc->ciss_max_logical_bus; i++) {
1986 for (j = 0; j < CISS_MAX_LOGICAL; j++) {
1987 if (sc->ciss_logical[i][j].cl_ldrive)
1988 free(sc->ciss_logical[i][j].cl_ldrive, CISS_MALLOC_CLASS);
1989 if (sc->ciss_logical[i][j].cl_lstatus)
1990 free(sc->ciss_logical[i][j].cl_lstatus, CISS_MALLOC_CLASS);
1991 }
1992 free(sc->ciss_logical[i], CISS_MALLOC_CLASS);
1993 }
1994 free(sc->ciss_logical, CISS_MALLOC_CLASS);

--- 966 unchanged lines hidden (view full) ---

2961 struct ccb_pathinq *cpi = &ccb->cpi;
2962
2963 debug(1, "XPT_PATH_INQ %d:%d:%d", cam_sim_bus(sim), ccb->ccb_h.target_id, ccb->ccb_h.target_lun);
2964
2965 cpi->version_num = 1;
2966 cpi->hba_inquiry = PI_TAG_ABLE; /* XXX is this correct? */
2967 cpi->target_sprt = 0;
2968 cpi->hba_misc = 0;
2969 cpi->max_target = CISS_MAX_LOGICAL;
2970 cpi->max_lun = 0; /* 'logical drive' channel only */
2971 cpi->initiator_id = CISS_MAX_LOGICAL;
2972 strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
2973 strncpy(cpi->hba_vid, "msmith@freebsd.org", HBA_IDLEN);
2974 strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
2975 cpi->unit_number = cam_sim_unit(sim);
2976 cpi->bus_id = cam_sim_bus(sim);
2977 cpi->base_transfer_speed = 132 * 1024; /* XXX what to set this to? */
2978 cpi->transport = XPORT_SPI;
2979 cpi->transport_version = 2;

--- 894 unchanged lines hidden (view full) ---

3874 struct ciss_ldrive *ld;
3875 int i, j, ndrives;
3876
3877 /*
3878 * We must rescan all logical volumes to get the right logical
3879 * drive address.
3880 */
3881 cll = ciss_report_luns(sc, CISS_OPCODE_REPORT_LOGICAL_LUNS,
3882 CISS_MAX_LOGICAL);
3883 if (cll == NULL)
3884 return;
3885
3886 ndrives = (ntohl(cll->list_size) / sizeof(union ciss_device_address));
3887
3888 /*
3889 * Delete any of the drives which were destroyed by the
3890 * firmware.
3891 */
3892 for (i = 0; i < sc->ciss_max_logical_bus; i++) {
3893 for (j = 0; j < CISS_MAX_LOGICAL; j++) {
3894 ld = &sc->ciss_logical[i][j];
3895
3896 if (ld->cl_update == 0)
3897 continue;
3898
3899 if (ld->cl_status != CISS_LD_ONLINE) {
3900 ciss_cam_rescan_target(sc, i, j);
3901 ld->cl_update = 0;

--- 152 unchanged lines hidden (view full) ---

4054 */
4055 if ((bus >= 0) && (target >= 0))
4056 sc->ciss_physical[bus][target].cp_online = 0;
4057 } else {
4058 /*
4059 * Rescan the physical lun list for new items
4060 */
4061 cll = ciss_report_luns(sc, CISS_OPCODE_REPORT_PHYSICAL_LUNS,
4062 CISS_MAX_PHYSICAL);
4063 if (cll == NULL) {
4064 ciss_printf(sc, "Warning, cannot get physical lun list\n");
4065 break;
4066 }
4067 ciss_filter_physical(sc, cll);
4068 }
4069 break;
4070

--- 231 unchanged lines hidden (view full) ---

4302 sc->ciss_qstat[i].q_length,
4303 sc->ciss_qstat[i].q_max);
4304 }
4305 ciss_printf(sc, "max_requests %d\n", sc->ciss_max_requests);
4306 ciss_printf(sc, "flags %b\n", sc->ciss_flags,
4307 "\20\1notify_ok\2control_open\3aborting\4running\21fake_synch\22bmic_abort\n");
4308
4309 for (i = 0; i < sc->ciss_max_logical_bus; i++) {
4310 for (j = 0; j < CISS_MAX_LOGICAL; j++) {
4311 ciss_printf(sc, "LOGICAL DRIVE %d: ", i);
4312 ciss_print_ldrive(sc, &sc->ciss_logical[i][j]);
4313 }
4314 }
4315
4316 /* XXX Should physical drives be printed out here? */
4317
4318 for (i = 1; i < sc->ciss_max_requests; i++)

--- 341 unchanged lines hidden ---