Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b9092b79 authored by Kevin Barnett's avatar Kevin Barnett Committed by James Bottomley
Browse files

Change how controllers in mixed mode are handled.

parent cbb47dcb
Loading
Loading
Loading
Loading
+11 −86
Original line number Diff line number Diff line
@@ -791,7 +791,8 @@ static ssize_t path_info_show(struct device *dev,
				PATH_STRING_LEN,
				"PORT: %.2s ",
				phys_connector);
		if (hdev->devtype == TYPE_DISK && h->hba_mode_enabled) {
		if (hdev->devtype == TYPE_DISK &&
			hdev->expose_state != HPSA_DO_NOT_EXPOSE) {
			if (box == 0 || box == 0xFF) {
				output_len += snprintf(path[i] + output_len,
					PATH_STRING_LEN,
@@ -2689,34 +2690,6 @@ static int hpsa_scsi_do_inquiry(struct ctlr_info *h, unsigned char *scsi3addr,
	return rc;
}

static int hpsa_bmic_ctrl_mode_sense(struct ctlr_info *h,
		unsigned char *scsi3addr, unsigned char page,
		struct bmic_controller_parameters *buf, size_t bufsize)
{
	int rc = IO_OK;
	struct CommandList *c;
	struct ErrorInfo *ei;

	c = cmd_alloc(h);
	if (fill_cmd(c, BMIC_SENSE_CONTROLLER_PARAMETERS, h, buf, bufsize,
			page, scsi3addr, TYPE_CMD)) {
		rc = -1;
		goto out;
	}
	rc = hpsa_scsi_do_simple_cmd_with_retry(h, c,
			PCI_DMA_FROMDEVICE, NO_TIMEOUT);
	if (rc)
		goto out;
	ei = c->err_info;
	if (ei->CommandStatus != 0 && ei->CommandStatus != CMD_DATA_UNDERRUN) {
		hpsa_scsi_interpret_error(h, c);
		rc = -1;
	}
out:
	cmd_free(h, c);
	return rc;
}

static int hpsa_send_reset(struct ctlr_info *h, unsigned char *scsi3addr,
	u8 reset_type, int reply_queue)
{
@@ -3665,29 +3638,6 @@ static u8 *figure_lunaddrbytes(struct ctlr_info *h, int raid_ctlr_position,
	return NULL;
}

static int hpsa_hba_mode_enabled(struct ctlr_info *h)
{
	int rc;
	int hba_mode_enabled;
	struct bmic_controller_parameters *ctlr_params;
	ctlr_params = kzalloc(sizeof(struct bmic_controller_parameters),
		GFP_KERNEL);

	if (!ctlr_params)
		return -ENOMEM;
	rc = hpsa_bmic_ctrl_mode_sense(h, RAID_CTLR_LUNID, 0, ctlr_params,
		sizeof(struct bmic_controller_parameters));
	if (rc) {
		kfree(ctlr_params);
		return rc;
	}

	hba_mode_enabled =
		((ctlr_params->nvram_flags & HBA_MODE_ENABLED_FLAG) != 0);
	kfree(ctlr_params);
	return hba_mode_enabled;
}

/* get physical drive ioaccel handle and queue depth */
static void hpsa_get_ioaccel_drive_info(struct ctlr_info *h,
		struct hpsa_scsi_dev_t *dev,
@@ -3765,7 +3715,6 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h, int hostno)
	int ncurrent = 0;
	int i, n_ext_target_devs, ndevs_to_allocate;
	int raid_ctlr_position;
	int rescan_hba_mode;
	DECLARE_BITMAP(lunzerobits, MAX_EXT_TARGETS);

	currentsd = kzalloc(sizeof(*currentsd) * HPSA_MAX_DEVICES, GFP_KERNEL);
@@ -3781,17 +3730,6 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h, int hostno)
	}
	memset(lunzerobits, 0, sizeof(lunzerobits));

	rescan_hba_mode = hpsa_hba_mode_enabled(h);
	if (rescan_hba_mode < 0)
		goto out;

	if (!h->hba_mode_enabled && rescan_hba_mode)
		dev_warn(&h->pdev->dev, "HBA mode enabled\n");
	else if (h->hba_mode_enabled && !rescan_hba_mode)
		dev_warn(&h->pdev->dev, "HBA mode disabled\n");

	h->hba_mode_enabled = rescan_hba_mode;

	if (hpsa_gather_lun_info(h, physdev_list, &nphysicals,
			logdev_list, &nlogicals))
		goto out;
@@ -3867,9 +3805,6 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h, int hostno)
		/* do not expose masked devices */
		if (MASKED_DEVICE(lunaddrbytes) &&
			i < nphysicals + (raid_ctlr_position == 0)) {
			if (h->hba_mode_enabled)
				dev_warn(&h->pdev->dev,
					"Masked physical device detected\n");
			this_device->expose_state = HPSA_DO_NOT_EXPOSE;
		} else {
			this_device->expose_state =
@@ -3889,29 +3824,20 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h, int hostno)
				ncurrent++;
			break;
		case TYPE_DISK:
			if (i >= nphysicals) {
				ncurrent++;
				break;
			}

			if (h->hba_mode_enabled)
				/* never use raid mapper in HBA mode */
			if (i < nphysicals + (raid_ctlr_position == 0)) {
				/* The disk is in HBA mode. */
				/* Never use RAID mapper in HBA mode. */
				this_device->offload_enabled = 0;
			else if (!(h->transMethod & CFGTBL_Trans_io_accel1 ||
				h->transMethod & CFGTBL_Trans_io_accel2))
				break;
				hpsa_get_ioaccel_drive_info(h, this_device,
					lunaddrbytes, id_phys);
			hpsa_get_path_info(this_device, lunaddrbytes, id_phys);
			atomic_set(&this_device->ioaccel_cmds_out, 0);
				hpsa_get_path_info(this_device, lunaddrbytes,
							id_phys);
			}
			ncurrent++;
			break;
		case TYPE_TAPE:
		case TYPE_MEDIUM_CHANGER:
			ncurrent++;
			break;
		case TYPE_ENCLOSURE:
			if (h->hba_mode_enabled)
			ncurrent++;
			break;
		case TYPE_RAID:
@@ -8120,7 +8046,6 @@ static int hpsa_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)

	pci_set_drvdata(pdev, h);
	h->ndevices = 0;
	h->hba_mode_enabled = 0;

	spin_lock_init(&h->devlock);
	rc = hpsa_put_ctlr_into_performant_mode(h);
+0 −2
Original line number Diff line number Diff line
@@ -116,7 +116,6 @@ struct bmic_controller_parameters {
	u8   automatic_drive_slamming;
	u8   reserved1;
	u8   nvram_flags;
#define HBA_MODE_ENABLED_FLAG (1 << 3)
	u8   cache_nvram_flags;
	u8   drive_config_flags;
	u16  reserved2;
@@ -155,7 +154,6 @@ struct ctlr_info {
	unsigned int msi_vector;
	int intr_mode; /* either PERF_MODE_INT or SIMPLE_MODE_INT */
	struct access_method access;
	char hba_mode_enabled;

	/* queue and queue Info */
	unsigned int Qdepth;