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