diff options
author | Chad Dupuis <chad.dupuis@qlogic.com> | 2011-05-10 14:30:10 -0400 |
---|---|---|
committer | James Bottomley <jbottomley@parallels.com> | 2011-05-17 03:32:39 -0400 |
commit | d652e0937029e1f7cf9b17d639782db1b0c23ea9 (patch) | |
tree | 9fc9f2607f9d08ee12267f2245b1af05888ac7d8 /drivers | |
parent | 875efad774f05433210c8d99af405260cfda4f09 (diff) |
[SCSI] qla2xxx: Add qla82xx_rom_unlock() function.
Encapsulate the unlocking of the ROM lock in a function for better
code readability.
Signed-off-by: Chad Dupuis <chad.dupuis@qlogic.com>
Signed-off-by: Madhuranath Iyengar <Madhu.Iyengar@qlogic.com>
Signed-off-by: James Bottomley <jbottomley@parallels.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/scsi/qla2xxx/qla_gbl.h | 1 | ||||
-rw-r--r-- | drivers/scsi/qla2xxx/qla_nx.c | 20 |
2 files changed, 13 insertions, 8 deletions
diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h index fbb4b8fbf635..53968ccf88e3 100644 --- a/drivers/scsi/qla2xxx/qla_gbl.h +++ b/drivers/scsi/qla2xxx/qla_gbl.h | |||
@@ -552,7 +552,6 @@ extern int qla82xx_wr_32(struct qla_hw_data *, ulong, u32); | |||
552 | extern int qla82xx_rd_32(struct qla_hw_data *, ulong); | 552 | extern int qla82xx_rd_32(struct qla_hw_data *, ulong); |
553 | extern int qla82xx_rdmem(struct qla_hw_data *, u64, void *, int); | 553 | extern int qla82xx_rdmem(struct qla_hw_data *, u64, void *, int); |
554 | extern int qla82xx_wrmem(struct qla_hw_data *, u64, void *, int); | 554 | extern int qla82xx_wrmem(struct qla_hw_data *, u64, void *, int); |
555 | extern void qla82xx_rom_unlock(struct qla_hw_data *); | ||
556 | 555 | ||
557 | /* ISP 8021 IDC */ | 556 | /* ISP 8021 IDC */ |
558 | extern void qla82xx_clear_drv_active(struct qla_hw_data *); | 557 | extern void qla82xx_clear_drv_active(struct qla_hw_data *); |
diff --git a/drivers/scsi/qla2xxx/qla_nx.c b/drivers/scsi/qla2xxx/qla_nx.c index 752b03e7622a..5d5b603acc8c 100644 --- a/drivers/scsi/qla2xxx/qla_nx.c +++ b/drivers/scsi/qla2xxx/qla_nx.c | |||
@@ -844,6 +844,12 @@ qla82xx_rom_lock(struct qla_hw_data *ha) | |||
844 | return 0; | 844 | return 0; |
845 | } | 845 | } |
846 | 846 | ||
847 | static void | ||
848 | qla82xx_rom_unlock(struct qla_hw_data *ha) | ||
849 | { | ||
850 | qla82xx_rd_32(ha, QLA82XX_PCIE_REG(PCIE_SEM2_UNLOCK)); | ||
851 | } | ||
852 | |||
847 | static int | 853 | static int |
848 | qla82xx_wait_rom_busy(struct qla_hw_data *ha) | 854 | qla82xx_wait_rom_busy(struct qla_hw_data *ha) |
849 | { | 855 | { |
@@ -924,7 +930,7 @@ qla82xx_rom_fast_read(struct qla_hw_data *ha, int addr, int *valp) | |||
924 | return -1; | 930 | return -1; |
925 | } | 931 | } |
926 | ret = qla82xx_do_rom_fast_read(ha, addr, valp); | 932 | ret = qla82xx_do_rom_fast_read(ha, addr, valp); |
927 | qla82xx_rd_32(ha, QLA82XX_PCIE_REG(PCIE_SEM2_UNLOCK)); | 933 | qla82xx_rom_unlock(ha); |
928 | return ret; | 934 | return ret; |
929 | } | 935 | } |
930 | 936 | ||
@@ -1056,7 +1062,7 @@ qla82xx_write_flash_dword(struct qla_hw_data *ha, uint32_t flashaddr, | |||
1056 | ret = qla82xx_flash_wait_write_finish(ha); | 1062 | ret = qla82xx_flash_wait_write_finish(ha); |
1057 | 1063 | ||
1058 | done_write: | 1064 | done_write: |
1059 | qla82xx_rd_32(ha, QLA82XX_PCIE_REG(PCIE_SEM2_UNLOCK)); | 1065 | qla82xx_rom_unlock(ha); |
1060 | return ret; | 1066 | return ret; |
1061 | } | 1067 | } |
1062 | 1068 | ||
@@ -1144,7 +1150,7 @@ qla82xx_pinit_from_rom(scsi_qla_host_t *vha) | |||
1144 | qla82xx_wr_32(ha, QLA82XX_CRB_QDR_NET + 0xe4, val); | 1150 | qla82xx_wr_32(ha, QLA82XX_CRB_QDR_NET + 0xe4, val); |
1145 | msleep(20); | 1151 | msleep(20); |
1146 | 1152 | ||
1147 | qla82xx_rd_32(ha, QLA82XX_PCIE_REG(PCIE_SEM2_UNLOCK)); | 1153 | qla82xx_rom_unlock(ha); |
1148 | 1154 | ||
1149 | /* Read the signature value from the flash. | 1155 | /* Read the signature value from the flash. |
1150 | * Offset 0: Contain signature (0xcafecafe) | 1156 | * Offset 0: Contain signature (0xcafecafe) |
@@ -3010,7 +3016,7 @@ qla82xx_unprotect_flash(struct qla_hw_data *ha) | |||
3010 | qla_printk(KERN_WARNING, ha, "Write disable failed\n"); | 3016 | qla_printk(KERN_WARNING, ha, "Write disable failed\n"); |
3011 | 3017 | ||
3012 | done_unprotect: | 3018 | done_unprotect: |
3013 | qla82xx_rd_32(ha, QLA82XX_PCIE_REG(PCIE_SEM2_UNLOCK)); | 3019 | qla82xx_rom_unlock(ha); |
3014 | return ret; | 3020 | return ret; |
3015 | } | 3021 | } |
3016 | 3022 | ||
@@ -3039,7 +3045,7 @@ qla82xx_protect_flash(struct qla_hw_data *ha) | |||
3039 | if (qla82xx_write_disable_flash(ha) != 0) | 3045 | if (qla82xx_write_disable_flash(ha) != 0) |
3040 | qla_printk(KERN_WARNING, ha, "Write disable failed\n"); | 3046 | qla_printk(KERN_WARNING, ha, "Write disable failed\n"); |
3041 | done_protect: | 3047 | done_protect: |
3042 | qla82xx_rd_32(ha, QLA82XX_PCIE_REG(PCIE_SEM2_UNLOCK)); | 3048 | qla82xx_rom_unlock(ha); |
3043 | return ret; | 3049 | return ret; |
3044 | } | 3050 | } |
3045 | 3051 | ||
@@ -3067,7 +3073,7 @@ qla82xx_erase_sector(struct qla_hw_data *ha, int addr) | |||
3067 | } | 3073 | } |
3068 | ret = qla82xx_flash_wait_write_finish(ha); | 3074 | ret = qla82xx_flash_wait_write_finish(ha); |
3069 | done: | 3075 | done: |
3070 | qla82xx_rd_32(ha, QLA82XX_PCIE_REG(PCIE_SEM2_UNLOCK)); | 3076 | qla82xx_rom_unlock(ha); |
3071 | return ret; | 3077 | return ret; |
3072 | } | 3078 | } |
3073 | 3079 | ||
@@ -3247,7 +3253,7 @@ void qla82xx_rom_lock_recovery(struct qla_hw_data *ha) | |||
3247 | * else died while holding it. | 3253 | * else died while holding it. |
3248 | * In either case, unlock. | 3254 | * In either case, unlock. |
3249 | */ | 3255 | */ |
3250 | qla82xx_rd_32(ha, QLA82XX_PCIE_REG(PCIE_SEM2_UNLOCK)); | 3256 | qla82xx_rom_unlock(ha); |
3251 | } | 3257 | } |
3252 | 3258 | ||
3253 | /* | 3259 | /* |