scsi:stex.c Support to Pegasus series.
PATCH v2 1/4 scsi:stex.c Support to Pegasus series.
From 5fdb4203c09d6896e7b71a8f839e46e84234eeb9 Mon Sep 17 00:00:00 2001
From: Charles Chiou <[email protected]>
Date: Wed, 5 Nov 2014 14:18:43 +0800
Subject: [PATCH 1/4] scsi:stex.c Support to Pegasus series.
Pegasus is a high performace hardware RAID solution designed to unleash the raw power of Thunderbolt technology.
I add code to distinct SuperTrack and Pegasus series by subID. It's needed for backward compatibility.
Change the driver version.
--- drivers/scsi/stex.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-)
drivers/scsi/stex.c +19 -5
@@ -37,11 +37,11 @@#include <scsi/scsi_eh.h> #define DRV_NAME "stex" -#define ST_DRIVER_VERSION "4.6.0000.4" -#define ST_VER_MAJOR 4 -#define ST_VER_MINOR 6 -#define ST_OEM 0 -#define ST_BUILD_VER 4 +#define ST_DRIVER_VERSION "5.00.0000.01" +#define ST_VER_MAJOR 5 +#define ST_VER_MINOR 00 +#define ST_OEM 0000 +#define ST_BUILD_VER 01enum {/* MU register offset */
@@ -327,6 +327,7 @@ struct st_hba {u16 rq_count;u16 rq_size;u16 sts_count; +u8 yellowstone; };struct st_card_info {
@@ -1546,6 +1547,7 @@ static int stex_probe(struct pci_dev *pdev, const struct pci_device_id *id)struct Scsi_Host *host;const struct st_card_info *ci =NULL ;u32 sts_offset, cp_offset, scratch_offset; +u32 subID;int err; err =pci_enable_device (pdev);
@@ -1590,6 +1592,18 @@ static int stex_probe(struct pci_dev *pdev, const struct pci_device_id *id) hba->cardtype = (unsigned int ) id->driver_data; ci = &stex_card_info[hba->cardtype]; + subID = id->subdevice; +if ((subID ==0x4221 || subID ==0x4222 || + subID ==0x4223 || subID ==0x4224 || + subID ==0x4225 || subID ==0x4226 || + subID ==0x4227 || subID ==0x4261 || + subID ==0x4262 || subID ==0x4263 || + subID ==0x4264 || subID ==0x4265 ) && + (hba->cardtype == st_yel)) { + hba->yellowstone =1 ; + }else if (hba->cardtype == st_yel) { + hba->yellowstone =0 ; + } sts_offset = scratch_offset = (ci->rq_count+1 ) * ci->rq_size;if (hba->cardtype == st_yel) sts_offset += (ci->sts_count+1 ) *sizeof (u32);
Signature · 1 line
1.9.1
drivers/scsi/stex.c struct st_hba { · line 330
Quoted 1 line
drivers/scsi/stex.c +1
-0+u8 yellowstone;
Calling this flag yellowstone seems a bit confusing as there already is a st_yel card type, and this only seems a subset of those. Maybe a ->support_pm flag or similar would be useful?
drivers/scsi/stex.c static int stex_probe(struct pci_dev *pdev, const struct pci_device_id *id) · line 1550
Quoted 1 line
drivers/scsi/stex.c +1
-0+u32 subID;
We don't use camelCaps, but I don't think you even need this variable at all..
Quoted 5 lines
drivers/scsi/stex.c +2
-0hba->cardtype = (unsigned int ) id->driver_data; ci = &stex_card_info[hba->cardtype]; + subID = id->subdevice; + if ((subID == 0x4221 || subID == 0x4222 ||
drivers/scsi/stex.c static int stex_probe(struct pci_dev *pdev, const struct pci_device_id *id) · line 1606
Quoted 10 lines
drivers/scsi/stex.c +10
-0+ subID ==0x4223 || subID ==0x4224 || + subID ==0x4225 || subID ==0x4226 || + subID ==0x4227 || subID ==0x4261 || + subID ==0x4262 || subID ==0x4263 || + subID == 0x4264 || subID == 0x4265) && + (hba->cardtype == st_yel)) { + hba->yellowstone = 1; + } else if (hba->cardtype == st_yel) { + hba->yellowstone =0 ; + }
Just write this as
switch (id->subdevice) {
case 0x4221:
case 0x4222:
case 0x4223:
case 0x4224:
case 0x4225:
case 0x4226:
case 0x4227:
case 0x4261:
case 0x4262:
case 0x4263:
case 0x4264:
case 0x4265:
if (hba->cardtype == st_yel) {
hba->supports_pm = 1;
break;
}
default:
hba->supports_pm = 0;
}Quoted 6 lines · Christoph Hellwig
drivers/scsi/stex.c struct st_hba { · line 330
Quoted 1 line
drivers/scsi/stex.c +1
-0+u8 yellowstone;Calling this flag yellowstone seems a bit confusing as there already is a
st_yelcard type, and this only seems a subset of those. Maybe a ->support_pm flag or similar would be useful?
OK, I'll modify it.
Quoted 35 lines
drivers/scsi/stex.c static int stex_probe(struct pci_dev *pdev, const struct pci_device_id *id) · line 1550
Quoted 1 line
drivers/scsi/stex.c +1
-0+u32 subID;We don't use camelCaps, but I don't think you even need this variable at all..
Quoted 5 lines
hba->cardtype = (unsigned int) id->driver_data; ci = &stex_card_info[hba->cardtype];drivers/scsi/stex.c +2
-0+ subID = id->subdevice; + if ((subID == 0x4221 || subID == 0x4222 ||drivers/scsi/stex.c static int stex_probe(struct pci_dev *pdev, const struct pci_device_id *id) · line 1606
Quoted 10 lines
drivers/scsi/stex.c +10
-0+ subID ==0x4223 || subID ==0x4224 || + subID ==0x4225 || subID ==0x4226 || + subID ==0x4227 || subID ==0x4261 || + subID ==0x4262 || subID ==0x4263 || + subID == 0x4264 || subID == 0x4265) && + (hba->cardtype == st_yel)) { + hba->yellowstone = 1; + } else if (hba->cardtype == st_yel) { + hba->yellowstone =0 ; + }Just write this as
switch (id->subdevice) { case 0x4221: case 0x4222: case 0x4223: case 0x4224: case 0x4225: case 0x4226: case 0x4227: case 0x4261: case 0x4262: case 0x4263: case 0x4264:
Quoted 9 lines
case 0x4265:
if (hba->cardtype == st_yel) {
hba->supports_pm = 1;
break;
}
default:
hba->supports_pm = 0;
}OK, I'll correct this. Thank you!