]>
Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | /* |
2 | * Adaptec AAC series RAID controller driver | |
fa195afe | 3 | * (c) Copyright 2001 Red Hat Inc. |
1da177e4 LT |
4 | * |
5 | * based on the old aacraid driver that is.. | |
6 | * Adaptec aacraid device driver for Linux. | |
7 | * | |
e8b12f0f | 8 | * Copyright (c) 2000-2010 Adaptec, Inc. |
f4babba0 RAR |
9 | * 2010-2015 PMC-Sierra, Inc. (aacraid@pmc-sierra.com) |
10 | * 2016-2017 Microsemi Corp. (aacraid@microsemi.com) | |
1da177e4 LT |
11 | * |
12 | * This program is free software; you can redistribute it and/or modify | |
13 | * it under the terms of the GNU General Public License as published by | |
14 | * the Free Software Foundation; either version 2, or (at your option) | |
15 | * any later version. | |
16 | * | |
17 | * This program is distributed in the hope that it will be useful, | |
18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 | * GNU General Public License for more details. | |
21 | * | |
22 | * You should have received a copy of the GNU General Public License | |
23 | * along with this program; see the file COPYING. If not, write to | |
24 | * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | |
25 | * | |
26 | * Module Name: | |
27 | * rkt.c | |
28 | * | |
29 | * Abstract: Hardware miniport for Drawbridge specific hardware functions. | |
30 | * | |
31 | */ | |
32 | ||
1da177e4 | 33 | #include <linux/blkdev.h> |
1da177e4 LT |
34 | |
35 | #include <scsi/scsi_host.h> | |
36 | ||
37 | #include "aacraid.h" | |
38 | ||
28713324 MH |
39 | #define AAC_NUM_IO_FIB_RKT (246 - AAC_NUM_MGT_FIB) |
40 | ||
41 | /** | |
42 | * aac_rkt_select_comm - Select communications method | |
43 | * @dev: Adapter | |
44 | * @comm: communications method | |
45 | */ | |
46 | ||
47 | static int aac_rkt_select_comm(struct aac_dev *dev, int comm) | |
48 | { | |
49 | int retval; | |
28713324 MH |
50 | retval = aac_rx_select_comm(dev, comm); |
51 | if (comm == AAC_COMM_MESSAGE) { | |
52 | /* | |
53 | * FIB Setup has already been done, but we can minimize the | |
54 | * damage by at least ensuring the OS never issues more | |
55 | * commands than we can handle. The Rocket adapters currently | |
56 | * can only handle 246 commands and 8 AIFs at the same time, | |
57 | * and in fact do notify us accordingly if we negotiate the | |
58 | * FIB size. The problem that causes us to add this check is | |
59 | * to ensure that we do not overdo it with the adapter when a | |
60 | * hard coded FIB override is being utilized. This special | |
61 | * case warrants this half baked, but convenient, check here. | |
62 | */ | |
63 | if (dev->scsi_host_ptr->can_queue > AAC_NUM_IO_FIB_RKT) { | |
d1ef4da8 | 64 | dev->init->r7.max_io_commands = |
28713324 MH |
65 | cpu_to_le32(AAC_NUM_IO_FIB_RKT + AAC_NUM_MGT_FIB); |
66 | dev->scsi_host_ptr->can_queue = AAC_NUM_IO_FIB_RKT; | |
67 | } | |
68 | } | |
69 | return retval; | |
70 | } | |
71 | ||
1da177e4 | 72 | /** |
76a7f8fd MH |
73 | * aac_rkt_ioremap |
74 | * @size: mapping resize request | |
1da177e4 | 75 | * |
1da177e4 | 76 | */ |
76a7f8fd | 77 | static int aac_rkt_ioremap(struct aac_dev * dev, u32 size) |
1da177e4 | 78 | { |
76a7f8fd MH |
79 | if (!size) { |
80 | iounmap(dev->regs.rkt); | |
81 | return 0; | |
1da177e4 | 82 | } |
ff08784b | 83 | dev->base = dev->regs.rkt = ioremap(dev->base_start, size); |
76a7f8fd | 84 | if (dev->base == NULL) |
1da177e4 | 85 | return -1; |
76a7f8fd | 86 | dev->IndexRegs = &dev->regs.rkt->IndexRegs; |
8c23cd74 MH |
87 | return 0; |
88 | } | |
89 | ||
1da177e4 LT |
90 | /** |
91 | * aac_rkt_init - initialize an i960 based AAC card | |
92 | * @dev: device to configure | |
93 | * | |
94 | * Allocate and set up resources for the i960 based AAC variants. The | |
95 | * device_interface in the commregion will be allocated and linked | |
96 | * to the comm region. | |
97 | */ | |
98 | ||
99 | int aac_rkt_init(struct aac_dev *dev) | |
100 | { | |
1da177e4 LT |
101 | /* |
102 | * Fill in the function dispatch table. | |
103 | */ | |
76a7f8fd | 104 | dev->a_ops.adapter_ioremap = aac_rkt_ioremap; |
28713324 | 105 | dev->a_ops.adapter_comm = aac_rkt_select_comm; |
bd1aac80 | 106 | |
28713324 | 107 | return _aac_rx_init(dev); |
1da177e4 | 108 | } |