hpsa.c (a829a8445f09036404060f4d6489cb13433f4304) hpsa.c (7e8a9486786d5ede1d2405fab140c6a0d8b2c1fe)
1/*
2 * Disk Array driver for HP Smart Array SAS controllers
3 * Copyright 2016 Microsemi Corporation
4 * Copyright 2014-2015 PMC-Sierra, Inc.
5 * Copyright 2000,2009-2015 Hewlett-Packard Development Company, L.P.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by

--- 1543 unchanged lines hidden (view full) ---

1552 spin_unlock_irqrestore(&h->offline_device_lock, flags);
1553 return;
1554 }
1555 }
1556 spin_unlock_irqrestore(&h->offline_device_lock, flags);
1557
1558 /* Device is not on the list, add it. */
1559 device = kmalloc(sizeof(*device), GFP_KERNEL);
1/*
2 * Disk Array driver for HP Smart Array SAS controllers
3 * Copyright 2016 Microsemi Corporation
4 * Copyright 2014-2015 PMC-Sierra, Inc.
5 * Copyright 2000,2009-2015 Hewlett-Packard Development Company, L.P.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by

--- 1543 unchanged lines hidden (view full) ---

1552 spin_unlock_irqrestore(&h->offline_device_lock, flags);
1553 return;
1554 }
1555 }
1556 spin_unlock_irqrestore(&h->offline_device_lock, flags);
1557
1558 /* Device is not on the list, add it. */
1559 device = kmalloc(sizeof(*device), GFP_KERNEL);
1560 if (!device) {
1561 dev_warn(&h->pdev->dev, "out of memory in %s\n", __func__);
1560 if (!device)
1562 return;
1561 return;
1563 }
1562
1564 memcpy(device->scsi3addr, scsi3addr, sizeof(device->scsi3addr));
1565 spin_lock_irqsave(&h->offline_device_lock, flags);
1566 list_add_tail(&device->offline_list, &h->offline_device_list);
1567 spin_unlock_irqrestore(&h->offline_device_lock, flags);
1568}
1569
1570/* Print a message explaining various offline volume states */
1571static void hpsa_show_volume_status(struct ctlr_info *h,

--- 565 unchanged lines hidden (view full) ---

2137{
2138 int i;
2139
2140 if (h->chainsize <= 0)
2141 return 0;
2142
2143 h->cmd_sg_list = kzalloc(sizeof(*h->cmd_sg_list) * h->nr_cmds,
2144 GFP_KERNEL);
1563 memcpy(device->scsi3addr, scsi3addr, sizeof(device->scsi3addr));
1564 spin_lock_irqsave(&h->offline_device_lock, flags);
1565 list_add_tail(&device->offline_list, &h->offline_device_list);
1566 spin_unlock_irqrestore(&h->offline_device_lock, flags);
1567}
1568
1569/* Print a message explaining various offline volume states */
1570static void hpsa_show_volume_status(struct ctlr_info *h,

--- 565 unchanged lines hidden (view full) ---

2136{
2137 int i;
2138
2139 if (h->chainsize <= 0)
2140 return 0;
2141
2142 h->cmd_sg_list = kzalloc(sizeof(*h->cmd_sg_list) * h->nr_cmds,
2143 GFP_KERNEL);
2145 if (!h->cmd_sg_list) {
2146 dev_err(&h->pdev->dev, "Failed to allocate SG list\n");
2144 if (!h->cmd_sg_list)
2147 return -ENOMEM;
2145 return -ENOMEM;
2148 }
2146
2149 for (i = 0; i < h->nr_cmds; i++) {
2150 h->cmd_sg_list[i] = kmalloc(sizeof(*h->cmd_sg_list[i]) *
2151 h->chainsize, GFP_KERNEL);
2147 for (i = 0; i < h->nr_cmds; i++) {
2148 h->cmd_sg_list[i] = kmalloc(sizeof(*h->cmd_sg_list[i]) *
2149 h->chainsize, GFP_KERNEL);
2152 if (!h->cmd_sg_list[i]) {
2153 dev_err(&h->pdev->dev, "Failed to allocate cmd SG\n");
2150 if (!h->cmd_sg_list[i])
2154 goto clean;
2151 goto clean;
2155 }
2152
2156 }
2157 return 0;
2158
2159clean:
2160 hpsa_free_sg_chain_blocks(h);
2161 return -ENOMEM;
2162}
2163

--- 1285 unchanged lines hidden (view full) ---

3449{
3450 int rc;
3451 u64 sa = 0;
3452
3453 if (is_hba_lunid(scsi3addr)) {
3454 struct bmic_sense_subsystem_info *ssi;
3455
3456 ssi = kzalloc(sizeof(*ssi), GFP_KERNEL);
2153 }
2154 return 0;
2155
2156clean:
2157 hpsa_free_sg_chain_blocks(h);
2158 return -ENOMEM;
2159}
2160

--- 1285 unchanged lines hidden (view full) ---

3446{
3447 int rc;
3448 u64 sa = 0;
3449
3450 if (is_hba_lunid(scsi3addr)) {
3451 struct bmic_sense_subsystem_info *ssi;
3452
3453 ssi = kzalloc(sizeof(*ssi), GFP_KERNEL);
3457 if (ssi == NULL) {
3458 dev_warn(&h->pdev->dev,
3459 "%s: out of memory\n", __func__);
3454 if (!ssi)
3460 return;
3455 return;
3461 }
3462
3463 rc = hpsa_bmic_sense_subsystem_information(h,
3464 scsi3addr, 0, ssi, sizeof(*ssi));
3465 if (rc == 0) {
3466 sa = get_unaligned_be64(ssi->primary_world_wide_id);
3467 h->sas_address = sa;
3468 }
3469

--- 860 unchanged lines hidden (view full) ---

4330 dev_warn(&h->pdev->dev, "maximum devices (%d) exceeded."
4331 " %d devices ignored.\n", HPSA_MAX_DEVICES,
4332 ndevs_to_allocate - HPSA_MAX_DEVICES);
4333 break;
4334 }
4335
4336 currentsd[i] = kzalloc(sizeof(*currentsd[i]), GFP_KERNEL);
4337 if (!currentsd[i]) {
3456
3457 rc = hpsa_bmic_sense_subsystem_information(h,
3458 scsi3addr, 0, ssi, sizeof(*ssi));
3459 if (rc == 0) {
3460 sa = get_unaligned_be64(ssi->primary_world_wide_id);
3461 h->sas_address = sa;
3462 }
3463

--- 860 unchanged lines hidden (view full) ---

4324 dev_warn(&h->pdev->dev, "maximum devices (%d) exceeded."
4325 " %d devices ignored.\n", HPSA_MAX_DEVICES,
4326 ndevs_to_allocate - HPSA_MAX_DEVICES);
4327 break;
4328 }
4329
4330 currentsd[i] = kzalloc(sizeof(*currentsd[i]), GFP_KERNEL);
4331 if (!currentsd[i]) {
4338 dev_warn(&h->pdev->dev, "out of memory at %s:%d\n",
4339 __FILE__, __LINE__);
4340 h->drv_req_rescan = 1;
4341 goto out;
4342 }
4343 ndev_allocated++;
4344 }
4345
4346 if (is_scsi_rev_5(h))
4347 raid_ctlr_position = 0;

--- 4244 unchanged lines hidden (view full) ---

8592 int rc = 1; /* assume there are changes */
8593 struct ReportLUNdata *logdev = NULL;
8594
8595 /* if we can't find out if lun data has changed,
8596 * assume that it has.
8597 */
8598
8599 if (!h->lastlogicals)
4332 h->drv_req_rescan = 1;
4333 goto out;
4334 }
4335 ndev_allocated++;
4336 }
4337
4338 if (is_scsi_rev_5(h))
4339 raid_ctlr_position = 0;

--- 4244 unchanged lines hidden (view full) ---

8584 int rc = 1; /* assume there are changes */
8585 struct ReportLUNdata *logdev = NULL;
8586
8587 /* if we can't find out if lun data has changed,
8588 * assume that it has.
8589 */
8590
8591 if (!h->lastlogicals)
8600 goto out;
8592 return rc;
8601
8602 logdev = kzalloc(sizeof(*logdev), GFP_KERNEL);
8593
8594 logdev = kzalloc(sizeof(*logdev), GFP_KERNEL);
8603 if (!logdev) {
8604 dev_warn(&h->pdev->dev,
8605 "Out of memory, can't track lun changes.\n");
8606 goto out;
8607 }
8595 if (!logdev)
8596 return rc;
8597
8608 if (hpsa_scsi_do_report_luns(h, 1, logdev, sizeof(*logdev), 0)) {
8609 dev_warn(&h->pdev->dev,
8610 "report luns failed, can't track lun changes.\n");
8611 goto out;
8612 }
8613 if (memcmp(logdev, h->lastlogicals, sizeof(*logdev))) {
8614 dev_info(&h->pdev->dev,
8615 "Lun changes detected.\n");

--- 377 unchanged lines hidden (view full) ---

8993 struct CommandList *c;
8994 int rc;
8995
8996 /* Don't bother trying to set diag options if locked up */
8997 if (unlikely(h->lockup_detected))
8998 return;
8999
9000 options = kzalloc(sizeof(*options), GFP_KERNEL);
8598 if (hpsa_scsi_do_report_luns(h, 1, logdev, sizeof(*logdev), 0)) {
8599 dev_warn(&h->pdev->dev,
8600 "report luns failed, can't track lun changes.\n");
8601 goto out;
8602 }
8603 if (memcmp(logdev, h->lastlogicals, sizeof(*logdev))) {
8604 dev_info(&h->pdev->dev,
8605 "Lun changes detected.\n");

--- 377 unchanged lines hidden (view full) ---

8983 struct CommandList *c;
8984 int rc;
8985
8986 /* Don't bother trying to set diag options if locked up */
8987 if (unlikely(h->lockup_detected))
8988 return;
8989
8990 options = kzalloc(sizeof(*options), GFP_KERNEL);
9001 if (!options) {
9002 dev_err(&h->pdev->dev,
9003 "Error: failed to disable rld caching, during alloc.\n");
8991 if (!options)
9004 return;
8992 return;
9005 }
9006
9007 c = cmd_alloc(h);
9008
9009 /* first, get the current diag options settings */
9010 if (fill_cmd(c, BMIC_SENSE_DIAG_OPTIONS, h, options, 4, 0,
9011 RAID_CTLR_LUNID, TYPE_CMD))
9012 goto errout;
9013

--- 1027 unchanged lines hidden ---
8993
8994 c = cmd_alloc(h);
8995
8996 /* first, get the current diag options settings */
8997 if (fill_cmd(c, BMIC_SENSE_DIAG_OPTIONS, h, options, 4, 0,
8998 RAID_CTLR_LUNID, TYPE_CMD))
8999 goto errout;
9000

--- 1027 unchanged lines hidden ---