Skip to contentSkip to conversation

hpsa updates

PATCH Superseded Don Brace 3 participants 8 messages Dec 21, 2015 – Dec 22, 2015

Subsystems (2)

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore

Don Brace

author
#0 lore raw

v2 cover hpsa updates

These patches are based on Linus's tree

The changes are:
- correct missing changes from snprintf to scnprintf in path_info_show by Rasmus Villemoes
- fix reported bus for SAS transport devices
- add in enclosure information

Changes from initial upload
- added short patch description for patch hpsa-add-enclosure-connection-box-bay-information
- kept hpsa-change-hba-controller-to-bus-0 the same to minimize changes.

Changes from V1
- modified add box and bay information for enclosure devices based on Matthew R. Ochs review.
- moved memory allocation lower in function hpsa_get_enclosure_info
- removed memset on a kzalloc'ed buffer
- do not fill out enclosure info on tape and medium changer devices.
- changed hpsa_get_enclosure_info to type void.

---

Don Brace (3):
hpsa: fix path_info_show
hpsa: change SAS transport devices to bus 0.
hpsa: add box and bay information for enclosure devices

 drivers/scsi/hpsa.c     |  117 ++++++++++++++++++++++++++++++++++++++++++-----
 drivers/scsi/hpsa.h     |    2 -
 drivers/scsi/hpsa_cmd.h |   13 +++++
 3 files changed, 119 insertions(+), 13 deletions(-)

--
Signature

author
#1 lore raw

PATCH v2 1/3 hpsa: fix path_info_show

left off some changes from Rasmus Villemoes where he changed snprintf to scnprintf

---
 drivers/scsi/hpsa.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/scsi/hpsa.c +6 -6
index a386036..f8370b8 100644
@@ -795,7 +795,7 @@ static ssize_t path_info_show(struct device *dev,
 		if (hdev->external ||
 			hdev->devtype == TYPE_RAID ||
 			is_logical_device(hdev)) {
-			output_len += snprintf(buf + output_len,
+			output_len += scnprintf(buf + output_len,
 						PAGE_SIZE - output_len,
 						"%s\n", active);
 			continue;
@@ -809,28 +809,28 @@ static ssize_t path_info_show(struct device *dev,
 		if (phys_connector[1] < '0')
 			phys_connector[1] = '0';
 		if (hdev->phys_connector[i] > 0)
-			output_len += snprintf(buf + output_len,
+			output_len += scnprintf(buf + output_len,
 				PAGE_SIZE - output_len,
 				"PORT: %.2s ",
 				phys_connector);
 		if (hdev->devtype == TYPE_DISK && hdev->expose_device) {
 			if (box == 0 || box == 0xFF) {
-				output_len += snprintf(buf + output_len,
+				output_len += scnprintf(buf + output_len,
 					PAGE_SIZE - output_len,
 					"BAY: %hhu %s\n",
 					bay, active);
 			} else {
-				output_len += snprintf(buf + output_len,
+				output_len += scnprintf(buf + output_len,
 					PAGE_SIZE - output_len,
 					"BOX: %hhu BAY: %hhu %s\n",
 					box, bay, active);
 			}
 		} else if (box != 0 && box != 0xFF) {
-			output_len += snprintf(buf + output_len,
+			output_len += scnprintf(buf + output_len,
 				PAGE_SIZE - output_len, "BOX: %hhu %s\n",
 				box, active);
 		} else
-			output_len += snprintf(buf + output_len,
+			output_len += scnprintf(buf + output_len,
 				PAGE_SIZE - output_len, "%s\n", active);
 	}
 
Reviewed-by on v2 1/3
#2 lore raw

Re: [PATCH v2 1/3] hpsa: fix path_info_show

Quoted 5 lines · Don Brace

left off some changes from Rasmus Villemoes where he changed snprintf to scnprintf

Quoted 7 lines

FYI, I did review and stamp this one back on 12/9.

author
#3 lore raw

PATCH v2 2/3 hpsa: change SAS transport devices to bus 0.

In reply to Don Brace

sas transport places devices on bus 0 but driver was setting the bus to 3.

---
 drivers/scsi/hpsa.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/hpsa.h +1 -1
index ae5beda..fdd39fc 100644
@@ -400,7 +400,7 @@ struct offline_device_entry {
 #define HPSA_PHYSICAL_DEVICE_BUS	0
 #define HPSA_RAID_VOLUME_BUS		1
 #define HPSA_EXTERNAL_RAID_VOLUME_BUS	2
-#define HPSA_HBA_BUS			3
+#define HPSA_HBA_BUS			0
 
 /*
 	Send the command to the hardware
author
#4 lore raw

PATCH v2 3/3 hpsa: add box and bay information for enclosure devices

In reply to Don Brace

Adding a new method to display enclosure device information.

---
 drivers/scsi/hpsa.c     |  107 ++++++++++++++++++++++++++++++++++++++++++++---
 drivers/scsi/hpsa_cmd.h |   13 ++++++
 2 files changed, 113 insertions(+), 7 deletions(-)
drivers/scsi/hpsa.c +100 -7
index f8370b8..89e6b2c 100644
@@ -750,7 +750,6 @@ static ssize_t host_show_hp_ssd_smart_path_enabled(struct device *dev,
 }
 
 #define MAX_PATHS 8
-
 static ssize_t path_info_show(struct device *dev,
 	     struct device_attribute *attr, char *buf)
 {
@@ -792,9 +791,7 @@ static ssize_t path_info_show(struct device *dev,
 				hdev->bus, hdev->target, hdev->lun,
 				scsi_device_type(hdev->devtype));
 
-		if (hdev->external ||
-			hdev->devtype == TYPE_RAID ||
-			is_logical_device(hdev)) {
+		if (hdev->devtype == TYPE_RAID || is_logical_device(hdev)) {
 			output_len += scnprintf(buf + output_len,
 						PAGE_SIZE - output_len,
 						"%s\n", active);
@@ -808,8 +805,7 @@ static ssize_t path_info_show(struct device *dev,
 			phys_connector[0] = '0';
 		if (phys_connector[1] < '0')
 			phys_connector[1] = '0';
-		if (hdev->phys_connector[i] > 0)
-			output_len += scnprintf(buf + output_len,
+		output_len += scnprintf(buf + output_len,
 				PAGE_SIZE - output_len,
 				"PORT: %.2s ",
 				phys_connector);
@@ -3191,6 +3187,87 @@ out:
 	return rc;
 }
 
+/*
+ * get enclosure information
+ * struct ReportExtendedLUNdata *rlep - Used for BMIC drive number
+ * struct hpsa_scsi_dev_t *encl_dev - device entry for enclosure
+ * Uses id_physical_device to determine the box_index.
+ */
+static void hpsa_get_enclosure_info(struct ctlr_info *h,
+			unsigned char *scsi3addr,
+			struct ReportExtendedLUNdata *rlep, int rle_index,
+			struct hpsa_scsi_dev_t *encl_dev)
+
+	int rc = -1;
+	struct CommandList *c = NULL;
+	struct ErrorInfo *ei = NULL;
+	struct bmic_sense_storage_box_params *bssbp = NULL;
+	struct bmic_identify_physical_device *id_phys = NULL;
+	struct ext_report_lun_entry *rle = &rlep->LUN[rle_index];
+	u16 bmic_device_index = 0;
+
+	bmic_device_index = GET_BMIC_DRIVE_NUMBER(&rle->lunid[0]);
+
+	if (bmic_device_index == 0xFF00)
+		goto out;
+
+	bssbp = kzalloc(sizeof(*bssbp), GFP_KERNEL);
+	if (!bssbp)
+		goto out;
+
+	id_phys = kzalloc(sizeof(*id_phys), GFP_KERNEL);
+	if (!id_phys)
+		goto out;
+
+	rc = hpsa_bmic_id_physical_device(h, scsi3addr, bmic_device_index,
+						id_phys, sizeof(*id_phys));
+	if (rc) {
+		dev_warn(&h->pdev->dev, "%s: id_phys failed %d bdi[0x%x]\n",
+			__func__, encl_dev->external, bmic_device_index);
+		goto out;
+	}
+
+	c = cmd_alloc(h);
+
+	rc = fill_cmd(c, BMIC_SENSE_STORAGE_BOX_PARAMS, h, bssbp,
+			sizeof(*bssbp), 0, RAID_CTLR_LUNID, TYPE_CMD);
+
+	if (rc)
+		goto out;
+
+	if (id_phys->phys_connector[1] == 'E')
+		c->Request.CDB[5] = id_phys->box_index;
+	else
+		c->Request.CDB[5] = 0;
+
+	rc = hpsa_scsi_do_simple_cmd_with_retry(h, c, PCI_DMA_FROMDEVICE,
+						NO_TIMEOUT);
+	if (rc)
+		goto out;
+
+	ei = c->err_info;
+	if (ei->CommandStatus != 0 && ei->CommandStatus != CMD_DATA_UNDERRUN) {
+		rc = -1;
+		goto out;
+	}
+
+	encl_dev->box[id_phys->active_path_number] = bssbp->phys_box_on_port;
+	memcpy(&encl_dev->phys_connector[id_phys->active_path_number],
+		bssbp->phys_connector, sizeof(bssbp->phys_connector));
+
+	rc = IO_OK;
+out:
+	kfree(bssbp);
+	kfree(id_phys);
+
+	if (c)
+		cmd_free(h, c);
+
+	if (rc != IO_OK)
+		hpsa_show_dev_msg(KERN_INFO, h, encl_dev,
+			"Error, could not get enclosure information\n");
+}
+
 static u64 hpsa_get_sas_address_from_report_physical(struct ctlr_info *h,
 						unsigned char *scsi3addr)
 {
@@ -4032,7 +4109,8 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h)
 
 		/* skip masked non-disk devices */
 		if (MASKED_DEVICE(lunaddrbytes) && physical_device &&
-			(physdev_list->LUN[phys_dev_index].device_flags & 0x01))
+		   (physdev_list->LUN[phys_dev_index].device_type != 0x06) &&
+		   (physdev_list->LUN[phys_dev_index].device_flags & 0x01))
 			continue;
 
 		/* Get device type, vendor, model, device id */
@@ -4116,7 +4194,12 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h)
 			break;
 		case TYPE_TAPE:
 		case TYPE_MEDIUM_CHANGER:
+			ncurrent++;
+			break;
 		case TYPE_ENCLOSURE:
+			hpsa_get_enclosure_info(h, lunaddrbytes,
+						physdev_list, phys_dev_index,
+						this_device);
 			ncurrent++;
 			break;
 		case TYPE_RAID:
@@ -6629,6 +6712,16 @@ static int fill_cmd(struct CommandList *c, u8 cmd, struct ctlr_info *h,
 			c->Request.CDB[7] = (size >> 16) & 0xFF;
 			c->Request.CDB[8] = (size >> 8) & 0XFF;
 			break;
+		case BMIC_SENSE_STORAGE_BOX_PARAMS:
+			c->Request.CDBLen = 10;
+			c->Request.type_attr_dir =
+				TYPE_ATTR_DIR(cmd_type, ATTR_SIMPLE, XFER_READ);
+			c->Request.Timeout = 0;
+			c->Request.CDB[0] = BMIC_READ;
+			c->Request.CDB[6] = BMIC_SENSE_STORAGE_BOX_PARAMS;
+			c->Request.CDB[7] = (size >> 16) & 0xFF;
+			c->Request.CDB[8] = (size >> 8) & 0XFF;
+			break;
 		case BMIC_IDENTIFY_CONTROLLER:
 			c->Request.CDBLen = 10;
 			c->Request.type_attr_dir =
drivers/scsi/hpsa_cmd.h +13 -0
index d92ef0d..6a919ad 100644
@@ -291,6 +291,7 @@ struct SenseSubsystem_info {
 #define BMIC_SENSE_DIAG_OPTIONS 0xF5
 #define HPSA_DIAG_OPTS_DISABLE_RLD_CACHING 0x40000000
 #define BMIC_SENSE_SUBSYSTEM_INFORMATION 0x66
+#define BMIC_SENSE_STORAGE_BOX_PARAMS 0x65
 
 /* Command List Structure */
 union SCSI3Addr {
@@ -842,5 +843,17 @@ struct bmic_sense_subsystem_info {
 	u8	pad[332];
 };
 
+struct bmic_sense_storage_box_params {
+	u8	reserved[36];
+	u8	inquiry_valid;
+	u8	reserved_1[68];
+	u8	phys_box_on_port;
+	u8	reserved_2[22];
+	u16	connection_info;
+	u8	reserver_3[84];
+	u8	phys_connector[2];
+	u8	reserved_4[296];
+};
+
 #pragma pack()
 #endif /* HPSA_CMD_H */
#5 lore raw

Re: [PATCH v2 3/3] hpsa: add box and bay information for enclosure devices

reproduce:

Hi Don,

[auto build test ERROR on scsi/for-next]
[also build test ERROR on v4.4-rc6 next-20151221]

url:    https://github.com/0day-ci/linux/commits/Don-Brace/hpsa-updates/20151222-012604
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next
config: i386-randconfig-x005-201551 (attached as .config)
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All error/warnings (new ones prefixed by >>):

drivers/scsi/hpsa.c: In function 'hpsa_get_enclosure_info':
drivers/scsi/hpsa.c:3201:2: error: parameter 'rc' is initialized

     int rc = -1;
     ^
   drivers/scsi/hpsa.c:3202:9: error: parameter 'c' is initialized
     struct CommandList *c = NULL;
            ^
   drivers/scsi/hpsa.c:3203:9: error: parameter 'ei' is initialized
     struct ErrorInfo *ei = NULL;
            ^
   drivers/scsi/hpsa.c:3204:9: error: parameter 'bssbp' is initialized
     struct bmic_sense_storage_box_params *bssbp = NULL;
            ^
   drivers/scsi/hpsa.c:3205:9: error: parameter 'id_phys' is initialized
     struct bmic_identify_physical_device *id_phys = NULL;
            ^
   drivers/scsi/hpsa.c:3206:9: error: parameter 'rle' is initialized
     struct ext_report_lun_entry *rle = &rlep->LUN[rle_index];
            ^
   drivers/scsi/hpsa.c:3206:38: error: 'rlep' undeclared (first use in this function)
     struct ext_report_lun_entry *rle = &rlep->LUN[rle_index];
                                         ^
   drivers/scsi/hpsa.c:3206:38: note: each undeclared identifier is reported only once for each function it appears in
   drivers/scsi/hpsa.c:3206:48: error: 'rle_index' undeclared (first use in this function)
     struct ext_report_lun_entry *rle = &rlep->LUN[rle_index];
                                                   ^
   drivers/scsi/hpsa.c:3207:2: error: parameter 'bmic_device_index' is initialized
     u16 bmic_device_index = 0;
     ^
   drivers/scsi/hpsa.c:3209:2: error: expected declaration specifiers before 'bmic_device_index'
     bmic_device_index = GET_BMIC_DRIVE_NUMBER(&rle->lunid[0]);
     ^
   In file included from include/uapi/linux/stddef.h:1:0,
                    from include/linux/stddef.h:4,
                    from include/uapi/linux/posix_types.h:4,
                    from include/uapi/linux/types.h:13,
                    from include/linux/types.h:5,
                    from include/linux/list.h:4,
                    from include/linux/module.h:9,
                    from drivers/scsi/hpsa.c:19:
>> include/linux/compiler.h:147:2: error: expected declaration specifiers before 'if'
     if (__builtin_constant_p((cond)) ? !!(cond) :   \
     ^
   include/linux/compiler.h:145:23: note: in expansion of macro '__trace_if'
    #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
                          ^
>> drivers/scsi/hpsa.c:3211:2: note: in expansion of macro 'if'
     if (bmic_device_index == 0xFF00)
     ^
>> include/linux/compiler.h:161:3: error: expected declaration specifiers before ')' token
     }))
      ^
   include/linux/compiler.h:145:23: note: in expansion of macro '__trace_if'
    #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
                          ^
>> drivers/scsi/hpsa.c:3211:2: note: in expansion of macro 'if'
     if (bmic_device_index == 0xFF00)
     ^
   drivers/scsi/hpsa.c:3214:2: error: expected declaration specifiers before 'bssbp'
     bssbp = kzalloc(sizeof(*bssbp), GFP_KERNEL);
     ^
   In file included from include/uapi/linux/stddef.h:1:0,
                    from include/linux/stddef.h:4,
                    from include/uapi/linux/posix_types.h:4,
                    from include/uapi/linux/types.h:13,
                    from include/linux/types.h:5,
                    from include/linux/list.h:4,
                    from include/linux/module.h:9,
                    from drivers/scsi/hpsa.c:19:
>> include/linux/compiler.h:147:2: error: expected declaration specifiers before 'if'
     if (__builtin_constant_p((cond)) ? !!(cond) :   \
     ^
   include/linux/compiler.h:145:23: note: in expansion of macro '__trace_if'
    #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
                          ^
   drivers/scsi/hpsa.c:3215:2: note: in expansion of macro 'if'
     if (!bssbp)
     ^
>> include/linux/compiler.h:161:3: error: expected declaration specifiers before ')' token
     }))
      ^
   include/linux/compiler.h:145:23: note: in expansion of macro '__trace_if'
    #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
                          ^
   drivers/scsi/hpsa.c:3215:2: note: in expansion of macro 'if'
     if (!bssbp)
     ^
   drivers/scsi/hpsa.c:3218:2: error: expected declaration specifiers before 'id_phys'
     id_phys = kzalloc(sizeof(*id_phys), GFP_KERNEL);
     ^
   In file included from include/uapi/linux/stddef.h:1:0,
                    from include/linux/stddef.h:4,
                    from include/uapi/linux/posix_types.h:4,
                    from include/uapi/linux/types.h:13,
                    from include/linux/types.h:5,
                    from include/linux/list.h:4,
                    from include/linux/module.h:9,
                    from drivers/scsi/hpsa.c:19:
>> include/linux/compiler.h:147:2: error: expected declaration specifiers before 'if'
     if (__builtin_constant_p((cond)) ? !!(cond) :   \
     ^
   include/linux/compiler.h:145:23: note: in expansion of macro '__trace_if'
    #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
                          ^
   drivers/scsi/hpsa.c:3219:2: note: in expansion of macro 'if'
     if (!id_phys)
     ^
>> include/linux/compiler.h:161:3: error: expected declaration specifiers before ')' token
     }))
      ^
   include/linux/compiler.h:145:23: note: in expansion of macro '__trace_if'
    #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
                          ^
   drivers/scsi/hpsa.c:3219:2: note: in expansion of macro 'if'
     if (!id_phys)
     ^
   drivers/scsi/hpsa.c:3222:2: error: expected declaration specifiers before 'rc'
     rc = hpsa_bmic_id_physical_device(h, scsi3addr, bmic_device_index,
     ^
   In file included from include/uapi/linux/stddef.h:1:0,
                    from include/linux/stddef.h:4,
                    from include/uapi/linux/posix_types.h:4,
                    from include/uapi/linux/types.h:13,
                    from include/linux/types.h:5,
                    from include/linux/list.h:4,
                    from include/linux/module.h:9,
                    from drivers/scsi/hpsa.c:19:
>> include/linux/compiler.h:147:2: error: expected declaration specifiers before 'if'
     if (__builtin_constant_p((cond)) ? !!(cond) :   \
     ^
   include/linux/compiler.h:145:23: note: in expansion of macro '__trace_if'
    #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
                          ^
   drivers/scsi/hpsa.c:3224:2: note: in expansion of macro 'if'
     if (rc) {
     ^
>> include/linux/compiler.h:161:3: error: expected declaration specifiers before ')' token
     }))
      ^
   include/linux/compiler.h:145:23: note: in expansion of macro '__trace_if'
    #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
                          ^
   drivers/scsi/hpsa.c:3224:2: note: in expansion of macro 'if'
     if (rc) {
     ^
   drivers/scsi/hpsa.c:3230:2: error: expected declaration specifiers before 'c'
     c = cmd_alloc(h);
     ^
   drivers/scsi/hpsa.c:3232:2: error: expected declaration specifiers before 'rc'
     rc = fill_cmd(c, BMIC_SENSE_STORAGE_BOX_PARAMS, h, bssbp,
     ^
   In file included from include/uapi/linux/stddef.h:1:0,
                    from include/linux/stddef.h:4,
                    from include/uapi/linux/posix_types.h:4,
                    from include/uapi/linux/types.h:13,
                    from include/linux/types.h:5,
                    from include/linux/list.h:4,
                    from include/linux/module.h:9,
                    from drivers/scsi/hpsa.c:19:
>> include/linux/compiler.h:147:2: error: expected declaration specifiers before 'if'
     if (__builtin_constant_p((cond)) ? !!(cond) :   \
     ^
   include/linux/compiler.h:145:23: note: in expansion of macro '__trace_if'
    #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
                          ^
   drivers/scsi/hpsa.c:3235:2: note: in expansion of macro 'if'
     if (rc)
     ^
>> include/linux/compiler.h:161:3: error: expected declaration specifiers before ')' token
     }))
      ^
   include/linux/compiler.h:145:23: note: in expansion of macro '__trace_if'
    #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
                          ^
   drivers/scsi/hpsa.c:3235:2: note: in expansion of macro 'if'
     if (rc)
     ^
>> include/linux/compiler.h:147:2: error: expected declaration specifiers before 'if'
     if (__builtin_constant_p((cond)) ? !!(cond) :   \
     ^
   include/linux/compiler.h:145:23: note: in expansion of macro '__trace_if'
    #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
                          ^
   drivers/scsi/hpsa.c:3238:2: note: in expansion of macro 'if'
     if (id_phys->phys_connector[1] == 'E')
     ^
>> include/linux/compiler.h:161:3: error: expected declaration specifiers before ')' token
     }))
      ^
   include/linux/compiler.h:145:23: note: in expansion of macro '__trace_if'
    #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
                          ^
   drivers/scsi/hpsa.c:3238:2: note: in expansion of macro 'if'
     if (id_phys->phys_connector[1] == 'E')
     ^
   drivers/scsi/hpsa.c:3240:2: error: expected declaration specifiers before 'else'
     else
     ^
   drivers/scsi/hpsa.c:3243:2: error: expected declaration specifiers before 'rc'
     rc = hpsa_scsi_do_simple_cmd_with_retry(h, c, PCI_DMA_FROMDEVICE,
     ^
   In file included from include/uapi/linux/stddef.h:1:0,
                    from include/linux/stddef.h:4,
                    from include/uapi/linux/posix_types.h:4,
                    from include/uapi/linux/types.h:13,
                    from include/linux/types.h:5,
                    from include/linux/list.h:4,
                    from include/linux/module.h:9,
                    from drivers/scsi/hpsa.c:19:
>> include/linux/compiler.h:147:2: error: expected declaration specifiers before 'if'
     if (__builtin_constant_p((cond)) ? !!(cond) :   \
     ^
   include/linux/compiler.h:145:23: note: in expansion of macro '__trace_if'
    #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
                          ^
   drivers/scsi/hpsa.c:3245:2: note: in expansion of macro 'if'
     if (rc)
     ^
>> include/linux/compiler.h:161:3: error: expected declaration specifiers before ')' token
     }))
      ^
   include/linux/compiler.h:145:23: note: in expansion of macro '__trace_if'
    #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
                          ^
   drivers/scsi/hpsa.c:3245:2: note: in expansion of macro 'if'
     if (rc)
     ^
   drivers/scsi/hpsa.c:3248:2: error: expected declaration specifiers before 'ei'
     ei = c->err_info;
     ^
   In file included from include/uapi/linux/stddef.h:1:0,
                    from include/linux/stddef.h:4,
                    from include/uapi/linux/posix_types.h:4,
                    from include/uapi/linux/types.h:13,
                    from include/linux/types.h:5,
                    from include/linux/list.h:4,
                    from include/linux/module.h:9,
                    from drivers/scsi/hpsa.c:19:
>> include/linux/compiler.h:147:2: error: expected declaration specifiers before 'if'
     if (__builtin_constant_p((cond)) ? !!(cond) :   \
     ^
   include/linux/compiler.h:145:23: note: in expansion of macro '__trace_if'
    #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
                          ^
   drivers/scsi/hpsa.c:3249:2: note: in expansion of macro 'if'
     if (ei->CommandStatus != 0 && ei->CommandStatus != CMD_DATA_UNDERRUN) {
     ^
>> include/linux/compiler.h:161:3: error: expected declaration specifiers before ')' token
     }))
      ^
   include/linux/compiler.h:145:23: note: in expansion of macro '__trace_if'
    #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
                          ^
   drivers/scsi/hpsa.c:3249:2: note: in expansion of macro 'if'
     if (ei->CommandStatus != 0 && ei->CommandStatus != CMD_DATA_UNDERRUN) {
     ^
   drivers/scsi/hpsa.c:3254:2: error: expected declaration specifiers before 'encl_dev'
     encl_dev->box[id_phys->active_path_number] = bssbp->phys_box_on_port;
     ^
   In file included from arch/x86/include/asm/string.h:2:0,
                    from include/linux/string.h:17,
                    from include/linux/dynamic_debug.h:111,
                    from include/linux/printk.h:277,
                    from include/linux/kernel.h:13,
                    from include/linux/list.h:8,
                    from include/linux/module.h:9,
                    from drivers/scsi/hpsa.c:19:
>> arch/x86/include/asm/string_32.h:182:25: error: expected declaration specifiers before '__builtin_memcpy'
    #define memcpy(t, f, n) __builtin_memcpy(t, f, n)
                            ^
>> drivers/scsi/hpsa.c:3255:2: note: in expansion of macro 'memcpy'
     memcpy(&encl_dev->phys_connector[id_phys->active_path_number],
     ^
   drivers/scsi/hpsa.c:3258:2: error: expected declaration specifiers before 'rc'
     rc = IO_OK;
     ^
   drivers/scsi/hpsa.c:3259:1: error: expected declaration specifiers before 'out'
    out:
    ^
   drivers/scsi/hpsa.c:3261:2: error: expected declaration specifiers before 'kfree'
     kfree(id_phys);
     ^

In file included from include/uapi/linux/stddef.h:1:0,
from include/linux/stddef.h:4, from include/uapi/linux/posix_types.h:4, from include/uapi/linux/types.h:13, from include/linux/types.h:5, from include/linux/list.h:4, from include/linux/module.h:9, from drivers/scsi/hpsa.c:19:

vim +/if +3211 drivers/scsi/hpsa.c

3205 struct bmic_identify_physical_device *id_phys = NULL;
3206 struct ext_report_lun_entry *rle = &rlep->LUN[rle_index];
3207 u16 bmic_device_index = 0;
3208
3209 bmic_device_index = GET_BMIC_DRIVE_NUMBER(&rle->lunid[0]);
3210

> 3211		if (bmic_device_index == 0xFF00)
  3212			goto out;
  3213	
  3214		bssbp = kzalloc(sizeof(*bssbp), GFP_KERNEL);
  3215		if (!bssbp)
  3216			goto out;
  3217	
  3218		id_phys = kzalloc(sizeof(*id_phys), GFP_KERNEL);
  3219		if (!id_phys)
  3220			goto out;
  3221	
  3222		rc = hpsa_bmic_id_physical_device(h, scsi3addr, bmic_device_index,
  3223							id_phys, sizeof(*id_phys));
  3224		if (rc) {
  3225			dev_warn(&h->pdev->dev, "%s: id_phys failed %d bdi[0x%x]\n",
  3226				__func__, encl_dev->external, bmic_device_index);
  3227			goto out;
  3228		}
  3229	
  3230		c = cmd_alloc(h);
  3231	
  3232		rc = fill_cmd(c, BMIC_SENSE_STORAGE_BOX_PARAMS, h, bssbp,
  3233				sizeof(*bssbp), 0, RAID_CTLR_LUNID, TYPE_CMD);
  3234	
  3235		if (rc)
  3236			goto out;
  3237	
  3238		if (id_phys->phys_connector[1] == 'E')
  3239			c->Request.CDB[5] = id_phys->box_index;
  3240		else
  3241			c->Request.CDB[5] = 0;
  3242	
  3243		rc = hpsa_scsi_do_simple_cmd_with_retry(h, c, PCI_DMA_FROMDEVICE,
  3244							NO_TIMEOUT);
  3245		if (rc)
  3246			goto out;
  3247	
  3248		ei = c->err_info;
  3249		if (ei->CommandStatus != 0 && ei->CommandStatus != CMD_DATA_UNDERRUN) {
  3250			rc = -1;
  3251			goto out;
  3252		}
  3253	
  3254		encl_dev->box[id_phys->active_path_number] = bssbp->phys_box_on_port;
> 3255		memcpy(&encl_dev->phys_connector[id_phys->active_path_number],

3256 bssbp->phys_connector, sizeof(bssbp->phys_connector));
3257
3258 rc = IO_OK;

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

#6 lore raw

Re: [PATCH v2 3/3] hpsa: add box and bay information for enclosure devices

In reply to Don Brace
reproduce: wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree…

Hi Don,

[auto build test ERROR on scsi/for-next]
[also build test ERROR on v4.4-rc6 next-20151221]

url:    https://github.com/0day-ci/linux/commits/Don-Brace/hpsa-updates/20151222-012604
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next
config: alpha-allyesconfig (attached as .config)

reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=alpha

All errors (new ones prefixed by >>):

drivers/scsi/hpsa.c: In function 'hpsa_get_enclosure_info':
drivers/scsi/hpsa.c:3201:2: error: parameter 'rc' is initialized

     int rc = -1;
     ^
   drivers/scsi/hpsa.c:3202:9: error: parameter 'c' is initialized
     struct CommandList *c = NULL;
            ^
   drivers/scsi/hpsa.c:3203:9: error: parameter 'ei' is initialized
     struct ErrorInfo *ei = NULL;
            ^
   drivers/scsi/hpsa.c:3204:9: error: parameter 'bssbp' is initialized
     struct bmic_sense_storage_box_params *bssbp = NULL;
            ^
   drivers/scsi/hpsa.c:3205:9: error: parameter 'id_phys' is initialized
     struct bmic_identify_physical_device *id_phys = NULL;
            ^
   drivers/scsi/hpsa.c:3206:9: error: parameter 'rle' is initialized
     struct ext_report_lun_entry *rle = &rlep->LUN[rle_index];
            ^
   drivers/scsi/hpsa.c:3206:38: error: 'rlep' undeclared (first use in this function)
     struct ext_report_lun_entry *rle = &rlep->LUN[rle_index];
                                         ^
   drivers/scsi/hpsa.c:3206:38: note: each undeclared identifier is reported only once for each function it appears in
   drivers/scsi/hpsa.c:3206:48: error: 'rle_index' undeclared (first use in this function)
     struct ext_report_lun_entry *rle = &rlep->LUN[rle_index];
                                                   ^
   drivers/scsi/hpsa.c:3207:2: error: parameter 'bmic_device_index' is initialized
     u16 bmic_device_index = 0;
     ^
   drivers/scsi/hpsa.c:3209:2: error: expected declaration specifiers before 'bmic_device_index'
     bmic_device_index = GET_BMIC_DRIVE_NUMBER(&rle->lunid[0]);
     ^
   drivers/scsi/hpsa.c:3211:2: error: expected declaration specifiers before 'if'
     if (bmic_device_index == 0xFF00)
     ^
   drivers/scsi/hpsa.c:3214:2: error: expected declaration specifiers before 'bssbp'
     bssbp = kzalloc(sizeof(*bssbp), GFP_KERNEL);
     ^
   drivers/scsi/hpsa.c:3215:2: error: expected declaration specifiers before 'if'
     if (!bssbp)
     ^
   drivers/scsi/hpsa.c:3218:2: error: expected declaration specifiers before 'id_phys'
     id_phys = kzalloc(sizeof(*id_phys), GFP_KERNEL);
     ^
   drivers/scsi/hpsa.c:3219:2: error: expected declaration specifiers before 'if'
     if (!id_phys)
     ^
   drivers/scsi/hpsa.c:3222:2: error: expected declaration specifiers before 'rc'
     rc = hpsa_bmic_id_physical_device(h, scsi3addr, bmic_device_index,
     ^
   drivers/scsi/hpsa.c:3224:2: error: expected declaration specifiers before 'if'
     if (rc) {
     ^
   drivers/scsi/hpsa.c:3230:2: error: expected declaration specifiers before 'c'
     c = cmd_alloc(h);
     ^
   drivers/scsi/hpsa.c:3232:2: error: expected declaration specifiers before 'rc'
     rc = fill_cmd(c, BMIC_SENSE_STORAGE_BOX_PARAMS, h, bssbp,
     ^
   drivers/scsi/hpsa.c:3235:2: error: expected declaration specifiers before 'if'
     if (rc)
     ^
   drivers/scsi/hpsa.c:3238:2: error: expected declaration specifiers before 'if'
     if (id_phys->phys_connector[1] == 'E')
     ^
   drivers/scsi/hpsa.c:3240:2: error: expected declaration specifiers before 'else'
     else
     ^
   drivers/scsi/hpsa.c:3243:2: error: expected declaration specifiers before 'rc'
     rc = hpsa_scsi_do_simple_cmd_with_retry(h, c, PCI_DMA_FROMDEVICE,
     ^
   drivers/scsi/hpsa.c:3245:2: error: expected declaration specifiers before 'if'
     if (rc)
     ^
   drivers/scsi/hpsa.c:3248:2: error: expected declaration specifiers before 'ei'
     ei = c->err_info;
     ^
   drivers/scsi/hpsa.c:3249:2: error: expected declaration specifiers before 'if'
     if (ei->CommandStatus != 0 && ei->CommandStatus != CMD_DATA_UNDERRUN) {
     ^
   drivers/scsi/hpsa.c:3254:2: error: expected declaration specifiers before 'encl_dev'
     encl_dev->box[id_phys->active_path_number] = bssbp->phys_box_on_port;
     ^
   In file included from include/linux/string.h:17:0,
                    from include/linux/bitmap.h:8,
                    from include/linux/nodemask.h:92,
                    from include/linux/mmzone.h:16,
                    from include/linux/gfp.h:5,
                    from include/linux/kmod.h:22,
                    from include/linux/module.h:13,
                    from drivers/scsi/hpsa.c:19:
>> arch/alpha/include/asm/string.h:21:16: error: expected declaration specifiers before '__builtin_memcpy'
    #define memcpy __builtin_memcpy
                   ^
   drivers/scsi/hpsa.c:3255:2: note: in expansion of macro 'memcpy'
     memcpy(&encl_dev->phys_connector[id_phys->active_path_number],
     ^
   drivers/scsi/hpsa.c:3258:2: error: expected declaration specifiers before 'rc'
     rc = IO_OK;
     ^
   drivers/scsi/hpsa.c:3259:1: error: expected declaration specifiers before 'out'
    out:
    ^
   drivers/scsi/hpsa.c:3261:2: error: expected declaration specifiers before 'kfree'
     kfree(id_phys);
     ^
   drivers/scsi/hpsa.c:3263:2: error: expected declaration specifiers before 'if'
     if (c)
     ^
   drivers/scsi/hpsa.c:3266:2: error: expected declaration specifiers before 'if'
     if (rc != IO_OK)
     ^
   drivers/scsi/hpsa.c:3269:1: error: expected declaration specifiers before '}' token
    }
    ^
   drivers/scsi/hpsa.c:3273:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   drivers/scsi/hpsa.c:3303:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   drivers/scsi/hpsa.c:3334:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   drivers/scsi/hpsa.c:3377:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   drivers/scsi/hpsa.c:3417:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   drivers/scsi/hpsa.c:3438:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   drivers/scsi/hpsa.c:3482:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   drivers/scsi/hpsa.c:3489:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   drivers/scsi/hpsa.c:3495:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   drivers/scsi/hpsa.c:3504:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   drivers/scsi/hpsa.c:3548:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   drivers/scsi/hpsa.c:3624:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   drivers/scsi/hpsa.c:3661:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   drivers/scsi/hpsa.c:3675:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   drivers/scsi/hpsa.c:3756:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   drivers/scsi/hpsa.c:3787:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   drivers/scsi/hpsa.c:3823:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   drivers/scsi/hpsa.c:3843:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   drivers/scsi/hpsa.c:3871:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   drivers/scsi/hpsa.c:3909:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   drivers/scsi/hpsa.c:3937:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   drivers/scsi/hpsa.c:3962:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   drivers/scsi/hpsa.c:3989:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   drivers/scsi/hpsa.c:4012:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   drivers/scsi/hpsa.c:4247:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^
   drivers/scsi/hpsa.c:4264:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {

vim +/__builtin_memcpy +21 arch/alpha/include/asm/string.h

^1da177e include/asm-alpha/string.h      Linus Torvalds    2005-04-16   5  
^1da177e include/asm-alpha/string.h      Linus Torvalds    2005-04-16   6  /*
^1da177e include/asm-alpha/string.h      Linus Torvalds    2005-04-16   7   * GCC of any recent vintage doesn't do stupid things with bcopy.
^1da177e include/asm-alpha/string.h      Linus Torvalds    2005-04-16   8   * EGCS 1.1 knows all about expanding memcpy inline, others don't.
^1da177e include/asm-alpha/string.h      Linus Torvalds    2005-04-16   9   *
^1da177e include/asm-alpha/string.h      Linus Torvalds    2005-04-16  10   * Similarly for a memset with data = 0.
^1da177e include/asm-alpha/string.h      Linus Torvalds    2005-04-16  11   */
^1da177e include/asm-alpha/string.h      Linus Torvalds    2005-04-16  12  
^1da177e include/asm-alpha/string.h      Linus Torvalds    2005-04-16  13  #define __HAVE_ARCH_MEMCPY
^1da177e include/asm-alpha/string.h      Linus Torvalds    2005-04-16  14  extern void * memcpy(void *, const void *, size_t);
^1da177e include/asm-alpha/string.h      Linus Torvalds    2005-04-16  15  #define __HAVE_ARCH_MEMMOVE
^1da177e include/asm-alpha/string.h      Linus Torvalds    2005-04-16  16  extern void * memmove(void *, const void *, size_t);
^1da177e include/asm-alpha/string.h      Linus Torvalds    2005-04-16  17  
^1da177e include/asm-alpha/string.h      Linus Torvalds    2005-04-16  18  /* For backward compatibility with modules.  Unused otherwise.  */
^1da177e include/asm-alpha/string.h      Linus Torvalds    2005-04-16  19  extern void * __memcpy(void *, const void *, size_t);
^1da177e include/asm-alpha/string.h      Linus Torvalds    2005-04-16  20  
^1da177e include/asm-alpha/string.h      Linus Torvalds    2005-04-16 @21  #define memcpy __builtin_memcpy
^1da177e include/asm-alpha/string.h      Linus Torvalds    2005-04-16  22  
^1da177e include/asm-alpha/string.h      Linus Torvalds    2005-04-16  23  #define __HAVE_ARCH_MEMSET
^1da177e include/asm-alpha/string.h      Linus Torvalds    2005-04-16  24  extern void * __constant_c_memset(void *, unsigned long, size_t);
a47e5bb5 arch/alpha/include/asm/string.h Richard Henderson 2013-07-11  25  extern void * ___memset(void *, int, size_t);
^1da177e include/asm-alpha/string.h      Linus Torvalds    2005-04-16  26  extern void * __memset(void *, int, size_t);
^1da177e include/asm-alpha/string.h      Linus Torvalds    2005-04-16  27  extern void * memset(void *, int, size_t);
^1da177e include/asm-alpha/string.h      Linus Torvalds    2005-04-16  28  
a47e5bb5 arch/alpha/include/asm/string.h Richard Henderson 2013-07-11  29  /* For gcc 3.x, we cannot have the inline function named "memset" because

:::::: The code at line 21 was first introduced by commit :::::: 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Linux-2.6.12-rc2

:::::: TO: Linus Torvalds <[email protected]> :::::: CC: Linus Torvalds <[email protected]>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation