diff options
author | Joe Carnuccio <joe.carnuccio@qlogic.com> | 2009-03-24 12:08:06 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2009-04-03 10:22:48 -0400 |
commit | 1d2874de809a14e6780246b99a18bbc0fc0a8f2a (patch) | |
tree | 0f9dc305dc6f802c27bcef6edc607832864b7687 /drivers/scsi/qla2xxx/qla_mbx.c | |
parent | b9978769877c6c90c8d6777df13b9ae427af40b7 (diff) |
[SCSI] qla2xxx: Add Flash-Access-Control support for recent ISPs.
Given the low-level interface varies from one flash-part
manufacturer to the next, the Flash-Access-Control (FAC) mailbox
command makes the specific flash type transparent to the driver
by encapsulating a basic set of accessor and update routines.
Use these new routines where applicable by querying FAC opcode
get-sector-size at init-time.
Additional cleanups and
Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi/qla2xxx/qla_mbx.c')
-rw-r--r-- | drivers/scsi/qla2xxx/qla_mbx.c | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c index b380c6fdbe40..2bc08d3b3537 100644 --- a/drivers/scsi/qla2xxx/qla_mbx.c +++ b/drivers/scsi/qla2xxx/qla_mbx.c | |||
@@ -3228,3 +3228,100 @@ qla81xx_idc_ack(scsi_qla_host_t *vha, uint16_t *mb) | |||
3228 | 3228 | ||
3229 | return rval; | 3229 | return rval; |
3230 | } | 3230 | } |
3231 | |||
3232 | int | ||
3233 | qla81xx_fac_get_sector_size(scsi_qla_host_t *vha, uint32_t *sector_size) | ||
3234 | { | ||
3235 | int rval; | ||
3236 | mbx_cmd_t mc; | ||
3237 | mbx_cmd_t *mcp = &mc; | ||
3238 | |||
3239 | if (!IS_QLA81XX(vha->hw)) | ||
3240 | return QLA_FUNCTION_FAILED; | ||
3241 | |||
3242 | DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no)); | ||
3243 | |||
3244 | mcp->mb[0] = MBC_FLASH_ACCESS_CTRL; | ||
3245 | mcp->mb[1] = FAC_OPT_CMD_GET_SECTOR_SIZE; | ||
3246 | mcp->out_mb = MBX_1|MBX_0; | ||
3247 | mcp->in_mb = MBX_1|MBX_0; | ||
3248 | mcp->tov = MBX_TOV_SECONDS; | ||
3249 | mcp->flags = 0; | ||
3250 | rval = qla2x00_mailbox_command(vha, mcp); | ||
3251 | |||
3252 | if (rval != QLA_SUCCESS) { | ||
3253 | DEBUG2_3_11(printk("%s(%ld): failed=%x mb[0]=%x mb[1]=%x.\n", | ||
3254 | __func__, vha->host_no, rval, mcp->mb[0], mcp->mb[1])); | ||
3255 | } else { | ||
3256 | DEBUG11(printk("%s(%ld): done.\n", __func__, vha->host_no)); | ||
3257 | *sector_size = mcp->mb[1]; | ||
3258 | } | ||
3259 | |||
3260 | return rval; | ||
3261 | } | ||
3262 | |||
3263 | int | ||
3264 | qla81xx_fac_do_write_enable(scsi_qla_host_t *vha, int enable) | ||
3265 | { | ||
3266 | int rval; | ||
3267 | mbx_cmd_t mc; | ||
3268 | mbx_cmd_t *mcp = &mc; | ||
3269 | |||
3270 | if (!IS_QLA81XX(vha->hw)) | ||
3271 | return QLA_FUNCTION_FAILED; | ||
3272 | |||
3273 | DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no)); | ||
3274 | |||
3275 | mcp->mb[0] = MBC_FLASH_ACCESS_CTRL; | ||
3276 | mcp->mb[1] = enable ? FAC_OPT_CMD_WRITE_ENABLE : | ||
3277 | FAC_OPT_CMD_WRITE_PROTECT; | ||
3278 | mcp->out_mb = MBX_1|MBX_0; | ||
3279 | mcp->in_mb = MBX_1|MBX_0; | ||
3280 | mcp->tov = MBX_TOV_SECONDS; | ||
3281 | mcp->flags = 0; | ||
3282 | rval = qla2x00_mailbox_command(vha, mcp); | ||
3283 | |||
3284 | if (rval != QLA_SUCCESS) { | ||
3285 | DEBUG2_3_11(printk("%s(%ld): failed=%x mb[0]=%x mb[1]=%x.\n", | ||
3286 | __func__, vha->host_no, rval, mcp->mb[0], mcp->mb[1])); | ||
3287 | } else { | ||
3288 | DEBUG11(printk("%s(%ld): done.\n", __func__, vha->host_no)); | ||
3289 | } | ||
3290 | |||
3291 | return rval; | ||
3292 | } | ||
3293 | |||
3294 | int | ||
3295 | qla81xx_fac_erase_sector(scsi_qla_host_t *vha, uint32_t start, uint32_t finish) | ||
3296 | { | ||
3297 | int rval; | ||
3298 | mbx_cmd_t mc; | ||
3299 | mbx_cmd_t *mcp = &mc; | ||
3300 | |||
3301 | if (!IS_QLA81XX(vha->hw)) | ||
3302 | return QLA_FUNCTION_FAILED; | ||
3303 | |||
3304 | DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no)); | ||
3305 | |||
3306 | mcp->mb[0] = MBC_FLASH_ACCESS_CTRL; | ||
3307 | mcp->mb[1] = FAC_OPT_CMD_ERASE_SECTOR; | ||
3308 | mcp->mb[2] = LSW(start); | ||
3309 | mcp->mb[3] = MSW(start); | ||
3310 | mcp->mb[4] = LSW(finish); | ||
3311 | mcp->mb[5] = MSW(finish); | ||
3312 | mcp->out_mb = MBX_5|MBX_4|MBX_3|MBX_2|MBX_1|MBX_0; | ||
3313 | mcp->in_mb = MBX_2|MBX_1|MBX_0; | ||
3314 | mcp->tov = MBX_TOV_SECONDS; | ||
3315 | mcp->flags = 0; | ||
3316 | rval = qla2x00_mailbox_command(vha, mcp); | ||
3317 | |||
3318 | if (rval != QLA_SUCCESS) { | ||
3319 | DEBUG2_3_11(printk("%s(%ld): failed=%x mb[0]=%x mb[1]=%x " | ||
3320 | "mb[2]=%x.\n", __func__, vha->host_no, rval, mcp->mb[0], | ||
3321 | mcp->mb[1], mcp->mb[2])); | ||
3322 | } else { | ||
3323 | DEBUG11(printk("%s(%ld): done.\n", __func__, vha->host_no)); | ||
3324 | } | ||
3325 | |||
3326 | return rval; | ||
3327 | } | ||