hpsa.c (2bf74771ca5610b10c3ac4cd17aacc389e6927ca) hpsa.c (8f31fa53d36b96a9e6a0b6940571baed459b6fc3)
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

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

4692 u32 block;
4693 u32 block_cnt;
4694
4695 /* Perform some CDB fixups if needed using 10 byte reads/writes only */
4696 switch (cdb[0]) {
4697 case WRITE_6:
4698 case WRITE_12:
4699 is_write = 1;
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

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

4692 u32 block;
4693 u32 block_cnt;
4694
4695 /* Perform some CDB fixups if needed using 10 byte reads/writes only */
4696 switch (cdb[0]) {
4697 case WRITE_6:
4698 case WRITE_12:
4699 is_write = 1;
4700 fallthrough;
4700 /* fall through */
4701 case READ_6:
4702 case READ_12:
4703 if (*cdb_len == 6) {
4704 block = (((cdb[1] & 0x1F) << 16) |
4705 (cdb[2] << 8) |
4706 cdb[3]);
4707 block_cnt = cdb[4];
4708 if (block_cnt == 0)

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

5142
5143 if (dev->in_reset)
5144 return -1;
5145
5146 /* check for valid opcode, get LBA and block count */
5147 switch (cmd->cmnd[0]) {
5148 case WRITE_6:
5149 is_write = 1;
4701 case READ_6:
4702 case READ_12:
4703 if (*cdb_len == 6) {
4704 block = (((cdb[1] & 0x1F) << 16) |
4705 (cdb[2] << 8) |
4706 cdb[3]);
4707 block_cnt = cdb[4];
4708 if (block_cnt == 0)

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

5142
5143 if (dev->in_reset)
5144 return -1;
5145
5146 /* check for valid opcode, get LBA and block count */
5147 switch (cmd->cmnd[0]) {
5148 case WRITE_6:
5149 is_write = 1;
5150 fallthrough;
5150 /* fall through */
5151 case READ_6:
5152 first_block = (((cmd->cmnd[1] & 0x1F) << 16) |
5153 (cmd->cmnd[2] << 8) |
5154 cmd->cmnd[3]);
5155 block_cnt = cmd->cmnd[4];
5156 if (block_cnt == 0)
5157 block_cnt = 256;
5158 break;
5159 case WRITE_10:
5160 is_write = 1;
5151 case READ_6:
5152 first_block = (((cmd->cmnd[1] & 0x1F) << 16) |
5153 (cmd->cmnd[2] << 8) |
5154 cmd->cmnd[3]);
5155 block_cnt = cmd->cmnd[4];
5156 if (block_cnt == 0)
5157 block_cnt = 256;
5158 break;
5159 case WRITE_10:
5160 is_write = 1;
5161 fallthrough;
5161 /* fall through */
5162 case READ_10:
5163 first_block =
5164 (((u64) cmd->cmnd[2]) << 24) |
5165 (((u64) cmd->cmnd[3]) << 16) |
5166 (((u64) cmd->cmnd[4]) << 8) |
5167 cmd->cmnd[5];
5168 block_cnt =
5169 (((u32) cmd->cmnd[7]) << 8) |
5170 cmd->cmnd[8];
5171 break;
5172 case WRITE_12:
5173 is_write = 1;
5162 case READ_10:
5163 first_block =
5164 (((u64) cmd->cmnd[2]) << 24) |
5165 (((u64) cmd->cmnd[3]) << 16) |
5166 (((u64) cmd->cmnd[4]) << 8) |
5167 cmd->cmnd[5];
5168 block_cnt =
5169 (((u32) cmd->cmnd[7]) << 8) |
5170 cmd->cmnd[8];
5171 break;
5172 case WRITE_12:
5173 is_write = 1;
5174 fallthrough;
5174 /* fall through */
5175 case READ_12:
5176 first_block =
5177 (((u64) cmd->cmnd[2]) << 24) |
5178 (((u64) cmd->cmnd[3]) << 16) |
5179 (((u64) cmd->cmnd[4]) << 8) |
5180 cmd->cmnd[5];
5181 block_cnt =
5182 (((u32) cmd->cmnd[6]) << 24) |
5183 (((u32) cmd->cmnd[7]) << 16) |
5184 (((u32) cmd->cmnd[8]) << 8) |
5185 cmd->cmnd[9];
5186 break;
5187 case WRITE_16:
5188 is_write = 1;
5175 case READ_12:
5176 first_block =
5177 (((u64) cmd->cmnd[2]) << 24) |
5178 (((u64) cmd->cmnd[3]) << 16) |
5179 (((u64) cmd->cmnd[4]) << 8) |
5180 cmd->cmnd[5];
5181 block_cnt =
5182 (((u32) cmd->cmnd[6]) << 24) |
5183 (((u32) cmd->cmnd[7]) << 16) |
5184 (((u32) cmd->cmnd[8]) << 8) |
5185 cmd->cmnd[9];
5186 break;
5187 case WRITE_16:
5188 is_write = 1;
5189 fallthrough;
5189 /* fall through */
5190 case READ_16:
5191 first_block =
5192 (((u64) cmd->cmnd[2]) << 56) |
5193 (((u64) cmd->cmnd[3]) << 48) |
5194 (((u64) cmd->cmnd[4]) << 40) |
5195 (((u64) cmd->cmnd[5]) << 32) |
5196 (((u64) cmd->cmnd[6]) << 24) |
5197 (((u64) cmd->cmnd[7]) << 16) |

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

9324 }
9325 return 0;
9326}
9327
9328/* Free ioaccel1 mode command blocks and block fetch table */
9329static void hpsa_free_ioaccel1_cmd_and_bft(struct ctlr_info *h)
9330{
9331 if (h->ioaccel_cmd_pool) {
5190 case READ_16:
5191 first_block =
5192 (((u64) cmd->cmnd[2]) << 56) |
5193 (((u64) cmd->cmnd[3]) << 48) |
5194 (((u64) cmd->cmnd[4]) << 40) |
5195 (((u64) cmd->cmnd[5]) << 32) |
5196 (((u64) cmd->cmnd[6]) << 24) |
5197 (((u64) cmd->cmnd[7]) << 16) |

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

9324 }
9325 return 0;
9326}
9327
9328/* Free ioaccel1 mode command blocks and block fetch table */
9329static void hpsa_free_ioaccel1_cmd_and_bft(struct ctlr_info *h)
9330{
9331 if (h->ioaccel_cmd_pool) {
9332 pci_free_consistent(h->pdev,
9333 h->nr_cmds * sizeof(*h->ioaccel_cmd_pool),
9334 h->ioaccel_cmd_pool,
9335 h->ioaccel_cmd_pool_dhandle);
9332 dma_free_coherent(&h->pdev->dev,
9333 h->nr_cmds * sizeof(*h->ioaccel_cmd_pool),
9334 h->ioaccel_cmd_pool,
9335 h->ioaccel_cmd_pool_dhandle);
9336 h->ioaccel_cmd_pool = NULL;
9337 h->ioaccel_cmd_pool_dhandle = 0;
9338 }
9339 kfree(h->ioaccel1_blockFetchTable);
9340 h->ioaccel1_blockFetchTable = NULL;
9341}
9342
9343/* Allocate ioaccel1 mode command blocks and block fetch table */

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

9377}
9378
9379/* Free ioaccel2 mode command blocks and block fetch table */
9380static void hpsa_free_ioaccel2_cmd_and_bft(struct ctlr_info *h)
9381{
9382 hpsa_free_ioaccel2_sg_chain_blocks(h);
9383
9384 if (h->ioaccel2_cmd_pool) {
9336 h->ioaccel_cmd_pool = NULL;
9337 h->ioaccel_cmd_pool_dhandle = 0;
9338 }
9339 kfree(h->ioaccel1_blockFetchTable);
9340 h->ioaccel1_blockFetchTable = NULL;
9341}
9342
9343/* Allocate ioaccel1 mode command blocks and block fetch table */

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

9377}
9378
9379/* Free ioaccel2 mode command blocks and block fetch table */
9380static void hpsa_free_ioaccel2_cmd_and_bft(struct ctlr_info *h)
9381{
9382 hpsa_free_ioaccel2_sg_chain_blocks(h);
9383
9384 if (h->ioaccel2_cmd_pool) {
9385 pci_free_consistent(h->pdev,
9386 h->nr_cmds * sizeof(*h->ioaccel2_cmd_pool),
9387 h->ioaccel2_cmd_pool,
9388 h->ioaccel2_cmd_pool_dhandle);
9385 dma_free_coherent(&h->pdev->dev,
9386 h->nr_cmds * sizeof(*h->ioaccel2_cmd_pool),
9387 h->ioaccel2_cmd_pool,
9388 h->ioaccel2_cmd_pool_dhandle);
9389 h->ioaccel2_cmd_pool = NULL;
9390 h->ioaccel2_cmd_pool_dhandle = 0;
9391 }
9392 kfree(h->ioaccel2_blockFetchTable);
9393 h->ioaccel2_blockFetchTable = NULL;
9394}
9395
9396/* Allocate ioaccel2 mode command blocks and block fetch table */

--- 605 unchanged lines hidden ---
9389 h->ioaccel2_cmd_pool = NULL;
9390 h->ioaccel2_cmd_pool_dhandle = 0;
9391 }
9392 kfree(h->ioaccel2_blockFetchTable);
9393 h->ioaccel2_blockFetchTable = NULL;
9394}
9395
9396/* Allocate ioaccel2 mode command blocks and block fetch table */

--- 605 unchanged lines hidden ---