| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* | 
 | 2 |  *	Adaptec AAC series RAID controller driver | 
| Alan Cox | fa195af | 2008-10-27 15:16:36 +0000 | [diff] [blame] | 3 |  *	(c) Copyright 2001 Red Hat Inc. | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4 |  * | 
 | 5 |  * based on the old aacraid driver that is.. | 
 | 6 |  * Adaptec aacraid device driver for Linux. | 
 | 7 |  * | 
| Salyzyn, Mark | 2ab01ef | 2007-05-15 09:14:21 -0400 | [diff] [blame] | 8 |  * Copyright (c) 2000-2007 Adaptec, Inc. (aacraid@adaptec.com) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 |  *  sa.c | 
 | 26 |  * | 
 | 27 |  * Abstract: Drawbridge specific support functions | 
 | 28 |  * | 
 | 29 |  */ | 
 | 30 |  | 
 | 31 | #include <linux/kernel.h> | 
 | 32 | #include <linux/init.h> | 
 | 33 | #include <linux/types.h> | 
| Salyzyn, Mark | 8ef2224 | 2008-02-08 05:48:22 -0800 | [diff] [blame] | 34 | #include <linux/pci.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 35 | #include <linux/spinlock.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 36 | #include <linux/blkdev.h> | 
 | 37 | #include <linux/delay.h> | 
 | 38 | #include <linux/completion.h> | 
 | 39 | #include <linux/time.h> | 
 | 40 | #include <linux/interrupt.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 41 |  | 
 | 42 | #include <scsi/scsi_host.h> | 
 | 43 |  | 
 | 44 | #include "aacraid.h" | 
 | 45 |  | 
| David Howells | 7d12e78 | 2006-10-05 14:55:46 +0100 | [diff] [blame] | 46 | static irqreturn_t aac_sa_intr(int irq, void *dev_id) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 47 | { | 
 | 48 | 	struct aac_dev *dev = dev_id; | 
 | 49 | 	unsigned short intstat, mask; | 
 | 50 |  | 
 | 51 | 	intstat = sa_readw(dev, DoorbellReg_p); | 
 | 52 | 	/* | 
 | 53 | 	 *	Read mask and invert because drawbridge is reversed. | 
 | 54 | 	 *	This allows us to only service interrupts that have been enabled. | 
 | 55 | 	 */ | 
 | 56 | 	mask = ~(sa_readw(dev, SaDbCSR.PRISETIRQMASK)); | 
 | 57 |  | 
 | 58 | 	/* Check to see if this is our interrupt.  If it isn't just return */ | 
 | 59 |  | 
 | 60 | 	if (intstat & mask) { | 
 | 61 | 		if (intstat & PrintfReady) { | 
 | 62 | 			aac_printf(dev, sa_readl(dev, Mailbox5)); | 
 | 63 | 			sa_writew(dev, DoorbellClrReg_p, PrintfReady); /* clear PrintfReady */ | 
 | 64 | 			sa_writew(dev, DoorbellReg_s, PrintfDone); | 
 | 65 | 		} else if (intstat & DOORBELL_1) {	// dev -> Host Normal Command Ready | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 66 | 			sa_writew(dev, DoorbellClrReg_p, DOORBELL_1); | 
| Mark Haverkamp | df3b766 | 2006-05-10 09:13:11 -0700 | [diff] [blame] | 67 | 			aac_command_normal(&dev->queues->queue[HostNormCmdQueue]); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 68 | 		} else if (intstat & DOORBELL_2) {	// dev -> Host Normal Response Ready | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 69 | 			sa_writew(dev, DoorbellClrReg_p, DOORBELL_2); | 
| Mark Haverkamp | df3b766 | 2006-05-10 09:13:11 -0700 | [diff] [blame] | 70 | 			aac_response_normal(&dev->queues->queue[HostNormRespQueue]); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 71 | 		} else if (intstat & DOORBELL_3) {	// dev -> Host Normal Command Not Full | 
 | 72 | 			sa_writew(dev, DoorbellClrReg_p, DOORBELL_3); | 
 | 73 | 		} else if (intstat & DOORBELL_4) {	// dev -> Host Normal Response Not Full | 
 | 74 | 			sa_writew(dev, DoorbellClrReg_p, DOORBELL_4); | 
 | 75 | 		} | 
 | 76 | 		return IRQ_HANDLED; | 
 | 77 | 	} | 
 | 78 | 	return IRQ_NONE; | 
 | 79 | } | 
 | 80 |  | 
 | 81 | /** | 
| Mark Haverkamp | bd1aac8 | 2005-08-03 15:39:01 -0700 | [diff] [blame] | 82 |  *	aac_sa_disable_interrupt	-	disable interrupt | 
 | 83 |  *	@dev: Which adapter to enable. | 
 | 84 |  */ | 
 | 85 |  | 
 | 86 | static void aac_sa_disable_interrupt (struct aac_dev *dev) | 
 | 87 | { | 
 | 88 | 	sa_writew(dev, SaDbCSR.PRISETIRQMASK, 0xffff); | 
 | 89 | } | 
 | 90 |  | 
 | 91 | /** | 
| Mark Haverkamp | 2871332 | 2007-01-23 14:59:20 -0800 | [diff] [blame] | 92 |  *	aac_sa_enable_interrupt	-	enable interrupt | 
 | 93 |  *	@dev: Which adapter to enable. | 
 | 94 |  */ | 
 | 95 |  | 
 | 96 | static void aac_sa_enable_interrupt (struct aac_dev *dev) | 
 | 97 | { | 
 | 98 | 	sa_writew(dev, SaDbCSR.PRICLEARIRQMASK, (PrintfReady | DOORBELL_1 | | 
 | 99 | 				DOORBELL_2 | DOORBELL_3 | DOORBELL_4)); | 
 | 100 | } | 
 | 101 |  | 
 | 102 | /** | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 103 |  *	aac_sa_notify_adapter		-	handle adapter notification | 
 | 104 |  *	@dev:	Adapter that notification is for | 
 | 105 |  *	@event:	Event to notidy | 
 | 106 |  * | 
 | 107 |  *	Notify the adapter of an event | 
 | 108 |  */ | 
 | 109 |   | 
| Adrian Bunk  | 4833869 | 2005-04-25 19:45:58 -0700 | [diff] [blame] | 110 | static void aac_sa_notify_adapter(struct aac_dev *dev, u32 event) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 111 | { | 
 | 112 | 	switch (event) { | 
 | 113 |  | 
 | 114 | 	case AdapNormCmdQue: | 
 | 115 | 		sa_writew(dev, DoorbellReg_s,DOORBELL_1); | 
 | 116 | 		break; | 
 | 117 | 	case HostNormRespNotFull: | 
 | 118 | 		sa_writew(dev, DoorbellReg_s,DOORBELL_4); | 
 | 119 | 		break; | 
 | 120 | 	case AdapNormRespQue: | 
 | 121 | 		sa_writew(dev, DoorbellReg_s,DOORBELL_2); | 
 | 122 | 		break; | 
 | 123 | 	case HostNormCmdNotFull: | 
 | 124 | 		sa_writew(dev, DoorbellReg_s,DOORBELL_3); | 
 | 125 | 		break; | 
 | 126 | 	case HostShutdown: | 
| Mark Haverkamp  | 7c00ffa | 2005-05-16 18:28:42 -0700 | [diff] [blame] | 127 | 		/* | 
 | 128 | 		sa_sync_cmd(dev, HOST_CRASHING, 0, 0, 0, 0, 0, 0, | 
 | 129 | 		NULL, NULL, NULL, NULL, NULL); | 
 | 130 | 		*/ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 131 | 		break; | 
 | 132 | 	case FastIo: | 
 | 133 | 		sa_writew(dev, DoorbellReg_s,DOORBELL_6); | 
 | 134 | 		break; | 
 | 135 | 	case AdapPrintfDone: | 
 | 136 | 		sa_writew(dev, DoorbellReg_s,DOORBELL_5); | 
 | 137 | 		break; | 
 | 138 | 	default: | 
 | 139 | 		BUG(); | 
 | 140 | 		break; | 
 | 141 | 	} | 
 | 142 | } | 
 | 143 |  | 
 | 144 |  | 
 | 145 | /** | 
 | 146 |  *	sa_sync_cmd	-	send a command and wait | 
 | 147 |  *	@dev: Adapter | 
 | 148 |  *	@command: Command to execute | 
 | 149 |  *	@p1: first parameter | 
 | 150 |  *	@ret: adapter status | 
 | 151 |  * | 
 | 152 |  *	This routine will send a synchronous command to the adapter and wait  | 
 | 153 |  *	for its	completion. | 
 | 154 |  */ | 
 | 155 |  | 
| Mark Haverkamp  | 7c00ffa | 2005-05-16 18:28:42 -0700 | [diff] [blame] | 156 | static int sa_sync_cmd(struct aac_dev *dev, u32 command,  | 
 | 157 | 		u32 p1, u32 p2, u32 p3, u32 p4, u32 p5, u32 p6, | 
 | 158 | 		u32 *ret, u32 *r1, u32 *r2, u32 *r3, u32 *r4) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 159 | { | 
 | 160 | 	unsigned long start; | 
 | 161 |  	int ok; | 
 | 162 | 	/* | 
 | 163 | 	 *	Write the Command into Mailbox 0 | 
 | 164 | 	 */ | 
 | 165 | 	sa_writel(dev, Mailbox0, command); | 
 | 166 | 	/* | 
 | 167 | 	 *	Write the parameters into Mailboxes 1 - 4 | 
 | 168 | 	 */ | 
 | 169 | 	sa_writel(dev, Mailbox1, p1); | 
| Mark Haverkamp  | 7c00ffa | 2005-05-16 18:28:42 -0700 | [diff] [blame] | 170 | 	sa_writel(dev, Mailbox2, p2); | 
 | 171 | 	sa_writel(dev, Mailbox3, p3); | 
 | 172 | 	sa_writel(dev, Mailbox4, p4); | 
 | 173 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 174 | 	/* | 
 | 175 | 	 *	Clear the synch command doorbell to start on a clean slate. | 
 | 176 | 	 */ | 
 | 177 | 	sa_writew(dev, DoorbellClrReg_p, DOORBELL_0); | 
 | 178 | 	/* | 
 | 179 | 	 *	Signal that there is a new synch command | 
 | 180 | 	 */ | 
 | 181 | 	sa_writew(dev, DoorbellReg_s, DOORBELL_0); | 
 | 182 |  | 
 | 183 | 	ok = 0; | 
 | 184 | 	start = jiffies; | 
 | 185 |  | 
 | 186 | 	while(time_before(jiffies, start+30*HZ)) | 
 | 187 | 	{ | 
 | 188 | 		/* | 
 | 189 | 		 *	Delay 5uS so that the monitor gets access | 
 | 190 | 		 */ | 
 | 191 | 		udelay(5); | 
 | 192 | 		/* | 
 | 193 | 		 *	Mon110 will set doorbell0 bit when it has  | 
 | 194 | 		 *	completed the command. | 
 | 195 | 		 */ | 
 | 196 | 		if(sa_readw(dev, DoorbellReg_p) & DOORBELL_0)  { | 
 | 197 | 			ok = 1; | 
 | 198 | 			break; | 
 | 199 | 		} | 
| Mark Haverkamp | 1241f35 | 2006-03-27 09:44:23 -0800 | [diff] [blame] | 200 | 		msleep(1); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 201 | 	} | 
 | 202 |  | 
 | 203 | 	if (ok != 1) | 
 | 204 | 		return -ETIMEDOUT; | 
 | 205 | 	/* | 
 | 206 | 	 *	Clear the synch command doorbell. | 
 | 207 | 	 */ | 
 | 208 | 	sa_writew(dev, DoorbellClrReg_p, DOORBELL_0); | 
 | 209 | 	/* | 
 | 210 | 	 *	Pull the synch status from Mailbox 0. | 
 | 211 | 	 */ | 
 | 212 | 	if (ret) | 
 | 213 | 		*ret = sa_readl(dev, Mailbox0); | 
| Mark Haverkamp  | 7c00ffa | 2005-05-16 18:28:42 -0700 | [diff] [blame] | 214 | 	if (r1) | 
 | 215 | 		*r1 = sa_readl(dev, Mailbox1); | 
 | 216 | 	if (r2) | 
 | 217 | 		*r2 = sa_readl(dev, Mailbox2); | 
 | 218 | 	if (r3) | 
 | 219 | 		*r3 = sa_readl(dev, Mailbox3); | 
 | 220 | 	if (r4) | 
 | 221 | 		*r4 = sa_readl(dev, Mailbox4); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 222 | 	return 0; | 
 | 223 | } | 
 | 224 |  | 
 | 225 | /** | 
 | 226 |  *	aac_sa_interrupt_adapter	-	interrupt an adapter | 
 | 227 |  *	@dev: Which adapter to enable. | 
 | 228 |  * | 
 | 229 |  *	Breakpoint an adapter. | 
 | 230 |  */ | 
 | 231 |   | 
 | 232 | static void aac_sa_interrupt_adapter (struct aac_dev *dev) | 
 | 233 | { | 
| Mark Haverkamp  | 7c00ffa | 2005-05-16 18:28:42 -0700 | [diff] [blame] | 234 | 	sa_sync_cmd(dev, BREAKPOINT_REQUEST, 0, 0, 0, 0, 0, 0, | 
| Mark Haverkamp | bd1aac8 | 2005-08-03 15:39:01 -0700 | [diff] [blame] | 235 | 			NULL, NULL, NULL, NULL, NULL); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 236 | } | 
 | 237 |  | 
 | 238 | /** | 
 | 239 |  *	aac_sa_start_adapter		-	activate adapter | 
 | 240 |  *	@dev:	Adapter | 
 | 241 |  * | 
 | 242 |  *	Start up processing on an ARM based AAC adapter | 
 | 243 |  */ | 
 | 244 |  | 
 | 245 | static void aac_sa_start_adapter(struct aac_dev *dev) | 
 | 246 | { | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 247 | 	struct aac_init *init; | 
 | 248 | 	/* | 
 | 249 | 	 * Fill in the remaining pieces of the init. | 
 | 250 | 	 */ | 
 | 251 | 	init = dev->init; | 
 | 252 | 	init->HostElapsedSeconds = cpu_to_le32(get_seconds()); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 253 | 	/* We can only use a 32 bit address here */ | 
| Mark Haverkamp  | 7c00ffa | 2005-05-16 18:28:42 -0700 | [diff] [blame] | 254 | 	sa_sync_cmd(dev, INIT_STRUCT_BASE_ADDRESS,  | 
 | 255 | 			(u32)(ulong)dev->init_pa, 0, 0, 0, 0, 0, | 
| Mark Haverkamp | 8e0c5eb | 2005-10-24 10:52:22 -0700 | [diff] [blame] | 256 | 			NULL, NULL, NULL, NULL, NULL); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 257 | } | 
 | 258 |  | 
| Salyzyn, Mark | 2ab01ef | 2007-05-15 09:14:21 -0400 | [diff] [blame] | 259 | static int aac_sa_restart_adapter(struct aac_dev *dev, int bled) | 
 | 260 | { | 
 | 261 | 	return -EINVAL; | 
 | 262 | } | 
 | 263 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 264 | /** | 
 | 265 |  *	aac_sa_check_health | 
 | 266 |  *	@dev: device to check if healthy | 
 | 267 |  * | 
 | 268 |  *	Will attempt to determine if the specified adapter is alive and | 
 | 269 |  *	capable of handling requests, returning 0 if alive. | 
 | 270 |  */ | 
 | 271 | static int aac_sa_check_health(struct aac_dev *dev) | 
 | 272 | { | 
 | 273 | 	long status = sa_readl(dev, Mailbox7); | 
 | 274 |  | 
 | 275 | 	/* | 
 | 276 | 	 *	Check to see if the board failed any self tests. | 
 | 277 | 	 */ | 
 | 278 | 	if (status & SELF_TEST_FAILED) | 
 | 279 | 		return -1; | 
 | 280 | 	/* | 
 | 281 | 	 *	Check to see if the board panic'd while booting. | 
 | 282 | 	 */ | 
 | 283 | 	if (status & KERNEL_PANIC) | 
 | 284 | 		return -2; | 
 | 285 | 	/* | 
 | 286 | 	 *	Wait for the adapter to be up and running. Wait up to 3 minutes | 
 | 287 | 	 */ | 
 | 288 | 	if (!(status & KERNEL_UP_AND_RUNNING)) | 
 | 289 | 		return -3; | 
 | 290 | 	/* | 
 | 291 | 	 *	Everything is OK | 
 | 292 | 	 */ | 
 | 293 | 	return 0; | 
 | 294 | } | 
 | 295 |  | 
 | 296 | /** | 
| Mark Haverkamp | 76a7f8f | 2006-09-19 09:00:02 -0700 | [diff] [blame] | 297 |  *	aac_sa_ioremap | 
 | 298 |  *	@size: mapping resize request | 
 | 299 |  * | 
 | 300 |  */ | 
 | 301 | static int aac_sa_ioremap(struct aac_dev * dev, u32 size) | 
 | 302 | { | 
 | 303 | 	if (!size) { | 
 | 304 | 		iounmap(dev->regs.sa); | 
 | 305 | 		return 0; | 
 | 306 | 	} | 
 | 307 | 	dev->base = dev->regs.sa = ioremap(dev->scsi_host_ptr->base, size); | 
 | 308 | 	return (dev->base == NULL) ? -1 : 0; | 
 | 309 | } | 
 | 310 |  | 
 | 311 | /** | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 312 |  *	aac_sa_init	-	initialize an ARM based AAC card | 
 | 313 |  *	@dev: device to configure | 
 | 314 |  * | 
 | 315 |  *	Allocate and set up resources for the ARM based AAC variants. The  | 
 | 316 |  *	device_interface in the commregion will be allocated and linked  | 
 | 317 |  *	to the comm region. | 
 | 318 |  */ | 
 | 319 |  | 
 | 320 | int aac_sa_init(struct aac_dev *dev) | 
 | 321 | { | 
 | 322 | 	unsigned long start; | 
 | 323 | 	unsigned long status; | 
 | 324 | 	int instance; | 
 | 325 | 	const char *name; | 
 | 326 |  | 
 | 327 | 	instance = dev->id; | 
 | 328 | 	name     = dev->name; | 
 | 329 |  | 
| Mark Haverkamp | 76a7f8f | 2006-09-19 09:00:02 -0700 | [diff] [blame] | 330 | 	if (aac_sa_ioremap(dev, dev->base_size)) { | 
 | 331 | 		printk(KERN_WARNING "%s: unable to map adapter.\n", name); | 
 | 332 | 		goto error_iounmap; | 
 | 333 | 	} | 
 | 334 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 335 | 	/* | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 336 | 	 *	Check to see if the board failed any self tests. | 
 | 337 | 	 */ | 
 | 338 | 	if (sa_readl(dev, Mailbox7) & SELF_TEST_FAILED) { | 
 | 339 | 		printk(KERN_WARNING "%s%d: adapter self-test failed.\n", name, instance); | 
 | 340 | 		goto error_iounmap; | 
 | 341 | 	} | 
 | 342 | 	/* | 
 | 343 | 	 *	Check to see if the board panic'd while booting. | 
 | 344 | 	 */ | 
 | 345 | 	if (sa_readl(dev, Mailbox7) & KERNEL_PANIC) { | 
 | 346 | 		printk(KERN_WARNING "%s%d: adapter kernel panic'd.\n", name, instance); | 
 | 347 | 		goto error_iounmap; | 
 | 348 | 	} | 
 | 349 | 	start = jiffies; | 
 | 350 | 	/* | 
 | 351 | 	 *	Wait for the adapter to be up and running. Wait up to 3 minutes. | 
 | 352 | 	 */ | 
 | 353 | 	while (!(sa_readl(dev, Mailbox7) & KERNEL_UP_AND_RUNNING)) { | 
| Mark Haverkamp | 404d9a9 | 2006-05-10 09:12:48 -0700 | [diff] [blame] | 354 | 		if (time_after(jiffies, start+startup_timeout*HZ)) { | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 355 | 			status = sa_readl(dev, Mailbox7); | 
 | 356 | 			printk(KERN_WARNING "%s%d: adapter kernel failed to start, init status = %lx.\n",  | 
 | 357 | 					name, instance, status); | 
 | 358 | 			goto error_iounmap; | 
 | 359 | 		} | 
| Mark Haverkamp | 404d9a9 | 2006-05-10 09:12:48 -0700 | [diff] [blame] | 360 | 		msleep(1); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 361 | 	} | 
 | 362 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 363 | 	/* | 
 | 364 | 	 *	Fill in the function dispatch table. | 
 | 365 | 	 */ | 
 | 366 |  | 
 | 367 | 	dev->a_ops.adapter_interrupt = aac_sa_interrupt_adapter; | 
| Mark Haverkamp | bd1aac8 | 2005-08-03 15:39:01 -0700 | [diff] [blame] | 368 | 	dev->a_ops.adapter_disable_int = aac_sa_disable_interrupt; | 
| Mark Haverkamp | 2871332 | 2007-01-23 14:59:20 -0800 | [diff] [blame] | 369 | 	dev->a_ops.adapter_enable_int = aac_sa_enable_interrupt; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 370 | 	dev->a_ops.adapter_notify = aac_sa_notify_adapter; | 
 | 371 | 	dev->a_ops.adapter_sync_cmd = sa_sync_cmd; | 
 | 372 | 	dev->a_ops.adapter_check_health = aac_sa_check_health; | 
| Salyzyn, Mark | 2ab01ef | 2007-05-15 09:14:21 -0400 | [diff] [blame] | 373 | 	dev->a_ops.adapter_restart = aac_sa_restart_adapter; | 
| Mark Haverkamp | 2871332 | 2007-01-23 14:59:20 -0800 | [diff] [blame] | 374 | 	dev->a_ops.adapter_intr = aac_sa_intr; | 
| Salyzyn, Mark | 2ab01ef | 2007-05-15 09:14:21 -0400 | [diff] [blame] | 375 | 	dev->a_ops.adapter_deliver = aac_rx_deliver_producer; | 
| Mark Haverkamp | 76a7f8f | 2006-09-19 09:00:02 -0700 | [diff] [blame] | 376 | 	dev->a_ops.adapter_ioremap = aac_sa_ioremap; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 377 |  | 
| Mark Haverkamp | bd1aac8 | 2005-08-03 15:39:01 -0700 | [diff] [blame] | 378 | 	/* | 
 | 379 | 	 *	First clear out all interrupts.  Then enable the one's that  | 
 | 380 | 	 *	we can handle. | 
 | 381 | 	 */ | 
| Mark Haverkamp | 2871332 | 2007-01-23 14:59:20 -0800 | [diff] [blame] | 382 | 	aac_adapter_disable_int(dev); | 
 | 383 | 	aac_adapter_enable_int(dev); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 384 |  | 
 | 385 | 	if(aac_init_adapter(dev) == NULL) | 
 | 386 | 		goto error_irq; | 
| Salyzyn, Mark | 8ef2224 | 2008-02-08 05:48:22 -0800 | [diff] [blame] | 387 | 	if (request_irq(dev->pdev->irq, dev->a_ops.adapter_intr, | 
| Mark Haverkamp | 2871332 | 2007-01-23 14:59:20 -0800 | [diff] [blame] | 388 | 			IRQF_SHARED|IRQF_DISABLED, | 
 | 389 | 			"aacraid", (void *)dev ) < 0) { | 
 | 390 | 		printk(KERN_WARNING "%s%d: Interrupt unavailable.\n", | 
 | 391 | 			name, instance); | 
 | 392 | 		goto error_iounmap; | 
 | 393 | 	} | 
 | 394 | 	aac_adapter_enable_int(dev); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 395 |  | 
 | 396 | 	/* | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 397 | 	 *	Tell the adapter that all is configure, and it can start  | 
 | 398 | 	 *	accepting requests | 
 | 399 | 	 */ | 
 | 400 | 	aac_sa_start_adapter(dev); | 
 | 401 | 	return 0; | 
 | 402 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 403 | error_irq: | 
| Mark Haverkamp | 2871332 | 2007-01-23 14:59:20 -0800 | [diff] [blame] | 404 | 	aac_sa_disable_interrupt(dev); | 
| Salyzyn, Mark | 8ef2224 | 2008-02-08 05:48:22 -0800 | [diff] [blame] | 405 | 	free_irq(dev->pdev->irq, (void *)dev); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 406 |  | 
 | 407 | error_iounmap: | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 408 |  | 
 | 409 | 	return -1; | 
 | 410 | } | 
 | 411 |  |