Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 Jul 2014 20:08:53 +0000 (UTC)
From:      Sean Bruno <sbruno@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r268955 - stable/10/sys/dev/ciss
Message-ID:  <201407212008.s6LK8rdx014471@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: sbruno
Date: Mon Jul 21 20:08:53 2014
New Revision: 268955
URL: http://svnweb.freebsd.org/changeset/base/268955

Log:
  MFC r268017 and r268018
  
  268017:
  Check return of cam_periph_find() before using it in a printf.
  
  268018:
  Add detection for ciss(4)  controllers that are set to non-raid JBOD mode.

Modified:
  stable/10/sys/dev/ciss/ciss.c
  stable/10/sys/dev/ciss/cissreg.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/ciss/ciss.c
==============================================================================
--- stable/10/sys/dev/ciss/ciss.c	Mon Jul 21 19:33:08 2014	(r268954)
+++ stable/10/sys/dev/ciss/ciss.c	Mon Jul 21 20:08:53 2014	(r268955)
@@ -1220,7 +1220,7 @@ ciss_identify_adapter(struct ciss_softc 
     }
 
     /* sanity-check reply */
-    if (!sc->ciss_id->big_map_supported) {
+    if (!(sc->ciss_id->controller_flags & CONTROLLER_FLAGS_BIG_MAP_SUPPORT)) {
 	ciss_printf(sc, "adapter does not support BIG_MAP\n");
 	error = ENXIO;
 	goto out;
@@ -1250,7 +1250,7 @@ ciss_identify_adapter(struct ciss_softc 
 		    sc->ciss_id->configured_logical_drives,
 		    (sc->ciss_id->configured_logical_drives == 1) ? "" : "s");
 	ciss_printf(sc, "  firmware %4.4s\n", sc->ciss_id->running_firmware_revision);
-	ciss_printf(sc, "  %d SCSI channels\n", sc->ciss_id->scsi_bus_count);
+	ciss_printf(sc, "  %d SCSI channels\n", sc->ciss_id->scsi_chip_count);
 
 	ciss_printf(sc, "  signature '%.4s'\n", sc->ciss_cfg->signature);
 	ciss_printf(sc, "  valence %d\n", sc->ciss_cfg->valence);
@@ -1274,6 +1274,10 @@ ciss_identify_adapter(struct ciss_softc 
     	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, "  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) ?
+			"Enabled" : "Disabled");
     }
 
 out:
@@ -3387,25 +3391,28 @@ ciss_cam_complete_fixup(struct ciss_soft
 	bus = cam_sim_bus(xpt_path_sim(csio->ccb_h.path));
 
 	/*
-	 * Don't let hard drives be seen by the DA driver.  They will still be
-	 * attached by the PASS driver.
+	 * If the controller is in JBOD mode, there are no logical volumes.
+	 * Let the disks be probed and dealt with via CAM.  Else, mask off 
+	 * the physical disks and setup the parts of the inq structure for
+	 * the logical volume.  swb
 	 */
-	if (CISS_IS_PHYSICAL(bus)) {
-	    if (SID_TYPE(inq) == T_DIRECT)
-		inq->device = (inq->device & 0xe0) | T_NODEVICE;
-	    return;
+	if( !(sc->ciss_id->PowerUPNvramFlags & PWR_UP_FLAG_JBOD_ENABLED)){
+		if (CISS_IS_PHYSICAL(bus)) {
+	    		if (SID_TYPE(inq) == T_DIRECT)
+				inq->device = (inq->device & 0xe0) | T_NODEVICE;
+	    		return;
+		}
+		cl = &sc->ciss_logical[bus][target];
+
+		padstr(inq->vendor, "HP",
+	       		SID_VENDOR_SIZE);
+		padstr(inq->product,
+	       		ciss_name_ldrive_org(cl->cl_ldrive->fault_tolerance),
+	       		SID_PRODUCT_SIZE);
+		padstr(inq->revision,
+	       		ciss_name_ldrive_status(cl->cl_lstatus->status),
+	       		SID_REVISION_SIZE);
 	}
-
-	cl = &sc->ciss_logical[bus][target];
-
-	padstr(inq->vendor, "HP",
-	       SID_VENDOR_SIZE);
-	padstr(inq->product,
-	       ciss_name_ldrive_org(cl->cl_ldrive->fault_tolerance),
-	       SID_PRODUCT_SIZE);
-	padstr(inq->revision,
-	       ciss_name_ldrive_status(cl->cl_lstatus->status),
-	       SID_REVISION_SIZE);
     }
 }
 
@@ -3429,13 +3436,17 @@ ciss_name_device(struct ciss_softc *sc, 
 			     target, 0);
 
     if (status == CAM_REQ_CMP) {
+	mtx_lock(&sc->ciss_mtx);
 	xpt_path_lock(path);
 	periph = cam_periph_find(path, NULL);
-	sprintf(sc->ciss_logical[bus][target].cl_name, "%s%d",
-		periph->periph_name, periph->unit_number);
 	xpt_path_unlock(path);
+	mtx_unlock(&sc->ciss_mtx);
 	xpt_free_path(path);
-	return(0);
+	if (periph != NULL) {
+		sprintf(sc->ciss_logical[bus][target].cl_name, "%s%d",
+			periph->periph_name, periph->unit_number);
+		return(0);
+	}
     }
     sc->ciss_logical[bus][target].cl_name[0] = 0;
     return(ENOENT);

Modified: stable/10/sys/dev/ciss/cissreg.h
==============================================================================
--- stable/10/sys/dev/ciss/cissreg.h	Mon Jul 21 19:33:08 2014	(r268954)
+++ stable/10/sys/dev/ciss/cissreg.h	Mon Jul 21 20:08:53 2014	(r268955)
@@ -615,26 +615,124 @@ struct ciss_bmic_id_table {
     char	running_firmware_revision[4];
     char	stored_firmware_revision[4];
     u_int8_t	hardware_revision;
-    u_int8_t	res1[4];
+    u_int8_t	boot_block_revision[4];
     u_int32_t	deprecated_drive_present_map;
     u_int32_t	deprecated_external_drive_present_map;
     u_int32_t	board_id;
-    u_int8_t	res2;
+    u_int8_t	swapped_error_cable;
     u_int32_t	deprecated_non_disk_map;
-    u_int8_t	res3[5];
+    u_int8_t	bad_host_ram_addr;
+    u_int8_t	cpu_revision;
+    u_int8_t	res3[3];
     char	marketting_revision;
-    u_int8_t	res4:3;
-    u_int8_t	more_than_seven_supported:1;
-    u_int8_t	res5:3;
-    u_int8_t	big_map_supported:1;		/* must be set! */
-    u_int8_t	res6[2];
-    u_int8_t	scsi_bus_count;
-    u_int32_t	res7;
+    u_int8_t	controller_flags;
+#define	CONTROLLER_FLAGS_FLASH_ROM_INSTALLED	0x01
+#define	CONTROLLER_FLAGS_DIAGS_MODE_BIT		0x02
+#define	CONTROLLER_FLAGS_EXPAND_32MB_FX 	0x04
+#define	CONTROLLER_FLAGS_MORE_THAN_7_SUPPORT 	0x08
+#define	CONTROLLER_FLAGS_DAISY_SUPPORT_BIT 	0x10
+#define	CONTROLLER_FLAGS_RES6 			0x20
+#define	CONTROLLER_FLAGS_RES7 			0x40
+#define	CONTROLLER_FLAGS_BIG_MAP_SUPPORT 	0x80
+    u_int8_t	host_flags;
+#define HOST_FLAGS_SDB_ASIC_WORK_AROUND 	0x01
+#define HOST_FLAGS_PCI_DATA_BUS_PARITY_SUPPORT	0x02
+#define HOST_FLAGS_RES3				0x04
+#define HOST_FLAGS_RES4				0x08
+#define HOST_FLAGS_RES5				0x10
+#define HOST_FLAGS_RES6				0x20
+#define HOST_FLAGS_RES7				0x30
+#define HOST_FLAGS_RES8				0x40
+    u_int8_t	expand_disable_code;
+#define EXPAND_DISABLE_NOT_NEEDED		0x01
+#define EXPAND_DISABLE_MISSING_CACHE_BOARD	0x02
+#define EXPAND_DISABLE_WCXC_FATAL_CACHE_BITS	0x04
+#define EXPAND_DISABLE_CACHE_PERM_DISABLED	0x08
+#define EXPAND_DISABLE_RAM_ALLOCATION_FAILED	0x10
+#define EXPAND_DISABLE_BATTEREIS_DISCHARGED	0x20
+#define EXPAND_DISABLE_RES7			0x40
+#define EXPAND_DISABLE_REBUILD_RUNNING		0x80
+    u_int8_t	scsi_chip_count;
+    u_int32_t	maximum_blocks;
     u_int32_t	controller_clock;
     u_int8_t	drives_per_scsi_bus;
     u_int8_t	big_drive_present_map[CISS_BIG_MAP_ENTRIES / 8];
     u_int8_t	big_external_drive_present_map[CISS_BIG_MAP_ENTRIES / 8];
     u_int8_t	big_non_disk_map[CISS_BIG_MAP_ENTRIES / 8];
+
+    u_int16_t	task_flags;		/* used for FW debugging */
+    u_int8_t	ICL_bus_map;		/* Bitmap used for ICL between controllers */
+    u_int8_t	redund_ctlr_modes_support;	/* See REDUNDANT MODE VALUES */
+    u_int8_t	curr_redund_ctlr_mode;
+    u_int8_t	redund_ctlr_status;
+    u_int8_t	redund_op_failure_code;
+
+    u_int8_t	unsupported_nile_bus;
+    u_int8_t	host_i2c_autorev;
+    u_int8_t	cpld_revision;
+    u_int8_t	fibre_chip_count;
+    u_int8_t	daughterboard_type;
+    u_int8_t	more_swapped_config_cable_error;
+
+    u_int8_t	license_key_status;
+    u_int8_t	access_module_status;
+    u_int8_t	features_supported[12];
+    u_int8_t	rec_rom_inact_rev[4];    /* Recovery ROM inactive f/w revision  */
+    u_int8_t	rec_rom_act_status;      /* Recovery ROM flags                  */
+    u_int8_t	pci_to_pci_status;       /* PCI to PCI bridge status            */
+    u_int32_t	redundant_server_info;   /* Reserved for future use             */
+    u_int8_t	percent_write_cache;     /* Percent of memory allocated to write cache */
+    u_int16_t	daughterboard_size_mb;   /* Total size (MB) of cache board      */
+    u_int8_t	cache_batter_count;      /* Number of cache batteries           */
+    u_int16_t	total_controller_mem_mb; /* Total size (MB) of atttached memory */
+    u_int8_t	more_controller_flags;   /* Additional controller flags byte    */
+    u_int8_t	x_board_host_i2c_rev;    /* 2nd byte of 3 byte autorev field    */
+    u_int8_t	battery_pic_rev;         /* BBWC PIC revision                   */
+/*
+ * Below here I have no documentation on the rest of this data structure.  It is
+ * inferred from the opensource cciss_vol_status application.  I assume that this 
+ * data strucutre is 512 bytes in total size, do not exceed it.
+ */
+    u_int8_t	bDdffVersion[4];         /* DDFF update engine version          */
+    u_int16_t	usMaxLogicalUnits;       /* Maximum logical units supported */
+    u_int16_t	usExtLogicalUnitCount;   /* Big num configured logical units */
+    u_int16_t	usMaxPhysicalDevices;    /* Maximum physical devices supported */
+    u_int16_t	usMaxPhyDrvPerLogicalUnit; /* Max physical drive per logical unit */
+    u_int8_t	bEnclosureCount;         /* Number of attached enclosures */
+    u_int8_t	bExpanderCount;          /* Number of expanders detected */
+    u_int16_t	usOffsetToEDPbitmap;     /* Offset to extended drive present map*/
+    u_int16_t	usOffsetToEEDPbitmap;    /* Offset to extended external drive present map */
+    u_int16_t	usOffsetToENDbitmap;     /* Offset to extended non-disk map */
+    u_int8_t	bInternalPortStatus[8];  /* Internal port status bytes */
+    u_int8_t	bExternalPortStatus[8];  /* External port status bytes */
+    u_int32_t	uiYetMoreControllerFlags;/* Yet More Controller flags  */
+#define YMORE_CONTROLLER_FLAGS_JBOD_SUPPORTED \
+	( 1 << 25 )			 /* Controller has JBOD support */
+
+    u_int8_t	bLastLockup;              /* Last lockup code */
+    u_int8_t	bSlot;                    /* PCI slot according to option ROM*/
+    u_int16_t	usBuildNum;               /* Build number */
+    u_int32_t	uiMaxSafeFullStripeSize;  /* Maximum safe full stripe size */
+    u_int32_t	uiTotalLength;            /* Total structure length */
+    u_int8_t	bVendorID[8];             /* Vendor ID */
+    u_int8_t	bProductID[16];           /* Product ID */
+/*
+ * These are even more obscure as they seem to only be available in cciss_vol_status
+ */
+    u_int32_t	ExtendedLastLockupCode;
+    u_int16_t	MaxRaid;
+    u_int16_t	MaxParity;
+    u_int16_t	MaxADGStripSize;
+    u_int16_t	YetMoreSwappedCables;
+    u_int8_t	MaxDevicePaths;
+    u_int8_t	PowerUPNvramFlags;
+#define PWR_UP_FLAG_JBOD_ENABLED	0x08	/*JBOD mode is enabled, all RAID features off */
+
+    u_int16_t	ZonedOffset;
+    u_int32_t   FixedFieldsLength;
+    u_int8_t	FWCompileTimeStamp[24];
+    u_int32_t	EvenMoreControllerFlags;
+    u_int8_t	padding[240];
 } __packed;
 
 /* CISS_BMIC_ID_PDRIVE */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201407212008.s6LK8rdx014471>