aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/lpfc
diff options
context:
space:
mode:
authorJames Smart <james.smart@emulex.com>2011-08-21 21:48:49 -0400
committerJames Bottomley <JBottomley@Parallels.com>2011-08-29 03:16:18 -0400
commit079b5c916d19e7533c060b32d4a31ce45c3552d2 (patch)
tree7e1ed1356e7fb0395a7adba1c98fda2ee274efe7 /drivers/scsi/lpfc
parentbf08611bcc461d83199a8449930b176823017f58 (diff)
[SCSI] lpfc 8.3.26: Fix HBA initialization issues
Fix HBA initialization issues - Swap all values that come from the firmware image on little endian systems. Created a new bf_get_be macro that does the same as the bf_get_le macro but for big endian data instead of little endian data. - Moved the incrementing of temp_offset after the copy fixed the write object loop to use temp_offset to figure out where the end of the image is instead of offset. - Added the necessary codes for properly bringing the driver instance offline and then trying to bring the port back online with the PCI function IP reset. If it fails to bring the SLI port back online, it will fall through to bringing the SLI port to HBA error offline. - Add a call in the probe_one_s3 and probe_one_s4 routines to get the Modeldesc - Change OCe50100 to OCe15100 - Made the error log also include the PCI BAR bitmap returned from kernel call pci_select_bars(). Signed-off-by: Alex Iannicelli <alex.iannicelli@emulex.com> Signed-off-by: James Smart <james.smart@emulex.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/lpfc')
-rw-r--r--drivers/scsi/lpfc/lpfc_hw4.h2
-rw-r--r--drivers/scsi/lpfc/lpfc_init.c60
2 files changed, 35 insertions, 27 deletions
diff --git a/drivers/scsi/lpfc/lpfc_hw4.h b/drivers/scsi/lpfc/lpfc_hw4.h
index 7f8003b5181..52a197db71e 100644
--- a/drivers/scsi/lpfc/lpfc_hw4.h
+++ b/drivers/scsi/lpfc/lpfc_hw4.h
@@ -41,6 +41,8 @@
41 * Or clear that bit field: 41 * Or clear that bit field:
42 * bf_set(example_bit_field, &t1, 0); 42 * bf_set(example_bit_field, &t1, 0);
43 */ 43 */
44#define bf_get_be32(name, ptr) \
45 ((be32_to_cpu((ptr)->name##_WORD) >> name##_SHIFT) & name##_MASK)
44#define bf_get_le32(name, ptr) \ 46#define bf_get_le32(name, ptr) \
45 ((le32_to_cpu((ptr)->name##_WORD) >> name##_SHIFT) & name##_MASK) 47 ((le32_to_cpu((ptr)->name##_WORD) >> name##_SHIFT) & name##_MASK)
46#define bf_get(name, ptr) \ 48#define bf_get(name, ptr) \
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index a3c820083c3..b9ff38fa7c2 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -1481,15 +1481,18 @@ lpfc_handle_eratt_s4(struct lpfc_hba *phba)
1481 return; 1481 return;
1482 } 1482 }
1483 if (bf_get(lpfc_sliport_status_rn, &portstat_reg)) { 1483 if (bf_get(lpfc_sliport_status_rn, &portstat_reg)) {
1484 /* 1484 /* need reset: attempt for port recovery */
1485 * TODO: Attempt port recovery via a port reset.
1486 * When fully implemented, the driver should
1487 * attempt to recover the port here and return.
1488 * For now, log an error and take the port offline.
1489 */
1490 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, 1485 lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
1491 "2887 Port Error: Attempting " 1486 "2887 Port Error: Attempting "
1492 "Port Recovery\n"); 1487 "Port Recovery\n");
1488 lpfc_offline_prep(phba);
1489 lpfc_offline(phba);
1490 lpfc_sli_brdrestart(phba);
1491 if (lpfc_online(phba) == 0) {
1492 lpfc_unblock_mgmt_io(phba);
1493 return;
1494 }
1495 /* fall through for not able to recover */
1493 } 1496 }
1494 lpfc_sli4_offline_eratt(phba); 1497 lpfc_sli4_offline_eratt(phba);
1495 break; 1498 break;
@@ -1958,7 +1961,7 @@ lpfc_get_hba_model_desc(struct lpfc_hba *phba, uint8_t *mdp, uint8_t *descp)
1958 case PCI_DEVICE_ID_LANCER_FCOE: 1961 case PCI_DEVICE_ID_LANCER_FCOE:
1959 case PCI_DEVICE_ID_LANCER_FCOE_VF: 1962 case PCI_DEVICE_ID_LANCER_FCOE_VF:
1960 oneConnect = 1; 1963 oneConnect = 1;
1961 m = (typeof(m)){"OCe50100", "PCIe", "FCoE"}; 1964 m = (typeof(m)){"OCe15100", "PCIe", "FCoE"};
1962 break; 1965 break;
1963 default: 1966 default:
1964 m = (typeof(m)){"Unknown", "", ""}; 1967 m = (typeof(m)){"Unknown", "", ""};
@@ -3949,7 +3952,7 @@ static int
3949lpfc_enable_pci_dev(struct lpfc_hba *phba) 3952lpfc_enable_pci_dev(struct lpfc_hba *phba)
3950{ 3953{
3951 struct pci_dev *pdev; 3954 struct pci_dev *pdev;
3952 int bars; 3955 int bars = 0;
3953 3956
3954 /* Obtain PCI device reference */ 3957 /* Obtain PCI device reference */
3955 if (!phba->pcidev) 3958 if (!phba->pcidev)
@@ -3978,6 +3981,8 @@ lpfc_enable_pci_dev(struct lpfc_hba *phba)
3978out_disable_device: 3981out_disable_device:
3979 pci_disable_device(pdev); 3982 pci_disable_device(pdev);
3980out_error: 3983out_error:
3984 lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
3985 "1401 Failed to enable pci device, bars:x%x\n", bars);
3981 return -ENODEV; 3986 return -ENODEV;
3982} 3987}
3983 3988
@@ -8271,11 +8276,8 @@ lpfc_pci_probe_one_s3(struct pci_dev *pdev, const struct pci_device_id *pid)
8271 8276
8272 /* Perform generic PCI device enabling operation */ 8277 /* Perform generic PCI device enabling operation */
8273 error = lpfc_enable_pci_dev(phba); 8278 error = lpfc_enable_pci_dev(phba);
8274 if (error) { 8279 if (error)
8275 lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
8276 "1401 Failed to enable pci device.\n");
8277 goto out_free_phba; 8280 goto out_free_phba;
8278 }
8279 8281
8280 /* Set up SLI API function jump table for PCI-device group-0 HBAs */ 8282 /* Set up SLI API function jump table for PCI-device group-0 HBAs */
8281 error = lpfc_api_table_setup(phba, LPFC_PCI_DEV_LP); 8283 error = lpfc_api_table_setup(phba, LPFC_PCI_DEV_LP);
@@ -8322,6 +8324,9 @@ lpfc_pci_probe_one_s3(struct pci_dev *pdev, const struct pci_device_id *pid)
8322 goto out_free_iocb_list; 8324 goto out_free_iocb_list;
8323 } 8325 }
8324 8326
8327 /* Get the default values for Model Name and Description */
8328 lpfc_get_hba_model_desc(phba, phba->ModelName, phba->ModelDesc);
8329
8325 /* Create SCSI host to the physical port */ 8330 /* Create SCSI host to the physical port */
8326 error = lpfc_create_shost(phba); 8331 error = lpfc_create_shost(phba);
8327 if (error) { 8332 if (error) {
@@ -8885,16 +8890,17 @@ lpfc_write_firmware(struct lpfc_hba *phba, const struct firmware *fw)
8885 uint32_t offset = 0, temp_offset = 0; 8890 uint32_t offset = 0, temp_offset = 0;
8886 8891
8887 INIT_LIST_HEAD(&dma_buffer_list); 8892 INIT_LIST_HEAD(&dma_buffer_list);
8888 if ((image->magic_number != LPFC_GROUP_OJECT_MAGIC_NUM) || 8893 if ((be32_to_cpu(image->magic_number) != LPFC_GROUP_OJECT_MAGIC_NUM) ||
8889 (bf_get(lpfc_grp_hdr_file_type, image) != LPFC_FILE_TYPE_GROUP) || 8894 (bf_get_be32(lpfc_grp_hdr_file_type, image) !=
8890 (bf_get(lpfc_grp_hdr_id, image) != LPFC_FILE_ID_GROUP) || 8895 LPFC_FILE_TYPE_GROUP) ||
8891 (image->size != fw->size)) { 8896 (bf_get_be32(lpfc_grp_hdr_id, image) != LPFC_FILE_ID_GROUP) ||
8897 (be32_to_cpu(image->size) != fw->size)) {
8892 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, 8898 lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
8893 "3022 Invalid FW image found. " 8899 "3022 Invalid FW image found. "
8894 "Magic:%d Type:%x ID:%x\n", 8900 "Magic:%x Type:%x ID:%x\n",
8895 image->magic_number, 8901 be32_to_cpu(image->magic_number),
8896 bf_get(lpfc_grp_hdr_file_type, image), 8902 bf_get_be32(lpfc_grp_hdr_file_type, image),
8897 bf_get(lpfc_grp_hdr_id, image)); 8903 bf_get_be32(lpfc_grp_hdr_id, image));
8898 return -EINVAL; 8904 return -EINVAL;
8899 } 8905 }
8900 lpfc_decode_firmware_rev(phba, fwrev, 1); 8906 lpfc_decode_firmware_rev(phba, fwrev, 1);
@@ -8924,11 +8930,11 @@ lpfc_write_firmware(struct lpfc_hba *phba, const struct firmware *fw)
8924 while (offset < fw->size) { 8930 while (offset < fw->size) {
8925 temp_offset = offset; 8931 temp_offset = offset;
8926 list_for_each_entry(dmabuf, &dma_buffer_list, list) { 8932 list_for_each_entry(dmabuf, &dma_buffer_list, list) {
8927 if (offset + SLI4_PAGE_SIZE > fw->size) { 8933 if (temp_offset + SLI4_PAGE_SIZE > fw->size) {
8928 temp_offset += fw->size - offset;
8929 memcpy(dmabuf->virt, 8934 memcpy(dmabuf->virt,
8930 fw->data + temp_offset, 8935 fw->data + temp_offset,
8931 fw->size - offset); 8936 fw->size - temp_offset);
8937 temp_offset = fw->size;
8932 break; 8938 break;
8933 } 8939 }
8934 memcpy(dmabuf->virt, fw->data + temp_offset, 8940 memcpy(dmabuf->virt, fw->data + temp_offset,
@@ -8995,11 +9001,8 @@ lpfc_pci_probe_one_s4(struct pci_dev *pdev, const struct pci_device_id *pid)
8995 9001
8996 /* Perform generic PCI device enabling operation */ 9002 /* Perform generic PCI device enabling operation */
8997 error = lpfc_enable_pci_dev(phba); 9003 error = lpfc_enable_pci_dev(phba);
8998 if (error) { 9004 if (error)
8999 lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
9000 "1409 Failed to enable pci device.\n");
9001 goto out_free_phba; 9005 goto out_free_phba;
9002 }
9003 9006
9004 /* Set up SLI API function jump table for PCI-device group-1 HBAs */ 9007 /* Set up SLI API function jump table for PCI-device group-1 HBAs */
9005 error = lpfc_api_table_setup(phba, LPFC_PCI_DEV_OC); 9008 error = lpfc_api_table_setup(phba, LPFC_PCI_DEV_OC);
@@ -9054,6 +9057,9 @@ lpfc_pci_probe_one_s4(struct pci_dev *pdev, const struct pci_device_id *pid)
9054 goto out_free_iocb_list; 9057 goto out_free_iocb_list;
9055 } 9058 }
9056 9059
9060 /* Get the default values for Model Name and Description */
9061 lpfc_get_hba_model_desc(phba, phba->ModelName, phba->ModelDesc);
9062
9057 /* Create SCSI host to the physical port */ 9063 /* Create SCSI host to the physical port */
9058 error = lpfc_create_shost(phba); 9064 error = lpfc_create_shost(phba);
9059 if (error) { 9065 if (error) {