aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/bfa
diff options
context:
space:
mode:
authorKrishna Gudipati <kgudipat@brocade.com>2011-07-20 20:02:32 -0400
committerJames Bottomley <JBottomley@Parallels.com>2011-07-27 06:50:06 -0400
commita46bd300e191d5a1a7367a799a9f5268c5e6aafd (patch)
treed5735b3f19dc62fb0ad182e597337eb416f620b9 /drivers/scsi/bfa
parent37ea0558b87abb151245bc750070a4dcda490aca (diff)
[SCSI] bfa: Add support to configure and query flash boot partition
Signed-off-by: Krishna Gudipati <kgudipat@brocade.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/bfa')
-rw-r--r--drivers/scsi/bfa/bfa_defs.h23
-rw-r--r--drivers/scsi/bfa/bfad_bsg.c124
-rw-r--r--drivers/scsi/bfa/bfad_bsg.h26
3 files changed, 173 insertions, 0 deletions
diff --git a/drivers/scsi/bfa/bfa_defs.h b/drivers/scsi/bfa/bfa_defs.h
index 2dc4b6fc79d0..75b9d91d1f94 100644
--- a/drivers/scsi/bfa/bfa_defs.h
+++ b/drivers/scsi/bfa/bfa_defs.h
@@ -656,6 +656,20 @@ struct bfa_boot_bootlun_s {
656/* 656/*
657 * BOOT boot configuraton 657 * BOOT boot configuraton
658 */ 658 */
659struct bfa_boot_cfg_s {
660 u8 version;
661 u8 rsvd1;
662 u16 chksum;
663 u8 enable; /* enable/disable SAN boot */
664 u8 speed; /* boot speed settings */
665 u8 topology; /* boot topology setting */
666 u8 bootopt; /* bfa_boot_bootopt_t */
667 u32 nbluns; /* number of boot luns */
668 u32 rsvd2;
669 struct bfa_boot_bootlun_s blun[BFA_BOOT_BOOTLUN_MAX];
670 struct bfa_boot_bootlun_s blun_disc[BFA_BOOT_BOOTLUN_MAX];
671};
672
659struct bfa_boot_pbc_s { 673struct bfa_boot_pbc_s {
660 u8 enable; /* enable/disable SAN boot */ 674 u8 enable; /* enable/disable SAN boot */
661 u8 speed; /* boot speed settings */ 675 u8 speed; /* boot speed settings */
@@ -665,6 +679,15 @@ struct bfa_boot_pbc_s {
665 struct bfa_boot_bootlun_s pblun[BFA_PREBOOT_BOOTLUN_MAX]; 679 struct bfa_boot_bootlun_s pblun[BFA_PREBOOT_BOOTLUN_MAX];
666}; 680};
667 681
682struct bfa_ethboot_cfg_s {
683 u8 version;
684 u8 rsvd1;
685 u16 chksum;
686 u8 enable; /* enable/disable Eth/PXE boot */
687 u8 rsvd2;
688 u16 vlan;
689};
690
668/* 691/*
669 * ASIC block configuration related structures 692 * ASIC block configuration related structures
670 */ 693 */
diff --git a/drivers/scsi/bfa/bfad_bsg.c b/drivers/scsi/bfa/bfad_bsg.c
index 0d920edebac9..f782ee4b8868 100644
--- a/drivers/scsi/bfa/bfad_bsg.c
+++ b/drivers/scsi/bfa/bfad_bsg.c
@@ -2072,6 +2072,115 @@ out:
2072 return 0; 2072 return 0;
2073} 2073}
2074 2074
2075int
2076bfad_iocmd_boot_cfg(struct bfad_s *bfad, void *cmd)
2077{
2078 struct bfa_bsg_boot_s *iocmd = (struct bfa_bsg_boot_s *)cmd;
2079 struct bfad_hal_comp fcomp;
2080 unsigned long flags;
2081
2082 init_completion(&fcomp.comp);
2083 spin_lock_irqsave(&bfad->bfad_lock, flags);
2084 iocmd->status = bfa_flash_update_part(BFA_FLASH(&bfad->bfa),
2085 BFA_FLASH_PART_BOOT, PCI_FUNC(bfad->pcidev->devfn),
2086 &iocmd->cfg, sizeof(struct bfa_boot_cfg_s), 0,
2087 bfad_hcb_comp, &fcomp);
2088 spin_unlock_irqrestore(&bfad->bfad_lock, flags);
2089 if (iocmd->status != BFA_STATUS_OK)
2090 goto out;
2091 wait_for_completion(&fcomp.comp);
2092 iocmd->status = fcomp.status;
2093out:
2094 return 0;
2095}
2096
2097int
2098bfad_iocmd_boot_query(struct bfad_s *bfad, void *cmd)
2099{
2100 struct bfa_bsg_boot_s *iocmd = (struct bfa_bsg_boot_s *)cmd;
2101 struct bfad_hal_comp fcomp;
2102 unsigned long flags;
2103
2104 init_completion(&fcomp.comp);
2105 spin_lock_irqsave(&bfad->bfad_lock, flags);
2106 iocmd->status = bfa_flash_read_part(BFA_FLASH(&bfad->bfa),
2107 BFA_FLASH_PART_BOOT, PCI_FUNC(bfad->pcidev->devfn),
2108 &iocmd->cfg, sizeof(struct bfa_boot_cfg_s), 0,
2109 bfad_hcb_comp, &fcomp);
2110 spin_unlock_irqrestore(&bfad->bfad_lock, flags);
2111 if (iocmd->status != BFA_STATUS_OK)
2112 goto out;
2113 wait_for_completion(&fcomp.comp);
2114 iocmd->status = fcomp.status;
2115out:
2116 return 0;
2117}
2118
2119int
2120bfad_iocmd_preboot_query(struct bfad_s *bfad, void *cmd)
2121{
2122 struct bfa_bsg_preboot_s *iocmd = (struct bfa_bsg_preboot_s *)cmd;
2123 struct bfi_iocfc_cfgrsp_s *cfgrsp = bfad->bfa.iocfc.cfgrsp;
2124 struct bfa_boot_pbc_s *pbcfg = &iocmd->cfg;
2125 unsigned long flags;
2126
2127 spin_lock_irqsave(&bfad->bfad_lock, flags);
2128 pbcfg->enable = cfgrsp->pbc_cfg.boot_enabled;
2129 pbcfg->nbluns = cfgrsp->pbc_cfg.nbluns;
2130 pbcfg->speed = cfgrsp->pbc_cfg.port_speed;
2131 memcpy(pbcfg->pblun, cfgrsp->pbc_cfg.blun, sizeof(pbcfg->pblun));
2132 iocmd->status = BFA_STATUS_OK;
2133 spin_unlock_irqrestore(&bfad->bfad_lock, flags);
2134
2135 return 0;
2136}
2137
2138int
2139bfad_iocmd_ethboot_cfg(struct bfad_s *bfad, void *cmd)
2140{
2141 struct bfa_bsg_ethboot_s *iocmd = (struct bfa_bsg_ethboot_s *)cmd;
2142 struct bfad_hal_comp fcomp;
2143 unsigned long flags;
2144
2145 init_completion(&fcomp.comp);
2146 spin_lock_irqsave(&bfad->bfad_lock, flags);
2147 iocmd->status = bfa_flash_update_part(BFA_FLASH(&bfad->bfa),
2148 BFA_FLASH_PART_PXECFG,
2149 bfad->bfa.ioc.port_id, &iocmd->cfg,
2150 sizeof(struct bfa_ethboot_cfg_s), 0,
2151 bfad_hcb_comp, &fcomp);
2152 spin_unlock_irqrestore(&bfad->bfad_lock, flags);
2153 if (iocmd->status != BFA_STATUS_OK)
2154 goto out;
2155 wait_for_completion(&fcomp.comp);
2156 iocmd->status = fcomp.status;
2157out:
2158 return 0;
2159}
2160
2161int
2162bfad_iocmd_ethboot_query(struct bfad_s *bfad, void *cmd)
2163{
2164 struct bfa_bsg_ethboot_s *iocmd = (struct bfa_bsg_ethboot_s *)cmd;
2165 struct bfad_hal_comp fcomp;
2166 unsigned long flags;
2167
2168 init_completion(&fcomp.comp);
2169 spin_lock_irqsave(&bfad->bfad_lock, flags);
2170 iocmd->status = bfa_flash_read_part(BFA_FLASH(&bfad->bfa),
2171 BFA_FLASH_PART_PXECFG,
2172 bfad->bfa.ioc.port_id, &iocmd->cfg,
2173 sizeof(struct bfa_ethboot_cfg_s), 0,
2174 bfad_hcb_comp, &fcomp);
2175 spin_unlock_irqrestore(&bfad->bfad_lock, flags);
2176 if (iocmd->status != BFA_STATUS_OK)
2177 goto out;
2178 wait_for_completion(&fcomp.comp);
2179 iocmd->status = fcomp.status;
2180out:
2181 return 0;
2182}
2183
2075static int 2184static int
2076bfad_iocmd_handler(struct bfad_s *bfad, unsigned int cmd, void *iocmd, 2185bfad_iocmd_handler(struct bfad_s *bfad, unsigned int cmd, void *iocmd,
2077 unsigned int payload_len) 2186 unsigned int payload_len)
@@ -2346,6 +2455,21 @@ bfad_iocmd_handler(struct bfad_s *bfad, unsigned int cmd, void *iocmd,
2346 case IOCMD_FCPORT_RESET_STATS: 2455 case IOCMD_FCPORT_RESET_STATS:
2347 rc = bfad_iocmd_fcport_reset_stats(bfad, iocmd); 2456 rc = bfad_iocmd_fcport_reset_stats(bfad, iocmd);
2348 break; 2457 break;
2458 case IOCMD_BOOT_CFG:
2459 rc = bfad_iocmd_boot_cfg(bfad, iocmd);
2460 break;
2461 case IOCMD_BOOT_QUERY:
2462 rc = bfad_iocmd_boot_query(bfad, iocmd);
2463 break;
2464 case IOCMD_PREBOOT_QUERY:
2465 rc = bfad_iocmd_preboot_query(bfad, iocmd);
2466 break;
2467 case IOCMD_ETHBOOT_CFG:
2468 rc = bfad_iocmd_ethboot_cfg(bfad, iocmd);
2469 break;
2470 case IOCMD_ETHBOOT_QUERY:
2471 rc = bfad_iocmd_ethboot_query(bfad, iocmd);
2472 break;
2349 default: 2473 default:
2350 rc = -EINVAL; 2474 rc = -EINVAL;
2351 break; 2475 break;
diff --git a/drivers/scsi/bfa/bfad_bsg.h b/drivers/scsi/bfa/bfad_bsg.h
index f64f3eee6dbf..95694cee0cd8 100644
--- a/drivers/scsi/bfa/bfad_bsg.h
+++ b/drivers/scsi/bfa/bfad_bsg.h
@@ -121,6 +121,11 @@ enum {
121 IOCMD_ITNIM_GET_IOPROFILE, 121 IOCMD_ITNIM_GET_IOPROFILE,
122 IOCMD_FCPORT_GET_STATS, 122 IOCMD_FCPORT_GET_STATS,
123 IOCMD_FCPORT_RESET_STATS, 123 IOCMD_FCPORT_RESET_STATS,
124 IOCMD_BOOT_CFG,
125 IOCMD_BOOT_QUERY,
126 IOCMD_PREBOOT_QUERY,
127 IOCMD_ETHBOOT_CFG,
128 IOCMD_ETHBOOT_QUERY,
124}; 129};
125 130
126struct bfa_bsg_gen_s { 131struct bfa_bsg_gen_s {
@@ -630,6 +635,27 @@ struct bfa_bsg_vhba_attr_s {
630 struct bfa_vhba_attr_s attr; 635 struct bfa_vhba_attr_s attr;
631}; 636};
632 637
638struct bfa_bsg_boot_s {
639 bfa_status_t status;
640 u16 bfad_num;
641 u16 rsvd;
642 struct bfa_boot_cfg_s cfg;
643};
644
645struct bfa_bsg_preboot_s {
646 bfa_status_t status;
647 u16 bfad_num;
648 u16 rsvd;
649 struct bfa_boot_pbc_s cfg;
650};
651
652struct bfa_bsg_ethboot_s {
653 bfa_status_t status;
654 u16 bfad_num;
655 u16 rsvd;
656 struct bfa_ethboot_cfg_s cfg;
657};
658
633struct bfa_bsg_fcpt_s { 659struct bfa_bsg_fcpt_s {
634 bfa_status_t status; 660 bfa_status_t status;
635 u16 vf_id; 661 u16 vf_id;