1
0
Fork 0

SCSI misc on 20160113

This pull includes driver updates from the usual suspects (bfa, arcmsr,
 scsi_dh_alua, lpfc, storvsc, cxlflash).  The major change is the addition of
 the hisi_sas driver, which is an ARM platform device for SAS.  The other
 change of note is an enormous style transformation to the atp870u driver
 (which is our worst written SCSI driver).
 
 Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQEcBAABAgAGBQJWluqqAAoJEDeqqVYsXL0McuwH/1oqvFOagsvoDcwDyNAUR/eW
 VAH454ndIJ0eSXORNfA7ko3ZQKa53x1WN9eKr+RHI7lpGCjwBz2MjnvQsnKISvXp
 K0owkJTcAAF+Wdq7rdNlm1VlQHuLvG8TMTnno+NY3CtxCR2yiRWlctkNkjr0rWUv
 leXJkXZSThkkiY/rEDZZXee8Ajwac87QT+ELEqCT2HueGZD+J8s59JpsOtZdt6Bj
 n94ydOuct8hF3Xt3pdu1oDRpWpoJIyjHtYhdrvzSiKKBHTWtuq1oN0Cwnp0qtEDD
 X3K1Mr0yBmAjTOsK+y+bZnJ1y7qJLLt5ZHmVixkzFWujXPNbrIsyYkV5eI432XA=
 =ggNi
 -----END PGP SIGNATURE-----

Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi

Pull first round of SCSI updates from James Bottomley:
 "This includes driver updates from the usual suspects (bfa, arcmsr,
  scsi_dh_alua, lpfc, storvsc, cxlflash).

  The major change is the addition of the hisi_sas driver, which is an
  ARM platform device for SAS.  The other change of note is an enormous
  style transformation to the atp870u driver (which is our worst written
  SCSI driver)"

* tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (169 commits)
  cxlflash: Enable device id for future IBM CXL adapter
  cxlflash: Resolve oops in wait_port_offline
  cxlflash: Fix to resolve cmd leak after host reset
  cxlflash: Removed driver date print
  cxlflash: Fix to avoid virtual LUN failover failure
  cxlflash: Fix to escalate LINK_RESET also on port 1
  storvsc: Tighten up the interrupt path
  storvsc: Refactor the code in storvsc_channel_init()
  storvsc: Properly support Fibre Channel devices
  storvsc: Fix a bug in the layout of the hv_fc_wwn_packet
  mvsas: Add SGPIO support to Marvell 94xx
  mpt3sas: A correction in unmap_resources
  hpsa: Add box and bay information for enclosure devices
  hpsa: Change SAS transport devices to bus 0.
  hpsa: fix path_info_show
  cciss: print max outstanding commands as a hex value
  scsi_debug: Increase the reported optimal transfer length
  lpfc: Update version to 11.0.0.10 for upstream patch set
  lpfc: Use kzalloc instead of kmalloc
  lpfc: Delete unnecessary checks before the function call "mempool_destroy"
  ...
hifive-unleashed-5.1
Linus Torvalds 2016-01-13 19:37:36 -08:00
commit 1289ace5b4
110 changed files with 8188 additions and 4575 deletions

View File

@ -0,0 +1,69 @@
* HiSilicon SAS controller
The HiSilicon SAS controller supports SAS/SATA.
Main node required properties:
- compatible : value should be as follows:
(a) "hisilicon,hip05-sas-v1" for v1 hw in hip05 chipset
- sas-addr : array of 8 bytes for host SAS address
- reg : Address and length of the SAS register
- hisilicon,sas-syscon: phandle of syscon used for sas control
- ctrl-reset-reg : offset to controller reset register in ctrl reg
- ctrl-reset-sts-reg : offset to controller reset status register in ctrl reg
- ctrl-clock-ena-reg : offset to controller clock enable register in ctrl reg
- queue-count : number of delivery and completion queues in the controller
- phy-count : number of phys accessible by the controller
- interrupts : Interrupts for phys, completion queues, and fatal
sources; the interrupts are ordered in 3 groups, as follows:
- Phy interrupts
- Completion queue interrupts
- Fatal interrupts
Phy interrupts : Each phy has 3 interrupt sources:
- broadcast
- phyup
- abnormal
The phy interrupts are ordered into groups of 3 per phy
(broadcast, phyup, and abnormal) in increasing order.
Completion queue interrupts : each completion queue has 1
interrupt source.
The interrupts are ordered in increasing order.
Fatal interrupts : the fatal interrupts are ordered as follows:
- ECC
- AXI bus
Example:
sas0: sas@c1000000 {
compatible = "hisilicon,hip05-sas-v1";
sas-addr = [50 01 88 20 16 00 00 0a];
reg = <0x0 0xc1000000 0x0 0x10000>;
hisilicon,sas-syscon = <&pcie_sas>;
ctrl-reset-reg = <0xa60>;
ctrl-reset-sts-reg = <0x5a30>;
ctrl-clock-ena-reg = <0x338>;
queue-count = <32>;
phy-count = <8>;
dma-coherent;
interrupt-parent = <&mbigen_dsa>;
interrupts = <259 4>,<263 4>,<264 4>,/* phy0 */
<269 4>,<273 4>,<274 4>,/* phy1 */
<279 4>,<283 4>,<284 4>,/* phy2 */
<289 4>,<293 4>,<294 4>,/* phy3 */
<299 4>,<303 4>,<304 4>,/* phy4 */
<309 4>,<313 4>,<314 4>,/* phy5 */
<319 4>,<323 4>,<324 4>,/* phy6 */
<329 4>,<333 4>,<334 4>,/* phy7 */
<336 1>,<337 1>,<338 1>,/* cq0-2 */
<339 1>,<340 1>,<341 1>,/* cq3-5 */
<342 1>,<343 1>,<344 1>,/* cq6-8 */
<345 1>,<346 1>,<347 1>,/* cq9-11 */
<348 1>,<349 1>,<350 1>,/* cq12-14 */
<351 1>,<352 1>,<353 1>,/* cq15-17 */
<354 1>,<355 1>,<356 1>,/* cq18-20 */
<357 1>,<358 1>,<359 1>,/* cq21-23 */
<360 1>,<361 1>,<362 1>,/* cq24-26 */
<363 1>,<364 1>,<365 1>,/* cq27-29 */
<366 1>,<367 1>/* cq30-31 */
<376 4>,/* fatal ecc */
<381 4>;/* fatal axi */
status = "disabled";
};

View File

@ -5038,6 +5038,13 @@ F: include/uapi/linux/if_hippi.h
F: net/802/hippi.c
F: drivers/net/hippi/
HISILICON SAS Controller
M: John Garry <john.garry@huawei.com>
W: http://www.hisilicon.com
S: Supported
F: drivers/scsi/hisi_sas/
F: Documentation/devicetree/bindings/scsi/hisilicon-sas.txt
HOST AP DRIVER
M: Jouni Malinen <j@w1.fi>
L: hostap@shmoo.com (subscribers-only)

View File

@ -3848,7 +3848,7 @@ static void print_cfg_table(ctlr_info_t *h)
readl(&(tb->HostWrite.CoalIntDelay)));
dev_dbg(&h->pdev->dev, " Coalesce Interrupt Count = 0x%x\n",
readl(&(tb->HostWrite.CoalIntCount)));
dev_dbg(&h->pdev->dev, " Max outstanding commands = 0x%d\n",
dev_dbg(&h->pdev->dev, " Max outstanding commands = 0x%x\n",
readl(&(tb->CmdsOutMax)));
dev_dbg(&h->pdev->dev, " Bus Types = 0x%x\n",
readl(&(tb->BusTypes)));

View File

@ -194,6 +194,7 @@ config CHR_DEV_SCH
config SCSI_ENCLOSURE
tristate "SCSI Enclosure Support"
depends on SCSI && ENCLOSURE_SERVICES
depends on m || SCSI_SAS_ATTRS != m
help
Enclosures are devices sitting on or in SCSI backplanes that
manage devices. If you have a disk cage, the chances are that
@ -474,6 +475,7 @@ config SCSI_AACRAID
source "drivers/scsi/aic7xxx/Kconfig.aic7xxx"
source "drivers/scsi/aic7xxx/Kconfig.aic79xx"
source "drivers/scsi/aic94xx/Kconfig"
source "drivers/scsi/hisi_sas/Kconfig"
source "drivers/scsi/mvsas/Kconfig"
config SCSI_MVUMI

View File

@ -157,6 +157,7 @@ obj-$(CONFIG_CHR_DEV_SCH) += ch.o
obj-$(CONFIG_SCSI_ENCLOSURE) += ses.o
obj-$(CONFIG_SCSI_OSD_INITIATOR) += osd/
obj-$(CONFIG_SCSI_HISI_SAS) += hisi_sas/
# This goes last, so that "real" scsi devices probe earlier
obj-$(CONFIG_SCSI_DEBUG) += scsi_debug.o

View File

@ -1318,7 +1318,7 @@ static int aac_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
}
#if (defined(CONFIG_PM))
void aac_release_resources(struct aac_dev *aac)
static void aac_release_resources(struct aac_dev *aac)
{
int i;

View File

@ -327,46 +327,9 @@ struct scb_header {
#define LUN_SIZE 8
/* See SAS spec, task IU
*/
struct ssp_task_iu {
u8 lun[LUN_SIZE]; /* BE */
u16 _r_a;
u8 tmf;
u8 _r_b;
__be16 tag; /* BE */
u8 _r_c[14];
} __attribute__ ((packed));
/* See SAS spec, command IU
*/
struct ssp_command_iu {
u8 lun[LUN_SIZE];
u8 _r_a;
u8 efb_prio_attr; /* enable first burst, task prio & attr */
#define EFB_MASK 0x80
#define TASK_PRIO_MASK 0x78
#define TASK_ATTR_MASK 0x07
u8 _r_b;
u8 add_cdb_len; /* in dwords, since bit 0,1 are reserved */
union {
u8 cdb[16];
struct {
__le64 long_cdb_addr; /* bus address, LE */
__le32 long_cdb_size; /* LE */
u8 _r_c[3];
u8 eol_ds; /* eol:6,6, ds:5,4 */
} long_cdb; /* sequencer extension */
};
} __attribute__ ((packed));
struct xfer_rdy_iu {
__be32 requested_offset; /* BE */
__be32 write_data_len; /* BE */
__be32 _r_a;
} __attribute__ ((packed));
#define EFB_MASK 0x80
#define TASK_PRIO_MASK 0x78
#define TASK_ATTR_MASK 0x07
/* ---------- SCB tasks ---------- */
/* This is both ssp_task and long_ssp_task
@ -511,7 +474,7 @@ struct abort_task {
u8 proto_conn_rate;
__le32 _r_a;
struct ssp_frame_hdr ssp_frame;
struct ssp_task_iu ssp_task;
struct ssp_tmf_iu ssp_task;
__le16 sister_scb;
__le16 conn_handle;
u8 flags; /* ovrd_itnl_timer:3,3, suspend_data_trans:2,2 */
@ -549,7 +512,7 @@ struct clear_nexus {
u8 _r_b[3];
u8 conn_mask;
u8 _r_c[19];
struct ssp_task_iu ssp_task; /* LUN and TAG */
struct ssp_tmf_iu ssp_task; /* LUN and TAG */
__le16 _r_d;
__le16 conn_handle;
__le64 _r_e;
@ -562,7 +525,7 @@ struct initiate_ssp_tmf {
u8 proto_conn_rate;
__le32 _r_a;
struct ssp_frame_hdr ssp_frame;
struct ssp_task_iu ssp_task;
struct ssp_tmf_iu ssp_task;
__le16 sister_scb;
__le16 conn_handle;
u8 flags; /* itnl override and suspend data tx */

View File

@ -52,7 +52,7 @@ struct device_attribute;
#define ARCMSR_MAX_FREECCB_NUM 320
#define ARCMSR_MAX_OUTSTANDING_CMD 255
#endif
#define ARCMSR_DRIVER_VERSION "v1.30.00.04-20140919"
#define ARCMSR_DRIVER_VERSION "v1.30.00.22-20151126"
#define ARCMSR_SCSI_INITIATOR_ID 255
#define ARCMSR_MAX_XFER_SECTORS 512
#define ARCMSR_MAX_XFER_SECTORS_B 4096
@ -74,6 +74,9 @@ struct device_attribute;
#ifndef PCI_DEVICE_ID_ARECA_1214
#define PCI_DEVICE_ID_ARECA_1214 0x1214
#endif
#ifndef PCI_DEVICE_ID_ARECA_1203
#define PCI_DEVICE_ID_ARECA_1203 0x1203
#endif
/*
**********************************************************************************
**
@ -245,6 +248,12 @@ struct FIRMWARE_INFO
/* window of "instruction flags" from iop to driver */
#define ARCMSR_IOP2DRV_DOORBELL 0x00020408
#define ARCMSR_IOP2DRV_DOORBELL_MASK 0x0002040C
/* window of "instruction flags" from iop to driver */
#define ARCMSR_IOP2DRV_DOORBELL_1203 0x00021870
#define ARCMSR_IOP2DRV_DOORBELL_MASK_1203 0x00021874
/* window of "instruction flags" from driver to iop */
#define ARCMSR_DRV2IOP_DOORBELL_1203 0x00021878
#define ARCMSR_DRV2IOP_DOORBELL_MASK_1203 0x0002187C
/* ARECA FLAG LANGUAGE */
/* ioctl transfer */
#define ARCMSR_IOP2DRV_DATA_WRITE_OK 0x00000001
@ -288,6 +297,9 @@ struct FIRMWARE_INFO
#define ARCMSR_MESSAGE_RBUFFER 0x0000ff00
/* iop message_rwbuffer for message command */
#define ARCMSR_MESSAGE_RWBUFFER 0x0000fa00
#define MEM_BASE0(x) (u32 __iomem *)((unsigned long)acb->mem_base0 + x)
#define MEM_BASE1(x) (u32 __iomem *)((unsigned long)acb->mem_base1 + x)
/*
************************************************************************
** SPEC. for Areca HBC adapter

View File

@ -114,6 +114,7 @@ static void arcmsr_hardware_reset(struct AdapterControlBlock *acb);
static const char *arcmsr_info(struct Scsi_Host *);
static irqreturn_t arcmsr_interrupt(struct AdapterControlBlock *acb);
static void arcmsr_free_irq(struct pci_dev *, struct AdapterControlBlock *);
static void arcmsr_wait_firmware_ready(struct AdapterControlBlock *acb);
static int arcmsr_adjust_disk_queue_depth(struct scsi_device *sdev, int queue_depth)
{
if (queue_depth > ARCMSR_MAX_CMD_PERLUN)
@ -157,6 +158,8 @@ static struct pci_device_id arcmsr_device_id_table[] = {
.driver_data = ACB_ADAPTER_TYPE_B},
{PCI_DEVICE(PCI_VENDOR_ID_ARECA, PCI_DEVICE_ID_ARECA_1202),
.driver_data = ACB_ADAPTER_TYPE_B},
{PCI_DEVICE(PCI_VENDOR_ID_ARECA, PCI_DEVICE_ID_ARECA_1203),
.driver_data = ACB_ADAPTER_TYPE_B},
{PCI_DEVICE(PCI_VENDOR_ID_ARECA, PCI_DEVICE_ID_ARECA_1210),
.driver_data = ACB_ADAPTER_TYPE_A},
{PCI_DEVICE(PCI_VENDOR_ID_ARECA, PCI_DEVICE_ID_ARECA_1214),
@ -495,6 +498,91 @@ static void arcmsr_flush_adapter_cache(struct AdapterControlBlock *acb)
}
}
static bool arcmsr_alloc_io_queue(struct AdapterControlBlock *acb)
{
bool rtn = true;
void *dma_coherent;
dma_addr_t dma_coherent_handle;
struct pci_dev *pdev = acb->pdev;
switch (acb->adapter_type) {
case ACB_ADAPTER_TYPE_B: {
struct MessageUnit_B *reg;
acb->roundup_ccbsize = roundup(sizeof(struct MessageUnit_B), 32);
dma_coherent = dma_zalloc_coherent(&pdev->dev, acb->roundup_ccbsize,
&dma_coherent_handle, GFP_KERNEL);
if (!dma_coherent) {
pr_notice("arcmsr%d: DMA allocation failed\n", acb->host->host_no);
return false;
}
acb->dma_coherent_handle2 = dma_coherent_handle;
acb->dma_coherent2 = dma_coherent;
reg = (struct MessageUnit_B *)dma_coherent;
acb->pmuB = reg;
if (acb->pdev->device == PCI_DEVICE_ID_ARECA_1203) {
reg->drv2iop_doorbell = MEM_BASE0(ARCMSR_DRV2IOP_DOORBELL_1203);
reg->drv2iop_doorbell_mask = MEM_BASE0(ARCMSR_DRV2IOP_DOORBELL_MASK_1203);
reg->iop2drv_doorbell = MEM_BASE0(ARCMSR_IOP2DRV_DOORBELL_1203);
reg->iop2drv_doorbell_mask = MEM_BASE0(ARCMSR_IOP2DRV_DOORBELL_MASK_1203);
} else {
reg->drv2iop_doorbell = MEM_BASE0(ARCMSR_DRV2IOP_DOORBELL);
reg->drv2iop_doorbell_mask = MEM_BASE0(ARCMSR_DRV2IOP_DOORBELL_MASK);
reg->iop2drv_doorbell = MEM_BASE0(ARCMSR_IOP2DRV_DOORBELL);
reg->iop2drv_doorbell_mask = MEM_BASE0(ARCMSR_IOP2DRV_DOORBELL_MASK);
}
reg->message_wbuffer = MEM_BASE1(ARCMSR_MESSAGE_WBUFFER);
reg->message_rbuffer = MEM_BASE1(ARCMSR_MESSAGE_RBUFFER);
reg->message_rwbuffer = MEM_BASE1(ARCMSR_MESSAGE_RWBUFFER);
}
break;
case ACB_ADAPTER_TYPE_D: {
struct MessageUnit_D *reg;
acb->roundup_ccbsize = roundup(sizeof(struct MessageUnit_D), 32);
dma_coherent = dma_zalloc_coherent(&pdev->dev, acb->roundup_ccbsize,
&dma_coherent_handle, GFP_KERNEL);
if (!dma_coherent) {
pr_notice("arcmsr%d: DMA allocation failed\n", acb->host->host_no);
return false;
}
acb->dma_coherent_handle2 = dma_coherent_handle;
acb->dma_coherent2 = dma_coherent;
reg = (struct MessageUnit_D *)dma_coherent;
acb->pmuD = reg;
reg->chip_id = MEM_BASE0(ARCMSR_ARC1214_CHIP_ID);
reg->cpu_mem_config = MEM_BASE0(ARCMSR_ARC1214_CPU_MEMORY_CONFIGURATION);
reg->i2o_host_interrupt_mask = MEM_BASE0(ARCMSR_ARC1214_I2_HOST_INTERRUPT_MASK);
reg->sample_at_reset = MEM_BASE0(ARCMSR_ARC1214_SAMPLE_RESET);
reg->reset_request = MEM_BASE0(ARCMSR_ARC1214_RESET_REQUEST);
reg->host_int_status = MEM_BASE0(ARCMSR_ARC1214_MAIN_INTERRUPT_STATUS);
reg->pcief0_int_enable = MEM_BASE0(ARCMSR_ARC1214_PCIE_F0_INTERRUPT_ENABLE);
reg->inbound_msgaddr0 = MEM_BASE0(ARCMSR_ARC1214_INBOUND_MESSAGE0);
reg->inbound_msgaddr1 = MEM_BASE0(ARCMSR_ARC1214_INBOUND_MESSAGE1);
reg->outbound_msgaddr0 = MEM_BASE0(ARCMSR_ARC1214_OUTBOUND_MESSAGE0);
reg->outbound_msgaddr1 = MEM_BASE0(ARCMSR_ARC1214_OUTBOUND_MESSAGE1);
reg->inbound_doorbell = MEM_BASE0(ARCMSR_ARC1214_INBOUND_DOORBELL);
reg->outbound_doorbell = MEM_BASE0(ARCMSR_ARC1214_OUTBOUND_DOORBELL);
reg->outbound_doorbell_enable = MEM_BASE0(ARCMSR_ARC1214_OUTBOUND_DOORBELL_ENABLE);
reg->inboundlist_base_low = MEM_BASE0(ARCMSR_ARC1214_INBOUND_LIST_BASE_LOW);
reg->inboundlist_base_high = MEM_BASE0(ARCMSR_ARC1214_INBOUND_LIST_BASE_HIGH);
reg->inboundlist_write_pointer = MEM_BASE0(ARCMSR_ARC1214_INBOUND_LIST_WRITE_POINTER);
reg->outboundlist_base_low = MEM_BASE0(ARCMSR_ARC1214_OUTBOUND_LIST_BASE_LOW);
reg->outboundlist_base_high = MEM_BASE0(ARCMSR_ARC1214_OUTBOUND_LIST_BASE_HIGH);
reg->outboundlist_copy_pointer = MEM_BASE0(ARCMSR_ARC1214_OUTBOUND_LIST_COPY_POINTER);
reg->outboundlist_read_pointer = MEM_BASE0(ARCMSR_ARC1214_OUTBOUND_LIST_READ_POINTER);
reg->outboundlist_interrupt_cause = MEM_BASE0(ARCMSR_ARC1214_OUTBOUND_INTERRUPT_CAUSE);
reg->outboundlist_interrupt_enable = MEM_BASE0(ARCMSR_ARC1214_OUTBOUND_INTERRUPT_ENABLE);
reg->message_wbuffer = MEM_BASE0(ARCMSR_ARC1214_MESSAGE_WBUFFER);
reg->message_rbuffer = MEM_BASE0(ARCMSR_ARC1214_MESSAGE_RBUFFER);
reg->msgcode_rwbuffer = MEM_BASE0(ARCMSR_ARC1214_MESSAGE_RWBUFFER);
}
break;
default:
break;
}
return rtn;
}
static int arcmsr_alloc_ccb_pool(struct AdapterControlBlock *acb)
{
struct pci_dev *pdev = acb->pdev;
@ -739,9 +827,12 @@ static int arcmsr_probe(struct pci_dev *pdev, const struct pci_device_id *id)
if(!error){
goto pci_release_regs;
}
error = arcmsr_alloc_io_queue(acb);
if (!error)
goto unmap_pci_region;
error = arcmsr_get_firmware_spec(acb);
if(!error){
goto unmap_pci_region;
goto free_hbb_mu;
}
error = arcmsr_alloc_ccb_pool(acb);
if(error){
@ -2622,9 +2713,6 @@ static bool arcmsr_hbaA_get_config(struct AdapterControlBlock *acb)
static bool arcmsr_hbaB_get_config(struct AdapterControlBlock *acb)
{
struct MessageUnit_B *reg = acb->pmuB;
struct pci_dev *pdev = acb->pdev;
void *dma_coherent;
dma_addr_t dma_coherent_handle;
char *acb_firm_model = acb->firm_model;
char *acb_firm_version = acb->firm_version;
char *acb_device_map = acb->device_map;
@ -2636,30 +2724,16 @@ static bool arcmsr_hbaB_get_config(struct AdapterControlBlock *acb)
/*firm_version,21,84-99*/
int count;
acb->roundup_ccbsize = roundup(sizeof(struct MessageUnit_B), 32);
dma_coherent = dma_alloc_coherent(&pdev->dev, acb->roundup_ccbsize,
&dma_coherent_handle, GFP_KERNEL);
if (!dma_coherent){
printk(KERN_NOTICE
"arcmsr%d: dma_alloc_coherent got error for hbb mu\n",
acb->host->host_no);
return false;
}
acb->dma_coherent_handle2 = dma_coherent_handle;
acb->dma_coherent2 = dma_coherent;
reg = (struct MessageUnit_B *)dma_coherent;
acb->pmuB = reg;
reg->drv2iop_doorbell= (uint32_t __iomem *)((unsigned long)acb->mem_base0 + ARCMSR_DRV2IOP_DOORBELL);
reg->drv2iop_doorbell_mask = (uint32_t __iomem *)((unsigned long)acb->mem_base0 + ARCMSR_DRV2IOP_DOORBELL_MASK);
reg->iop2drv_doorbell = (uint32_t __iomem *)((unsigned long)acb->mem_base0 + ARCMSR_IOP2DRV_DOORBELL);
reg->iop2drv_doorbell_mask = (uint32_t __iomem *)((unsigned long)acb->mem_base0 + ARCMSR_IOP2DRV_DOORBELL_MASK);
reg->message_wbuffer = (uint32_t __iomem *)((unsigned long)acb->mem_base1 + ARCMSR_MESSAGE_WBUFFER);
reg->message_rbuffer = (uint32_t __iomem *)((unsigned long)acb->mem_base1 + ARCMSR_MESSAGE_RBUFFER);
reg->message_rwbuffer = (uint32_t __iomem *)((unsigned long)acb->mem_base1 + ARCMSR_MESSAGE_RWBUFFER);
iop_firm_model = (char __iomem *)(&reg->message_rwbuffer[15]); /*firm_model,15,60-67*/
iop_firm_version = (char __iomem *)(&reg->message_rwbuffer[17]); /*firm_version,17,68-83*/
iop_device_map = (char __iomem *)(&reg->message_rwbuffer[21]); /*firm_version,21,84-99*/
arcmsr_wait_firmware_ready(acb);
writel(ARCMSR_MESSAGE_START_DRIVER_MODE, reg->drv2iop_doorbell);
if (!arcmsr_hbaB_wait_msgint_ready(acb)) {
printk(KERN_ERR "arcmsr%d: can't set driver mode.\n", acb->host->host_no);
return false;
}
writel(ARCMSR_MESSAGE_GET_CONFIG, reg->drv2iop_doorbell);
if (!arcmsr_hbaB_wait_msgint_ready(acb)) {
printk(KERN_NOTICE "arcmsr%d: wait 'get adapter firmware \
@ -2694,15 +2768,15 @@ static bool arcmsr_hbaB_get_config(struct AdapterControlBlock *acb)
acb->firm_model,
acb->firm_version);
acb->signature = readl(&reg->message_rwbuffer[1]);
acb->signature = readl(&reg->message_rwbuffer[0]);
/*firm_signature,1,00-03*/
acb->firm_request_len = readl(&reg->message_rwbuffer[2]);
acb->firm_request_len = readl(&reg->message_rwbuffer[1]);
/*firm_request_len,1,04-07*/
acb->firm_numbers_queue = readl(&reg->message_rwbuffer[3]);
acb->firm_numbers_queue = readl(&reg->message_rwbuffer[2]);
/*firm_numbers_queue,2,08-11*/
acb->firm_sdram_size = readl(&reg->message_rwbuffer[4]);
acb->firm_sdram_size = readl(&reg->message_rwbuffer[3]);
/*firm_sdram_size,3,12-15*/
acb->firm_hd_channels = readl(&reg->message_rwbuffer[5]);
acb->firm_hd_channels = readl(&reg->message_rwbuffer[4]);
/*firm_ide_channels,4,16-19*/
acb->firm_cfg_version = readl(&reg->message_rwbuffer[25]); /*firm_cfg_version,25,100-103*/
/*firm_ide_channels,4,16-19*/
@ -2777,70 +2851,8 @@ static bool arcmsr_hbaD_get_config(struct AdapterControlBlock *acb)
char __iomem *iop_firm_version;
char __iomem *iop_device_map;
u32 count;
struct MessageUnit_D *reg;
void *dma_coherent2;
dma_addr_t dma_coherent_handle2;
struct pci_dev *pdev = acb->pdev;
struct MessageUnit_D *reg = acb->pmuD;
acb->roundup_ccbsize = roundup(sizeof(struct MessageUnit_D), 32);
dma_coherent2 = dma_alloc_coherent(&pdev->dev, acb->roundup_ccbsize,
&dma_coherent_handle2, GFP_KERNEL);
if (!dma_coherent2) {
pr_notice("DMA allocation failed...\n");
return false;
}
memset(dma_coherent2, 0, acb->roundup_ccbsize);
acb->dma_coherent_handle2 = dma_coherent_handle2;
acb->dma_coherent2 = dma_coherent2;
reg = (struct MessageUnit_D *)dma_coherent2;
acb->pmuD = reg;
reg->chip_id = acb->mem_base0 + ARCMSR_ARC1214_CHIP_ID;
reg->cpu_mem_config = acb->mem_base0 +
ARCMSR_ARC1214_CPU_MEMORY_CONFIGURATION;
reg->i2o_host_interrupt_mask = acb->mem_base0 +
ARCMSR_ARC1214_I2_HOST_INTERRUPT_MASK;
reg->sample_at_reset = acb->mem_base0 + ARCMSR_ARC1214_SAMPLE_RESET;
reg->reset_request = acb->mem_base0 + ARCMSR_ARC1214_RESET_REQUEST;
reg->host_int_status = acb->mem_base0 +
ARCMSR_ARC1214_MAIN_INTERRUPT_STATUS;
reg->pcief0_int_enable = acb->mem_base0 +
ARCMSR_ARC1214_PCIE_F0_INTERRUPT_ENABLE;
reg->inbound_msgaddr0 = acb->mem_base0 +
ARCMSR_ARC1214_INBOUND_MESSAGE0;
reg->inbound_msgaddr1 = acb->mem_base0 +
ARCMSR_ARC1214_INBOUND_MESSAGE1;
reg->outbound_msgaddr0 = acb->mem_base0 +
ARCMSR_ARC1214_OUTBOUND_MESSAGE0;
reg->outbound_msgaddr1 = acb->mem_base0 +
ARCMSR_ARC1214_OUTBOUND_MESSAGE1;
reg->inbound_doorbell = acb->mem_base0 +
ARCMSR_ARC1214_INBOUND_DOORBELL;
reg->outbound_doorbell = acb->mem_base0 +
ARCMSR_ARC1214_OUTBOUND_DOORBELL;
reg->outbound_doorbell_enable = acb->mem_base0 +
ARCMSR_ARC1214_OUTBOUND_DOORBELL_ENABLE;
reg->inboundlist_base_low = acb->mem_base0 +
ARCMSR_ARC1214_INBOUND_LIST_BASE_LOW;
reg->inboundlist_base_high = acb->mem_base0 +
ARCMSR_ARC1214_INBOUND_LIST_BASE_HIGH;
reg->inboundlist_write_pointer = acb->mem_base0 +
ARCMSR_ARC1214_INBOUND_LIST_WRITE_POINTER;
reg->outboundlist_base_low = acb->mem_base0 +
ARCMSR_ARC1214_OUTBOUND_LIST_BASE_LOW;
reg->outboundlist_base_high = acb->mem_base0 +
ARCMSR_ARC1214_OUTBOUND_LIST_BASE_HIGH;
reg->outboundlist_copy_pointer = acb->mem_base0 +
ARCMSR_ARC1214_OUTBOUND_LIST_COPY_POINTER;
reg->outboundlist_read_pointer = acb->mem_base0 +
ARCMSR_ARC1214_OUTBOUND_LIST_READ_POINTER;
reg->outboundlist_interrupt_cause = acb->mem_base0 +
ARCMSR_ARC1214_OUTBOUND_INTERRUPT_CAUSE;
reg->outboundlist_interrupt_enable = acb->mem_base0 +
ARCMSR_ARC1214_OUTBOUND_INTERRUPT_ENABLE;
reg->message_wbuffer = acb->mem_base0 + ARCMSR_ARC1214_MESSAGE_WBUFFER;
reg->message_rbuffer = acb->mem_base0 + ARCMSR_ARC1214_MESSAGE_RBUFFER;
reg->msgcode_rwbuffer = acb->mem_base0 +
ARCMSR_ARC1214_MESSAGE_RWBUFFER;
iop_firm_model = (char __iomem *)(&reg->msgcode_rwbuffer[15]);
iop_firm_version = (char __iomem *)(&reg->msgcode_rwbuffer[17]);
iop_device_map = (char __iomem *)(&reg->msgcode_rwbuffer[21]);
@ -2855,8 +2867,6 @@ static bool arcmsr_hbaD_get_config(struct AdapterControlBlock *acb)
if (!arcmsr_hbaD_wait_msgint_ready(acb)) {
pr_notice("arcmsr%d: wait get adapter firmware "
"miscellaneous data timeout\n", acb->host->host_no);
dma_free_coherent(&acb->pdev->dev, acb->roundup_ccbsize,
acb->dma_coherent2, acb->dma_coherent_handle2);
return false;
}
count = 8;
@ -2880,15 +2890,15 @@ static bool arcmsr_hbaD_get_config(struct AdapterControlBlock *acb)
iop_device_map++;
count--;
}
acb->signature = readl(&reg->msgcode_rwbuffer[1]);
acb->signature = readl(&reg->msgcode_rwbuffer[0]);
/*firm_signature,1,00-03*/
acb->firm_request_len = readl(&reg->msgcode_rwbuffer[2]);
acb->firm_request_len = readl(&reg->msgcode_rwbuffer[1]);
/*firm_request_len,1,04-07*/
acb->firm_numbers_queue = readl(&reg->msgcode_rwbuffer[3]);
acb->firm_numbers_queue = readl(&reg->msgcode_rwbuffer[2]);
/*firm_numbers_queue,2,08-11*/
acb->firm_sdram_size = readl(&reg->msgcode_rwbuffer[4]);
acb->firm_sdram_size = readl(&reg->msgcode_rwbuffer[3]);
/*firm_sdram_size,3,12-15*/
acb->firm_hd_channels = readl(&reg->msgcode_rwbuffer[5]);
acb->firm_hd_channels = readl(&reg->msgcode_rwbuffer[4]);
/*firm_hd_channels,4,16-19*/
acb->firm_cfg_version = readl(&reg->msgcode_rwbuffer[25]);
pr_notice("Areca RAID Controller%d: Model %s, F/W %s\n",
@ -3998,6 +4008,7 @@ static const char *arcmsr_info(struct Scsi_Host *host)
case PCI_DEVICE_ID_ARECA_1160:
case PCI_DEVICE_ID_ARECA_1170:
case PCI_DEVICE_ID_ARECA_1201:
case PCI_DEVICE_ID_ARECA_1203:
case PCI_DEVICE_ID_ARECA_1220:
case PCI_DEVICE_ID_ARECA_1230:
case PCI_DEVICE_ID_ARECA_1260:

File diff suppressed because it is too large Load Diff

View File

@ -26,22 +26,18 @@ struct atp_unit
unsigned long baseport;
unsigned long ioport[2];
unsigned long pciport[2];
unsigned long irq;
unsigned char last_cmd[2];
unsigned char in_snd[2];
unsigned char in_int[2];
unsigned char quhd[2];
unsigned char quend[2];
unsigned char global_map[2];
unsigned char chip_ver;
unsigned char scam_on;
unsigned char host_id[2];
unsigned int working[2];
unsigned short wide_id[2];
unsigned short active_id[2];
unsigned short ultra_map[2];
unsigned short async[2];
unsigned short dev_id;
unsigned char sp[2][16];
unsigned char r1f[2][16];
struct scsi_cmnd *quereq[2][qcnt];

View File

@ -1,9 +1,10 @@
/*
* Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
* Copyright (c) 2005-2014 Brocade Communications Systems, Inc.
* Copyright (c) 2014- QLogic Corporation.
* All rights reserved
* www.brocade.com
* www.qlogic.com
*
* Linux driver for Brocade Fibre Channel Host Bus Adapter.
* Linux driver for QLogic BR-series Fibre Channel Host Bus Adapter.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License (GPL) Version 2 as

View File

@ -1,9 +1,10 @@
/*
* Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
* Copyright (c) 2005-2014 Brocade Communications Systems, Inc.
* Copyright (c) 2014- QLogic Corporation.
* All rights reserved
* www.brocade.com
* www.qlogic.com
*
* Linux driver for Brocade Fibre Channel Host Bus Adapter.
* Linux driver for QLogic BR-series Fibre Channel Host Bus Adapter.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License (GPL) Version 2 as

View File

@ -1,9 +1,10 @@
/*
* Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
* Copyright (c) 2005-2014 Brocade Communications Systems, Inc.
* Copyright (c) 2014- QLogic Corporation.
* All rights reserved
* www.brocade.com
* www.qlogic.com
*
* Linux driver for Brocade Fibre Channel Host Bus Adapter.
* Linux driver for QLogic BR-series Fibre Channel Host Bus Adapter.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License (GPL) Version 2 as

View File

@ -1,9 +1,10 @@
/*
* Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
* Copyright (c) 2005-2014 Brocade Communications Systems, Inc.
* Copyright (c) 2014- QLogic Corporation.
* All rights reserved
* www.brocade.com
* www.qlogic.com
*
* Linux driver for Brocade Fibre Channel Host Bus Adapter.
* Linux driver for QLogic BR-series Fibre Channel Host Bus Adapter.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License (GPL) Version 2 as

View File

@ -1,9 +1,10 @@
/*
* Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
* Copyright (c) 2005-2014 Brocade Communications Systems, Inc.
* Copyright (c) 2014- QLogic Corporation.
* All rights reserved
* www.brocade.com
* www.qlogic.com
*
* Linux driver for Brocade Fibre Channel Host Bus Adapter.
* Linux driver for QLogic BR-series Fibre Channel Host Bus Adapter.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License (GPL) Version 2 as

View File

@ -1,9 +1,10 @@
/*
* Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
* Copyright (c) 2005-2014 Brocade Communications Systems, Inc.
* Copyright (c) 2014- QLogic Corporation.
* All rights reserved
* www.brocade.com
* www.qlogic.com
*
* Linux driver for Brocade Fibre Channel Host Bus Adapter.
* Linux driver for QLogic BR-series Fibre Channel Host Bus Adapter.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License (GPL) Version 2 as

View File

@ -1,9 +1,10 @@
/*
* Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
* Copyright (c) 2005-2014 Brocade Communications Systems, Inc.
* Copyright (c) 2014- QLogic Corporation.
* All rights reserved
* www.brocade.com
* www.qlogic.com
*
* Linux driver for Brocade Fibre Channel Host Bus Adapter.
* Linux driver for QLogic BR-series Fibre Channel Host Bus Adapter.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License (GPL) Version 2 as

View File

@ -1,9 +1,10 @@
/*
* Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
* Copyright (c) 2005-2014 Brocade Communications Systems, Inc.
* Copyright (c) 2014- QLogic Corporation.
* All rights reserved
* www.brocade.com
* www.qlogic.com
*
* Linux driver for Brocade Fibre Channel Host Bus Adapter.
* Linux driver for QLogic BR-series Fibre Channel Host Bus Adapter.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License (GPL) Version 2 as

View File

@ -1,9 +1,10 @@
/*
* Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
* Copyright (c) 2005-2014 Brocade Communications Systems, Inc.
* Copyright (c) 2014- QLogic Corporation.
* All rights reserved
* www.brocade.com
* www.qlogic.com
*
* Linux driver for Brocade Fibre Channel Host Bus Adapter.
* Linux driver for QLogic BR-series Fibre Channel Host Bus Adapter.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License (GPL) Version 2 as

View File

@ -1,9 +1,10 @@
/*
* Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
* Copyright (c) 2005-2014 Brocade Communications Systems, Inc.
* Copyright (c) 2014- QLogic Corporation.
* All rights reserved
* www.brocade.com
* www.qlogic.com
*
* Linux driver for Brocade Fibre Channel Host Bus Adapter.
* Linux driver for QLogic BR-series Fibre Channel Host Bus Adapter.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License (GPL) Version 2 as

View File

@ -1,9 +1,10 @@
/*
* Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
* Copyright (c) 2005-2014 Brocade Communications Systems, Inc.
* Copyright (c) 2014- QLogic Corporation.
* All rights reserved
* www.brocade.com
* www.qlogic.com
*
* Linux driver for Brocade Fibre Channel Host Bus Adapter.
* Linux driver for QLogic BR-series Fibre Channel Host Bus Adapter.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License (GPL) Version 2 as

View File

@ -1,9 +1,10 @@
/*
* Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
* Copyright (c) 2005-2014 Brocade Communications Systems, Inc.
* Copyright (c) 2014- QLogic Corporation.
* All rights reserved
* www.brocade.com
* www.qlogic.com
*
* Linux driver for Brocade Fibre Channel Host Bus Adapter.
* Linux driver for QLogic BR-series Fibre Channel Host Bus Adapter.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License (GPL) Version 2 as

View File

@ -1,9 +1,10 @@
/*
* Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
* Copyright (c) 2005-2014 Brocade Communications Systems, Inc.
* Copyright (c) 2014- QLogic Corporation.
* All rights reserved
* www.brocade.com
* www.qlogic.com
*
* Linux driver for Brocade Fibre Channel Host Bus Adapter.
* Linux driver for QLogic BR-series Fibre Channel Host Bus Adapter.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License (GPL) Version 2 as
@ -633,7 +634,7 @@ void bfa_fcs_fcpim_uf_recv(struct bfa_fcs_itnim_s *itnim,
/*
* HBA Attribute Block : BFA internal representation. Note : Some variable
* sizes have been trimmed to suit BFA For Ex : Model will be "Brocade". Based
* sizes have been trimmed to suit BFA For Ex : Model will be "QLogic ". Based
* on this the size has been reduced to 16 bytes from the standard's 64 bytes.
*/
struct bfa_fcs_fdmi_hba_attr_s {

View File

@ -1,9 +1,10 @@
/*
* Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
* Copyright (c) 2005-2014 Brocade Communications Systems, Inc.
* Copyright (c) 2014- QLogic Corporation.
* All rights reserved
* www.brocade.com
* www.qlogic.com
*
* Linux driver for Brocade Fibre Channel Host Bus Adapter.
* Linux driver for QLogic BR-series Fibre Channel Host Bus Adapter.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License (GPL) Version 2 as

View File

@ -1,9 +1,10 @@
/*
* Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
* Copyright (c) 2005-2014 Brocade Communications Systems, Inc.
* Copyright (c) 2014- QLogic Corporation.
* All rights reserved
* www.brocade.com
* www.qlogic.com
*
* Linux driver for Brocade Fibre Channel Host Bus Adapter.
* Linux driver for QLogic BR-series Fibre Channel Host Bus Adapter.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License (GPL) Version 2 as
@ -2653,7 +2654,7 @@ bfa_fcs_fdmi_get_hbaattr(struct bfa_fcs_lport_fdmi_s *fdmi,
strncpy(hba_attr->node_sym_name.symname,
port->port_cfg.node_sym_name.symname, BFA_SYMNAME_MAXLEN);
strcpy(hba_attr->vendor_info, "BROCADE");
strcpy(hba_attr->vendor_info, "QLogic");
hba_attr->num_ports =
cpu_to_be32(bfa_ioc_get_nports(&port->fcs->bfa->ioc));
hba_attr->fabric_name = port->fabric->lps->pr_nwwn;

View File

@ -1,9 +1,10 @@
/*
* Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
* Copyright (c) 2005-2014 Brocade Communications Systems, Inc.
* Copyright (c) 2014- QLogic Corporation.
* All rights reserved
* www.brocade.com
* www.qlogic.com
*
* Linux driver for Brocade Fibre Channel Host Bus Adapter.
* Linux driver for QLogic BR-series Fibre Channel Host Bus Adapter.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License (GPL) Version 2 as

View File

@ -1,9 +1,10 @@
/*
* Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
* Copyright (c) 2005-2014 Brocade Communications Systems, Inc.
* Copyright (c) 2014- QLogic Corporation.
* All rights reserved
* www.brocade.com
* www.qlogic.com
*
* Linux driver for Brocade Fibre Channel Host Bus Adapter.
* Linux driver for QLogic BR-series Fibre Channel Host Bus Adapter.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License (GPL) Version 2 as

View File

@ -1,9 +1,10 @@
/*
* Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
* Copyright (c) 2005-2014 Brocade Communications Systems, Inc.
* Copyright (c) 2014- QLogic Corporation.
* All rights reserved
* www.brocade.com
* www.qlogic.com
*
* Linux driver for Brocade Fibre Channel Host Bus Adapter.
* Linux driver for QLogic BR-series Fibre Channel Host Bus Adapter.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License (GPL) Version 2 as

View File

@ -1,9 +1,10 @@
/*
* Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
* Copyright (c) 2005-2014 Brocade Communications Systems, Inc.
* Copyright (c) 2014- QLogic Corporation.
* All rights reserved
* www.brocade.com
* www.qlogic.com
*
* Linux driver for Brocade Fibre Channel Host Bus Adapter.
* Linux driver for QLogic BR-series Fibre Channel Host Bus Adapter.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License (GPL) Version 2 as
@ -2697,7 +2698,7 @@ bfa_ioc_reset_fwstate(struct bfa_ioc_s *ioc)
bfa_ioc_set_alt_ioc_fwstate(ioc, BFI_IOC_UNINIT);
}
#define BFA_MFG_NAME "Brocade"
#define BFA_MFG_NAME "QLogic"
void
bfa_ioc_get_adapter_attr(struct bfa_ioc_s *ioc,
struct bfa_adapter_attr_s *ad_attr)

View File

@ -1,9 +1,10 @@
/*
* Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
* Copyright (c) 2005-2014 Brocade Communications Systems, Inc.
* Copyright (c) 2014- QLogic Corporation.
* All rights reserved
* www.brocade.com
* www.qlogic.com
*
* Linux driver for Brocade Fibre Channel Host Bus Adapter.
* Linux driver for QLogic BR-series Fibre Channel Host Bus Adapter.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License (GPL) Version 2 as

View File

@ -1,9 +1,10 @@
/*
* Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
* Copyright (c) 2005-2014 Brocade Communications Systems, Inc.
* Copyright (c) 2014- QLogic Corporation.
* All rights reserved
* www.brocade.com
* www.qlogic.com
*
* Linux driver for Brocade Fibre Channel Host Bus Adapter.
* Linux driver for QLogic BR-series Fibre Channel Host Bus Adapter.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License (GPL) Version 2 as

View File

@ -1,9 +1,10 @@
/*
* Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
* Copyright (c) 2005-2014 Brocade Communications Systems, Inc.
* Copyright (c) 2014- QLogic Corporation.
* All rights reserved
* www.brocade.com
* www.qlogic.com
*
* Linux driver for Brocade Fibre Channel Host Bus Adapter.
* Linux driver for QLogic BR-series Fibre Channel Host Bus Adapter.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License (GPL) Version 2 as

View File

@ -1,9 +1,10 @@
/*
* Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
* Copyright (c) 2005-2014 Brocade Communications Systems, Inc.
* Copyright (c) 2014- QLogic Corporation.
* All rights reserved
* www.brocade.com
* www.qlogic.com
*
* Linux driver for Brocade Fibre Channel Host Bus Adapter.
* Linux driver for QLogic BR-series Fibre Channel Host Bus Adapter.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License (GPL) Version 2 as

View File

@ -1,9 +1,10 @@
/*
* Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
* Copyright (c) 2005-2014 Brocade Communications Systems, Inc.
* Copyright (c) 2014- QLogic Corporation.
* All rights reserved
* www.brocade.com
* www.qlogic.com
*
* Linux driver for Brocade Fibre Channel Host Bus Adapter.
* Linux driver for QLogic BR-series Fibre Channel Host Bus Adapter.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License (GPL) Version 2 as

View File

@ -1,9 +1,10 @@
/*
* Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
* Copyright (c) 2005-2014 Brocade Communications Systems, Inc.
* Copyright (c) 2014- QLogic Corporation.
* All rights reserved
* www.brocade.com
* www.qlogic.com
*
* Linux driver for Brocade Fibre Channel Host Bus Adapter.
* Linux driver for QLogic BR-series Fibre Channel Host Bus Adapter.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License (GPL) Version 2 as

View File

@ -1,9 +1,10 @@
/*
* Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
* Copyright (c) 2005-2014 Brocade Communications Systems, Inc.
* Copyright (c) 2014- QLogic Corporation.
* All rights reserved
* www.brocade.com
* www.qlogic.com
*
* Linux driver for Brocade Fibre Channel Host Bus Adapter.
* Linux driver for QLogic BR-series Fibre Channel Host Bus Adapter.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License (GPL) Version 2 as

View File

@ -1,9 +1,10 @@
/*
* Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
* Copyright (c) 2005-2014 Brocade Communications Systems, Inc.
* Copyright (c) 2014- QLogic Corporation.
* All rights reserved
* www.brocade.com
* www.qlogic.com
*
* Linux driver for Brocade Fibre Channel Host Bus Adapter.
* Linux driver for QLogic BR-series Fibre Channel Host Bus Adapter.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License (GPL) Version 2 as

View File

@ -1,9 +1,10 @@
/*
* Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
* Copyright (c) 2005-2014 Brocade Communications Systems, Inc.
* Copyright (c) 2014- QLogic Corporation.
* All rights reserved
* www.brocade.com
* www.qlogic.com
*
* Linux driver for Brocade Fibre Channel Host Bus Adapter.
* Linux driver for QLogic BR-series Fibre Channel Host Bus Adapter.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License (GPL) Version 2 as

View File

@ -1,9 +1,10 @@
/*
* Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
* Copyright (c) 2005-2014 Brocade Communications Systems, Inc.
* Copyright (c) 2014- QLogic Corporation.
* All rights reserved
* www.brocade.com
* www.qlogic.com
*
* Linux driver for Brocade Fibre Channel Host Bus Adapter.
* Linux driver for QLogic BR-series Fibre Channel Host Bus Adapter.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License (GPL) Version 2 as
@ -130,13 +131,9 @@ MODULE_PARM_DESC(bfa_linkup_delay, "Link up delay, default=30 secs for "
"boot port. Otherwise 10 secs in RHEL4 & 0 for "
"[RHEL5, SLES10, ESX40] Range[>0]");
module_param(msix_disable_cb, int, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC(msix_disable_cb, "Disable Message Signaled Interrupts "
"for Brocade-415/425/815/825 cards, default=0, "
" Range[false:0|true:1]");
MODULE_PARM_DESC(msix_disable_cb, "Disable Message Signaled Interrupts for QLogic-415/425/815/825 cards, default=0 Range[false:0|true:1]");
module_param(msix_disable_ct, int, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC(msix_disable_ct, "Disable Message Signaled Interrupts "
"if possible for Brocade-1010/1020/804/1007/902/1741 "
"cards, default=0, Range[false:0|true:1]");
MODULE_PARM_DESC(msix_disable_ct, "Disable Message Signaled Interrupts if possible for QLogic-1010/1020/804/1007/902/1741 cards, default=0, Range[false:0|true:1]");
module_param(fdmi_enable, int, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC(fdmi_enable, "Enables fdmi registration, default=1, "
"Range[false:0|true:1]");
@ -838,8 +835,7 @@ bfad_drv_init(struct bfad_s *bfad)
printk(KERN_WARNING "bfad%d bfad_hal_mem_alloc failure\n",
bfad->inst_no);
printk(KERN_WARNING
"Not enough memory to attach all Brocade HBA ports, %s",
"System may need more memory.\n");
"Not enough memory to attach all QLogic BR-series HBA ports. System may need more memory.\n");
return BFA_STATUS_FAILED;
}
@ -1710,7 +1706,7 @@ bfad_init(void)
{
int error = 0;
printk(KERN_INFO "Brocade BFA FC/FCOE SCSI driver - version: %s\n",
pr_info("QLogic BR-series BFA FC/FCOE SCSI driver - version: %s\n",
BFAD_DRIVER_VERSION);
if (num_sgpgs > 0)
@ -1817,6 +1813,6 @@ bfad_free_fwimg(void)
module_init(bfad_init);
module_exit(bfad_exit);
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("Brocade Fibre Channel HBA Driver" BFAD_PROTO_NAME);
MODULE_AUTHOR("Brocade Communications Systems, Inc.");
MODULE_DESCRIPTION("QLogic BR-series Fibre Channel HBA Driver" BFAD_PROTO_NAME);
MODULE_AUTHOR("QLogic Corporation");
MODULE_VERSION(BFAD_DRIVER_VERSION);

View File

@ -1,9 +1,10 @@
/*
* Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
* Copyright (c) 2005-2014 Brocade Communications Systems, Inc.
* Copyright (c) 2014- QLogic Corporation.
* All rights reserved
* www.brocade.com
* www.qlogic.com
*
* Linux driver for Brocade Fibre Channel Host Bus Adapter.
* Linux driver for QLogic BR-series Fibre Channel Host Bus Adapter.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License (GPL) Version 2 as
@ -750,65 +751,65 @@ bfad_im_model_desc_show(struct device *dev, struct device_attribute *attr,
bfa_get_adapter_model(&bfad->bfa, model);
nports = bfa_get_nports(&bfad->bfa);
if (!strcmp(model, "Brocade-425"))
if (!strcmp(model, "QLogic-425"))
snprintf(model_descr, BFA_ADAPTER_MODEL_DESCR_LEN,
"Brocade 4Gbps PCIe dual port FC HBA");
else if (!strcmp(model, "Brocade-825"))
"QLogic BR-series 4Gbps PCIe dual port FC HBA");
else if (!strcmp(model, "QLogic-825"))
snprintf(model_descr, BFA_ADAPTER_MODEL_DESCR_LEN,
"Brocade 8Gbps PCIe dual port FC HBA");
else if (!strcmp(model, "Brocade-42B"))
"QLogic BR-series 8Gbps PCIe dual port FC HBA");
else if (!strcmp(model, "QLogic-42B"))
snprintf(model_descr, BFA_ADAPTER_MODEL_DESCR_LEN,
"Brocade 4Gbps PCIe dual port FC HBA for HP");
else if (!strcmp(model, "Brocade-82B"))
"QLogic BR-series 4Gbps PCIe dual port FC HBA for HP");
else if (!strcmp(model, "QLogic-82B"))
snprintf(model_descr, BFA_ADAPTER_MODEL_DESCR_LEN,
"Brocade 8Gbps PCIe dual port FC HBA for HP");
else if (!strcmp(model, "Brocade-1010"))
"QLogic BR-series 8Gbps PCIe dual port FC HBA for HP");
else if (!strcmp(model, "QLogic-1010"))
snprintf(model_descr, BFA_ADAPTER_MODEL_DESCR_LEN,
"Brocade 10Gbps single port CNA");
else if (!strcmp(model, "Brocade-1020"))
"QLogic BR-series 10Gbps single port CNA");
else if (!strcmp(model, "QLogic-1020"))
snprintf(model_descr, BFA_ADAPTER_MODEL_DESCR_LEN,
"Brocade 10Gbps dual port CNA");
else if (!strcmp(model, "Brocade-1007"))
"QLogic BR-series 10Gbps dual port CNA");
else if (!strcmp(model, "QLogic-1007"))
snprintf(model_descr, BFA_ADAPTER_MODEL_DESCR_LEN,
"Brocade 10Gbps CNA for IBM Blade Center");
else if (!strcmp(model, "Brocade-415"))
"QLogic BR-series 10Gbps CNA for IBM Blade Center");
else if (!strcmp(model, "QLogic-415"))
snprintf(model_descr, BFA_ADAPTER_MODEL_DESCR_LEN,
"Brocade 4Gbps PCIe single port FC HBA");
else if (!strcmp(model, "Brocade-815"))
"QLogic BR-series 4Gbps PCIe single port FC HBA");
else if (!strcmp(model, "QLogic-815"))
snprintf(model_descr, BFA_ADAPTER_MODEL_DESCR_LEN,
"Brocade 8Gbps PCIe single port FC HBA");
else if (!strcmp(model, "Brocade-41B"))
"QLogic BR-series 8Gbps PCIe single port FC HBA");
else if (!strcmp(model, "QLogic-41B"))
snprintf(model_descr, BFA_ADAPTER_MODEL_DESCR_LEN,
"Brocade 4Gbps PCIe single port FC HBA for HP");
else if (!strcmp(model, "Brocade-81B"))
"QLogic BR-series 4Gbps PCIe single port FC HBA for HP");
else if (!strcmp(model, "QLogic-81B"))
snprintf(model_descr, BFA_ADAPTER_MODEL_DESCR_LEN,
"Brocade 8Gbps PCIe single port FC HBA for HP");
else if (!strcmp(model, "Brocade-804"))
"QLogic BR-series 8Gbps PCIe single port FC HBA for HP");
else if (!strcmp(model, "QLogic-804"))
snprintf(model_descr, BFA_ADAPTER_MODEL_DESCR_LEN,
"Brocade 8Gbps FC HBA for HP Bladesystem C-class");
else if (!strcmp(model, "Brocade-1741"))
"QLogic BR-series 8Gbps FC HBA for HP Bladesystem C-class");
else if (!strcmp(model, "QLogic-1741"))
snprintf(model_descr, BFA_ADAPTER_MODEL_DESCR_LEN,
"Brocade 10Gbps CNA for Dell M-Series Blade Servers");
else if (strstr(model, "Brocade-1860")) {
"QLogic BR-series 10Gbps CNA for Dell M-Series Blade Servers");
else if (strstr(model, "QLogic-1860")) {
if (nports == 1 && bfa_ioc_is_cna(&bfad->bfa.ioc))
snprintf(model_descr, BFA_ADAPTER_MODEL_DESCR_LEN,
"Brocade 10Gbps single port CNA");
"QLogic BR-series 10Gbps single port CNA");
else if (nports == 1 && !bfa_ioc_is_cna(&bfad->bfa.ioc))
snprintf(model_descr, BFA_ADAPTER_MODEL_DESCR_LEN,
"Brocade 16Gbps PCIe single port FC HBA");
"QLogic BR-series 16Gbps PCIe single port FC HBA");
else if (nports == 2 && bfa_ioc_is_cna(&bfad->bfa.ioc))
snprintf(model_descr, BFA_ADAPTER_MODEL_DESCR_LEN,
"Brocade 10Gbps dual port CNA");
"QLogic BR-series 10Gbps dual port CNA");
else if (nports == 2 && !bfa_ioc_is_cna(&bfad->bfa.ioc))
snprintf(model_descr, BFA_ADAPTER_MODEL_DESCR_LEN,
"Brocade 16Gbps PCIe dual port FC HBA");
} else if (!strcmp(model, "Brocade-1867")) {
"QLogic BR-series 16Gbps PCIe dual port FC HBA");
} else if (!strcmp(model, "QLogic-1867")) {
if (nports == 1 && !bfa_ioc_is_cna(&bfad->bfa.ioc))
snprintf(model_descr, BFA_ADAPTER_MODEL_DESCR_LEN,
"Brocade 16Gbps PCIe single port FC HBA for IBM");
"QLogic BR-series 16Gbps PCIe single port FC HBA for IBM");
else if (nports == 2 && !bfa_ioc_is_cna(&bfad->bfa.ioc))
snprintf(model_descr, BFA_ADAPTER_MODEL_DESCR_LEN,
"Brocade 16Gbps PCIe dual port FC HBA for IBM");
"QLogic BR-series 16Gbps PCIe dual port FC HBA for IBM");
} else
snprintf(model_descr, BFA_ADAPTER_MODEL_DESCR_LEN,
"Invalid Model");

View File

@ -1,9 +1,10 @@
/*
* Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
* Copyright (c) 2005-2014 Brocade Communications Systems, Inc.
* Copyright (c) 2014- QLogic Corporation.
* All rights reserved
* www.brocade.com
* www.qlogic.com
*
* Linux driver for Brocade Fibre Channel Host Bus Adapter.
* Linux driver for QLogic BR-series Fibre Channel Host Bus Adapter.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License (GPL) Version 2 as

View File

@ -1,9 +1,10 @@
/*
* Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
* Copyright (c) 2005-2014 Brocade Communications Systems, Inc.
* Copyright (c) 2014- QLogic Corporation.
* All rights reserved
* www.brocade.com
* www.qlogic.com
*
* Linux driver for Brocade Fibre Channel Host Bus Adapter.
* Linux driver for QLogic BR-series Fibre Channel Host Bus Adapter.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License (GPL) Version 2 as

View File

@ -1,9 +1,10 @@
/*
* Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
* Copyright (c) 2005-2014 Brocade Communications Systems, Inc.
* Copyright (c) 2014- QLogic Corporation.
* All rights reserved
* www.brocade.com
* www.qlogic.com
*
* Linux driver for Brocade Fibre Channel Host Bus Adapter.
* Linux driver for QLogic BR-series Fibre Channel Host Bus Adapter.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License (GPL) Version 2 as

View File

@ -1,9 +1,10 @@
/*
* Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
* Copyright (c) 2005-2014 Brocade Communications Systems, Inc.
* Copyright (c) 2014- QLogic Corporation.
* All rights reserved
* www.brocade.com
* www.qlogic.com
*
* Linux driver for Brocade Fibre Channel Host Bus Adapter.
* Linux driver for QLogic BR-series Fibre Channel Host Bus Adapter.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License (GPL) Version 2 as
@ -57,7 +58,7 @@
#ifdef BFA_DRIVER_VERSION
#define BFAD_DRIVER_VERSION BFA_DRIVER_VERSION
#else
#define BFAD_DRIVER_VERSION "3.2.23.0"
#define BFAD_DRIVER_VERSION "3.2.25.0"
#endif
#define BFAD_PROTO_NAME FCPI_NAME

View File

@ -1,9 +1,10 @@
/*
* Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
* Copyright (c) 2005-2014 Brocade Communications Systems, Inc.
* Copyright (c) 2014- QLogic Corporation.
* All rights reserved
* www.brocade.com
* www.qlogic.com
*
* Linux driver for Brocade Fibre Channel Host Bus Adapter.
* Linux driver for QLogic BR-series Fibre Channel Host Bus Adapter.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License (GPL) Version 2 as
@ -185,7 +186,7 @@ bfad_im_info(struct Scsi_Host *shost)
memset(bfa_buf, 0, sizeof(bfa_buf));
snprintf(bfa_buf, sizeof(bfa_buf),
"Brocade FC/FCOE Adapter, " "hwpath: %s driver: %s",
"QLogic BR-series FC/FCOE Adapter, hwpath: %s driver: %s",
bfad->pci_name, BFAD_DRIVER_VERSION);
return bfa_buf;
@ -271,6 +272,19 @@ bfad_im_target_reset_send(struct bfad_s *bfad, struct scsi_cmnd *cmnd,
cmnd->host_scribble = NULL;
cmnd->SCp.Status = 0;
bfa_itnim = bfa_fcs_itnim_get_halitn(&itnim->fcs_itnim);
/*
* bfa_itnim can be NULL if the port gets disconnected and the bfa
* and fcs layers have cleaned up their nexus with the targets and
* the same has not been cleaned up by the shim
*/
if (bfa_itnim == NULL) {
bfa_tskim_free(tskim);
BFA_LOG(KERN_ERR, bfad, bfa_log_level,
"target reset, bfa_itnim is NULL\n");
rc = BFA_STATUS_FAILED;
goto out;
}
memset(&scsilun, 0, sizeof(scsilun));
bfa_tskim_start(tskim, bfa_itnim, scsilun,
FCP_TM_TARGET_RESET, BFAD_TARGET_RESET_TMO);
@ -326,6 +340,19 @@ bfad_im_reset_lun_handler(struct scsi_cmnd *cmnd)
cmnd->SCp.ptr = (char *)&wq;
cmnd->SCp.Status = 0;
bfa_itnim = bfa_fcs_itnim_get_halitn(&itnim->fcs_itnim);
/*
* bfa_itnim can be NULL if the port gets disconnected and the bfa
* and fcs layers have cleaned up their nexus with the targets and
* the same has not been cleaned up by the shim
*/
if (bfa_itnim == NULL) {
bfa_tskim_free(tskim);
BFA_LOG(KERN_ERR, bfad, bfa_log_level,
"lun reset, bfa_itnim is NULL\n");
spin_unlock_irqrestore(&bfad->bfad_lock, flags);
rc = FAILED;
goto out;
}
int_to_scsilun(cmnd->device->lun, &scsilun);
bfa_tskim_start(tskim, bfa_itnim, scsilun,
FCP_TM_LUN_RESET, BFAD_LUN_RESET_TMO);

View File

@ -1,9 +1,10 @@
/*
* Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
* Copyright (c) 2005-2014 Brocade Communications Systems, Inc.
* Copyright (c) 2014- QLogic Corporation.
* All rights reserved
* www.brocade.com
* www.qlogic.com
*
* Linux driver for Brocade Fibre Channel Host Bus Adapter.
* Linux driver for QLogic BR-series Fibre Channel Host Bus Adapter.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License (GPL) Version 2 as

View File

@ -1,9 +1,10 @@
/*
* Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
* Copyright (c) 2005-2014 Brocade Communications Systems, Inc.
* Copyright (c) 2014- QLogic Corporation.
* All rights reserved
* www.brocade.com
* www.qlogic.com
*
* Linux driver for Brocade Fibre Channel Host Bus Adapter.
* Linux driver for QLogic BR-series Fibre Channel Host Bus Adapter.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License (GPL) Version 2 as

View File

@ -1,9 +1,10 @@
/*
* Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
* Copyright (c) 2005-2014 Brocade Communications Systems, Inc.
* Copyright (c) 2014- QLogic Corporation.
* All rights reserved
* www.brocade.com
* www.qlogic.com
*
* Linux driver for Brocade Fibre Channel Host Bus Adapter.
* Linux driver for QLogic BR-series Fibre Channel Host Bus Adapter.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License (GPL) Version 2 as

View File

@ -1,9 +1,10 @@
/*
* Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
* Copyright (c) 2005-2014 Brocade Communications Systems, Inc.
* Copyright (c) 2014- QLogic Corporation.
* All rights reserved
* www.brocade.com
* www.qlogic.com
*
* Linux driver for Brocade Fibre Channel Host Bus Adapter.
* Linux driver for QLogic BR-series Fibre Channel Host Bus Adapter.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License (GPL) Version 2 as
@ -16,7 +17,7 @@
*/
/*
* bfi_reg.h ASIC register defines for all Brocade adapter ASICs
* bfi_reg.h ASIC register defines for all QLogic BR-series adapter ASICs
*/
#ifndef __BFI_REG_H__

View File

@ -165,6 +165,8 @@ struct afu {
struct sisl_host_map __iomem *host_map; /* MC host map */
struct sisl_ctrl_map __iomem *ctrl_map; /* MC control map */
struct kref mapcount;
ctx_hndl_t ctx_hndl; /* master's context handle */
u64 *hrrq_start;
u64 *hrrq_end;

View File

@ -368,6 +368,7 @@ out:
no_room:
afu->read_room = true;
kref_get(&cfg->afu->mapcount);
schedule_work(&cfg->work_q);
rc = SCSI_MLQUEUE_HOST_BUSY;
goto out;
@ -473,6 +474,16 @@ out:
return rc;
}
static void afu_unmap(struct kref *ref)
{
struct afu *afu = container_of(ref, struct afu, mapcount);
if (likely(afu->afu_map)) {
cxl_psa_unmap((void __iomem *)afu->afu_map);
afu->afu_map = NULL;
}
}
/**
* cxlflash_driver_info() - information handler for this host driver
* @host: SCSI host associated with device.
@ -503,6 +514,7 @@ static int cxlflash_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *scp)
ulong lock_flags;
short lflag = 0;
int rc = 0;
int kref_got = 0;
dev_dbg_ratelimited(dev, "%s: (scp=%p) %d/%d/%d/%llu "
"cdb=(%08X-%08X-%08X-%08X)\n",
@ -547,6 +559,9 @@ static int cxlflash_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *scp)
goto out;
}
kref_get(&cfg->afu->mapcount);
kref_got = 1;
cmd->rcb.ctx_id = afu->ctx_hndl;
cmd->rcb.port_sel = port_sel;
cmd->rcb.lun_id = lun_to_lunid(scp->device->lun);
@ -587,6 +602,8 @@ static int cxlflash_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *scp)
}
out:
if (kref_got)
kref_put(&afu->mapcount, afu_unmap);
pr_devel("%s: returning rc=%d\n", __func__, rc);
return rc;
}
@ -632,20 +649,36 @@ static void free_mem(struct cxlflash_cfg *cfg)
* @cfg: Internal structure associated with the host.
*
* Safe to call with AFU in a partially allocated/initialized state.
*
* Cleans up all state associated with the command queue, and unmaps
* the MMIO space.
*
* - complete() will take care of commands we initiated (they'll be checked
* in as part of the cleanup that occurs after the completion)
*
* - cmd_checkin() will take care of entries that we did not initiate and that
* have not (and will not) complete because they are sitting on a [now stale]
* hardware queue
*/
static void stop_afu(struct cxlflash_cfg *cfg)
{
int i;
struct afu *afu = cfg->afu;
struct afu_cmd *cmd;
if (likely(afu)) {
for (i = 0; i < CXLFLASH_NUM_CMDS; i++)
complete(&afu->cmd[i].cevent);
for (i = 0; i < CXLFLASH_NUM_CMDS; i++) {
cmd = &afu->cmd[i];
complete(&cmd->cevent);
if (!atomic_read(&cmd->free))
cmd_checkin(cmd);
}
if (likely(afu->afu_map)) {
cxl_psa_unmap((void __iomem *)afu->afu_map);
afu->afu_map = NULL;
}
kref_put(&afu->mapcount, afu_unmap);
}
}
@ -731,8 +764,8 @@ static void cxlflash_remove(struct pci_dev *pdev)
scsi_remove_host(cfg->host);
/* fall through */
case INIT_STATE_AFU:
term_afu(cfg);
cancel_work_sync(&cfg->work_q);
term_afu(cfg);
case INIT_STATE_PCI:
pci_release_regions(cfg->dev);
pci_disable_device(pdev);
@ -1108,7 +1141,7 @@ static const struct asyc_intr_info ainfo[] = {
{SISL_ASTATUS_FC1_OTHER, "other error", 1, CLR_FC_ERROR | LINK_RESET},
{SISL_ASTATUS_FC1_LOGO, "target initiated LOGO", 1, 0},
{SISL_ASTATUS_FC1_CRC_T, "CRC threshold exceeded", 1, LINK_RESET},
{SISL_ASTATUS_FC1_LOGI_R, "login timed out, retrying", 1, 0},
{SISL_ASTATUS_FC1_LOGI_R, "login timed out, retrying", 1, LINK_RESET},
{SISL_ASTATUS_FC1_LOGI_F, "login failed", 1, CLR_FC_ERROR},
{SISL_ASTATUS_FC1_LOGI_S, "login succeeded", 1, SCAN_HOST},
{SISL_ASTATUS_FC1_LINK_DN, "link down", 1, 0},
@ -1316,6 +1349,7 @@ static irqreturn_t cxlflash_async_err_irq(int irq, void *data)
__func__, port);
cfg->lr_state = LINK_RESET_REQUIRED;
cfg->lr_port = port;
kref_get(&cfg->afu->mapcount);
schedule_work(&cfg->work_q);
}
@ -1336,6 +1370,7 @@ static irqreturn_t cxlflash_async_err_irq(int irq, void *data)
if (info->action & SCAN_HOST) {
atomic_inc(&cfg->scan_host_needed);
kref_get(&cfg->afu->mapcount);
schedule_work(&cfg->work_q);
}
}
@ -1731,6 +1766,7 @@ static int init_afu(struct cxlflash_cfg *cfg)
rc = -ENOMEM;
goto err1;
}
kref_init(&afu->mapcount);
/* No byte reverse on reading afu_version or string will be backwards */
reg = readq(&afu->afu_map->global.regs.afu_version);
@ -1765,8 +1801,7 @@ out:
return rc;
err2:
cxl_psa_unmap((void __iomem *)afu->afu_map);
afu->afu_map = NULL;
kref_put(&afu->mapcount, afu_unmap);
err1:
term_mc(cfg, UNDO_START);
goto out;
@ -2274,6 +2309,7 @@ static struct scsi_host_template driver_template = {
* Device dependent values
*/
static struct dev_dependent_vals dev_corsa_vals = { CXLFLASH_MAX_SECTORS };
static struct dev_dependent_vals dev_flash_gt_vals = { CXLFLASH_MAX_SECTORS };
/*
* PCI device binding table
@ -2281,6 +2317,8 @@ static struct dev_dependent_vals dev_corsa_vals = { CXLFLASH_MAX_SECTORS };
static struct pci_device_id cxlflash_pci_table[] = {
{PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_CORSA,
PCI_ANY_ID, PCI_ANY_ID, 0, 0, (kernel_ulong_t)&dev_corsa_vals},
{PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_FLASH_GT,
PCI_ANY_ID, PCI_ANY_ID, 0, 0, (kernel_ulong_t)&dev_flash_gt_vals},
{}
};
@ -2339,6 +2377,7 @@ static void cxlflash_worker_thread(struct work_struct *work)
if (atomic_dec_if_positive(&cfg->scan_host_needed) >= 0)
scsi_scan_host(cfg->host);
kref_put(&afu->mapcount, afu_unmap);
}
/**
@ -2585,8 +2624,7 @@ static struct pci_driver cxlflash_driver = {
*/
static int __init init_cxlflash(void)
{
pr_info("%s: IBM Power CXL Flash Adapter: %s\n",
__func__, CXLFLASH_DRIVER_DATE);
pr_info("%s: %s\n", __func__, CXLFLASH_ADAPTER_NAME);
cxlflash_list_init();

View File

@ -22,10 +22,9 @@
#define CXLFLASH_NAME "cxlflash"
#define CXLFLASH_ADAPTER_NAME "IBM POWER CXL Flash Adapter"
#define CXLFLASH_DRIVER_DATE "(August 13, 2015)"
#define PCI_DEVICE_ID_IBM_CORSA 0x04F0
#define CXLFLASH_SUBS_DEV_ID 0x04F0
#define PCI_DEVICE_ID_IBM_CORSA 0x04F0
#define PCI_DEVICE_ID_IBM_FLASH_GT 0x0600
/* Since there is only one target, make it 0 */
#define CXLFLASH_TARGET 0

View File

@ -1372,7 +1372,7 @@ static int cxlflash_disk_attach(struct scsi_device *sdev,
}
ctx = cxl_dev_context_init(cfg->dev);
if (unlikely(IS_ERR_OR_NULL(ctx))) {
if (IS_ERR_OR_NULL(ctx)) {
dev_err(dev, "%s: Could not initialize context %p\n",
__func__, ctx);
rc = -ENODEV;
@ -1380,7 +1380,7 @@ static int cxlflash_disk_attach(struct scsi_device *sdev,
}
ctxid = cxl_process_element(ctx);
if (unlikely((ctxid > MAX_CONTEXT) || (ctxid < 0))) {
if (unlikely((ctxid >= MAX_CONTEXT) || (ctxid < 0))) {
dev_err(dev, "%s: ctxid (%d) invalid!\n", __func__, ctxid);
rc = -EPERM;
goto err2;
@ -1500,7 +1500,7 @@ static int recover_context(struct cxlflash_cfg *cfg, struct ctx_info *ctxi)
struct afu *afu = cfg->afu;
ctx = cxl_dev_context_init(cfg->dev);
if (unlikely(IS_ERR_OR_NULL(ctx))) {
if (IS_ERR_OR_NULL(ctx)) {
dev_err(dev, "%s: Could not initialize context %p\n",
__func__, ctx);
rc = -ENODEV;
@ -1508,7 +1508,7 @@ static int recover_context(struct cxlflash_cfg *cfg, struct ctx_info *ctxi)
}
ctxid = cxl_process_element(ctx);
if (unlikely((ctxid > MAX_CONTEXT) || (ctxid < 0))) {
if (unlikely((ctxid >= MAX_CONTEXT) || (ctxid < 0))) {
dev_err(dev, "%s: ctxid (%d) invalid!\n", __func__, ctxid);
rc = -EPERM;
goto err1;

View File

@ -1008,6 +1008,8 @@ int cxlflash_disk_virtual_open(struct scsi_device *sdev, void *arg)
virt->last_lba = last_lba;
virt->rsrc_handle = rsrc_handle;
if (lli->port_sel == BOTH_PORTS)
virt->hdr.return_flags |= DK_CXLFLASH_ALL_PORTS_ACTIVE;
out:
if (likely(ctxi))
put_context(ctxi);

View File

@ -22,7 +22,9 @@
#include <linux/slab.h>
#include <linux/delay.h>
#include <linux/module.h>
#include <asm/unaligned.h>
#include <scsi/scsi.h>
#include <scsi/scsi_dbg.h>
#include <scsi/scsi_eh.h>
#include <scsi/scsi_dh.h>
@ -58,8 +60,9 @@
#define ALUA_FAILOVER_TIMEOUT 60
#define ALUA_FAILOVER_RETRIES 5
/* flags passed from user level */
/* device handler flags */
#define ALUA_OPTIMIZE_STPG 1
#define ALUA_RTPG_EXT_HDR_UNSUPP 2
struct alua_dh_data {
int group_id;
@ -73,7 +76,6 @@ struct alua_dh_data {
int bufflen;
unsigned char transition_tmo;
unsigned char sense[SCSI_SENSE_BUFFERSIZE];
int senselen;
struct scsi_device *sdev;
activate_complete callback_fn;
void *callback_data;
@ -83,7 +85,6 @@ struct alua_dh_data {
#define ALUA_POLICY_SWITCH_ALL 1
static char print_alua_state(int);
static int alua_check_sense(struct scsi_device *, struct scsi_sense_hdr *);
static int realloc_buffer(struct alua_dh_data *h, unsigned len)
{
@ -130,94 +131,48 @@ static struct request *get_alua_req(struct scsi_device *sdev,
return rq;
}
/*
* submit_vpd_inquiry - Issue an INQUIRY VPD page 0x83 command
* @sdev: sdev the command should be sent to
*/
static int submit_vpd_inquiry(struct scsi_device *sdev, struct alua_dh_data *h)
{
struct request *rq;
int err = SCSI_DH_RES_TEMP_UNAVAIL;
rq = get_alua_req(sdev, h->buff, h->bufflen, READ);
if (!rq)
goto done;
/* Prepare the command. */
rq->cmd[0] = INQUIRY;
rq->cmd[1] = 1;
rq->cmd[2] = 0x83;
rq->cmd[4] = h->bufflen;
rq->cmd_len = COMMAND_SIZE(INQUIRY);
rq->sense = h->sense;
memset(rq->sense, 0, SCSI_SENSE_BUFFERSIZE);
rq->sense_len = h->senselen = 0;
err = blk_execute_rq(rq->q, NULL, rq, 1);
if (err == -EIO) {
sdev_printk(KERN_INFO, sdev,
"%s: evpd inquiry failed with %x\n",
ALUA_DH_NAME, rq->errors);
h->senselen = rq->sense_len;
err = SCSI_DH_IO;
}
blk_put_request(rq);
done:
return err;
}
/*
* submit_rtpg - Issue a REPORT TARGET GROUP STATES command
* @sdev: sdev the command should be sent to
*/
static unsigned submit_rtpg(struct scsi_device *sdev, struct alua_dh_data *h,
bool rtpg_ext_hdr_req)
static unsigned submit_rtpg(struct scsi_device *sdev, struct alua_dh_data *h)
{
struct request *rq;
int err = SCSI_DH_RES_TEMP_UNAVAIL;
int err = 0;
rq = get_alua_req(sdev, h->buff, h->bufflen, READ);
if (!rq)
if (!rq) {
err = DRIVER_BUSY << 24;
goto done;
}
/* Prepare the command. */
rq->cmd[0] = MAINTENANCE_IN;
if (rtpg_ext_hdr_req)
if (!(h->flags & ALUA_RTPG_EXT_HDR_UNSUPP))
rq->cmd[1] = MI_REPORT_TARGET_PGS | MI_EXT_HDR_PARAM_FMT;
else
rq->cmd[1] = MI_REPORT_TARGET_PGS;
rq->cmd[6] = (h->bufflen >> 24) & 0xff;
rq->cmd[7] = (h->bufflen >> 16) & 0xff;
rq->cmd[8] = (h->bufflen >> 8) & 0xff;
rq->cmd[9] = h->bufflen & 0xff;
put_unaligned_be32(h->bufflen, &rq->cmd[6]);
rq->cmd_len = COMMAND_SIZE(MAINTENANCE_IN);
rq->sense = h->sense;
memset(rq->sense, 0, SCSI_SENSE_BUFFERSIZE);
rq->sense_len = h->senselen = 0;
rq->sense_len = 0;
err = blk_execute_rq(rq->q, NULL, rq, 1);
if (err == -EIO) {
sdev_printk(KERN_INFO, sdev,
"%s: rtpg failed with %x\n",
ALUA_DH_NAME, rq->errors);
h->senselen = rq->sense_len;
err = SCSI_DH_IO;
}
blk_execute_rq(rq->q, NULL, rq, 1);
if (rq->errors)
err = rq->errors;
blk_put_request(rq);
done:
return err;
}
/*
* alua_stpg - Evaluate SET TARGET GROUP STATES
* stpg_endio - Evaluate SET TARGET GROUP STATES
* @sdev: the device to be evaluated
* @state: the new target group state
*
* Send a SET TARGET GROUP STATES command to the device.
* We only have to test here if we should resubmit the command;
* any other error is assumed as a failure.
* Evaluate a SET TARGET GROUP STATES command response.
*/
static void stpg_endio(struct request *req, int error)
{
@ -231,22 +186,21 @@ static void stpg_endio(struct request *req, int error)
goto done;
}
if (req->sense_len > 0) {
err = scsi_normalize_sense(h->sense, SCSI_SENSE_BUFFERSIZE,
&sense_hdr);
if (!err) {
err = SCSI_DH_IO;
if (scsi_normalize_sense(h->sense, SCSI_SENSE_BUFFERSIZE,
&sense_hdr)) {
if (sense_hdr.sense_key == NOT_READY &&
sense_hdr.asc == 0x04 && sense_hdr.ascq == 0x0a) {
/* ALUA state transition already in progress */
err = SCSI_DH_OK;
goto done;
}
err = alua_check_sense(h->sdev, &sense_hdr);
if (err == ADD_TO_MLQUEUE) {
if (sense_hdr.sense_key == UNIT_ATTENTION) {
err = SCSI_DH_RETRY;
goto done;
}
sdev_printk(KERN_INFO, h->sdev,
"%s: stpg sense code: %02x/%02x/%02x\n",
ALUA_DH_NAME, sense_hdr.sense_key,
sense_hdr.asc, sense_hdr.ascq);
sdev_printk(KERN_INFO, h->sdev, "%s: stpg failed\n",
ALUA_DH_NAME);
scsi_print_sense_hdr(h->sdev, ALUA_DH_NAME, &sense_hdr);
err = SCSI_DH_IO;
} else if (error)
err = SCSI_DH_IO;
@ -284,8 +238,7 @@ static unsigned submit_stpg(struct alua_dh_data *h)
/* Prepare the data buffer */
memset(h->buff, 0, stpg_len);
h->buff[4] = TPGS_STATE_OPTIMIZED & 0x0f;
h->buff[6] = (h->group_id >> 8) & 0xff;
h->buff[7] = h->group_id & 0xff;
put_unaligned_be16(h->group_id, &h->buff[6]);
rq = get_alua_req(sdev, h->buff, stpg_len, WRITE);
if (!rq)
@ -294,15 +247,12 @@ static unsigned submit_stpg(struct alua_dh_data *h)
/* Prepare the command. */
rq->cmd[0] = MAINTENANCE_OUT;
rq->cmd[1] = MO_SET_TARGET_PGS;
rq->cmd[6] = (stpg_len >> 24) & 0xff;
rq->cmd[7] = (stpg_len >> 16) & 0xff;
rq->cmd[8] = (stpg_len >> 8) & 0xff;
rq->cmd[9] = stpg_len & 0xff;
put_unaligned_be32(stpg_len, &rq->cmd[6]);
rq->cmd_len = COMMAND_SIZE(MAINTENANCE_OUT);
rq->sense = h->sense;
memset(rq->sense, 0, SCSI_SENSE_BUFFERSIZE);
rq->sense_len = h->senselen = 0;
rq->sense_len = 0;
rq->end_io_data = h;
blk_execute_rq_nowait(rq->q, NULL, rq, 1, stpg_endio);
@ -316,12 +266,23 @@ static unsigned submit_stpg(struct alua_dh_data *h)
* Examine the TPGS setting of the sdev to find out if ALUA
* is supported.
*/
static int alua_check_tpgs(struct scsi_device *sdev, struct alua_dh_data *h)
static int alua_check_tpgs(struct scsi_device *sdev)
{
int err = SCSI_DH_OK;
int tpgs = TPGS_MODE_NONE;
h->tpgs = scsi_device_tpgs(sdev);
switch (h->tpgs) {
/*
* ALUA support for non-disk devices is fraught with
* difficulties, so disable it for now.
*/
if (sdev->type != TYPE_DISK) {
sdev_printk(KERN_INFO, sdev,
"%s: disable for non-disk devices\n",
ALUA_DH_NAME);
return tpgs;
}
tpgs = scsi_device_tpgs(sdev);
switch (tpgs) {
case TPGS_MODE_EXPLICIT|TPGS_MODE_IMPLICIT:
sdev_printk(KERN_INFO, sdev,
"%s: supports implicit and explicit TPGS\n",
@ -335,71 +296,34 @@ static int alua_check_tpgs(struct scsi_device *sdev, struct alua_dh_data *h)
sdev_printk(KERN_INFO, sdev, "%s: supports implicit TPGS\n",
ALUA_DH_NAME);
break;
default:
h->tpgs = TPGS_MODE_NONE;
case TPGS_MODE_NONE:
sdev_printk(KERN_INFO, sdev, "%s: not supported\n",
ALUA_DH_NAME);
err = SCSI_DH_DEV_UNSUPP;
break;
default:
sdev_printk(KERN_INFO, sdev,
"%s: unsupported TPGS setting %d\n",
ALUA_DH_NAME, tpgs);
tpgs = TPGS_MODE_NONE;
break;
}
return err;
return tpgs;
}
/*
* alua_vpd_inquiry - Evaluate INQUIRY vpd page 0x83
* alua_check_vpd - Evaluate INQUIRY vpd page 0x83
* @sdev: device to be checked
*
* Extract the relative target port and the target port group
* descriptor from the list of identificators.
*/
static int alua_vpd_inquiry(struct scsi_device *sdev, struct alua_dh_data *h)
static int alua_check_vpd(struct scsi_device *sdev, struct alua_dh_data *h)
{
int len;
unsigned err;
unsigned char *d;
int rel_port = -1, group_id;
retry:
err = submit_vpd_inquiry(sdev, h);
if (err != SCSI_DH_OK)
return err;
/* Check if vpd page exceeds initial buffer */
len = (h->buff[2] << 8) + h->buff[3] + 4;
if (len > h->bufflen) {
/* Resubmit with the correct length */
if (realloc_buffer(h, len)) {
sdev_printk(KERN_WARNING, sdev,
"%s: kmalloc buffer failed\n",
ALUA_DH_NAME);
/* Temporary failure, bypass */
return SCSI_DH_DEV_TEMP_BUSY;
}
goto retry;
}
/*
* Now look for the correct descriptor.
*/
d = h->buff + 4;
while (d < h->buff + len) {
switch (d[1] & 0xf) {
case 0x4:
/* Relative target port */
h->rel_port = (d[6] << 8) + d[7];
break;
case 0x5:
/* Target port group */
h->group_id = (d[6] << 8) + d[7];
break;
default:
break;
}
d += d[3] + 4;
}
if (h->group_id == -1) {
group_id = scsi_vpd_tpg_id(sdev, &rel_port);
if (group_id < 0) {
/*
* Internal error; TPGS supported but required
* VPD identification descriptors not present.
@ -408,16 +332,16 @@ static int alua_vpd_inquiry(struct scsi_device *sdev, struct alua_dh_data *h)
sdev_printk(KERN_INFO, sdev,
"%s: No target port descriptors found\n",
ALUA_DH_NAME);
h->state = TPGS_STATE_OPTIMIZED;
h->tpgs = TPGS_MODE_NONE;
err = SCSI_DH_DEV_UNSUPP;
} else {
sdev_printk(KERN_INFO, sdev,
"%s: port group %02x rel port %02x\n",
ALUA_DH_NAME, h->group_id, h->rel_port);
return SCSI_DH_DEV_UNSUPP;
}
h->state = TPGS_STATE_OPTIMIZED;
h->group_id = group_id;
return err;
sdev_printk(KERN_INFO, sdev,
"%s: port group %02x rel port %02x\n",
ALUA_DH_NAME, h->group_id, h->rel_port);
return 0;
}
static char print_alua_state(int state)
@ -452,28 +376,6 @@ static int alua_check_sense(struct scsi_device *sdev,
* LUN Not Accessible - ALUA state transition
*/
return ADD_TO_MLQUEUE;
if (sense_hdr->asc == 0x04 && sense_hdr->ascq == 0x0b)
/*
* LUN Not Accessible -- Target port in standby state
*/
return SUCCESS;
if (sense_hdr->asc == 0x04 && sense_hdr->ascq == 0x0c)
/*
* LUN Not Accessible -- Target port in unavailable state
*/
return SUCCESS;
if (sense_hdr->asc == 0x04 && sense_hdr->ascq == 0x12)
/*
* LUN Not Ready -- Offline
*/
return SUCCESS;
if (sdev->allow_restart &&
sense_hdr->asc == 0x04 && sense_hdr->ascq == 0x02)
/*
* if the device is not started, we need to wake
* the error handler to start the motor
*/
return FAILED;
break;
case UNIT_ATTENTION:
if (sense_hdr->asc == 0x29 && sense_hdr->ascq == 0x00)
@ -533,8 +435,7 @@ static int alua_rtpg(struct scsi_device *sdev, struct alua_dh_data *h, int wait_
struct scsi_sense_hdr sense_hdr;
int len, k, off, valid_states = 0;
unsigned char *ucp;
unsigned err;
bool rtpg_ext_hdr_req = 1;
unsigned err, retval;
unsigned long expiry, interval = 0;
unsigned int tpg_desc_tbl_off;
unsigned char orig_transition_tmo;
@ -545,13 +446,17 @@ static int alua_rtpg(struct scsi_device *sdev, struct alua_dh_data *h, int wait_
expiry = round_jiffies_up(jiffies + h->transition_tmo * HZ);
retry:
err = submit_rtpg(sdev, h, rtpg_ext_hdr_req);
if (err == SCSI_DH_IO && h->senselen > 0) {
err = scsi_normalize_sense(h->sense, SCSI_SENSE_BUFFERSIZE,
&sense_hdr);
if (!err)
retval = submit_rtpg(sdev, h);
if (retval) {
if (!scsi_normalize_sense(h->sense, SCSI_SENSE_BUFFERSIZE,
&sense_hdr)) {
sdev_printk(KERN_INFO, sdev,
"%s: rtpg failed, result %d\n",
ALUA_DH_NAME, retval);
if (driver_byte(retval) == DRIVER_BUSY)
return SCSI_DH_DEV_TEMP_BUSY;
return SCSI_DH_IO;
}
/*
* submit_rtpg() has failed on existing arrays
@ -561,27 +466,34 @@ static int alua_rtpg(struct scsi_device *sdev, struct alua_dh_data *h, int wait_
* The retry without rtpg_ext_hdr_req set
* handles this.
*/
if (rtpg_ext_hdr_req == 1 &&
if (!(h->flags & ALUA_RTPG_EXT_HDR_UNSUPP) &&
sense_hdr.sense_key == ILLEGAL_REQUEST &&
sense_hdr.asc == 0x24 && sense_hdr.ascq == 0) {
rtpg_ext_hdr_req = 0;
h->flags |= ALUA_RTPG_EXT_HDR_UNSUPP;
goto retry;
}
err = alua_check_sense(sdev, &sense_hdr);
if (err == ADD_TO_MLQUEUE && time_before(jiffies, expiry))
/*
* Retry on ALUA state transition or if any
* UNIT ATTENTION occurred.
*/
if (sense_hdr.sense_key == NOT_READY &&
sense_hdr.asc == 0x04 && sense_hdr.ascq == 0x0a)
err = SCSI_DH_RETRY;
else if (sense_hdr.sense_key == UNIT_ATTENTION)
err = SCSI_DH_RETRY;
if (err == SCSI_DH_RETRY && time_before(jiffies, expiry)) {
sdev_printk(KERN_ERR, sdev, "%s: rtpg retry\n",
ALUA_DH_NAME);
scsi_print_sense_hdr(sdev, ALUA_DH_NAME, &sense_hdr);
goto retry;
sdev_printk(KERN_INFO, sdev,
"%s: rtpg sense code %02x/%02x/%02x\n",
ALUA_DH_NAME, sense_hdr.sense_key,
sense_hdr.asc, sense_hdr.ascq);
err = SCSI_DH_IO;
}
sdev_printk(KERN_ERR, sdev, "%s: rtpg failed\n",
ALUA_DH_NAME);
scsi_print_sense_hdr(sdev, ALUA_DH_NAME, &sense_hdr);
return SCSI_DH_IO;
}
if (err != SCSI_DH_OK)
return err;
len = (h->buff[0] << 24) + (h->buff[1] << 16) +
(h->buff[2] << 8) + h->buff[3] + 4;
len = get_unaligned_be32(&h->buff[0]) + 4;
if (len > h->bufflen) {
/* Resubmit with the correct length */
@ -616,7 +528,7 @@ static int alua_rtpg(struct scsi_device *sdev, struct alua_dh_data *h, int wait_
k < len;
k += off, ucp += off) {
if (h->group_id == (ucp[2] << 8) + ucp[3]) {
if (h->group_id == get_unaligned_be16(&ucp[2])) {
h->state = ucp[0] & 0x0f;
h->pref = ucp[0] >> 7;
valid_states = ucp[1];
@ -674,13 +586,13 @@ static int alua_rtpg(struct scsi_device *sdev, struct alua_dh_data *h, int wait_
*/
static int alua_initialize(struct scsi_device *sdev, struct alua_dh_data *h)
{
int err;
int err = SCSI_DH_DEV_UNSUPP;
err = alua_check_tpgs(sdev, h);
if (err != SCSI_DH_OK)
h->tpgs = alua_check_tpgs(sdev);
if (h->tpgs == TPGS_MODE_NONE)
goto out;
err = alua_vpd_inquiry(sdev, h);
err = alua_check_vpd(sdev, h);
if (err != SCSI_DH_OK)
goto out;

View File

@ -0,0 +1,6 @@
config SCSI_HISI_SAS
tristate "HiSilicon SAS"
select SCSI_SAS_LIBSAS
select BLK_DEV_INTEGRITY
help
This driver supports HiSilicon's SAS HBA

View File

@ -0,0 +1,2 @@
obj-$(CONFIG_SCSI_HISI_SAS) += hisi_sas_main.o
obj-$(CONFIG_SCSI_HISI_SAS) += hisi_sas_v1_hw.o

View File

@ -0,0 +1,341 @@
/*
* Copyright (c) 2015 Linaro Ltd.
* Copyright (c) 2015 Hisilicon Limited.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
*/
#ifndef _HISI_SAS_H_
#define _HISI_SAS_H_
#include <linux/dmapool.h>
#include <linux/mfd/syscon.h>
#include <linux/module.h>
#include <linux/of_address.h>
#include <linux/platform_device.h>
#include <linux/regmap.h>
#include <scsi/libsas.h>
#define DRV_VERSION "v1.0"
#define HISI_SAS_MAX_PHYS 9
#define HISI_SAS_MAX_QUEUES 32
#define HISI_SAS_QUEUE_SLOTS 512
#define HISI_SAS_MAX_ITCT_ENTRIES 4096
#define HISI_SAS_MAX_DEVICES HISI_SAS_MAX_ITCT_ENTRIES
#define HISI_SAS_COMMAND_ENTRIES 8192
#define HISI_SAS_STATUS_BUF_SZ \
(sizeof(struct hisi_sas_err_record) + 1024)
#define HISI_SAS_COMMAND_TABLE_SZ \
(((sizeof(union hisi_sas_command_table)+3)/4)*4)
#define HISI_SAS_MAX_SSP_RESP_SZ (sizeof(struct ssp_frame_hdr) + 1024)
#define HISI_SAS_MAX_SMP_RESP_SZ 1028
struct hisi_hba;
enum {
PORT_TYPE_SAS = (1U << 1),
PORT_TYPE_SATA = (1U << 0),
};
enum dev_status {
HISI_SAS_DEV_NORMAL,
HISI_SAS_DEV_EH,
};
enum hisi_sas_dev_type {
HISI_SAS_DEV_TYPE_STP = 0,
HISI_SAS_DEV_TYPE_SSP,
HISI_SAS_DEV_TYPE_SATA,
};
struct hisi_sas_phy {
struct hisi_hba *hisi_hba;
struct hisi_sas_port *port;
struct asd_sas_phy sas_phy;
struct sas_identify identify;
struct timer_list timer;
struct work_struct phyup_ws;
u64 port_id; /* from hw */
u64 dev_sas_addr;
u64 phy_type;
u64 frame_rcvd_size;
u8 frame_rcvd[32];
u8 phy_attached;
u8 reserved[3];
enum sas_linkrate minimum_linkrate;
enum sas_linkrate maximum_linkrate;
};
struct hisi_sas_port {
struct asd_sas_port sas_port;
u8 port_attached;
u8 id; /* from hw */
struct list_head list;
};
struct hisi_sas_cq {
struct hisi_hba *hisi_hba;
int id;
};
struct hisi_sas_device {
enum sas_device_type dev_type;
struct hisi_hba *hisi_hba;
struct domain_device *sas_device;
u64 attached_phy;
u64 device_id;
u64 running_req;
u8 dev_status;
};
struct hisi_sas_slot {
struct list_head entry;
struct sas_task *task;
struct hisi_sas_port *port;
u64 n_elem;
int dlvry_queue;
int dlvry_queue_slot;
int cmplt_queue;
int cmplt_queue_slot;
int idx;
void *cmd_hdr;
dma_addr_t cmd_hdr_dma;
void *status_buffer;
dma_addr_t status_buffer_dma;
void *command_table;
dma_addr_t command_table_dma;
struct hisi_sas_sge_page *sge_page;
dma_addr_t sge_page_dma;
};
struct hisi_sas_tmf_task {
u8 tmf;
u16 tag_of_task_to_be_managed;
};
struct hisi_sas_hw {
int (*hw_init)(struct hisi_hba *hisi_hba);
void (*setup_itct)(struct hisi_hba *hisi_hba,
struct hisi_sas_device *device);
void (*sl_notify)(struct hisi_hba *hisi_hba, int phy_no);
int (*get_free_slot)(struct hisi_hba *hisi_hba, int *q, int *s);
void (*start_delivery)(struct hisi_hba *hisi_hba);
int (*prep_ssp)(struct hisi_hba *hisi_hba,
struct hisi_sas_slot *slot, int is_tmf,
struct hisi_sas_tmf_task *tmf);
int (*prep_smp)(struct hisi_hba *hisi_hba,
struct hisi_sas_slot *slot);
int (*slot_complete)(struct hisi_hba *hisi_hba,
struct hisi_sas_slot *slot, int abort);
void (*phy_enable)(struct hisi_hba *hisi_hba, int phy_no);
void (*phy_disable)(struct hisi_hba *hisi_hba, int phy_no);
void (*phy_hard_reset)(struct hisi_hba *hisi_hba, int phy_no);
void (*free_device)(struct hisi_hba *hisi_hba,
struct hisi_sas_device *dev);
int (*get_wideport_bitmap)(struct hisi_hba *hisi_hba, int port_id);
int complete_hdr_size;
};
struct hisi_hba {
/* This must be the first element, used by SHOST_TO_SAS_HA */
struct sas_ha_struct *p;
struct platform_device *pdev;
void __iomem *regs;
struct regmap *ctrl;
u32 ctrl_reset_reg;
u32 ctrl_reset_sts_reg;
u32 ctrl_clock_ena_reg;
u8 sas_addr[SAS_ADDR_SIZE];
int n_phy;
int scan_finished;
spinlock_t lock;
struct timer_list timer;
struct workqueue_struct *wq;
int slot_index_count;
unsigned long *slot_index_tags;
/* SCSI/SAS glue */
struct sas_ha_struct sha;
struct Scsi_Host *shost;
struct hisi_sas_cq cq[HISI_SAS_MAX_QUEUES];
struct hisi_sas_phy phy[HISI_SAS_MAX_PHYS];
struct hisi_sas_port port[HISI_SAS_MAX_PHYS];
int queue_count;
int queue;
struct hisi_sas_slot *slot_prep;
struct dma_pool *sge_page_pool;
struct hisi_sas_device devices[HISI_SAS_MAX_DEVICES];
struct dma_pool *command_table_pool;
struct dma_pool *status_buffer_pool;
struct hisi_sas_cmd_hdr *cmd_hdr[HISI_SAS_MAX_QUEUES];
dma_addr_t cmd_hdr_dma[HISI_SAS_MAX_QUEUES];
void *complete_hdr[HISI_SAS_MAX_QUEUES];
dma_addr_t complete_hdr_dma[HISI_SAS_MAX_QUEUES];
struct hisi_sas_initial_fis *initial_fis;
dma_addr_t initial_fis_dma;
struct hisi_sas_itct *itct;
dma_addr_t itct_dma;
struct hisi_sas_iost *iost;
dma_addr_t iost_dma;
struct hisi_sas_breakpoint *breakpoint;
dma_addr_t breakpoint_dma;
struct hisi_sas_breakpoint *sata_breakpoint;
dma_addr_t sata_breakpoint_dma;
struct hisi_sas_slot *slot_info;
const struct hisi_sas_hw *hw; /* Low level hw interface */
};
/* Generic HW DMA host memory structures */
/* Delivery queue header */
struct hisi_sas_cmd_hdr {
/* dw0 */
__le32 dw0;
/* dw1 */
__le32 dw1;
/* dw2 */
__le32 dw2;
/* dw3 */
__le32 transfer_tags;
/* dw4 */
__le32 data_transfer_len;
/* dw5 */
__le32 first_burst_num;
/* dw6 */
__le32 sg_len;
/* dw7 */
__le32 dw7;
/* dw8-9 */
__le64 cmd_table_addr;
/* dw10-11 */
__le64 sts_buffer_addr;
/* dw12-13 */
__le64 prd_table_addr;
/* dw14-15 */
__le64 dif_prd_table_addr;
};
struct hisi_sas_itct {
__le64 qw0;
__le64 sas_addr;
__le64 qw2;
__le64 qw3;
__le64 qw4;
__le64 qw_sata_ncq0_3;
__le64 qw_sata_ncq7_4;
__le64 qw_sata_ncq11_8;
__le64 qw_sata_ncq15_12;
__le64 qw_sata_ncq19_16;
__le64 qw_sata_ncq23_20;
__le64 qw_sata_ncq27_24;
__le64 qw_sata_ncq31_28;
__le64 qw_non_ncq_iptt;
__le64 qw_rsvd0;
__le64 qw_rsvd1;
};
struct hisi_sas_iost {
__le64 qw0;
__le64 qw1;
__le64 qw2;
__le64 qw3;
};
struct hisi_sas_err_record {
/* dw0 */
__le32 dma_err_type;
/* dw1 */
__le32 trans_tx_fail_type;
/* dw2 */
__le32 trans_rx_fail_type;
/* dw3 */
u32 rsvd;
};
struct hisi_sas_initial_fis {
struct hisi_sas_err_record err_record;
struct dev_to_host_fis fis;
u32 rsvd[3];
};
struct hisi_sas_breakpoint {
u8 data[128]; /*io128 byte*/
};
struct hisi_sas_sge {
__le64 addr;
__le32 page_ctrl_0;
__le32 page_ctrl_1;
__le32 data_len;
__le32 data_off;
};
struct hisi_sas_command_table_smp {
u8 bytes[44];
};
struct hisi_sas_command_table_stp {
struct host_to_dev_fis command_fis;
u8 dummy[12];
u8 atapi_cdb[ATAPI_CDB_LEN];
};
#define HISI_SAS_SGE_PAGE_CNT SCSI_MAX_SG_SEGMENTS
struct hisi_sas_sge_page {
struct hisi_sas_sge sge[HISI_SAS_SGE_PAGE_CNT];
};
struct hisi_sas_command_table_ssp {
struct ssp_frame_hdr hdr;
union {
struct {
struct ssp_command_iu task;
u32 prot[6];
};
struct ssp_tmf_iu ssp_task;
struct xfer_rdy_iu xfer_rdy;
struct ssp_response_iu ssp_res;
} u;
};
union hisi_sas_command_table {
struct hisi_sas_command_table_ssp ssp;
struct hisi_sas_command_table_smp smp;
struct hisi_sas_command_table_stp stp;
};
extern int hisi_sas_probe(struct platform_device *pdev,
const struct hisi_sas_hw *ops);
extern int hisi_sas_remove(struct platform_device *pdev);
extern void hisi_sas_phy_down(struct hisi_hba *hisi_hba, int phy_no, int rdy);
extern void hisi_sas_slot_task_free(struct hisi_hba *hisi_hba,
struct sas_task *task,
struct hisi_sas_slot *slot);
#endif

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -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,10 +791,8 @@ 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)) {
output_len += snprintf(buf + output_len,
if (hdev->devtype == TYPE_RAID || is_logical_device(hdev)) {
output_len += scnprintf(buf + output_len,
PAGE_SIZE - output_len,
"%s\n", active);
continue;
@ -808,29 +805,28 @@ 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 += 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);
}
@ -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 =

View File

@ -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

View File

@ -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 */

View File

@ -110,11 +110,6 @@
#define i91u_MAXQUEUE 2
#define i91u_REVID "Initio INI-9X00U/UW SCSI device driver; Revision: 1.04a"
#define I950_DEVICE_ID 0x9500 /* Initio's inic-950 product ID */
#define I940_DEVICE_ID 0x9400 /* Initio's inic-940 product ID */
#define I935_DEVICE_ID 0x9401 /* Initio's inic-935 product ID */
#define I920_DEVICE_ID 0x0002 /* Initio's other product ID */
#ifdef DEBUG_i91u
static unsigned int i91u_debug = DEBUG_DEFAULT;
#endif
@ -127,17 +122,6 @@ static int setup_debug = 0;
static void i91uSCBPost(u8 * pHcb, u8 * pScb);
/* PCI Devices supported by this driver */
static struct pci_device_id i91u_pci_devices[] = {
{ PCI_VENDOR_ID_INIT, I950_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
{ PCI_VENDOR_ID_INIT, I940_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
{ PCI_VENDOR_ID_INIT, I935_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
{ PCI_VENDOR_ID_INIT, I920_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
{ PCI_VENDOR_ID_DOMEX, I920_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
{ }
};
MODULE_DEVICE_TABLE(pci, i91u_pci_devices);
#define DEBUG_INTERRUPT 0
#define DEBUG_QUEUE 0
#define DEBUG_STATE 0

View File

@ -386,7 +386,6 @@ struct lpfc_vport {
uint32_t work_port_events; /* Timeout to be handled */
#define WORKER_DISC_TMO 0x1 /* vport: Discovery timeout */
#define WORKER_ELS_TMO 0x2 /* vport: ELS timeout */
#define WORKER_FDMI_TMO 0x4 /* vport: FDMI timeout */
#define WORKER_DELAYED_DISC_TMO 0x8 /* vport: delayed discovery */
#define WORKER_MBOX_TMO 0x100 /* hba: MBOX timeout */
@ -396,7 +395,6 @@ struct lpfc_vport {
#define WORKER_RAMP_UP_QUEUE 0x1000 /* hba: Increase Q depth */
#define WORKER_SERVICE_TXQ 0x2000 /* hba: IOCBs on the txq */
struct timer_list fc_fdmitmo;
struct timer_list els_tmofunc;
struct timer_list delayed_disc_tmo;
@ -405,6 +403,7 @@ struct lpfc_vport {
uint8_t load_flag;
#define FC_LOADING 0x1 /* HBA in process of loading drvr */
#define FC_UNLOADING 0x2 /* HBA in process of unloading drvr */
#define FC_ALLOW_FDMI 0x4 /* port is ready for FDMI requests */
/* Vport Config Parameters */
uint32_t cfg_scan_down;
uint32_t cfg_lun_queue_depth;
@ -414,10 +413,6 @@ struct lpfc_vport {
uint32_t cfg_peer_port_login;
uint32_t cfg_fcp_class;
uint32_t cfg_use_adisc;
uint32_t cfg_fdmi_on;
#define LPFC_FDMI_SUPPORT 1 /* bit 0 - FDMI supported? */
#define LPFC_FDMI_REG_DELAY 2 /* bit 1 - 60 sec registration delay */
#define LPFC_FDMI_ALL_ATTRIB 4 /* bit 2 - register ALL attributes? */
uint32_t cfg_discovery_threads;
uint32_t cfg_log_verbose;
uint32_t cfg_max_luns;
@ -443,6 +438,10 @@ struct lpfc_vport {
unsigned long rcv_buffer_time_stamp;
uint32_t vport_flag;
#define STATIC_VPORT 1
uint16_t fdmi_num_disc;
uint32_t fdmi_hba_mask;
uint32_t fdmi_port_mask;
};
struct hbq_s {
@ -755,6 +754,11 @@ struct lpfc_hba {
#define LPFC_DELAY_INIT_LINK 1 /* layered driver hold off */
#define LPFC_DELAY_INIT_LINK_INDEFINITELY 2 /* wait, manual intervention */
uint32_t cfg_enable_dss;
uint32_t cfg_fdmi_on;
#define LPFC_FDMI_NO_SUPPORT 0 /* FDMI not supported */
#define LPFC_FDMI_SUPPORT 1 /* FDMI supported? */
#define LPFC_FDMI_SMART_SAN 2 /* SmartSAN supported */
uint32_t cfg_enable_SmartSAN;
lpfc_vpd_t vpd; /* vital product data */
struct pci_dev *pcidev;

View File

@ -4572,19 +4572,27 @@ LPFC_ATTR_R(multi_ring_type, FC_TYPE_IP, 1,
255, "Identifies TYPE for additional ring configuration");
/*
# lpfc_fdmi_on: controls FDMI support.
# Set NOT Set
# bit 0 = FDMI support no FDMI support
# LPFC_FDMI_SUPPORT just turns basic support on/off
# bit 1 = Register delay no register delay (60 seconds)
# LPFC_FDMI_REG_DELAY 60 sec registration delay after FDMI login
# bit 2 = All attributes Use a attribute subset
# LPFC_FDMI_ALL_ATTRIB applies to both port and HBA attributes
# Port attrutes subset: 1 thru 6 OR all: 1 thru 0xd 0x101 0x102 0x103
# HBA attributes subset: 1 thru 0xb OR all: 1 thru 0xc
# Value range [0,7]. Default value is 0.
# lpfc_enable_SmartSAN: Sets up FDMI support for SmartSAN
# 0 = SmartSAN functionality disabled (default)
# 1 = SmartSAN functionality enabled
# This parameter will override the value of lpfc_fdmi_on module parameter.
# Value range is [0,1]. Default value is 0.
*/
LPFC_VPORT_ATTR_RW(fdmi_on, 0, 0, 7, "Enable FDMI support");
LPFC_ATTR_R(enable_SmartSAN, 0, 0, 1, "Enable SmartSAN functionality");
/*
# lpfc_fdmi_on: Controls FDMI support.
# 0 No FDMI support (default)
# 1 Traditional FDMI support
# 2 Smart SAN support
# If lpfc_enable_SmartSAN is set 1, the driver sets lpfc_fdmi_on to value 2
# overwriting the current value. If lpfc_enable_SmartSAN is set 0, the
# driver uses the current value of lpfc_fdmi_on provided it has value 0 or 1.
# A value of 2 with lpfc_enable_SmartSAN set to 0 causes the driver to
# set lpfc_fdmi_on back to 1.
# Value range [0,2]. Default value is 0.
*/
LPFC_ATTR_R(fdmi_on, 0, 0, 2, "Enable FDMI support");
/*
# Specifies the maximum number of ELS cmds we can have outstanding (for
@ -4815,6 +4823,7 @@ struct device_attribute *lpfc_hba_attrs[] = {
&dev_attr_lpfc_multi_ring_rctl,
&dev_attr_lpfc_multi_ring_type,
&dev_attr_lpfc_fdmi_on,
&dev_attr_lpfc_enable_SmartSAN,
&dev_attr_lpfc_max_luns,
&dev_attr_lpfc_enable_npiv,
&dev_attr_lpfc_fcf_failover_policy,
@ -4887,7 +4896,6 @@ struct device_attribute *lpfc_vport_attrs[] = {
&dev_attr_lpfc_fcp_class,
&dev_attr_lpfc_use_adisc,
&dev_attr_lpfc_first_burst_size,
&dev_attr_lpfc_fdmi_on,
&dev_attr_lpfc_max_luns,
&dev_attr_nport_evt_cnt,
&dev_attr_npiv_info,
@ -5247,7 +5255,7 @@ lpfc_get_host_speed(struct Scsi_Host *shost)
spin_lock_irq(shost->host_lock);
if (lpfc_is_link_up(phba)) {
if ((lpfc_is_link_up(phba)) && (!(phba->hba_flag & HBA_FCOE_MODE))) {
switch(phba->fc_linkspeed) {
case LPFC_LINK_SPEED_1GHZ:
fc_host_speed(shost) = FC_PORTSPEED_1GBIT;
@ -5826,6 +5834,8 @@ lpfc_get_cfgparam(struct lpfc_hba *phba)
lpfc_enable_npiv_init(phba, lpfc_enable_npiv);
lpfc_fcf_failover_policy_init(phba, lpfc_fcf_failover_policy);
lpfc_enable_rrq_init(phba, lpfc_enable_rrq);
lpfc_fdmi_on_init(phba, lpfc_fdmi_on);
lpfc_enable_SmartSAN_init(phba, lpfc_enable_SmartSAN);
lpfc_use_msi_init(phba, lpfc_use_msi);
lpfc_fcp_imax_init(phba, lpfc_fcp_imax);
lpfc_fcp_cpu_map_init(phba, lpfc_fcp_cpu_map);
@ -5846,6 +5856,15 @@ lpfc_get_cfgparam(struct lpfc_hba *phba)
phba->cfg_poll = 0;
else
phba->cfg_poll = lpfc_poll;
/* Ensure fdmi_on and enable_SmartSAN don't conflict */
if (phba->cfg_enable_SmartSAN) {
phba->cfg_fdmi_on = LPFC_FDMI_SMART_SAN;
} else {
if (phba->cfg_fdmi_on == LPFC_FDMI_SMART_SAN)
phba->cfg_fdmi_on = LPFC_FDMI_SUPPORT;
}
phba->cfg_soft_wwnn = 0L;
phba->cfg_soft_wwpn = 0L;
lpfc_sg_seg_cnt_init(phba, lpfc_sg_seg_cnt);
@ -5879,7 +5898,6 @@ lpfc_get_vport_cfgparam(struct lpfc_vport *vport)
lpfc_use_adisc_init(vport, lpfc_use_adisc);
lpfc_first_burst_size_init(vport, lpfc_first_burst_size);
lpfc_max_scsicmpl_time_init(vport, lpfc_max_scsicmpl_time);
lpfc_fdmi_on_init(vport, lpfc_fdmi_on);
lpfc_discovery_threads_init(vport, lpfc_discovery_threads);
lpfc_max_luns_init(vport, lpfc_max_luns);
lpfc_scan_down_init(vport, lpfc_scan_down);

View File

@ -72,6 +72,7 @@ void lpfc_cancel_all_vport_retry_delay_timer(struct lpfc_hba *);
void lpfc_retry_pport_discovery(struct lpfc_hba *);
void lpfc_release_rpi(struct lpfc_hba *, struct lpfc_vport *, uint16_t);
void lpfc_mbx_cmpl_local_config_link(struct lpfc_hba *, LPFC_MBOXQ_t *);
void lpfc_mbx_cmpl_reg_login(struct lpfc_hba *, LPFC_MBOXQ_t *);
void lpfc_mbx_cmpl_dflt_rpi(struct lpfc_hba *, LPFC_MBOXQ_t *);
void lpfc_mbx_cmpl_fabric_reg_login(struct lpfc_hba *, LPFC_MBOXQ_t *);
@ -167,9 +168,8 @@ void lpfc_ct_unsol_event(struct lpfc_hba *, struct lpfc_sli_ring *,
struct lpfc_iocbq *);
int lpfc_ct_handle_unsol_abort(struct lpfc_hba *, struct hbq_dmabuf *);
int lpfc_ns_cmd(struct lpfc_vport *, int, uint8_t, uint32_t);
int lpfc_fdmi_cmd(struct lpfc_vport *, struct lpfc_nodelist *, int);
void lpfc_fdmi_tmo(unsigned long);
void lpfc_fdmi_timeout_handler(struct lpfc_vport *);
int lpfc_fdmi_cmd(struct lpfc_vport *, struct lpfc_nodelist *, int, uint32_t);
void lpfc_fdmi_num_disc_check(struct lpfc_vport *);
void lpfc_delayed_disc_tmo(unsigned long);
void lpfc_delayed_disc_timeout_handler(struct lpfc_vport *);

File diff suppressed because it is too large Load Diff

View File

@ -455,9 +455,9 @@ int
lpfc_issue_reg_vfi(struct lpfc_vport *vport)
{
struct lpfc_hba *phba = vport->phba;
LPFC_MBOXQ_t *mboxq;
LPFC_MBOXQ_t *mboxq = NULL;
struct lpfc_nodelist *ndlp;
struct lpfc_dmabuf *dmabuf;
struct lpfc_dmabuf *dmabuf = NULL;
int rc = 0;
/* move forward in case of SLI4 FC port loopback test and pt2pt mode */
@ -471,25 +471,33 @@ lpfc_issue_reg_vfi(struct lpfc_vport *vport)
}
}
dmabuf = kzalloc(sizeof(struct lpfc_dmabuf), GFP_KERNEL);
if (!dmabuf) {
rc = -ENOMEM;
goto fail;
}
dmabuf->virt = lpfc_mbuf_alloc(phba, MEM_PRI, &dmabuf->phys);
if (!dmabuf->virt) {
rc = -ENOMEM;
goto fail_free_dmabuf;
}
mboxq = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
if (!mboxq) {
rc = -ENOMEM;
goto fail_free_coherent;
goto fail;
}
/* Supply CSP's only if we are fabric connect or pt-to-pt connect */
if ((vport->fc_flag & FC_FABRIC) || (vport->fc_flag & FC_PT2PT)) {
dmabuf = kzalloc(sizeof(struct lpfc_dmabuf), GFP_KERNEL);
if (!dmabuf) {
rc = -ENOMEM;
goto fail;
}
dmabuf->virt = lpfc_mbuf_alloc(phba, MEM_PRI, &dmabuf->phys);
if (!dmabuf->virt) {
rc = -ENOMEM;
goto fail;
}
memcpy(dmabuf->virt, &phba->fc_fabparam,
sizeof(struct serv_parm));
}
vport->port_state = LPFC_FABRIC_CFG_LINK;
memcpy(dmabuf->virt, &phba->fc_fabparam, sizeof(vport->fc_sparam));
lpfc_reg_vfi(mboxq, vport, dmabuf->phys);
if (dmabuf)
lpfc_reg_vfi(mboxq, vport, dmabuf->phys);
else
lpfc_reg_vfi(mboxq, vport, 0);
mboxq->mbox_cmpl = lpfc_mbx_cmpl_reg_vfi;
mboxq->vport = vport;
@ -497,17 +505,19 @@ lpfc_issue_reg_vfi(struct lpfc_vport *vport)
rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_NOWAIT);
if (rc == MBX_NOT_FINISHED) {
rc = -ENXIO;
goto fail_free_mbox;
goto fail;
}
return 0;
fail_free_mbox:
mempool_free(mboxq, phba->mbox_mem_pool);
fail_free_coherent:
lpfc_mbuf_free(phba, dmabuf->virt, dmabuf->phys);
fail_free_dmabuf:
kfree(dmabuf);
fail:
if (mboxq)
mempool_free(mboxq, phba->mbox_mem_pool);
if (dmabuf) {
if (dmabuf->virt)
lpfc_mbuf_free(phba, dmabuf->virt, dmabuf->phys);
kfree(dmabuf);
}
lpfc_vport_set_state(vport, FC_VPORT_FAILED);
lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS,
"0289 Issue Register VFI failed: Err %d\n", rc);
@ -678,6 +688,21 @@ lpfc_cmpl_els_flogi_fabric(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
sp->cmn.bbRcvSizeLsb;
fabric_param_changed = lpfc_check_clean_addr_bit(vport, sp);
if (fabric_param_changed) {
/* Reset FDMI attribute masks based on config parameter */
if (phba->cfg_fdmi_on == LPFC_FDMI_NO_SUPPORT) {
vport->fdmi_hba_mask = 0;
vport->fdmi_port_mask = 0;
} else {
/* Setup appropriate attribute masks */
vport->fdmi_hba_mask = LPFC_FDMI2_HBA_ATTR;
if (phba->cfg_fdmi_on == LPFC_FDMI_SMART_SAN)
vport->fdmi_port_mask = LPFC_FDMI2_SMART_ATTR;
else
vport->fdmi_port_mask = LPFC_FDMI2_PORT_ATTR;
}
}
memcpy(&vport->fabric_portname, &sp->portName,
sizeof(struct lpfc_name));
memcpy(&vport->fabric_nodename, &sp->nodeName,
@ -711,9 +736,10 @@ lpfc_cmpl_els_flogi_fabric(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
* For FC we need to do some special processing because of the SLI
* Port's default settings of the Common Service Parameters.
*/
if (phba->sli4_hba.lnk_info.lnk_tp == LPFC_LNK_TYPE_FC) {
if ((phba->sli_rev == LPFC_SLI_REV4) &&
(phba->sli4_hba.lnk_info.lnk_tp == LPFC_LNK_TYPE_FC)) {
/* If physical FC port changed, unreg VFI and ALL VPIs / RPIs */
if ((phba->sli_rev == LPFC_SLI_REV4) && fabric_param_changed)
if (fabric_param_changed)
lpfc_unregister_fcf_prep(phba);
/* This should just update the VFI CSPs*/
@ -824,13 +850,21 @@ lpfc_cmpl_els_flogi_nport(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
spin_lock_irq(shost->host_lock);
vport->fc_flag &= ~(FC_FABRIC | FC_PUBLIC_LOOP);
vport->fc_flag |= FC_PT2PT;
spin_unlock_irq(shost->host_lock);
phba->fc_edtov = FF_DEF_EDTOV;
phba->fc_ratov = FF_DEF_RATOV;
/* If physical FC port changed, unreg VFI and ALL VPIs / RPIs */
if ((phba->sli_rev == LPFC_SLI_REV4) && phba->fc_topology_changed) {
lpfc_unregister_fcf_prep(phba);
spin_lock_irq(shost->host_lock);
vport->fc_flag &= ~FC_VFI_REGISTERED;
spin_unlock_irq(shost->host_lock);
phba->fc_topology_changed = 0;
}
rc = memcmp(&vport->fc_portname, &sp->portName,
sizeof(vport->fc_portname));
memcpy(&phba->fc_fabparam, sp, sizeof(struct serv_parm));
if (rc >= 0) {
/* This side will initiate the PLOGI */
@ -839,38 +873,14 @@ lpfc_cmpl_els_flogi_nport(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
spin_unlock_irq(shost->host_lock);
/*
* N_Port ID cannot be 0, set our to LocalID the other
* side will be RemoteID.
* N_Port ID cannot be 0, set our Id to LocalID
* the other side will be RemoteID.
*/
/* not equal */
if (rc)
vport->fc_myDID = PT2PT_LocalID;
mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
if (!mbox)
goto fail;
lpfc_config_link(phba, mbox);
mbox->mbox_cmpl = lpfc_sli_def_mbox_cmpl;
mbox->vport = vport;
rc = lpfc_sli_issue_mbox(phba, mbox, MBX_NOWAIT);
if (rc == MBX_NOT_FINISHED) {
mempool_free(mbox, phba->mbox_mem_pool);
goto fail;
}
/*
* For SLI4, the VFI/VPI are registered AFTER the
* Nport with the higher WWPN sends the PLOGI with
* an assigned NPortId.
*/
/* not equal */
if ((phba->sli_rev == LPFC_SLI_REV4) && rc)
lpfc_issue_reg_vfi(vport);
/* Decrement ndlp reference count indicating that ndlp can be
* safely released when other references to it are done.
*/
@ -912,29 +922,20 @@ lpfc_cmpl_els_flogi_nport(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
/* If we are pt2pt with another NPort, force NPIV off! */
phba->sli3_options &= ~LPFC_SLI3_NPIV_ENABLED;
spin_lock_irq(shost->host_lock);
vport->fc_flag |= FC_PT2PT;
spin_unlock_irq(shost->host_lock);
/* If physical FC port changed, unreg VFI and ALL VPIs / RPIs */
if ((phba->sli_rev == LPFC_SLI_REV4) && phba->fc_topology_changed) {
lpfc_unregister_fcf_prep(phba);
mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
if (!mbox)
goto fail;
/* The FC_VFI_REGISTERED flag will get clear in the cmpl
* handler for unreg_vfi, but if we don't force the
* FC_VFI_REGISTERED flag then the reg_vfi mailbox could be
* built with the update bit set instead of just the vp bit to
* change the Nport ID. We need to have the vp set and the
* Upd cleared on topology changes.
*/
spin_lock_irq(shost->host_lock);
vport->fc_flag &= ~FC_VFI_REGISTERED;
spin_unlock_irq(shost->host_lock);
phba->fc_topology_changed = 0;
lpfc_issue_reg_vfi(vport);
lpfc_config_link(phba, mbox);
mbox->mbox_cmpl = lpfc_mbx_cmpl_local_config_link;
mbox->vport = vport;
rc = lpfc_sli_issue_mbox(phba, mbox, MBX_NOWAIT);
if (rc == MBX_NOT_FINISHED) {
mempool_free(mbox, phba->mbox_mem_pool);
goto fail;
}
/* Start discovery - this should just do CLEAR_LA */
lpfc_disc_start(vport);
return 0;
fail:
return -ENXIO;
@ -1157,6 +1158,7 @@ flogifail:
spin_lock_irq(&phba->hbalock);
phba->fcf.fcf_flag &= ~FCF_DISCOVERY;
spin_unlock_irq(&phba->hbalock);
lpfc_nlp_put(ndlp);
if (!lpfc_error_lost_link(irsp)) {
@ -3792,14 +3794,17 @@ lpfc_cmpl_els_rsp(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
lpfc_nlp_set_state(vport, ndlp,
NLP_STE_REG_LOGIN_ISSUE);
}
ndlp->nlp_flag |= NLP_REG_LOGIN_SEND;
if (lpfc_sli_issue_mbox(phba, mbox, MBX_NOWAIT)
!= MBX_NOT_FINISHED)
goto out;
else
/* Decrement the ndlp reference count we
* set for this failed mailbox command.
*/
lpfc_nlp_put(ndlp);
/* Decrement the ndlp reference count we
* set for this failed mailbox command.
*/
lpfc_nlp_put(ndlp);
ndlp->nlp_flag &= ~NLP_REG_LOGIN_SEND;
/* ELS rsp: Cannot issue reg_login for <NPortid> */
lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS,
@ -3856,6 +3861,7 @@ out:
* the routine lpfc_els_free_iocb.
*/
cmdiocb->context1 = NULL;
}
lpfc_els_free_iocb(phba, cmdiocb);
@ -3898,6 +3904,7 @@ lpfc_els_rsp_acc(struct lpfc_vport *vport, uint32_t flag,
IOCB_t *oldcmd;
struct lpfc_iocbq *elsiocb;
uint8_t *pcmd;
struct serv_parm *sp;
uint16_t cmdsize;
int rc;
ELS_PKT *els_pkt_ptr;
@ -3927,6 +3934,7 @@ lpfc_els_rsp_acc(struct lpfc_vport *vport, uint32_t flag,
"Issue ACC: did:x%x flg:x%x",
ndlp->nlp_DID, ndlp->nlp_flag, 0);
break;
case ELS_CMD_FLOGI:
case ELS_CMD_PLOGI:
cmdsize = (sizeof(struct serv_parm) + sizeof(uint32_t));
elsiocb = lpfc_prep_els_iocb(vport, 0, cmdsize, oldiocb->retry,
@ -3944,10 +3952,34 @@ lpfc_els_rsp_acc(struct lpfc_vport *vport, uint32_t flag,
*((uint32_t *) (pcmd)) = ELS_CMD_ACC;
pcmd += sizeof(uint32_t);
memcpy(pcmd, &vport->fc_sparam, sizeof(struct serv_parm));
sp = (struct serv_parm *)pcmd;
if (flag == ELS_CMD_FLOGI) {
/* Copy the received service parameters back */
memcpy(sp, &phba->fc_fabparam,
sizeof(struct serv_parm));
/* Clear the F_Port bit */
sp->cmn.fPort = 0;
/* Mark all class service parameters as invalid */
sp->cls1.classValid = 0;
sp->cls2.classValid = 0;
sp->cls3.classValid = 0;
sp->cls4.classValid = 0;
/* Copy our worldwide names */
memcpy(&sp->portName, &vport->fc_sparam.portName,
sizeof(struct lpfc_name));
memcpy(&sp->nodeName, &vport->fc_sparam.nodeName,
sizeof(struct lpfc_name));
} else {
memcpy(pcmd, &vport->fc_sparam,
sizeof(struct serv_parm));
}
lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_RSP,
"Issue ACC PLOGI: did:x%x flg:x%x",
"Issue ACC FLOGI/PLOGI: did:x%x flg:x%x",
ndlp->nlp_DID, ndlp->nlp_flag, 0);
break;
case ELS_CMD_PRLO:
@ -4673,6 +4705,23 @@ lpfc_rdp_res_link_error(struct fc_rdp_link_error_status_desc *desc,
desc->length = cpu_to_be32(sizeof(desc->info));
}
int
lpfc_rdp_res_fec_desc(struct fc_fec_rdp_desc *desc, READ_LNK_VAR *stat)
{
if (bf_get(lpfc_read_link_stat_gec2, stat) == 0)
return 0;
desc->tag = cpu_to_be32(RDP_FEC_DESC_TAG);
desc->info.CorrectedBlocks =
cpu_to_be32(stat->fecCorrBlkCount);
desc->info.UncorrectableBlocks =
cpu_to_be32(stat->fecUncorrBlkCount);
desc->length = cpu_to_be32(sizeof(desc->info));
return sizeof(struct fc_fec_rdp_desc);
}
void
lpfc_rdp_res_speed(struct fc_rdp_port_speed_desc *desc, struct lpfc_hba *phba)
{
@ -4681,26 +4730,26 @@ lpfc_rdp_res_speed(struct fc_rdp_port_speed_desc *desc, struct lpfc_hba *phba)
desc->tag = cpu_to_be32(RDP_PORT_SPEED_DESC_TAG);
switch (phba->sli4_hba.link_state.speed) {
case LPFC_FC_LA_SPEED_1G:
switch (phba->fc_linkspeed) {
case LPFC_LINK_SPEED_1GHZ:
rdp_speed = RDP_PS_1GB;
break;
case LPFC_FC_LA_SPEED_2G:
case LPFC_LINK_SPEED_2GHZ:
rdp_speed = RDP_PS_2GB;
break;
case LPFC_FC_LA_SPEED_4G:
case LPFC_LINK_SPEED_4GHZ:
rdp_speed = RDP_PS_4GB;
break;
case LPFC_FC_LA_SPEED_8G:
case LPFC_LINK_SPEED_8GHZ:
rdp_speed = RDP_PS_8GB;
break;
case LPFC_FC_LA_SPEED_10G:
case LPFC_LINK_SPEED_10GHZ:
rdp_speed = RDP_PS_10GB;
break;
case LPFC_FC_LA_SPEED_16G:
case LPFC_LINK_SPEED_16GHZ:
rdp_speed = RDP_PS_16GB;
break;
case LPFC_FC_LA_SPEED_32G:
case LPFC_LINK_SPEED_32GHZ:
rdp_speed = RDP_PS_32GB;
break;
default:
@ -4778,15 +4827,18 @@ lpfc_els_rdp_cmpl(struct lpfc_hba *phba, struct lpfc_rdp_context *rdp_context,
struct lpfc_nodelist *ndlp = rdp_context->ndlp;
struct lpfc_vport *vport = ndlp->vport;
struct lpfc_iocbq *elsiocb;
struct ulp_bde64 *bpl;
IOCB_t *icmd;
uint8_t *pcmd;
struct ls_rjt *stat;
struct fc_rdp_res_frame *rdp_res;
uint32_t cmdsize;
int rc;
int rc, fec_size;
if (status != SUCCESS)
goto error;
/* This will change once we know the true size of the RDP payload */
cmdsize = sizeof(struct fc_rdp_res_frame);
elsiocb = lpfc_prep_els_iocb(vport, 0, cmdsize,
@ -4823,10 +4875,18 @@ lpfc_els_rdp_cmpl(struct lpfc_hba *phba, struct lpfc_rdp_context *rdp_context,
lpfc_rdp_res_diag_port_names(&rdp_res->diag_port_names_desc, phba);
lpfc_rdp_res_attach_port_names(&rdp_res->attached_port_names_desc,
vport, ndlp);
rdp_res->length = cpu_to_be32(RDP_DESC_PAYLOAD_SIZE);
fec_size = lpfc_rdp_res_fec_desc(&rdp_res->fec_desc,
&rdp_context->link_stat);
rdp_res->length = cpu_to_be32(fec_size + RDP_DESC_PAYLOAD_SIZE);
elsiocb->iocb_cmpl = lpfc_cmpl_els_rsp;
/* Now that we know the true size of the payload, update the BPL */
bpl = (struct ulp_bde64 *)
(((struct lpfc_dmabuf *)(elsiocb->context3))->virt);
bpl->tus.f.bdeSize = (fec_size + RDP_DESC_PAYLOAD_SIZE + 8);
bpl->tus.f.bdeFlags = 0;
bpl->tus.w = le32_to_cpu(bpl->tus.w);
phba->fc_stat.elsXmitACC++;
rc = lpfc_sli_issue_iocb(phba, LPFC_ELS_RING, elsiocb, 0);
if (rc == IOCB_ERROR)
@ -4956,13 +5016,12 @@ lpfc_els_rcv_rdp(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb,
if (RDP_NPORT_ID_SIZE !=
be32_to_cpu(rdp_req->nport_id_desc.length))
goto rjt_logerr;
rdp_context = kmalloc(sizeof(struct lpfc_rdp_context), GFP_KERNEL);
rdp_context = kzalloc(sizeof(struct lpfc_rdp_context), GFP_KERNEL);
if (!rdp_context) {
rjt_err = LSRJT_UNABLE_TPC;
goto error;
}
memset(rdp_context, 0, sizeof(struct lpfc_rdp_context));
cmd = &cmdiocb->iocb;
rdp_context->ndlp = lpfc_nlp_get(ndlp);
rdp_context->ox_id = cmd->unsli3.rcvsli3.ox_id;
@ -5739,7 +5798,6 @@ lpfc_els_rcv_flogi(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb,
IOCB_t *icmd = &cmdiocb->iocb;
struct serv_parm *sp;
LPFC_MBOXQ_t *mbox;
struct ls_rjt stat;
uint32_t cmd, did;
int rc;
uint32_t fc_flag = 0;
@ -5765,135 +5823,92 @@ lpfc_els_rcv_flogi(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb,
return 1;
}
if ((lpfc_check_sparm(vport, ndlp, sp, CLASS3, 1))) {
/* For a FLOGI we accept, then if our portname is greater
* then the remote portname we initiate Nport login.
*/
(void) lpfc_check_sparm(vport, ndlp, sp, CLASS3, 1);
rc = memcmp(&vport->fc_portname, &sp->portName,
sizeof(struct lpfc_name));
if (!rc) {
if (phba->sli_rev < LPFC_SLI_REV4) {
mbox = mempool_alloc(phba->mbox_mem_pool,
GFP_KERNEL);
if (!mbox)
return 1;
lpfc_linkdown(phba);
lpfc_init_link(phba, mbox,
phba->cfg_topology,
phba->cfg_link_speed);
mbox->u.mb.un.varInitLnk.lipsr_AL_PA = 0;
mbox->mbox_cmpl = lpfc_sli_def_mbox_cmpl;
mbox->vport = vport;
rc = lpfc_sli_issue_mbox(phba, mbox,
MBX_NOWAIT);
lpfc_set_loopback_flag(phba);
if (rc == MBX_NOT_FINISHED)
mempool_free(mbox, phba->mbox_mem_pool);
/*
* If our portname is greater than the remote portname,
* then we initiate Nport login.
*/
rc = memcmp(&vport->fc_portname, &sp->portName,
sizeof(struct lpfc_name));
if (!rc) {
if (phba->sli_rev < LPFC_SLI_REV4) {
mbox = mempool_alloc(phba->mbox_mem_pool,
GFP_KERNEL);
if (!mbox)
return 1;
} else {
/* abort the flogi coming back to ourselves
* due to external loopback on the port.
*/
lpfc_els_abort_flogi(phba);
return 0;
}
} else if (rc > 0) { /* greater than */
spin_lock_irq(shost->host_lock);
vport->fc_flag |= FC_PT2PT_PLOGI;
spin_unlock_irq(shost->host_lock);
lpfc_linkdown(phba);
lpfc_init_link(phba, mbox,
phba->cfg_topology,
phba->cfg_link_speed);
mbox->u.mb.un.varInitLnk.lipsr_AL_PA = 0;
mbox->mbox_cmpl = lpfc_sli_def_mbox_cmpl;
mbox->vport = vport;
rc = lpfc_sli_issue_mbox(phba, mbox,
MBX_NOWAIT);
lpfc_set_loopback_flag(phba);
if (rc == MBX_NOT_FINISHED)
mempool_free(mbox, phba->mbox_mem_pool);
return 1;
}
/* If we have the high WWPN we can assign our own
* myDID; otherwise, we have to WAIT for a PLOGI
* from the remote NPort to find out what it
* will be.
*/
vport->fc_myDID = PT2PT_LocalID;
} else
vport->fc_myDID = PT2PT_RemoteID;
/*
* The vport state should go to LPFC_FLOGI only
* AFTER we issue a FLOGI, not receive one.
/* abort the flogi coming back to ourselves
* due to external loopback on the port.
*/
lpfc_els_abort_flogi(phba);
return 0;
} else if (rc > 0) { /* greater than */
spin_lock_irq(shost->host_lock);
fc_flag = vport->fc_flag;
port_state = vport->port_state;
vport->fc_flag |= FC_PT2PT;
vport->fc_flag &= ~(FC_FABRIC | FC_PUBLIC_LOOP);
vport->fc_flag |= FC_PT2PT_PLOGI;
spin_unlock_irq(shost->host_lock);
lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS,
"3311 Rcv Flogi PS x%x new PS x%x "
"fc_flag x%x new fc_flag x%x\n",
port_state, vport->port_state,
fc_flag, vport->fc_flag);
/*
* We temporarily set fc_myDID to make it look like we are
* a Fabric. This is done just so we end up with the right
* did / sid on the FLOGI ACC rsp.
/* If we have the high WWPN we can assign our own
* myDID; otherwise, we have to WAIT for a PLOGI
* from the remote NPort to find out what it
* will be.
*/
did = vport->fc_myDID;
vport->fc_myDID = Fabric_DID;
vport->fc_myDID = PT2PT_LocalID;
} else {
/* Reject this request because invalid parameters */
stat.un.b.lsRjtRsvd0 = 0;
stat.un.b.lsRjtRsnCode = LSRJT_UNABLE_TPC;
stat.un.b.lsRjtRsnCodeExp = LSEXP_SPARM_OPTIONS;
stat.un.b.vendorUnique = 0;
/*
* We temporarily set fc_myDID to make it look like we are
* a Fabric. This is done just so we end up with the right
* did / sid on the FLOGI LS_RJT rsp.
*/
did = vport->fc_myDID;
vport->fc_myDID = Fabric_DID;
lpfc_els_rsp_reject(vport, stat.un.lsRjtError, cmdiocb, ndlp,
NULL);
/* Now lets put fc_myDID back to what its supposed to be */
vport->fc_myDID = did;
return 1;
vport->fc_myDID = PT2PT_RemoteID;
}
/* send our FLOGI first */
if (vport->port_state < LPFC_FLOGI) {
vport->fc_myDID = 0;
lpfc_initial_flogi(vport);
vport->fc_myDID = Fabric_DID;
}
/*
* The vport state should go to LPFC_FLOGI only
* AFTER we issue a FLOGI, not receive one.
*/
spin_lock_irq(shost->host_lock);
fc_flag = vport->fc_flag;
port_state = vport->port_state;
vport->fc_flag |= FC_PT2PT;
vport->fc_flag &= ~(FC_FABRIC | FC_PUBLIC_LOOP);
spin_unlock_irq(shost->host_lock);
lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS,
"3311 Rcv Flogi PS x%x new PS x%x "
"fc_flag x%x new fc_flag x%x\n",
port_state, vport->port_state,
fc_flag, vport->fc_flag);
/*
* We temporarily set fc_myDID to make it look like we are
* a Fabric. This is done just so we end up with the right
* did / sid on the FLOGI ACC rsp.
*/
did = vport->fc_myDID;
vport->fc_myDID = Fabric_DID;
memcpy(&phba->fc_fabparam, sp, sizeof(struct serv_parm));
/* Send back ACC */
lpfc_els_rsp_acc(vport, ELS_CMD_PLOGI, cmdiocb, ndlp, NULL);
lpfc_els_rsp_acc(vport, ELS_CMD_FLOGI, cmdiocb, ndlp, NULL);
/* Now lets put fc_myDID back to what its supposed to be */
vport->fc_myDID = did;
if (!(vport->fc_flag & FC_PT2PT_PLOGI)) {
mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
if (!mbox)
goto fail;
lpfc_config_link(phba, mbox);
mbox->mbox_cmpl = lpfc_sli_def_mbox_cmpl;
mbox->vport = vport;
rc = lpfc_sli_issue_mbox(phba, mbox, MBX_NOWAIT);
if (rc == MBX_NOT_FINISHED) {
mempool_free(mbox, phba->mbox_mem_pool);
goto fail;
}
}
return 0;
fail:
return 1;
}
/**
@ -7345,7 +7360,7 @@ lpfc_els_unsol_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
/* reject till our FLOGI completes */
if ((vport->port_state < LPFC_FABRIC_CFG_LINK) &&
(cmd != ELS_CMD_FLOGI)) {
(cmd != ELS_CMD_FLOGI)) {
rjt_err = LSRJT_UNABLE_TPC;
rjt_exp = LSEXP_NOTHING_MORE;
goto lsrjt;
@ -7381,6 +7396,7 @@ lpfc_els_unsol_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
rjt_exp = LSEXP_NOTHING_MORE;
break;
}
if (vport->port_state < LPFC_DISC_AUTH) {
if (!(phba->pport->fc_flag & FC_PT2PT) ||
(phba->pport->fc_flag & FC_PT2PT_PLOGI)) {
@ -7730,6 +7746,35 @@ lpfc_els_unsol_event(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
}
}
void
lpfc_start_fdmi(struct lpfc_vport *vport)
{
struct lpfc_hba *phba = vport->phba;
struct lpfc_nodelist *ndlp;
/* If this is the first time, allocate an ndlp and initialize
* it. Otherwise, make sure the node is enabled and then do the
* login.
*/
ndlp = lpfc_findnode_did(vport, FDMI_DID);
if (!ndlp) {
ndlp = mempool_alloc(phba->nlp_mem_pool, GFP_KERNEL);
if (ndlp) {
lpfc_nlp_init(vport, ndlp, FDMI_DID);
ndlp->nlp_type |= NLP_FABRIC;
} else {
return;
}
}
if (!NLP_CHK_NODE_ACT(ndlp))
ndlp = lpfc_enable_node(vport, ndlp, NLP_STE_NPR_NODE);
if (ndlp) {
lpfc_nlp_set_state(vport, ndlp, NLP_STE_PLOGI_ISSUE);
lpfc_issue_els_plogi(vport, ndlp->nlp_DID, 0);
}
}
/**
* lpfc_do_scr_ns_plogi - Issue a plogi to the name server for scr
* @phba: pointer to lpfc hba data structure.
@ -7746,7 +7791,7 @@ lpfc_els_unsol_event(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
void
lpfc_do_scr_ns_plogi(struct lpfc_hba *phba, struct lpfc_vport *vport)
{
struct lpfc_nodelist *ndlp, *ndlp_fdmi;
struct lpfc_nodelist *ndlp;
struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
/*
@ -7804,32 +7849,9 @@ lpfc_do_scr_ns_plogi(struct lpfc_hba *phba, struct lpfc_vport *vport)
return;
}
if (vport->cfg_fdmi_on & LPFC_FDMI_SUPPORT) {
/* If this is the first time, allocate an ndlp and initialize
* it. Otherwise, make sure the node is enabled and then do the
* login.
*/
ndlp_fdmi = lpfc_findnode_did(vport, FDMI_DID);
if (!ndlp_fdmi) {
ndlp_fdmi = mempool_alloc(phba->nlp_mem_pool,
GFP_KERNEL);
if (ndlp_fdmi) {
lpfc_nlp_init(vport, ndlp_fdmi, FDMI_DID);
ndlp_fdmi->nlp_type |= NLP_FABRIC;
} else
return;
}
if (!NLP_CHK_NODE_ACT(ndlp_fdmi))
ndlp_fdmi = lpfc_enable_node(vport,
ndlp_fdmi,
NLP_STE_NPR_NODE);
if (ndlp_fdmi) {
lpfc_nlp_set_state(vport, ndlp_fdmi,
NLP_STE_PLOGI_ISSUE);
lpfc_issue_els_plogi(vport, ndlp_fdmi->nlp_DID, 0);
}
}
if ((phba->cfg_fdmi_on > LPFC_FDMI_NO_SUPPORT) &&
(vport->load_flag & FC_ALLOW_FDMI))
lpfc_start_fdmi(vport);
}
/**

View File

@ -674,8 +674,6 @@ lpfc_work_done(struct lpfc_hba *phba)
lpfc_mbox_timeout_handler(phba);
if (work_port_events & WORKER_FABRIC_BLOCK_TMO)
lpfc_unblock_fabric_iocbs(phba);
if (work_port_events & WORKER_FDMI_TMO)
lpfc_fdmi_timeout_handler(vport);
if (work_port_events & WORKER_RAMP_DOWN_QUEUE)
lpfc_ramp_down_queue_handler(phba);
if (work_port_events & WORKER_DELAYED_DISC_TMO)
@ -1083,7 +1081,7 @@ out:
}
static void
void
lpfc_mbx_cmpl_local_config_link(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
{
struct lpfc_vport *vport = pmb->vport;
@ -1113,8 +1111,10 @@ lpfc_mbx_cmpl_local_config_link(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
/* Start discovery by sending a FLOGI. port_state is identically
* LPFC_FLOGI while waiting for FLOGI cmpl
*/
if (vport->port_state != LPFC_FLOGI || vport->fc_flag & FC_PT2PT_PLOGI)
if (vport->port_state != LPFC_FLOGI)
lpfc_initial_flogi(vport);
else if (vport->fc_flag & FC_PT2PT)
lpfc_disc_start(vport);
return;
out:
@ -2963,8 +2963,10 @@ lpfc_mbx_cmpl_reg_vfi(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq)
out_free_mem:
mempool_free(mboxq, phba->mbox_mem_pool);
lpfc_mbuf_free(phba, dmabuf->virt, dmabuf->phys);
kfree(dmabuf);
if (dmabuf) {
lpfc_mbuf_free(phba, dmabuf->virt, dmabuf->phys);
kfree(dmabuf);
}
return;
}
@ -3035,19 +3037,22 @@ lpfc_mbx_process_link_up(struct lpfc_hba *phba, struct lpfc_mbx_read_top *la)
uint32_t fc_flags = 0;
spin_lock_irq(&phba->hbalock);
switch (bf_get(lpfc_mbx_read_top_link_spd, la)) {
case LPFC_LINK_SPEED_1GHZ:
case LPFC_LINK_SPEED_2GHZ:
case LPFC_LINK_SPEED_4GHZ:
case LPFC_LINK_SPEED_8GHZ:
case LPFC_LINK_SPEED_10GHZ:
case LPFC_LINK_SPEED_16GHZ:
case LPFC_LINK_SPEED_32GHZ:
phba->fc_linkspeed = bf_get(lpfc_mbx_read_top_link_spd, la);
break;
default:
phba->fc_linkspeed = LPFC_LINK_SPEED_UNKNOWN;
break;
phba->fc_linkspeed = bf_get(lpfc_mbx_read_top_link_spd, la);
if (!(phba->hba_flag & HBA_FCOE_MODE)) {
switch (bf_get(lpfc_mbx_read_top_link_spd, la)) {
case LPFC_LINK_SPEED_1GHZ:
case LPFC_LINK_SPEED_2GHZ:
case LPFC_LINK_SPEED_4GHZ:
case LPFC_LINK_SPEED_8GHZ:
case LPFC_LINK_SPEED_10GHZ:
case LPFC_LINK_SPEED_16GHZ:
case LPFC_LINK_SPEED_32GHZ:
break;
default:
phba->fc_linkspeed = LPFC_LINK_SPEED_UNKNOWN;
break;
}
}
if (phba->fc_topology &&
@ -3448,10 +3453,10 @@ lpfc_mbx_cmpl_reg_login(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
spin_lock_irq(shost->host_lock);
ndlp->nlp_flag &= ~NLP_IGNR_REG_CMPL;
spin_unlock_irq(shost->host_lock);
} else
/* Good status, call state machine */
lpfc_disc_state_machine(vport, ndlp, pmb,
NLP_EVT_CMPL_REG_LOGIN);
}
/* Call state machine */
lpfc_disc_state_machine(vport, ndlp, pmb, NLP_EVT_CMPL_REG_LOGIN);
lpfc_mbuf_free(phba, mp->virt, mp->phys);
kfree(mp);
@ -5550,15 +5555,15 @@ lpfc_mbx_cmpl_fdmi_reg_login(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
ndlp->nlp_usg_map, ndlp);
/*
* Start issuing Fabric-Device Management Interface (FDMI) command to
* 0xfffffa (FDMI well known port) or Delay issuing FDMI command if
* fdmi-on=2 (supporting RPA/hostnmae)
* 0xfffffa (FDMI well known port).
* DHBA -> DPRT -> RHBA -> RPA (physical port)
* DPRT -> RPRT (vports)
*/
if (vport->cfg_fdmi_on & LPFC_FDMI_REG_DELAY)
mod_timer(&vport->fc_fdmitmo,
jiffies + msecs_to_jiffies(1000 * 60));
if (vport->port_type == LPFC_PHYSICAL_PORT)
lpfc_fdmi_cmd(vport, ndlp, SLI_MGMT_DHBA, 0);
else
lpfc_fdmi_cmd(vport, ndlp, SLI_MGMT_DHBA);
lpfc_fdmi_cmd(vport, ndlp, SLI_MGMT_DPRT, 0);
/* decrement the node reference count held for this callback
* function.

View File

@ -1097,6 +1097,18 @@ struct fc_rdp_port_name_desc {
};
struct fc_rdp_fec_info {
uint32_t CorrectedBlocks;
uint32_t UncorrectableBlocks;
};
#define RDP_FEC_DESC_TAG 0x00010005
struct fc_fec_rdp_desc {
uint32_t tag;
uint32_t length;
struct fc_rdp_fec_info info;
};
struct fc_rdp_link_error_status_payload_info {
struct fc_link_status link_status; /* 24 bytes */
uint32_t port_type; /* bits 31-30 only */
@ -1196,14 +1208,15 @@ struct fc_rdp_res_frame {
struct fc_rdp_link_error_status_desc link_error_desc; /* Word 13-21 */
struct fc_rdp_port_name_desc diag_port_names_desc; /* Word 22-27 */
struct fc_rdp_port_name_desc attached_port_names_desc;/* Word 28-33 */
struct fc_fec_rdp_desc fec_desc; /* FC Word 34 - 37 */
};
#define RDP_DESC_PAYLOAD_SIZE (sizeof(struct fc_rdp_link_service_desc) \
+ sizeof(struct fc_rdp_sfp_desc) \
+ sizeof(struct fc_rdp_port_speed_desc) \
+ sizeof(struct fc_rdp_link_error_status_desc) \
+ (sizeof(struct fc_rdp_port_name_desc) * 2))
+ sizeof(struct fc_rdp_sfp_desc) \
+ sizeof(struct fc_rdp_port_speed_desc) \
+ sizeof(struct fc_rdp_link_error_status_desc) \
+ (sizeof(struct fc_rdp_port_name_desc) * 2))
/******** FDMI ********/
@ -1233,31 +1246,10 @@ struct lpfc_fdmi_attr_def { /* Defined in TLV format */
/* Attribute Entry */
struct lpfc_fdmi_attr_entry {
union {
uint32_t VendorSpecific;
uint32_t SupportClass;
uint32_t SupportSpeed;
uint32_t PortSpeed;
uint32_t MaxFrameSize;
uint32_t MaxCTPayloadLen;
uint32_t PortState;
uint32_t PortId;
struct lpfc_name NodeName;
struct lpfc_name PortName;
struct lpfc_name FabricName;
uint8_t FC4Types[32];
uint8_t Manufacturer[64];
uint8_t SerialNumber[64];
uint8_t Model[256];
uint8_t ModelDescription[256];
uint8_t HardwareVersion[256];
uint8_t DriverVersion[256];
uint8_t OptionROMVersion[256];
uint8_t FirmwareVersion[256];
uint8_t OsHostName[256];
uint8_t NodeSymName[256];
uint8_t OsDeviceName[256];
uint8_t OsNameVersion[256];
uint8_t HostName[256];
uint32_t AttrInt;
uint8_t AttrTypes[32];
uint8_t AttrString[256];
struct lpfc_name AttrWWN;
} un;
};
@ -1327,6 +1319,8 @@ struct lpfc_fdmi_reg_portattr {
#define SLI_MGMT_DPRT 0x310 /* De-register Port */
#define SLI_MGMT_DPA 0x311 /* De-register Port attributes */
#define LPFC_FDMI_MAX_RETRY 3 /* Max retries for a FDMI command */
/*
* HBA Attribute Types
*/
@ -1342,6 +1336,39 @@ struct lpfc_fdmi_reg_portattr {
#define RHBA_OS_NAME_VERSION 0xa /* 4 to 256 byte ASCII string */
#define RHBA_MAX_CT_PAYLOAD_LEN 0xb /* 32-bit unsigned int */
#define RHBA_SYM_NODENAME 0xc /* 4 to 256 byte ASCII string */
#define RHBA_VENDOR_INFO 0xd /* 32-bit unsigned int */
#define RHBA_NUM_PORTS 0xe /* 32-bit unsigned int */
#define RHBA_FABRIC_WWNN 0xf /* 8 byte WWNN */
#define RHBA_BIOS_VERSION 0x10 /* 4 to 256 byte ASCII string */
#define RHBA_BIOS_STATE 0x11 /* 32-bit unsigned int */
#define RHBA_VENDOR_ID 0xe0 /* 8 byte ASCII string */
/* Bit mask for all individual HBA attributes */
#define LPFC_FDMI_HBA_ATTR_wwnn 0x00000001
#define LPFC_FDMI_HBA_ATTR_manufacturer 0x00000002
#define LPFC_FDMI_HBA_ATTR_sn 0x00000004
#define LPFC_FDMI_HBA_ATTR_model 0x00000008
#define LPFC_FDMI_HBA_ATTR_description 0x00000010
#define LPFC_FDMI_HBA_ATTR_hdw_ver 0x00000020
#define LPFC_FDMI_HBA_ATTR_drvr_ver 0x00000040
#define LPFC_FDMI_HBA_ATTR_rom_ver 0x00000080
#define LPFC_FDMI_HBA_ATTR_fmw_ver 0x00000100
#define LPFC_FDMI_HBA_ATTR_os_ver 0x00000200
#define LPFC_FDMI_HBA_ATTR_ct_len 0x00000400
#define LPFC_FDMI_HBA_ATTR_symbolic_name 0x00000800
#define LPFC_FDMI_HBA_ATTR_vendor_info 0x00001000 /* Not used */
#define LPFC_FDMI_HBA_ATTR_num_ports 0x00002000
#define LPFC_FDMI_HBA_ATTR_fabric_wwnn 0x00004000
#define LPFC_FDMI_HBA_ATTR_bios_ver 0x00008000
#define LPFC_FDMI_HBA_ATTR_bios_state 0x00010000 /* Not used */
#define LPFC_FDMI_HBA_ATTR_vendor_id 0x00020000
/* Bit mask for FDMI-1 defined HBA attributes */
#define LPFC_FDMI1_HBA_ATTR 0x000007ff
/* Bit mask for FDMI-2 defined HBA attributes */
/* Skip vendor_info and bios_state */
#define LPFC_FDMI2_HBA_ATTR 0x0002efff
/*
* Port Attrubute Types
@ -1353,15 +1380,65 @@ struct lpfc_fdmi_reg_portattr {
#define RPRT_OS_DEVICE_NAME 0x5 /* 4 to 256 byte ASCII string */
#define RPRT_HOST_NAME 0x6 /* 4 to 256 byte ASCII string */
#define RPRT_NODENAME 0x7 /* 8 byte WWNN */
#define RPRT_PORTNAME 0x8 /* 8 byte WWNN */
#define RPRT_PORTNAME 0x8 /* 8 byte WWPN */
#define RPRT_SYM_PORTNAME 0x9 /* 4 to 256 byte ASCII string */
#define RPRT_PORT_TYPE 0xa /* 32-bit unsigned int */
#define RPRT_SUPPORTED_CLASS 0xb /* 32-bit unsigned int */
#define RPRT_FABRICNAME 0xc /* 8 byte Fabric WWNN */
#define RPRT_FABRICNAME 0xc /* 8 byte Fabric WWPN */
#define RPRT_ACTIVE_FC4_TYPES 0xd /* 32 byte binary array */
#define RPRT_PORT_STATE 0x101 /* 32-bit unsigned int */
#define RPRT_DISC_PORT 0x102 /* 32-bit unsigned int */
#define RPRT_PORT_ID 0x103 /* 32-bit unsigned int */
#define RPRT_SMART_SERVICE 0xf100 /* 4 to 256 byte ASCII string */
#define RPRT_SMART_GUID 0xf101 /* 8 byte WWNN + 8 byte WWPN */
#define RPRT_SMART_VERSION 0xf102 /* 4 to 256 byte ASCII string */
#define RPRT_SMART_MODEL 0xf103 /* 4 to 256 byte ASCII string */
#define RPRT_SMART_PORT_INFO 0xf104 /* 32-bit unsigned int */
#define RPRT_SMART_QOS 0xf105 /* 32-bit unsigned int */
#define RPRT_SMART_SECURITY 0xf106 /* 32-bit unsigned int */
/* Bit mask for all individual PORT attributes */
#define LPFC_FDMI_PORT_ATTR_fc4type 0x00000001
#define LPFC_FDMI_PORT_ATTR_support_speed 0x00000002
#define LPFC_FDMI_PORT_ATTR_speed 0x00000004
#define LPFC_FDMI_PORT_ATTR_max_frame 0x00000008
#define LPFC_FDMI_PORT_ATTR_os_devname 0x00000010
#define LPFC_FDMI_PORT_ATTR_host_name 0x00000020
#define LPFC_FDMI_PORT_ATTR_wwnn 0x00000040
#define LPFC_FDMI_PORT_ATTR_wwpn 0x00000080
#define LPFC_FDMI_PORT_ATTR_symbolic_name 0x00000100
#define LPFC_FDMI_PORT_ATTR_port_type 0x00000200
#define LPFC_FDMI_PORT_ATTR_class 0x00000400
#define LPFC_FDMI_PORT_ATTR_fabric_wwpn 0x00000800
#define LPFC_FDMI_PORT_ATTR_port_state 0x00001000
#define LPFC_FDMI_PORT_ATTR_active_fc4type 0x00002000
#define LPFC_FDMI_PORT_ATTR_num_disc 0x00004000
#define LPFC_FDMI_PORT_ATTR_nportid 0x00008000
#define LPFC_FDMI_SMART_ATTR_service 0x00010000 /* Vendor specific */
#define LPFC_FDMI_SMART_ATTR_guid 0x00020000 /* Vendor specific */
#define LPFC_FDMI_SMART_ATTR_version 0x00040000 /* Vendor specific */
#define LPFC_FDMI_SMART_ATTR_model 0x00080000 /* Vendor specific */
#define LPFC_FDMI_SMART_ATTR_port_info 0x00100000 /* Vendor specific */
#define LPFC_FDMI_SMART_ATTR_qos 0x00200000 /* Vendor specific */
#define LPFC_FDMI_SMART_ATTR_security 0x00400000 /* Vendor specific */
/* Bit mask for FDMI-1 defined PORT attributes */
#define LPFC_FDMI1_PORT_ATTR 0x0000003f
/* Bit mask for FDMI-2 defined PORT attributes */
#define LPFC_FDMI2_PORT_ATTR 0x0000ffff
/* Bit mask for Smart SAN defined PORT attributes */
#define LPFC_FDMI2_SMART_ATTR 0x007fffff
/* Defines for PORT port state attribute */
#define LPFC_FDMI_PORTSTATE_UNKNOWN 1
#define LPFC_FDMI_PORTSTATE_ONLINE 2
/* Defines for PORT port type attribute */
#define LPFC_FDMI_PORTTYPE_UNKNOWN 0
#define LPFC_FDMI_PORTTYPE_NPORT 1
#define LPFC_FDMI_PORTTYPE_NLPORT 2
/*
* Begin HBA configuration parameters.
@ -2498,10 +2575,38 @@ typedef struct {
/* Structure for MB Command READ_LINK_STAT (18) */
typedef struct {
uint32_t rsvd1;
uint32_t word0;
#define lpfc_read_link_stat_rec_SHIFT 0
#define lpfc_read_link_stat_rec_MASK 0x1
#define lpfc_read_link_stat_rec_WORD word0
#define lpfc_read_link_stat_gec_SHIFT 1
#define lpfc_read_link_stat_gec_MASK 0x1
#define lpfc_read_link_stat_gec_WORD word0
#define lpfc_read_link_stat_w02oftow23of_SHIFT 2
#define lpfc_read_link_stat_w02oftow23of_MASK 0x3FFFFF
#define lpfc_read_link_stat_w02oftow23of_WORD word0
#define lpfc_read_link_stat_rsvd_SHIFT 24
#define lpfc_read_link_stat_rsvd_MASK 0x1F
#define lpfc_read_link_stat_rsvd_WORD word0
#define lpfc_read_link_stat_gec2_SHIFT 29
#define lpfc_read_link_stat_gec2_MASK 0x1
#define lpfc_read_link_stat_gec2_WORD word0
#define lpfc_read_link_stat_clrc_SHIFT 30
#define lpfc_read_link_stat_clrc_MASK 0x1
#define lpfc_read_link_stat_clrc_WORD word0
#define lpfc_read_link_stat_clof_SHIFT 31
#define lpfc_read_link_stat_clof_MASK 0x1
#define lpfc_read_link_stat_clof_WORD word0
uint32_t linkFailureCnt;
uint32_t lossSyncCnt;
uint32_t lossSignalCnt;
uint32_t primSeqErrCnt;
uint32_t invalidXmitWord;
@ -2509,6 +2614,19 @@ typedef struct {
uint32_t primSeqTimeout;
uint32_t elasticOverrun;
uint32_t arbTimeout;
uint32_t advRecBufCredit;
uint32_t curRecBufCredit;
uint32_t advTransBufCredit;
uint32_t curTransBufCredit;
uint32_t recEofCount;
uint32_t recEofdtiCount;
uint32_t recEofniCount;
uint32_t recSofcount;
uint32_t rsvd1;
uint32_t rsvd2;
uint32_t recDrpXriCount;
uint32_t fecCorrBlkCount;
uint32_t fecUncorrBlkCount;
} READ_LNK_VAR;
/* Structure for MB Command REG_LOGIN (19) */

View File

@ -3317,6 +3317,7 @@ struct lpfc_acqe_link {
#define LPFC_ASYNC_LINK_SPEED_20GBPS 0x5
#define LPFC_ASYNC_LINK_SPEED_25GBPS 0x6
#define LPFC_ASYNC_LINK_SPEED_40GBPS 0x7
#define LPFC_ASYNC_LINK_SPEED_100GBPS 0x8
#define lpfc_acqe_link_duplex_SHIFT 16
#define lpfc_acqe_link_duplex_MASK 0x000000FF
#define lpfc_acqe_link_duplex_WORD word0
@ -3447,23 +3448,50 @@ struct lpfc_acqe_fc_la {
struct lpfc_acqe_misconfigured_event {
struct {
uint32_t word0;
#define lpfc_sli_misconfigured_port0_SHIFT 0
#define lpfc_sli_misconfigured_port0_MASK 0x000000FF
#define lpfc_sli_misconfigured_port0_WORD word0
#define lpfc_sli_misconfigured_port1_SHIFT 8
#define lpfc_sli_misconfigured_port1_MASK 0x000000FF
#define lpfc_sli_misconfigured_port1_WORD word0
#define lpfc_sli_misconfigured_port2_SHIFT 16
#define lpfc_sli_misconfigured_port2_MASK 0x000000FF
#define lpfc_sli_misconfigured_port2_WORD word0
#define lpfc_sli_misconfigured_port3_SHIFT 24
#define lpfc_sli_misconfigured_port3_MASK 0x000000FF
#define lpfc_sli_misconfigured_port3_WORD word0
#define lpfc_sli_misconfigured_port0_state_SHIFT 0
#define lpfc_sli_misconfigured_port0_state_MASK 0x000000FF
#define lpfc_sli_misconfigured_port0_state_WORD word0
#define lpfc_sli_misconfigured_port1_state_SHIFT 8
#define lpfc_sli_misconfigured_port1_state_MASK 0x000000FF
#define lpfc_sli_misconfigured_port1_state_WORD word0
#define lpfc_sli_misconfigured_port2_state_SHIFT 16
#define lpfc_sli_misconfigured_port2_state_MASK 0x000000FF
#define lpfc_sli_misconfigured_port2_state_WORD word0
#define lpfc_sli_misconfigured_port3_state_SHIFT 24
#define lpfc_sli_misconfigured_port3_state_MASK 0x000000FF
#define lpfc_sli_misconfigured_port3_state_WORD word0
uint32_t word1;
#define lpfc_sli_misconfigured_port0_op_SHIFT 0
#define lpfc_sli_misconfigured_port0_op_MASK 0x00000001
#define lpfc_sli_misconfigured_port0_op_WORD word1
#define lpfc_sli_misconfigured_port0_severity_SHIFT 1
#define lpfc_sli_misconfigured_port0_severity_MASK 0x00000003
#define lpfc_sli_misconfigured_port0_severity_WORD word1
#define lpfc_sli_misconfigured_port1_op_SHIFT 8
#define lpfc_sli_misconfigured_port1_op_MASK 0x00000001
#define lpfc_sli_misconfigured_port1_op_WORD word1
#define lpfc_sli_misconfigured_port1_severity_SHIFT 9
#define lpfc_sli_misconfigured_port1_severity_MASK 0x00000003
#define lpfc_sli_misconfigured_port1_severity_WORD word1
#define lpfc_sli_misconfigured_port2_op_SHIFT 16
#define lpfc_sli_misconfigured_port2_op_MASK 0x00000001
#define lpfc_sli_misconfigured_port2_op_WORD word1
#define lpfc_sli_misconfigured_port2_severity_SHIFT 17
#define lpfc_sli_misconfigured_port2_severity_MASK 0x00000003
#define lpfc_sli_misconfigured_port2_severity_WORD word1
#define lpfc_sli_misconfigured_port3_op_SHIFT 24
#define lpfc_sli_misconfigured_port3_op_MASK 0x00000001
#define lpfc_sli_misconfigured_port3_op_WORD word1
#define lpfc_sli_misconfigured_port3_severity_SHIFT 25
#define lpfc_sli_misconfigured_port3_severity_MASK 0x00000003
#define lpfc_sli_misconfigured_port3_severity_WORD word1
} theEvent;
#define LPFC_SLI_EVENT_STATUS_VALID 0x00
#define LPFC_SLI_EVENT_STATUS_NOT_PRESENT 0x01
#define LPFC_SLI_EVENT_STATUS_WRONG_TYPE 0x02
#define LPFC_SLI_EVENT_STATUS_UNSUPPORTED 0x03
#define LPFC_SLI_EVENT_STATUS_UNQUALIFIED 0x04
#define LPFC_SLI_EVENT_STATUS_UNCERTIFIED 0x05
};
struct lpfc_acqe_sli {

View File

@ -1184,8 +1184,10 @@ lpfc_hb_timeout_handler(struct lpfc_hba *phba)
vports = lpfc_create_vport_work_array(phba);
if (vports != NULL)
for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++)
for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) {
lpfc_rcv_seq_check_edtov(vports[i]);
lpfc_fdmi_num_disc_check(vports[i]);
}
lpfc_destroy_vport_work_array(phba, vports);
if ((phba->link_state == LPFC_HBA_ERROR) ||
@ -1290,6 +1292,10 @@ lpfc_hb_timeout_handler(struct lpfc_hba *phba)
jiffies +
msecs_to_jiffies(1000 * LPFC_HB_MBOX_TIMEOUT));
}
} else {
mod_timer(&phba->hb_tmofunc,
jiffies +
msecs_to_jiffies(1000 * LPFC_HB_MBOX_INTERVAL));
}
}
@ -2621,7 +2627,6 @@ void
lpfc_stop_vport_timers(struct lpfc_vport *vport)
{
del_timer_sync(&vport->els_tmofunc);
del_timer_sync(&vport->fc_fdmitmo);
del_timer_sync(&vport->delayed_disc_tmo);
lpfc_can_disctmo(vport);
return;
@ -3340,10 +3345,6 @@ lpfc_create_port(struct lpfc_hba *phba, int instance, struct device *dev)
vport->fc_disctmo.function = lpfc_disc_timeout;
vport->fc_disctmo.data = (unsigned long)vport;
init_timer(&vport->fc_fdmitmo);
vport->fc_fdmitmo.function = lpfc_fdmi_tmo;
vport->fc_fdmitmo.data = (unsigned long)vport;
init_timer(&vport->els_tmofunc);
vport->els_tmofunc.function = lpfc_els_timeout;
vport->els_tmofunc.data = (unsigned long)vport;
@ -3708,49 +3709,6 @@ lpfc_sli4_parse_latt_type(struct lpfc_hba *phba,
return att_type;
}
/**
* lpfc_sli4_parse_latt_link_speed - Parse sli4 link-attention link speed
* @phba: pointer to lpfc hba data structure.
* @acqe_link: pointer to the async link completion queue entry.
*
* This routine is to parse the SLI4 link-attention link speed and translate
* it into the base driver's link-attention link speed coding.
*
* Return: Link-attention link speed in terms of base driver's coding.
**/
static uint8_t
lpfc_sli4_parse_latt_link_speed(struct lpfc_hba *phba,
struct lpfc_acqe_link *acqe_link)
{
uint8_t link_speed;
switch (bf_get(lpfc_acqe_link_speed, acqe_link)) {
case LPFC_ASYNC_LINK_SPEED_ZERO:
case LPFC_ASYNC_LINK_SPEED_10MBPS:
case LPFC_ASYNC_LINK_SPEED_100MBPS:
link_speed = LPFC_LINK_SPEED_UNKNOWN;
break;
case LPFC_ASYNC_LINK_SPEED_1GBPS:
link_speed = LPFC_LINK_SPEED_1GHZ;
break;
case LPFC_ASYNC_LINK_SPEED_10GBPS:
link_speed = LPFC_LINK_SPEED_10GHZ;
break;
case LPFC_ASYNC_LINK_SPEED_20GBPS:
case LPFC_ASYNC_LINK_SPEED_25GBPS:
case LPFC_ASYNC_LINK_SPEED_40GBPS:
link_speed = LPFC_LINK_SPEED_UNKNOWN;
break;
default:
lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
"0483 Invalid link-attention link speed: x%x\n",
bf_get(lpfc_acqe_link_speed, acqe_link));
link_speed = LPFC_LINK_SPEED_UNKNOWN;
break;
}
return link_speed;
}
/**
* lpfc_sli_port_speed_get - Get sli3 link speed code to link speed
* @phba: pointer to lpfc hba data structure.
@ -3767,27 +3725,35 @@ lpfc_sli_port_speed_get(struct lpfc_hba *phba)
if (!lpfc_is_link_up(phba))
return 0;
switch (phba->fc_linkspeed) {
case LPFC_LINK_SPEED_1GHZ:
link_speed = 1000;
break;
case LPFC_LINK_SPEED_2GHZ:
link_speed = 2000;
break;
case LPFC_LINK_SPEED_4GHZ:
link_speed = 4000;
break;
case LPFC_LINK_SPEED_8GHZ:
link_speed = 8000;
break;
case LPFC_LINK_SPEED_10GHZ:
link_speed = 10000;
break;
case LPFC_LINK_SPEED_16GHZ:
link_speed = 16000;
break;
default:
link_speed = 0;
if (phba->sli_rev <= LPFC_SLI_REV3) {
switch (phba->fc_linkspeed) {
case LPFC_LINK_SPEED_1GHZ:
link_speed = 1000;
break;
case LPFC_LINK_SPEED_2GHZ:
link_speed = 2000;
break;
case LPFC_LINK_SPEED_4GHZ:
link_speed = 4000;
break;
case LPFC_LINK_SPEED_8GHZ:
link_speed = 8000;
break;
case LPFC_LINK_SPEED_10GHZ:
link_speed = 10000;
break;
case LPFC_LINK_SPEED_16GHZ:
link_speed = 16000;
break;
default:
link_speed = 0;
}
} else {
if (phba->sli4_hba.link_state.logical_speed)
link_speed =
phba->sli4_hba.link_state.logical_speed;
else
link_speed = phba->sli4_hba.link_state.speed;
}
return link_speed;
}
@ -3983,7 +3949,7 @@ lpfc_sli4_async_link_evt(struct lpfc_hba *phba,
la->eventTag = acqe_link->event_tag;
bf_set(lpfc_mbx_read_top_att_type, la, att_type);
bf_set(lpfc_mbx_read_top_link_spd, la,
lpfc_sli4_parse_latt_link_speed(phba, acqe_link));
(bf_get(lpfc_acqe_link_speed, acqe_link)));
/* Fake the the following irrelvant fields */
bf_set(lpfc_mbx_read_top_topology, la, LPFC_TOPOLOGY_PT_PT);
@ -4113,22 +4079,18 @@ lpfc_sli4_async_sli_evt(struct lpfc_hba *phba, struct lpfc_acqe_sli *acqe_sli)
char message[128];
uint8_t status;
uint8_t evt_type;
uint8_t operational = 0;
struct temp_event temp_event_data;
struct lpfc_acqe_misconfigured_event *misconfigured;
struct Scsi_Host *shost;
evt_type = bf_get(lpfc_trailer_type, acqe_sli);
/* Special case Lancer */
if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) !=
LPFC_SLI_INTF_IF_TYPE_2) {
lpfc_printf_log(phba, KERN_INFO, LOG_SLI,
"2901 Async SLI event - Event Data1:x%08x Event Data2:"
"x%08x SLI Event Type:%d\n",
acqe_sli->event_data1, acqe_sli->event_data2,
evt_type);
return;
}
lpfc_printf_log(phba, KERN_INFO, LOG_SLI,
"2901 Async SLI event - Event Data1:x%08x Event Data2:"
"x%08x SLI Event Type:%d\n",
acqe_sli->event_data1, acqe_sli->event_data2,
evt_type);
port_name = phba->Port[0];
if (port_name == 0x00)
@ -4174,29 +4136,46 @@ lpfc_sli4_async_sli_evt(struct lpfc_hba *phba, struct lpfc_acqe_sli *acqe_sli)
/* fetch the status for this port */
switch (phba->sli4_hba.lnk_info.lnk_no) {
case LPFC_LINK_NUMBER_0:
status = bf_get(lpfc_sli_misconfigured_port0,
status = bf_get(lpfc_sli_misconfigured_port0_state,
&misconfigured->theEvent);
operational = bf_get(lpfc_sli_misconfigured_port0_op,
&misconfigured->theEvent);
break;
case LPFC_LINK_NUMBER_1:
status = bf_get(lpfc_sli_misconfigured_port1,
status = bf_get(lpfc_sli_misconfigured_port1_state,
&misconfigured->theEvent);
operational = bf_get(lpfc_sli_misconfigured_port1_op,
&misconfigured->theEvent);
break;
case LPFC_LINK_NUMBER_2:
status = bf_get(lpfc_sli_misconfigured_port2,
status = bf_get(lpfc_sli_misconfigured_port2_state,
&misconfigured->theEvent);
operational = bf_get(lpfc_sli_misconfigured_port2_op,
&misconfigured->theEvent);
break;
case LPFC_LINK_NUMBER_3:
status = bf_get(lpfc_sli_misconfigured_port3,
status = bf_get(lpfc_sli_misconfigured_port3_state,
&misconfigured->theEvent);
operational = bf_get(lpfc_sli_misconfigured_port3_op,
&misconfigured->theEvent);
break;
default:
status = ~LPFC_SLI_EVENT_STATUS_VALID;
break;
lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
"3296 "
"LPFC_SLI_EVENT_TYPE_MISCONFIGURED "
"event: Invalid link %d",
phba->sli4_hba.lnk_info.lnk_no);
return;
}
/* Skip if optic state unchanged */
if (phba->sli4_hba.lnk_info.optic_state == status)
return;
switch (status) {
case LPFC_SLI_EVENT_STATUS_VALID:
return; /* no message if the sfp is okay */
sprintf(message, "Physical Link is functional");
break;
case LPFC_SLI_EVENT_STATUS_NOT_PRESENT:
sprintf(message, "Optics faulted/incorrectly "
"installed/not installed - Reseat optics, "
@ -4211,15 +4190,26 @@ lpfc_sli4_async_sli_evt(struct lpfc_hba *phba, struct lpfc_acqe_sli *acqe_sli)
sprintf(message, "Incompatible optics - Replace with "
"compatible optics for card to function.");
break;
case LPFC_SLI_EVENT_STATUS_UNQUALIFIED:
sprintf(message, "Unqualified optics - Replace with "
"Avago optics for Warranty and Technical "
"Support - Link is%s operational",
(operational) ? "" : " not");
break;
case LPFC_SLI_EVENT_STATUS_UNCERTIFIED:
sprintf(message, "Uncertified optics - Replace with "
"Avago-certified optics to enable link "
"operation - Link is%s operational",
(operational) ? "" : " not");
break;
default:
/* firmware is reporting a status we don't know about */
sprintf(message, "Unknown event status x%02x", status);
break;
}
phba->sli4_hba.lnk_info.optic_state = status;
lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
"3176 Misconfigured Physical Port - "
"Port Name %c %s\n", port_name, message);
"3176 Port Name %c %s\n", port_name, message);
break;
case LPFC_SLI_EVENT_TYPE_REMOTE_DPORT:
lpfc_printf_log(phba, KERN_INFO, LOG_SLI,
@ -5293,6 +5283,9 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba)
INIT_LIST_HEAD(&phba->sli4_hba.lpfc_vfi_blk_list);
INIT_LIST_HEAD(&phba->lpfc_vpi_blk_list);
/* initialize optic_state to 0xFF */
phba->sli4_hba.lnk_info.optic_state = 0xff;
/* Initialize the driver internal SLI layer lists. */
lpfc_sli_setup(phba);
lpfc_sli_queue_setup(phba);
@ -6159,6 +6152,20 @@ lpfc_create_shost(struct lpfc_hba *phba)
/* Put reference to SCSI host to driver's device private data */
pci_set_drvdata(phba->pcidev, shost);
/*
* At this point we are fully registered with PSA. In addition,
* any initial discovery should be completed.
*/
vport->load_flag |= FC_ALLOW_FDMI;
if (phba->cfg_fdmi_on > LPFC_FDMI_NO_SUPPORT) {
/* Setup appropriate attribute masks */
vport->fdmi_hba_mask = LPFC_FDMI2_HBA_ATTR;
if (phba->cfg_fdmi_on == LPFC_FDMI_SMART_SAN)
vport->fdmi_port_mask = LPFC_FDMI2_SMART_ATTR;
else
vport->fdmi_port_mask = LPFC_FDMI2_PORT_ATTR;
}
return 0;
}
@ -8833,9 +8840,12 @@ found:
* already mapped to this phys_id.
*/
if (cpup->irq != LPFC_VECTOR_MAP_EMPTY) {
chann[saved_chann] =
cpup->channel_id;
saved_chann++;
if (saved_chann <=
LPFC_FCP_IO_CHAN_MAX) {
chann[saved_chann] =
cpup->channel_id;
saved_chann++;
}
goto out;
}

View File

@ -231,15 +231,13 @@ lpfc_mem_free(struct lpfc_hba *phba)
if (phba->lpfc_hbq_pool)
pci_pool_destroy(phba->lpfc_hbq_pool);
phba->lpfc_hbq_pool = NULL;
if (phba->rrq_pool)
mempool_destroy(phba->rrq_pool);
mempool_destroy(phba->rrq_pool);
phba->rrq_pool = NULL;
/* Free NLP memory pool */
mempool_destroy(phba->nlp_mem_pool);
phba->nlp_mem_pool = NULL;
if (phba->sli_rev == LPFC_SLI_REV4 && phba->active_rrq_pool) {
if (phba->sli_rev == LPFC_SLI_REV4) {
mempool_destroy(phba->active_rrq_pool);
phba->active_rrq_pool = NULL;
}

View File

@ -280,38 +280,12 @@ lpfc_rcv_plogi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
uint32_t *lp;
IOCB_t *icmd;
struct serv_parm *sp;
uint32_t ed_tov;
LPFC_MBOXQ_t *mbox;
struct ls_rjt stat;
int rc;
memset(&stat, 0, sizeof (struct ls_rjt));
if (vport->port_state <= LPFC_FDISC) {
/* Before responding to PLOGI, check for pt2pt mode.
* If we are pt2pt, with an outstanding FLOGI, abort
* the FLOGI and resend it first.
*/
if (vport->fc_flag & FC_PT2PT) {
lpfc_els_abort_flogi(phba);
if (!(vport->fc_flag & FC_PT2PT_PLOGI)) {
/* If the other side is supposed to initiate
* the PLOGI anyway, just ACC it now and
* move on with discovery.
*/
phba->fc_edtov = FF_DEF_EDTOV;
phba->fc_ratov = FF_DEF_RATOV;
/* Start discovery - this should just do
CLEAR_LA */
lpfc_disc_start(vport);
} else
lpfc_initial_flogi(vport);
} else {
stat.un.b.lsRjtRsnCode = LSRJT_LOGICAL_BSY;
stat.un.b.lsRjtRsnCodeExp = LSEXP_NOTHING_MORE;
lpfc_els_rsp_reject(vport, stat.un.lsRjtError, cmdiocb,
ndlp, NULL);
return 0;
}
}
pcmd = (struct lpfc_dmabuf *) cmdiocb->context2;
lp = (uint32_t *) pcmd->virt;
sp = (struct serv_parm *) ((uint8_t *) lp + sizeof (uint32_t));
@ -404,30 +378,46 @@ lpfc_rcv_plogi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
/* Check for Nport to NPort pt2pt protocol */
if ((vport->fc_flag & FC_PT2PT) &&
!(vport->fc_flag & FC_PT2PT_PLOGI)) {
/* rcv'ed PLOGI decides what our NPortId will be */
vport->fc_myDID = icmd->un.rcvels.parmRo;
mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
if (mbox == NULL)
goto out;
lpfc_config_link(phba, mbox);
mbox->mbox_cmpl = lpfc_sli_def_mbox_cmpl;
mbox->vport = vport;
rc = lpfc_sli_issue_mbox(phba, mbox, MBX_NOWAIT);
if (rc == MBX_NOT_FINISHED) {
mempool_free(mbox, phba->mbox_mem_pool);
goto out;
ed_tov = be32_to_cpu(sp->cmn.e_d_tov);
if (sp->cmn.edtovResolution) {
/* E_D_TOV ticks are in nanoseconds */
ed_tov = (phba->fc_edtov + 999999) / 1000000;
}
/*
* For SLI4, the VFI/VPI are registered AFTER the
* Nport with the higher WWPN sends us a PLOGI with
* our assigned NPortId.
* For pt-to-pt, use the larger EDTOV
* RATOV = 2 * EDTOV
*/
if (ed_tov > phba->fc_edtov)
phba->fc_edtov = ed_tov;
phba->fc_ratov = (2 * phba->fc_edtov) / 1000;
memcpy(&phba->fc_fabparam, sp, sizeof(struct serv_parm));
/* Issue config_link / reg_vfi to account for updated TOV's */
if (phba->sli_rev == LPFC_SLI_REV4)
lpfc_issue_reg_vfi(vport);
else {
mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
if (mbox == NULL)
goto out;
lpfc_config_link(phba, mbox);
mbox->mbox_cmpl = lpfc_sli_def_mbox_cmpl;
mbox->vport = vport;
rc = lpfc_sli_issue_mbox(phba, mbox, MBX_NOWAIT);
if (rc == MBX_NOT_FINISHED) {
mempool_free(mbox, phba->mbox_mem_pool);
goto out;
}
}
lpfc_can_disctmo(vport);
}
mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
if (!mbox)
goto out;
@ -1038,7 +1028,9 @@ lpfc_cmpl_plogi_plogi_issue(struct lpfc_vport *vport,
uint32_t *lp;
IOCB_t *irsp;
struct serv_parm *sp;
uint32_t ed_tov;
LPFC_MBOXQ_t *mbox;
int rc;
cmdiocb = (struct lpfc_iocbq *) arg;
rspiocb = cmdiocb->context_un.rsp_iocb;
@ -1094,18 +1086,63 @@ lpfc_cmpl_plogi_plogi_issue(struct lpfc_vport *vport,
ndlp->nlp_maxframe =
((sp->cmn.bbRcvSizeMsb & 0x0F) << 8) | sp->cmn.bbRcvSizeLsb;
mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
if (!mbox) {
lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS,
"0133 PLOGI: no memory for reg_login "
"Data: x%x x%x x%x x%x\n",
ndlp->nlp_DID, ndlp->nlp_state,
ndlp->nlp_flag, ndlp->nlp_rpi);
goto out;
if ((vport->fc_flag & FC_PT2PT) &&
(vport->fc_flag & FC_PT2PT_PLOGI)) {
ed_tov = be32_to_cpu(sp->cmn.e_d_tov);
if (sp->cmn.edtovResolution) {
/* E_D_TOV ticks are in nanoseconds */
ed_tov = (phba->fc_edtov + 999999) / 1000000;
}
/*
* Use the larger EDTOV
* RATOV = 2 * EDTOV for pt-to-pt
*/
if (ed_tov > phba->fc_edtov)
phba->fc_edtov = ed_tov;
phba->fc_ratov = (2 * phba->fc_edtov) / 1000;
memcpy(&phba->fc_fabparam, sp, sizeof(struct serv_parm));
/* Issue config_link / reg_vfi to account for updated TOV's */
if (phba->sli_rev == LPFC_SLI_REV4) {
lpfc_issue_reg_vfi(vport);
} else {
mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
if (!mbox) {
lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS,
"0133 PLOGI: no memory "
"for config_link "
"Data: x%x x%x x%x x%x\n",
ndlp->nlp_DID, ndlp->nlp_state,
ndlp->nlp_flag, ndlp->nlp_rpi);
goto out;
}
lpfc_config_link(phba, mbox);
mbox->mbox_cmpl = lpfc_sli_def_mbox_cmpl;
mbox->vport = vport;
rc = lpfc_sli_issue_mbox(phba, mbox, MBX_NOWAIT);
if (rc == MBX_NOT_FINISHED) {
mempool_free(mbox, phba->mbox_mem_pool);
goto out;
}
}
}
lpfc_unreg_rpi(vport, ndlp);
mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
if (!mbox) {
lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS,
"0018 PLOGI: no memory for reg_login "
"Data: x%x x%x x%x x%x\n",
ndlp->nlp_DID, ndlp->nlp_state,
ndlp->nlp_flag, ndlp->nlp_rpi);
goto out;
}
if (lpfc_reg_rpi(phba, vport->vpi, irsp->un.elsreq64.remoteID,
(uint8_t *) sp, mbox, ndlp->nlp_rpi) == 0) {
switch (ndlp->nlp_DID) {
@ -2299,6 +2336,9 @@ lpfc_cmpl_reglogin_npr_node(struct lpfc_vport *vport,
if (vport->phba->sli_rev < LPFC_SLI_REV4)
ndlp->nlp_rpi = mb->un.varWords[0];
ndlp->nlp_flag |= NLP_RPI_REGISTERED;
if (ndlp->nlp_flag & NLP_LOGO_ACC) {
lpfc_unreg_rpi(vport, ndlp);
}
} else {
if (ndlp->nlp_flag & NLP_NODEV_REMOVE) {
lpfc_drop_node(vport, ndlp);

View File

@ -3676,6 +3676,7 @@ static void
lpfc_handle_fcp_err(struct lpfc_vport *vport, struct lpfc_scsi_buf *lpfc_cmd,
struct lpfc_iocbq *rsp_iocb)
{
struct lpfc_hba *phba = vport->phba;
struct scsi_cmnd *cmnd = lpfc_cmd->pCmd;
struct fcp_cmnd *fcpcmd = lpfc_cmd->fcp_cmnd;
struct fcp_rsp *fcprsp = lpfc_cmd->fcp_rsp;
@ -3685,6 +3686,7 @@ lpfc_handle_fcp_err(struct lpfc_vport *vport, struct lpfc_scsi_buf *lpfc_cmd,
uint32_t *lp;
uint32_t host_status = DID_OK;
uint32_t rsplen = 0;
uint32_t fcpDl;
uint32_t logit = LOG_FCP | LOG_FCP_ERROR;
@ -3755,13 +3757,14 @@ lpfc_handle_fcp_err(struct lpfc_vport *vport, struct lpfc_scsi_buf *lpfc_cmd,
fcprsp->rspInfo3);
scsi_set_resid(cmnd, 0);
fcpDl = be32_to_cpu(fcpcmd->fcpDl);
if (resp_info & RESID_UNDER) {
scsi_set_resid(cmnd, be32_to_cpu(fcprsp->rspResId));
lpfc_printf_vlog(vport, KERN_INFO, LOG_FCP_UNDER,
"9025 FCP Read Underrun, expected %d, "
"residual %d Data: x%x x%x x%x\n",
be32_to_cpu(fcpcmd->fcpDl),
fcpDl,
scsi_get_resid(cmnd), fcpi_parm, cmnd->cmnd[0],
cmnd->underflow);
@ -3777,7 +3780,7 @@ lpfc_handle_fcp_err(struct lpfc_vport *vport, struct lpfc_scsi_buf *lpfc_cmd,
LOG_FCP | LOG_FCP_ERROR,
"9026 FCP Read Check Error "
"and Underrun Data: x%x x%x x%x x%x\n",
be32_to_cpu(fcpcmd->fcpDl),
fcpDl,
scsi_get_resid(cmnd), fcpi_parm,
cmnd->cmnd[0]);
scsi_set_resid(cmnd, scsi_bufflen(cmnd));
@ -3812,13 +3815,25 @@ lpfc_handle_fcp_err(struct lpfc_vport *vport, struct lpfc_scsi_buf *lpfc_cmd,
* Check SLI validation that all the transfer was actually done
* (fcpi_parm should be zero). Apply check only to reads.
*/
} else if (fcpi_parm && (cmnd->sc_data_direction == DMA_FROM_DEVICE)) {
} else if (fcpi_parm) {
lpfc_printf_vlog(vport, KERN_WARNING, LOG_FCP | LOG_FCP_ERROR,
"9029 FCP Read Check Error Data: "
"9029 FCP %s Check Error xri x%x Data: "
"x%x x%x x%x x%x x%x\n",
be32_to_cpu(fcpcmd->fcpDl),
be32_to_cpu(fcprsp->rspResId),
((cmnd->sc_data_direction == DMA_FROM_DEVICE) ?
"Read" : "Write"),
((phba->sli_rev == LPFC_SLI_REV4) ?
lpfc_cmd->cur_iocbq.sli4_xritag :
rsp_iocb->iocb.ulpContext),
fcpDl, be32_to_cpu(fcprsp->rspResId),
fcpi_parm, cmnd->cmnd[0], scsi_status);
/* There is some issue with the LPe12000 that causes it
* to miscalculate the fcpi_parm and falsely trip this
* recovery logic. Detect this case and don't error when true.
*/
if (fcpi_parm > fcpDl)
goto out;
switch (scsi_status) {
case SAM_STAT_GOOD:
case SAM_STAT_CHECK_CONDITION:
@ -3908,9 +3923,9 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn,
uint32_t logit = LOG_FCP;
/* Sanity check on return of outstanding command */
if (!(lpfc_cmd->pCmd))
return;
cmd = lpfc_cmd->pCmd;
if (!cmd)
return;
shost = cmd->device->host;
lpfc_cmd->result = (pIocbOut->iocb.un.ulpWord[4] & IOERR_PARAM_MASK);
@ -4446,15 +4461,7 @@ lpfc_info(struct Scsi_Host *host)
phba->Port);
}
len = strlen(lpfcinfobuf);
if (phba->sli_rev <= LPFC_SLI_REV3) {
link_speed = lpfc_sli_port_speed_get(phba);
} else {
if (phba->sli4_hba.link_state.logical_speed)
link_speed =
phba->sli4_hba.link_state.logical_speed;
else
link_speed = phba->sli4_hba.link_state.speed;
}
link_speed = lpfc_sli_port_speed_get(phba);
if (link_speed != 0)
snprintf(lpfcinfobuf + len, 384-len,
" Logical Link Speed: %d Mbps", link_speed);

View File

@ -14842,10 +14842,12 @@ lpfc_fc_frame_add(struct lpfc_vport *vport, struct hbq_dmabuf *dmabuf)
struct lpfc_dmabuf *h_buf;
struct hbq_dmabuf *seq_dmabuf = NULL;
struct hbq_dmabuf *temp_dmabuf = NULL;
uint8_t found = 0;
INIT_LIST_HEAD(&dmabuf->dbuf.list);
dmabuf->time_stamp = jiffies;
new_hdr = (struct fc_frame_header *)dmabuf->hbuf.virt;
/* Use the hdr_buf to find the sequence that this frame belongs to */
list_for_each_entry(h_buf, &vport->rcv_buffer_list, list) {
temp_hdr = (struct fc_frame_header *)h_buf->virt;
@ -14885,7 +14887,8 @@ lpfc_fc_frame_add(struct lpfc_vport *vport, struct hbq_dmabuf *dmabuf)
return seq_dmabuf;
}
/* find the correct place in the sequence to insert this frame */
list_for_each_entry_reverse(d_buf, &seq_dmabuf->dbuf.list, list) {
d_buf = list_entry(seq_dmabuf->dbuf.list.prev, typeof(*d_buf), list);
while (!found) {
temp_dmabuf = container_of(d_buf, struct hbq_dmabuf, dbuf);
temp_hdr = (struct fc_frame_header *)temp_dmabuf->hbuf.virt;
/*
@ -14895,9 +14898,17 @@ lpfc_fc_frame_add(struct lpfc_vport *vport, struct hbq_dmabuf *dmabuf)
if (be16_to_cpu(new_hdr->fh_seq_cnt) >
be16_to_cpu(temp_hdr->fh_seq_cnt)) {
list_add(&dmabuf->dbuf.list, &temp_dmabuf->dbuf.list);
return seq_dmabuf;
found = 1;
break;
}
if (&d_buf->list == &seq_dmabuf->dbuf.list)
break;
d_buf = list_entry(d_buf->list.prev, typeof(*d_buf), list);
}
if (found)
return seq_dmabuf;
return NULL;
}
@ -16173,7 +16184,7 @@ fail_fcf_read:
}
/**
* lpfc_check_next_fcf_pri
* lpfc_check_next_fcf_pri_level
* phba pointer to the lpfc_hba struct for this port.
* This routine is called from the lpfc_sli4_fcf_rr_next_index_get
* routine when the rr_bmask is empty. The FCF indecies are put into the
@ -16329,8 +16340,12 @@ next_priority:
if (next_fcf_index < LPFC_SLI4_FCF_TBL_INDX_MAX &&
phba->fcf.fcf_pri[next_fcf_index].fcf_rec.flag &
LPFC_FCF_FLOGI_FAILED)
LPFC_FCF_FLOGI_FAILED) {
if (list_is_singular(&phba->fcf.fcf_pri_list))
return LPFC_FCOE_FCF_NEXT_NONE;
goto next_priority;
}
lpfc_printf_log(phba, KERN_INFO, LOG_FIP,
"2845 Get next roundrobin failover FCF (x%x)\n",

View File

@ -442,6 +442,7 @@ struct lpfc_sli4_lnk_info {
#define LPFC_LNK_GE 0x0 /* FCoE */
#define LPFC_LNK_FC 0x1 /* FC */
uint8_t lnk_no;
uint8_t optic_state;
};
#define LPFC_SLI4_HANDLER_CNT (LPFC_FCP_IO_CHAN_MAX+ \

View File

@ -18,7 +18,7 @@
* included with this package. *
*******************************************************************/
#define LPFC_DRIVER_VERSION "11.0.0.0."
#define LPFC_DRIVER_VERSION "11.0.0.10."
#define LPFC_DRIVER_NAME "lpfc"
/* Used for SLI 2/3 */

View File

@ -393,6 +393,14 @@ lpfc_vport_create(struct fc_vport *fc_vport, bool disable)
*(struct lpfc_vport **)fc_vport->dd_data = vport;
vport->fc_vport = fc_vport;
/* At this point we are fully registered with SCSI Layer. */
vport->load_flag |= FC_ALLOW_FDMI;
if (phba->cfg_fdmi_on > LPFC_FDMI_NO_SUPPORT) {
/* Setup appropriate attribute masks */
vport->fdmi_hba_mask = phba->pport->fdmi_hba_mask;
vport->fdmi_port_mask = phba->pport->fdmi_port_mask;
}
/*
* In SLI4, the vpi must be activated before it can be used
* by the port.

View File

@ -2020,8 +2020,10 @@ mpt3sas_base_unmap_resources(struct MPT3SAS_ADAPTER *ioc)
_base_free_irq(ioc);
_base_disable_msix(ioc);
if (ioc->msix96_vector)
if (ioc->msix96_vector) {
kfree(ioc->replyPostRegisterIndex);
ioc->replyPostRegisterIndex = NULL;
}
if (ioc->chip_phys) {
iounmap(ioc->chip);

View File

@ -330,6 +330,51 @@ static void mvs_94xx_phy_enable(struct mvs_info *mvi, u32 phy_id)
mvs_write_port_vsr_data(mvi, phy_id, tmp & 0xfd7fffff);
}
static void mvs_94xx_sgpio_init(struct mvs_info *mvi)
{
void __iomem *regs = mvi->regs_ex - 0x10200;
u32 tmp;
tmp = mr32(MVS_HST_CHIP_CONFIG);
tmp |= 0x100;
mw32(MVS_HST_CHIP_CONFIG, tmp);
mw32(MVS_SGPIO_CTRL + MVS_SGPIO_HOST_OFFSET * mvi->id,
MVS_SGPIO_CTRL_SDOUT_AUTO << MVS_SGPIO_CTRL_SDOUT_SHIFT);
mw32(MVS_SGPIO_CFG1 + MVS_SGPIO_HOST_OFFSET * mvi->id,
8 << MVS_SGPIO_CFG1_LOWA_SHIFT |
8 << MVS_SGPIO_CFG1_HIA_SHIFT |
4 << MVS_SGPIO_CFG1_LOWB_SHIFT |
4 << MVS_SGPIO_CFG1_HIB_SHIFT |
2 << MVS_SGPIO_CFG1_MAXACTON_SHIFT |
1 << MVS_SGPIO_CFG1_FORCEACTOFF_SHIFT
);
mw32(MVS_SGPIO_CFG2 + MVS_SGPIO_HOST_OFFSET * mvi->id,
(300000 / 100) << MVS_SGPIO_CFG2_CLK_SHIFT | /* 100kHz clock */
66 << MVS_SGPIO_CFG2_BLINK_SHIFT /* (66 * 0,121 Hz?)*/
);
mw32(MVS_SGPIO_CFG0 + MVS_SGPIO_HOST_OFFSET * mvi->id,
MVS_SGPIO_CFG0_ENABLE |
MVS_SGPIO_CFG0_BLINKA |
MVS_SGPIO_CFG0_BLINKB |
/* 3*4 data bits / PDU */
(12 - 1) << MVS_SGPIO_CFG0_AUT_BITLEN_SHIFT
);
mw32(MVS_SGPIO_DCTRL + MVS_SGPIO_HOST_OFFSET * mvi->id,
DEFAULT_SGPIO_BITS);
mw32(MVS_SGPIO_DSRC + MVS_SGPIO_HOST_OFFSET * mvi->id,
((mvi->id * 4) + 3) << (8 * 3) |
((mvi->id * 4) + 2) << (8 * 2) |
((mvi->id * 4) + 1) << (8 * 1) |
((mvi->id * 4) + 0) << (8 * 0));
}
static int mvs_94xx_init(struct mvs_info *mvi)
{
void __iomem *regs = mvi->regs;
@ -533,6 +578,8 @@ static int mvs_94xx_init(struct mvs_info *mvi)
/* Enable SRS interrupt */
mw32(MVS_INT_MASK_SRS_0, 0xFFFF);
mvs_94xx_sgpio_init(mvi);
return 0;
}
@ -1005,6 +1052,92 @@ static void mvs_94xx_tune_interrupt(struct mvs_info *mvi, u32 time)
}
static int mvs_94xx_gpio_write(struct mvs_prv_info *mvs_prv,
u8 reg_type, u8 reg_index,
u8 reg_count, u8 *write_data)
{
int i;
switch (reg_type) {
case SAS_GPIO_REG_TX_GP:
if (reg_index == 0)
return -EINVAL;
if (reg_count > 1)
return -EINVAL;
if (reg_count == 0)
return 0;
/* maximum supported bits = hosts * 4 drives * 3 bits */
for (i = 0; i < mvs_prv->n_host * 4 * 3; i++) {
/* select host */
struct mvs_info *mvi = mvs_prv->mvi[i/(4*3)];
void __iomem *regs = mvi->regs_ex - 0x10200;
int drive = (i/3) & (4-1); /* drive number on host */
u32 block = mr32(MVS_SGPIO_DCTRL +
MVS_SGPIO_HOST_OFFSET * mvi->id);
/*
* if bit is set then create a mask with the first
* bit of the drive set in the mask ...
*/
u32 bit = (write_data[i/8] & (1 << (i&(8-1)))) ?
1<<(24-drive*8) : 0;
/*
* ... and then shift it to the right position based
* on the led type (activity/id/fail)
*/
switch (i%3) {
case 0: /* activity */
block &= ~((0x7 << MVS_SGPIO_DCTRL_ACT_SHIFT)
<< (24-drive*8));
/* hardwire activity bit to SOF */
block |= LED_BLINKA_SOF << (
MVS_SGPIO_DCTRL_ACT_SHIFT +
(24-drive*8));
break;
case 1: /* id */
block &= ~((0x3 << MVS_SGPIO_DCTRL_LOC_SHIFT)
<< (24-drive*8));
block |= bit << MVS_SGPIO_DCTRL_LOC_SHIFT;
break;
case 2: /* fail */
block &= ~((0x7 << MVS_SGPIO_DCTRL_ERR_SHIFT)
<< (24-drive*8));
block |= bit << MVS_SGPIO_DCTRL_ERR_SHIFT;
break;
}
mw32(MVS_SGPIO_DCTRL + MVS_SGPIO_HOST_OFFSET * mvi->id,
block);
}
return reg_count;
case SAS_GPIO_REG_TX:
if (reg_index + reg_count > mvs_prv->n_host)
return -EINVAL;
for (i = 0; i < reg_count; i++) {
struct mvs_info *mvi = mvs_prv->mvi[i+reg_index];
void __iomem *regs = mvi->regs_ex - 0x10200;
mw32(MVS_SGPIO_DCTRL + MVS_SGPIO_HOST_OFFSET * mvi->id,
be32_to_cpu(((u32 *) write_data)[i]));
}
return reg_count;
}
return -ENOSYS;
}
const struct mvs_dispatch mvs_94xx_dispatch = {
"mv94xx",
mvs_94xx_init,
@ -1057,5 +1190,6 @@ const struct mvs_dispatch mvs_94xx_dispatch = {
mvs_94xx_fix_dma,
mvs_94xx_tune_interrupt,
mvs_94xx_non_spec_ncq_error,
mvs_94xx_gpio_write,
};

View File

@ -38,6 +38,10 @@ enum VANIR_REVISION_ID {
VANIR_C2_REV = 0xC2,
};
enum host_registers {
MVS_HST_CHIP_CONFIG = 0x10104, /* chip configuration */
};
enum hw_registers {
MVS_GBL_CTL = 0x04, /* global control */
MVS_GBL_INT_STAT = 0x00, /* global irq status */
@ -239,6 +243,73 @@ struct mvs_prd {
__le32 im_len;
} __attribute__ ((packed));
enum sgpio_registers {
MVS_SGPIO_HOST_OFFSET = 0x100, /* offset between hosts */
MVS_SGPIO_CFG0 = 0xc200,
MVS_SGPIO_CFG0_ENABLE = (1 << 0), /* enable pins */
MVS_SGPIO_CFG0_BLINKB = (1 << 1), /* blink generators */
MVS_SGPIO_CFG0_BLINKA = (1 << 2),
MVS_SGPIO_CFG0_INVSCLK = (1 << 3), /* invert signal? */
MVS_SGPIO_CFG0_INVSLOAD = (1 << 4),
MVS_SGPIO_CFG0_INVSDOUT = (1 << 5),
MVS_SGPIO_CFG0_SLOAD_FALLEDGE = (1 << 6), /* rise/fall edge? */
MVS_SGPIO_CFG0_SDOUT_FALLEDGE = (1 << 7),
MVS_SGPIO_CFG0_SDIN_RISEEDGE = (1 << 8),
MVS_SGPIO_CFG0_MAN_BITLEN_SHIFT = 18, /* bits/frame manual mode */
MVS_SGPIO_CFG0_AUT_BITLEN_SHIFT = 24, /* bits/frame auto mode */
MVS_SGPIO_CFG1 = 0xc204, /* blink timing register */
MVS_SGPIO_CFG1_LOWA_SHIFT = 0, /* A off time */
MVS_SGPIO_CFG1_HIA_SHIFT = 4, /* A on time */
MVS_SGPIO_CFG1_LOWB_SHIFT = 8, /* B off time */
MVS_SGPIO_CFG1_HIB_SHIFT = 12, /* B on time */
MVS_SGPIO_CFG1_MAXACTON_SHIFT = 16, /* max activity on time */
/* force activity off time */
MVS_SGPIO_CFG1_FORCEACTOFF_SHIFT = 20,
/* stretch activity on time */
MVS_SGPIO_CFG1_STRCHACTON_SHIFT = 24,
/* stretch activiity off time */
MVS_SGPIO_CFG1_STRCHACTOFF_SHIFT = 28,
MVS_SGPIO_CFG2 = 0xc208, /* clock speed register */
MVS_SGPIO_CFG2_CLK_SHIFT = 0,
MVS_SGPIO_CFG2_BLINK_SHIFT = 20,
MVS_SGPIO_CTRL = 0xc20c, /* SDOUT/SDIN mode control */
MVS_SGPIO_CTRL_SDOUT_AUTO = 2,
MVS_SGPIO_CTRL_SDOUT_SHIFT = 2,
MVS_SGPIO_DSRC = 0xc220, /* map ODn bits to drives */
MVS_SGPIO_DCTRL = 0xc238,
MVS_SGPIO_DCTRL_ERR_SHIFT = 0,
MVS_SGPIO_DCTRL_LOC_SHIFT = 3,
MVS_SGPIO_DCTRL_ACT_SHIFT = 5,
};
enum sgpio_led_status {
LED_OFF = 0,
LED_ON = 1,
LED_BLINKA = 2,
LED_BLINKA_INV = 3,
LED_BLINKA_SOF = 4,
LED_BLINKA_EOF = 5,
LED_BLINKB = 6,
LED_BLINKB_INV = 7,
};
#define DEFAULT_SGPIO_BITS ((LED_BLINKA_SOF << \
MVS_SGPIO_DCTRL_ACT_SHIFT) << (8 * 3) | \
(LED_BLINKA_SOF << \
MVS_SGPIO_DCTRL_ACT_SHIFT) << (8 * 2) | \
(LED_BLINKA_SOF << \
MVS_SGPIO_DCTRL_ACT_SHIFT) << (8 * 1) | \
(LED_BLINKA_SOF << \
MVS_SGPIO_DCTRL_ACT_SHIFT) << (8 * 0))
/*
* these registers are accessed through port vendor
* specific address/data registers

View File

@ -84,6 +84,8 @@ static struct sas_domain_function_template mvs_transport_ops = {
.lldd_port_formed = mvs_port_formed,
.lldd_port_deformed = mvs_port_deformed,
.lldd_write_gpio = mvs_gpio_write,
};
static void mvs_phy_init(struct mvs_info *mvi, int phy_id)

View File

@ -737,8 +737,8 @@ static int mvs_task_prep(struct sas_task *task, struct mvs_info *mvi, int is_tmf
mv_dprintk("device %016llx not ready.\n",
SAS_ADDR(dev->sas_addr));
rc = SAS_PHY_DOWN;
return rc;
rc = SAS_PHY_DOWN;
return rc;
}
tei.port = dev->port->lldd_port;
if (tei.port && !tei.port->port_attached && !tmf) {
@ -2105,3 +2105,16 @@ int mvs_int_rx(struct mvs_info *mvi, bool self_clear)
return 0;
}
int mvs_gpio_write(struct sas_ha_struct *sha, u8 reg_type, u8 reg_index,
u8 reg_count, u8 *write_data)
{
struct mvs_prv_info *mvs_prv = sha->lldd_ha;
struct mvs_info *mvi = mvs_prv->mvi[0];
if (MVS_CHIP_DISP->gpio_write) {
return MVS_CHIP_DISP->gpio_write(mvs_prv, reg_type,
reg_index, reg_count, write_data);
}
return -ENOSYS;
}

View File

@ -103,6 +103,7 @@ enum dev_reset {
};
struct mvs_info;
struct mvs_prv_info;
struct mvs_dispatch {
char *name;
@ -172,6 +173,8 @@ struct mvs_dispatch {
int buf_len, int from, void *prd);
void (*tune_interrupt)(struct mvs_info *mvi, u32 time);
void (*non_spec_ncq_error)(struct mvs_info *mvi);
int (*gpio_write)(struct mvs_prv_info *mvs_prv, u8 reg_type,
u8 reg_index, u8 reg_count, u8 *write_data);
};
@ -476,5 +479,7 @@ void mvs_int_port(struct mvs_info *mvi, int phy_no, u32 events);
void mvs_update_phyinfo(struct mvs_info *mvi, int i, int get_st);
int mvs_int_rx(struct mvs_info *mvi, bool self_clear);
struct mvs_device *mvs_find_dev_by_reg_set(struct mvs_info *mvi, u8 reg_set);
int mvs_gpio_write(struct sas_ha_struct *, u8 reg_type, u8 reg_index,
u8 reg_count, u8 *write_data);
#endif

View File

@ -170,10 +170,7 @@ static int _osd_get_print_system_info(struct osd_dev *od,
/* FIXME: Where are the time utilities */
pFirst = get_attrs[a++].val_ptr;
OSD_INFO("CLOCK [0x%02x%02x%02x%02x%02x%02x]\n",
((char *)pFirst)[0], ((char *)pFirst)[1],
((char *)pFirst)[2], ((char *)pFirst)[3],
((char *)pFirst)[4], ((char *)pFirst)[5]);
OSD_INFO("CLOCK [0x%6phN]\n", pFirst);
if (a < nelem) { /* IBM-OSD-SIM bug, Might not have it */
unsigned len = get_attrs[a].len;

View File

@ -18,9 +18,6 @@ config SCSI_QLA_FC
2322, 6322 ql2322_fw.bin
24xx, 54xx ql2400_fw.bin
25xx ql2500_fw.bin
2031 ql2600_fw.bin
8031 ql8300_fw.bin
27xx ql2700_fw.bin
Upon request, the driver caches the firmware image until
the driver is unloaded.

View File

@ -5843,6 +5843,3 @@ MODULE_FIRMWARE(FW_FILE_ISP2300);
MODULE_FIRMWARE(FW_FILE_ISP2322);
MODULE_FIRMWARE(FW_FILE_ISP24XX);
MODULE_FIRMWARE(FW_FILE_ISP25XX);
MODULE_FIRMWARE(FW_FILE_ISP2031);
MODULE_FIRMWARE(FW_FILE_ISP8031);
MODULE_FIRMWARE(FW_FILE_ISP27XX);

View File

@ -782,7 +782,7 @@ void scsi_attach_vpd(struct scsi_device *sdev)
int vpd_len = SCSI_VPD_PG_LEN;
int pg80_supported = 0;
int pg83_supported = 0;
unsigned char *vpd_buf;
unsigned char __rcu *vpd_buf, *orig_vpd_buf = NULL;
if (sdev->skip_vpd_pages)
return;
@ -828,8 +828,16 @@ retry_pg80:
kfree(vpd_buf);
goto retry_pg80;
}
mutex_lock(&sdev->inquiry_mutex);
orig_vpd_buf = sdev->vpd_pg80;
sdev->vpd_pg80_len = result;
sdev->vpd_pg80 = vpd_buf;
rcu_assign_pointer(sdev->vpd_pg80, vpd_buf);
mutex_unlock(&sdev->inquiry_mutex);
synchronize_rcu();
if (orig_vpd_buf) {
kfree(orig_vpd_buf);
orig_vpd_buf = NULL;
}
vpd_len = SCSI_VPD_PG_LEN;
}
@ -849,8 +857,14 @@ retry_pg83:
kfree(vpd_buf);
goto retry_pg83;
}
mutex_lock(&sdev->inquiry_mutex);
orig_vpd_buf = sdev->vpd_pg83;
sdev->vpd_pg83_len = result;
sdev->vpd_pg83 = vpd_buf;
rcu_assign_pointer(sdev->vpd_pg83, vpd_buf);
mutex_unlock(&sdev->inquiry_mutex);
synchronize_rcu();
if (orig_vpd_buf)
kfree(orig_vpd_buf);
}
}

View File

@ -129,7 +129,7 @@ static const char *scsi_debug_version_date = "20141022";
#define DEF_NO_LUN_0 0
#define DEF_NUM_PARTS 0
#define DEF_OPTS 0
#define DEF_OPT_BLKS 64
#define DEF_OPT_BLKS 1024
#define DEF_PHYSBLK_EXP 0
#define DEF_PTYPE 0
#define DEF_REMOVABLE false
@ -679,7 +679,7 @@ static void *fake_store(unsigned long long lba)
static struct sd_dif_tuple *dif_store(sector_t sector)
{
sector = do_div(sector, sdebug_store_sectors);
sector = sector_div(sector, sdebug_store_sectors);
return dif_storep + sector;
}
@ -2781,7 +2781,7 @@ static unsigned long lba_to_map_index(sector_t lba)
lba += scsi_debug_unmap_granularity -
scsi_debug_unmap_alignment;
}
do_div(lba, scsi_debug_unmap_granularity);
sector_div(lba, scsi_debug_unmap_granularity);
return lba;
}
@ -4140,7 +4140,7 @@ MODULE_PARM_DESC(no_lun_0, "no LU number 0 (def=0 -> have lun 0)");
MODULE_PARM_DESC(no_uld, "stop ULD (e.g. sd driver) attaching (def=0))");
MODULE_PARM_DESC(num_parts, "number of partitions(def=0)");
MODULE_PARM_DESC(num_tgts, "number of targets per host to simulate(def=1)");
MODULE_PARM_DESC(opt_blks, "optimal transfer length in block (def=64)");
MODULE_PARM_DESC(opt_blks, "optimal transfer length in blocks (def=1024)");
MODULE_PARM_DESC(opts, "1->noise, 2->medium_err, 4->timeout, 8->recovered_err... (def=0)");
MODULE_PARM_DESC(physblk_exp, "physical block exponent (def=0)");
MODULE_PARM_DESC(ptype, "SCSI peripheral type(def=0[disk])");
@ -4847,10 +4847,10 @@ static int __init scsi_debug_init(void)
/* play around with geometry, don't waste too much on track 0 */
sdebug_heads = 8;
sdebug_sectors_per = 32;
if (scsi_debug_dev_size_mb >= 16)
sdebug_heads = 32;
else if (scsi_debug_dev_size_mb >= 256)
if (scsi_debug_dev_size_mb >= 256)
sdebug_heads = 64;
else if (scsi_debug_dev_size_mb >= 16)
sdebug_heads = 32;
sdebug_cylinders_per = (unsigned long)sdebug_capacity /
(sdebug_sectors_per * sdebug_heads);
if (sdebug_cylinders_per >= 1024) {

View File

@ -153,76 +153,11 @@ static void scsi_dh_handler_detach(struct scsi_device *sdev)
module_put(sdev->handler->module);
}
/*
* Functions for sysfs attribute 'dh_state'
*/
static ssize_t
store_dh_state(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{
struct scsi_device *sdev = to_scsi_device(dev);
struct scsi_device_handler *scsi_dh;
int err = -EINVAL;
if (sdev->sdev_state == SDEV_CANCEL ||
sdev->sdev_state == SDEV_DEL)
return -ENODEV;
if (!sdev->handler) {
/*
* Attach to a device handler
*/
scsi_dh = scsi_dh_lookup(buf);
if (!scsi_dh)
return err;
err = scsi_dh_handler_attach(sdev, scsi_dh);
} else {
if (!strncmp(buf, "detach", 6)) {
/*
* Detach from a device handler
*/
sdev_printk(KERN_WARNING, sdev,
"can't detach handler %s.\n",
sdev->handler->name);
err = -EINVAL;
} else if (!strncmp(buf, "activate", 8)) {
/*
* Activate a device handler
*/
if (sdev->handler->activate)
err = sdev->handler->activate(sdev, NULL, NULL);
else
err = 0;
}
}
return err<0?err:count;
}
static ssize_t
show_dh_state(struct device *dev, struct device_attribute *attr, char *buf)
{
struct scsi_device *sdev = to_scsi_device(dev);
if (!sdev->handler)
return snprintf(buf, 20, "detached\n");
return snprintf(buf, 20, "%s\n", sdev->handler->name);
}
static struct device_attribute scsi_dh_state_attr =
__ATTR(dh_state, S_IRUGO | S_IWUSR, show_dh_state,
store_dh_state);
int scsi_dh_add_device(struct scsi_device *sdev)
{
struct scsi_device_handler *devinfo = NULL;
const char *drv;
int err;
err = device_create_file(&sdev->sdev_gendev, &scsi_dh_state_attr);
if (err)
return err;
int err = 0;
drv = scsi_dh_find_driver(sdev);
if (drv)
@ -238,11 +173,6 @@ void scsi_dh_release_device(struct scsi_device *sdev)
scsi_dh_handler_detach(sdev);
}
void scsi_dh_remove_device(struct scsi_device *sdev)
{
device_remove_file(&sdev->sdev_gendev, &scsi_dh_state_attr);
}
/*
* scsi_register_device_handler - register a device handler personality
* module.

View File

@ -23,6 +23,7 @@
#include <linux/scatterlist.h>
#include <linux/blk-mq.h>
#include <linux/ratelimit.h>
#include <asm/unaligned.h>
#include <scsi/scsi.h>
#include <scsi/scsi_cmnd.h>
@ -3154,3 +3155,190 @@ void sdev_enable_disk_events(struct scsi_device *sdev)
atomic_dec(&sdev->disk_events_disable_depth);
}
EXPORT_SYMBOL(sdev_enable_disk_events);
/**
* scsi_vpd_lun_id - return a unique device identification
* @sdev: SCSI device
* @id: buffer for the identification
* @id_len: length of the buffer
*
* Copies a unique device identification into @id based
* on the information in the VPD page 0x83 of the device.
* The string will be formatted as a SCSI name string.
*
* Returns the length of the identification or error on failure.
* If the identifier is longer than the supplied buffer the actual
* identifier length is returned and the buffer is not zero-padded.
*/
int scsi_vpd_lun_id(struct scsi_device *sdev, char *id, size_t id_len)
{
u8 cur_id_type = 0xff;
u8 cur_id_size = 0;
unsigned char *d, *cur_id_str;
unsigned char __rcu *vpd_pg83;
int id_size = -EINVAL;
rcu_read_lock();
vpd_pg83 = rcu_dereference(sdev->vpd_pg83);
if (!vpd_pg83) {
rcu_read_unlock();
return -ENXIO;
}
/*
* Look for the correct descriptor.
* Order of preference for lun descriptor:
* - SCSI name string
* - NAA IEEE Registered Extended
* - EUI-64 based 16-byte
* - EUI-64 based 12-byte
* - NAA IEEE Registered
* - NAA IEEE Extended
* as longer descriptors reduce the likelyhood
* of identification clashes.
*/
/* The id string must be at least 20 bytes + terminating NULL byte */
if (id_len < 21) {
rcu_read_unlock();
return -EINVAL;
}
memset(id, 0, id_len);
d = vpd_pg83 + 4;
while (d < vpd_pg83 + sdev->vpd_pg83_len) {
/* Skip designators not referring to the LUN */
if ((d[1] & 0x30) != 0x00)
goto next_desig;
switch (d[1] & 0xf) {
case 0x2:
/* EUI-64 */
if (cur_id_size > d[3])
break;
/* Prefer NAA IEEE Registered Extended */
if (cur_id_type == 0x3 &&
cur_id_size == d[3])
break;
cur_id_size = d[3];
cur_id_str = d + 4;
cur_id_type = d[1] & 0xf;
switch (cur_id_size) {
case 8:
id_size = snprintf(id, id_len,
"eui.%8phN",
cur_id_str);
break;
case 12:
id_size = snprintf(id, id_len,
"eui.%12phN",
cur_id_str);
break;
case 16:
id_size = snprintf(id, id_len,
"eui.%16phN",
cur_id_str);
break;
default:
cur_id_size = 0;
break;
}
break;
case 0x3:
/* NAA */
if (cur_id_size > d[3])
break;
cur_id_size = d[3];
cur_id_str = d + 4;
cur_id_type = d[1] & 0xf;
switch (cur_id_size) {
case 8:
id_size = snprintf(id, id_len,
"naa.%8phN",
cur_id_str);
break;
case 16:
id_size = snprintf(id, id_len,
"naa.%16phN",
cur_id_str);
break;
default:
cur_id_size = 0;
break;
}
break;
case 0x8:
/* SCSI name string */
if (cur_id_size + 4 > d[3])
break;
/* Prefer others for truncated descriptor */
if (cur_id_size && d[3] > id_len)
break;
cur_id_size = id_size = d[3];
cur_id_str = d + 4;
cur_id_type = d[1] & 0xf;
if (cur_id_size >= id_len)
cur_id_size = id_len - 1;
memcpy(id, cur_id_str, cur_id_size);
/* Decrease priority for truncated descriptor */
if (cur_id_size != id_size)
cur_id_size = 6;
break;
default:
break;
}
next_desig:
d += d[3] + 4;
}
rcu_read_unlock();
return id_size;
}
EXPORT_SYMBOL(scsi_vpd_lun_id);
/*
* scsi_vpd_tpg_id - return a target port group identifier
* @sdev: SCSI device
*
* Returns the Target Port Group identifier from the information
* froom VPD page 0x83 of the device.
*
* Returns the identifier or error on failure.
*/
int scsi_vpd_tpg_id(struct scsi_device *sdev, int *rel_id)
{
unsigned char *d;
unsigned char __rcu *vpd_pg83;
int group_id = -EAGAIN, rel_port = -1;
rcu_read_lock();
vpd_pg83 = rcu_dereference(sdev->vpd_pg83);
if (!vpd_pg83) {
rcu_read_unlock();
return -ENXIO;
}
d = sdev->vpd_pg83 + 4;
while (d < sdev->vpd_pg83 + sdev->vpd_pg83_len) {
switch (d[1] & 0xf) {
case 0x4:
/* Relative target port */
rel_port = get_unaligned_be16(&d[6]);
break;
case 0x5:
/* Target port group */
group_id = get_unaligned_be16(&d[6]);
break;
default:
break;
}
d += d[3] + 4;
}
rcu_read_unlock();
if (group_id >= 0 && rel_id && rel_port != -1)
*rel_id = rel_port;
return group_id;
}
EXPORT_SYMBOL(scsi_vpd_tpg_id);

View File

@ -174,12 +174,11 @@ extern struct async_domain scsi_sd_probe_domain;
#ifdef CONFIG_SCSI_DH
int scsi_dh_add_device(struct scsi_device *sdev);
void scsi_dh_release_device(struct scsi_device *sdev);
void scsi_dh_remove_device(struct scsi_device *sdev);
#else
static inline int scsi_dh_add_device(struct scsi_device *sdev) { return 0; }
static inline void scsi_dh_release_device(struct scsi_device *sdev) { }
static inline void scsi_dh_remove_device(struct scsi_device *sdev) { }
#endif
static inline void scsi_dh_remove_device(struct scsi_device *sdev) { }
/*
* internal scsi timeout functions: for use by mid-layer and transport

View File

@ -236,6 +236,7 @@ static struct scsi_device *scsi_alloc_sdev(struct scsi_target *starget,
INIT_LIST_HEAD(&sdev->starved_entry);
INIT_LIST_HEAD(&sdev->event_list);
spin_lock_init(&sdev->list_lock);
mutex_init(&sdev->inquiry_mutex);
INIT_WORK(&sdev->event_work, scsi_evt_thread);
INIT_WORK(&sdev->requeue_work, scsi_requeue_run_queue);
@ -1519,6 +1520,9 @@ EXPORT_SYMBOL(scsi_add_device);
void scsi_rescan_device(struct device *dev)
{
device_lock(dev);
scsi_attach_vpd(to_scsi_device(dev));
if (dev->driver && try_module_get(dev->driver->owner)) {
struct scsi_driver *drv = to_scsi_driver(dev->driver);

View File

@ -17,6 +17,7 @@
#include <scsi/scsi_device.h>
#include <scsi/scsi_host.h>
#include <scsi/scsi_tcq.h>
#include <scsi/scsi_dh.h>
#include <scsi/scsi_transport.h>
#include <scsi/scsi_driver.h>
@ -760,11 +761,15 @@ show_vpd_##_page(struct file *filp, struct kobject *kobj, \
{ \
struct device *dev = container_of(kobj, struct device, kobj); \
struct scsi_device *sdev = to_scsi_device(dev); \
int ret; \
if (!sdev->vpd_##_page) \
return -EINVAL; \
return memory_read_from_buffer(buf, count, &off, \
sdev->vpd_##_page, \
rcu_read_lock(); \
ret = memory_read_from_buffer(buf, count, &off, \
rcu_dereference(sdev->vpd_##_page), \
sdev->vpd_##_page##_len); \
rcu_read_unlock(); \
return ret; \
} \
static struct bin_attribute dev_attr_vpd_##_page = { \
.attr = {.name = __stringify(vpd_##_page), .mode = S_IRUGO }, \
@ -900,6 +905,76 @@ sdev_show_function(queue_depth, "%d\n");
static DEVICE_ATTR(queue_depth, S_IRUGO | S_IWUSR, sdev_show_queue_depth,
sdev_store_queue_depth);
static ssize_t
sdev_show_wwid(struct device *dev, struct device_attribute *attr,
char *buf)
{
struct scsi_device *sdev = to_scsi_device(dev);
ssize_t count;
count = scsi_vpd_lun_id(sdev, buf, PAGE_SIZE);
if (count > 0) {
buf[count] = '\n';
count++;
}
return count;
}
static DEVICE_ATTR(wwid, S_IRUGO, sdev_show_wwid, NULL);
#ifdef CONFIG_SCSI_DH
static ssize_t
sdev_show_dh_state(struct device *dev, struct device_attribute *attr,
char *buf)
{
struct scsi_device *sdev = to_scsi_device(dev);
if (!sdev->handler)
return snprintf(buf, 20, "detached\n");
return snprintf(buf, 20, "%s\n", sdev->handler->name);
}
static ssize_t
sdev_store_dh_state(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{
struct scsi_device *sdev = to_scsi_device(dev);
int err = -EINVAL;
if (sdev->sdev_state == SDEV_CANCEL ||
sdev->sdev_state == SDEV_DEL)
return -ENODEV;
if (!sdev->handler) {
/*
* Attach to a device handler
*/
err = scsi_dh_attach(sdev->request_queue, buf);
} else if (!strncmp(buf, "activate", 8)) {
/*
* Activate a device handler
*/
if (sdev->handler->activate)
err = sdev->handler->activate(sdev, NULL, NULL);
else
err = 0;
} else if (!strncmp(buf, "detach", 6)) {
/*
* Detach from a device handler
*/
sdev_printk(KERN_WARNING, sdev,
"can't detach handler %s.\n",
sdev->handler->name);
err = -EINVAL;
}
return err < 0 ? err : count;
}
static DEVICE_ATTR(dh_state, S_IRUGO | S_IWUSR, sdev_show_dh_state,
sdev_store_dh_state);
#endif
static ssize_t
sdev_show_queue_ramp_up_period(struct device *dev,
struct device_attribute *attr,
@ -969,6 +1044,10 @@ static struct attribute *scsi_sdev_attrs[] = {
&dev_attr_modalias.attr,
&dev_attr_queue_depth.attr,
&dev_attr_queue_type.attr,
&dev_attr_wwid.attr,
#ifdef CONFIG_SCSI_DH
&dev_attr_dh_state.attr,
#endif
&dev_attr_queue_ramp_up_period.attr,
REF_EVT(media_change),
REF_EVT(inquiry_change_reported),
@ -1058,11 +1137,12 @@ int scsi_sysfs_add_sdev(struct scsi_device *sdev)
}
error = scsi_dh_add_device(sdev);
if (error) {
if (error)
/*
* device_handler is optional, so any error can be ignored
*/
sdev_printk(KERN_INFO, sdev,
"failed to add device handler: %d\n", error);
return error;
}
device_enable_async_suspend(&sdev->sdev_dev);
error = device_add(&sdev->sdev_dev);

View File

@ -2586,7 +2586,7 @@ fc_rport_final_delete(struct work_struct *work)
transport_remove_device(dev);
device_del(dev);
transport_destroy_device(dev);
put_device(&shost->shost_gendev); /* for fc_host->rport list */
scsi_host_put(shost); /* for fc_host->rport list */
put_device(dev); /* for self-reference */
}
@ -2650,7 +2650,7 @@ fc_rport_create(struct Scsi_Host *shost, int channel,
else
rport->scsi_target_id = -1;
list_add_tail(&rport->peers, &fc_host->rports);
get_device(&shost->shost_gendev); /* for fc_host->rport list */
scsi_host_get(shost); /* for fc_host->rport list */
spin_unlock_irqrestore(shost->host_lock, flags);
@ -2685,7 +2685,7 @@ delete_rport:
transport_destroy_device(dev);
spin_lock_irqsave(shost->host_lock, flags);
list_del(&rport->peers);
put_device(&shost->shost_gendev); /* for fc_host->rport list */
scsi_host_put(shost); /* for fc_host->rport list */
spin_unlock_irqrestore(shost->host_lock, flags);
put_device(dev->parent);
kfree(rport);
@ -3383,7 +3383,7 @@ fc_vport_setup(struct Scsi_Host *shost, int channel, struct device *pdev,
fc_host->npiv_vports_inuse++;
vport->number = fc_host->next_vport_number++;
list_add_tail(&vport->peers, &fc_host->vports);
get_device(&shost->shost_gendev); /* for fc_host->vport list */
scsi_host_get(shost); /* for fc_host->vport list */
spin_unlock_irqrestore(shost->host_lock, flags);
@ -3441,7 +3441,7 @@ delete_vport:
transport_destroy_device(dev);
spin_lock_irqsave(shost->host_lock, flags);
list_del(&vport->peers);
put_device(&shost->shost_gendev); /* for fc_host->vport list */
scsi_host_put(shost); /* for fc_host->vport list */
fc_host->npiv_vports_inuse--;
spin_unlock_irqrestore(shost->host_lock, flags);
put_device(dev->parent);
@ -3504,7 +3504,7 @@ fc_vport_terminate(struct fc_vport *vport)
vport->flags |= FC_VPORT_DELETED;
list_del(&vport->peers);
fc_host->npiv_vports_inuse--;
put_device(&shost->shost_gendev); /* for fc_host->vport list */
scsi_host_put(shost); /* for fc_host->vport list */
}
spin_unlock_irqrestore(shost->host_lock, flags);

View File

@ -340,6 +340,22 @@ static int do_sas_phy_delete(struct device *dev, void *data)
return 0;
}
/**
* is_sas_attached - check if device is SAS attached
* @sdev: scsi device to check
*
* returns true if the device is SAS attached
*/
int is_sas_attached(struct scsi_device *sdev)
{
struct Scsi_Host *shost = sdev->host;
return shost->transportt->host_attrs.ac.class ==
&sas_host_class.class;
}
EXPORT_SYMBOL(is_sas_attached);
/**
* sas_remove_children - tear down a devices SAS data structures
* @dev: device belonging to the sas object
@ -366,6 +382,20 @@ void sas_remove_host(struct Scsi_Host *shost)
}
EXPORT_SYMBOL(sas_remove_host);
/**
* sas_get_address - return the SAS address of the device
* @sdev: scsi device
*
* Returns the SAS address of the scsi device
*/
u64 sas_get_address(struct scsi_device *sdev)
{
struct sas_end_device *rdev = sas_sdev_to_rdev(sdev);
return rdev->rphy.identify.sas_address;
}
EXPORT_SYMBOL(sas_get_address);
/**
* sas_tlr_supported - checking TLR bit in vpd 0x90
* @sdev: scsi device struct

View File

@ -34,6 +34,8 @@
#include <scsi/scsi_driver.h>
#include <scsi/scsi_host.h>
#include <scsi/scsi_transport_sas.h>
struct ses_device {
unsigned char *page1;
unsigned char *page1_types;
@ -579,31 +581,15 @@ static void ses_enclosure_data_process(struct enclosure_device *edev,
static void ses_match_to_enclosure(struct enclosure_device *edev,
struct scsi_device *sdev)
{
unsigned char *desc;
struct efd efd = {
.addr = 0,
};
ses_enclosure_data_process(edev, to_scsi_device(edev->edev.parent), 0);
if (!sdev->vpd_pg83_len)
return;
if (is_sas_attached(sdev))
efd.addr = sas_get_address(sdev);
desc = sdev->vpd_pg83 + 4;
while (desc < sdev->vpd_pg83 + sdev->vpd_pg83_len) {
enum scsi_protocol proto = desc[0] >> 4;
u8 code_set = desc[0] & 0x0f;
u8 piv = desc[1] & 0x80;
u8 assoc = (desc[1] & 0x30) >> 4;
u8 type = desc[1] & 0x0f;
u8 len = desc[3];
if (piv && code_set == 1 && assoc == 1
&& proto == SCSI_PROTOCOL_SAS && type == 3 && len == 8)
efd.addr = get_unaligned_be64(&desc[4]);
desc += len + 4;
}
if (efd.addr) {
efd.dev = &sdev->sdev_gendev;

Some files were not shown because too many files have changed in this diff Show More