hpsa.c (34592254c13324add1972e6a7d5f6636d95ade33) | hpsa.c (c2adae44e9161612c89e52d233c83086195f454c) |
---|---|
1/* 2 * Disk Array driver for HP Smart Array SAS controllers 3 * Copyright 2014-2015 PMC-Sierra, Inc. 4 * Copyright 2000,2009-2015 Hewlett-Packard Development Company, L.P. 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; version 2 of the License. --- 261 unchanged lines hidden (view full) --- 270static void hpsa_drain_accel_commands(struct ctlr_info *h); 271static void hpsa_flush_cache(struct ctlr_info *h); 272static int hpsa_scsi_ioaccel_queue_command(struct ctlr_info *h, 273 struct CommandList *c, u32 ioaccel_handle, u8 *cdb, int cdb_len, 274 u8 *scsi3addr, struct hpsa_scsi_dev_t *phys_disk); 275static void hpsa_command_resubmit_worker(struct work_struct *work); 276static u32 lockup_detected(struct ctlr_info *h); 277static int detect_controller_lockup(struct ctlr_info *h); | 1/* 2 * Disk Array driver for HP Smart Array SAS controllers 3 * Copyright 2014-2015 PMC-Sierra, Inc. 4 * Copyright 2000,2009-2015 Hewlett-Packard Development Company, L.P. 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; version 2 of the License. --- 261 unchanged lines hidden (view full) --- 270static void hpsa_drain_accel_commands(struct ctlr_info *h); 271static void hpsa_flush_cache(struct ctlr_info *h); 272static int hpsa_scsi_ioaccel_queue_command(struct ctlr_info *h, 273 struct CommandList *c, u32 ioaccel_handle, u8 *cdb, int cdb_len, 274 u8 *scsi3addr, struct hpsa_scsi_dev_t *phys_disk); 275static void hpsa_command_resubmit_worker(struct work_struct *work); 276static u32 lockup_detected(struct ctlr_info *h); 277static int detect_controller_lockup(struct ctlr_info *h); |
278static void hpsa_disable_rld_caching(struct ctlr_info *h); |
|
278static int hpsa_luns_changed(struct ctlr_info *h); 279 280static inline struct ctlr_info *sdev_to_hba(struct scsi_device *sdev) 281{ 282 unsigned long *priv = shost_priv(sdev->host); 283 return (struct ctlr_info *) *priv; 284} 285 --- 6089 unchanged lines hidden (view full) --- 6375 TYPE_ATTR_DIR(cmd_type, ATTR_SIMPLE, XFER_READ); 6376 c->Request.Timeout = 0; 6377 c->Request.CDB[0] = cmd; 6378 c->Request.CDB[6] = (size >> 24) & 0xFF; /* MSB */ 6379 c->Request.CDB[7] = (size >> 16) & 0xFF; 6380 c->Request.CDB[8] = (size >> 8) & 0xFF; 6381 c->Request.CDB[9] = size & 0xFF; 6382 break; | 279static int hpsa_luns_changed(struct ctlr_info *h); 280 281static inline struct ctlr_info *sdev_to_hba(struct scsi_device *sdev) 282{ 283 unsigned long *priv = shost_priv(sdev->host); 284 return (struct ctlr_info *) *priv; 285} 286 --- 6089 unchanged lines hidden (view full) --- 6376 TYPE_ATTR_DIR(cmd_type, ATTR_SIMPLE, XFER_READ); 6377 c->Request.Timeout = 0; 6378 c->Request.CDB[0] = cmd; 6379 c->Request.CDB[6] = (size >> 24) & 0xFF; /* MSB */ 6380 c->Request.CDB[7] = (size >> 16) & 0xFF; 6381 c->Request.CDB[8] = (size >> 8) & 0xFF; 6382 c->Request.CDB[9] = size & 0xFF; 6383 break; |
6384 case BMIC_SENSE_DIAG_OPTIONS: 6385 c->Request.CDBLen = 16; 6386 c->Request.type_attr_dir = 6387 TYPE_ATTR_DIR(cmd_type, ATTR_SIMPLE, XFER_READ); 6388 c->Request.Timeout = 0; 6389 /* Spec says this should be BMIC_WRITE */ 6390 c->Request.CDB[0] = BMIC_READ; 6391 c->Request.CDB[6] = BMIC_SENSE_DIAG_OPTIONS; 6392 break; 6393 case BMIC_SET_DIAG_OPTIONS: 6394 c->Request.CDBLen = 16; 6395 c->Request.type_attr_dir = 6396 TYPE_ATTR_DIR(cmd_type, 6397 ATTR_SIMPLE, XFER_WRITE); 6398 c->Request.Timeout = 0; 6399 c->Request.CDB[0] = BMIC_WRITE; 6400 c->Request.CDB[6] = BMIC_SET_DIAG_OPTIONS; 6401 break; |
|
6383 case HPSA_CACHE_FLUSH: 6384 c->Request.CDBLen = 12; 6385 c->Request.type_attr_dir = 6386 TYPE_ATTR_DIR(cmd_type, 6387 ATTR_SIMPLE, XFER_WRITE); 6388 c->Request.Timeout = 0; 6389 c->Request.CDB[0] = BMIC_WRITE; 6390 c->Request.CDB[6] = BMIC_CACHE_FLUSH; --- 1684 unchanged lines hidden (view full) --- 8075 return; 8076 8077 if (hpsa_ctlr_needs_rescan(h) || hpsa_offline_devices_ready(h)) { 8078 scsi_host_get(h->scsi_host); 8079 hpsa_ack_ctlr_events(h); 8080 hpsa_scan_start(h->scsi_host); 8081 scsi_host_put(h->scsi_host); 8082 } else if (h->discovery_polling) { | 6402 case HPSA_CACHE_FLUSH: 6403 c->Request.CDBLen = 12; 6404 c->Request.type_attr_dir = 6405 TYPE_ATTR_DIR(cmd_type, 6406 ATTR_SIMPLE, XFER_WRITE); 6407 c->Request.Timeout = 0; 6408 c->Request.CDB[0] = BMIC_WRITE; 6409 c->Request.CDB[6] = BMIC_CACHE_FLUSH; --- 1684 unchanged lines hidden (view full) --- 8094 return; 8095 8096 if (hpsa_ctlr_needs_rescan(h) || hpsa_offline_devices_ready(h)) { 8097 scsi_host_get(h->scsi_host); 8098 hpsa_ack_ctlr_events(h); 8099 hpsa_scan_start(h->scsi_host); 8100 scsi_host_put(h->scsi_host); 8101 } else if (h->discovery_polling) { |
8102 hpsa_disable_rld_caching(h); |
|
8083 if (hpsa_luns_changed(h)) { 8084 struct Scsi_Host *sh = NULL; 8085 8086 dev_info(&h->pdev->dev, 8087 "driver discovery polling rescan.\n"); 8088 sh = scsi_host_get(h->scsi_host); 8089 if (sh != NULL) { 8090 hpsa_scan_start(sh); --- 321 unchanged lines hidden (view full) --- 8412 if (c->err_info->CommandStatus != 0) 8413out: 8414 dev_warn(&h->pdev->dev, 8415 "error flushing cache on controller\n"); 8416 cmd_free(h, c); 8417 kfree(flush_buf); 8418} 8419 | 8103 if (hpsa_luns_changed(h)) { 8104 struct Scsi_Host *sh = NULL; 8105 8106 dev_info(&h->pdev->dev, 8107 "driver discovery polling rescan.\n"); 8108 sh = scsi_host_get(h->scsi_host); 8109 if (sh != NULL) { 8110 hpsa_scan_start(sh); --- 321 unchanged lines hidden (view full) --- 8432 if (c->err_info->CommandStatus != 0) 8433out: 8434 dev_warn(&h->pdev->dev, 8435 "error flushing cache on controller\n"); 8436 cmd_free(h, c); 8437 kfree(flush_buf); 8438} 8439 |
8440/* Make controller gather fresh report lun data each time we 8441 * send down a report luns request 8442 */ 8443static void hpsa_disable_rld_caching(struct ctlr_info *h) 8444{ 8445 u32 *options; 8446 struct CommandList *c; 8447 int rc; 8448 8449 /* Don't bother trying to set diag options if locked up */ 8450 if (unlikely(h->lockup_detected)) 8451 return; 8452 8453 options = kzalloc(sizeof(*options), GFP_KERNEL); 8454 if (!options) { 8455 dev_err(&h->pdev->dev, 8456 "Error: failed to disable rld caching, during alloc.\n"); 8457 return; 8458 } 8459 8460 c = cmd_alloc(h); 8461 8462 /* first, get the current diag options settings */ 8463 if (fill_cmd(c, BMIC_SENSE_DIAG_OPTIONS, h, options, 4, 0, 8464 RAID_CTLR_LUNID, TYPE_CMD)) 8465 goto errout; 8466 8467 rc = hpsa_scsi_do_simple_cmd_with_retry(h, c, 8468 PCI_DMA_FROMDEVICE, NO_TIMEOUT); 8469 if ((rc != 0) || (c->err_info->CommandStatus != 0)) 8470 goto errout; 8471 8472 /* Now, set the bit for disabling the RLD caching */ 8473 *options |= HPSA_DIAG_OPTS_DISABLE_RLD_CACHING; 8474 8475 if (fill_cmd(c, BMIC_SET_DIAG_OPTIONS, h, options, 4, 0, 8476 RAID_CTLR_LUNID, TYPE_CMD)) 8477 goto errout; 8478 8479 rc = hpsa_scsi_do_simple_cmd_with_retry(h, c, 8480 PCI_DMA_TODEVICE, NO_TIMEOUT); 8481 if ((rc != 0) || (c->err_info->CommandStatus != 0)) 8482 goto errout; 8483 8484 /* Now verify that it got set: */ 8485 if (fill_cmd(c, BMIC_SENSE_DIAG_OPTIONS, h, options, 4, 0, 8486 RAID_CTLR_LUNID, TYPE_CMD)) 8487 goto errout; 8488 8489 rc = hpsa_scsi_do_simple_cmd_with_retry(h, c, 8490 PCI_DMA_FROMDEVICE, NO_TIMEOUT); 8491 if ((rc != 0) || (c->err_info->CommandStatus != 0)) 8492 goto errout; 8493 8494 if (*options && HPSA_DIAG_OPTS_DISABLE_RLD_CACHING) 8495 goto out; 8496 8497errout: 8498 dev_err(&h->pdev->dev, 8499 "Error: failed to disable report lun data caching.\n"); 8500out: 8501 cmd_free(h, c); 8502 kfree(options); 8503} 8504 |
|
8420static void hpsa_shutdown(struct pci_dev *pdev) 8421{ 8422 struct ctlr_info *h; 8423 8424 h = pci_get_drvdata(pdev); 8425 /* Turn board interrupts off and send the flush cache command 8426 * sendcmd will turn off interrupt, and send the flush... 8427 * To write all data in the battery backed cache to disks --- 626 unchanged lines hidden --- | 8505static void hpsa_shutdown(struct pci_dev *pdev) 8506{ 8507 struct ctlr_info *h; 8508 8509 h = pci_get_drvdata(pdev); 8510 /* Turn board interrupts off and send the flush cache command 8511 * sendcmd will turn off interrupt, and send the flush... 8512 * To write all data in the battery backed cache to disks --- 626 unchanged lines hidden --- |