Merge git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
[wrt350n-kernel.git] / drivers / scsi / aacraid / nark.c
blobc55f7c862f0e0889541af9c1825fef78a3179c05
1 /*
2 * Adaptec AAC series RAID controller driver
4 * based on the old aacraid driver that is..
5 * Adaptec aacraid device driver for Linux.
7 * Copyright (c) 2006-2007 Adaptec, Inc. (aacraid@adaptec.com)
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2, or (at your option)
12 * any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; see the file COPYING. If not, write to
21 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
23 * Module Name:
24 * nark.c
26 * Abstract: Hardware Device Interface for NEMER/ARK
30 #include <linux/pci.h>
31 #include <linux/blkdev.h>
33 #include <scsi/scsi_host.h>
35 #include "aacraid.h"
37 /**
38 * aac_nark_ioremap
39 * @size: mapping resize request
42 static int aac_nark_ioremap(struct aac_dev * dev, u32 size)
44 if (!size) {
45 iounmap(dev->regs.rx);
46 dev->regs.rx = NULL;
47 iounmap(dev->base);
48 dev->base = NULL;
49 return 0;
51 dev->scsi_host_ptr->base = pci_resource_start(dev->pdev, 2);
52 dev->regs.rx = ioremap((u64)pci_resource_start(dev->pdev, 0) |
53 ((u64)pci_resource_start(dev->pdev, 1) << 32),
54 sizeof(struct rx_registers) - sizeof(struct rx_inbound));
55 dev->base = NULL;
56 if (dev->regs.rx == NULL)
57 return -1;
58 dev->base = ioremap(dev->scsi_host_ptr->base, size);
59 if (dev->base == NULL) {
60 iounmap(dev->regs.rx);
61 dev->regs.rx = NULL;
62 return -1;
64 dev->IndexRegs = &((struct rx_registers __iomem *)dev->base)->IndexRegs;
65 return 0;
68 /**
69 * aac_nark_init - initialize an NEMER/ARK Split Bar card
70 * @dev: device to configure
74 int aac_nark_init(struct aac_dev * dev)
77 * Fill in the function dispatch table.
79 dev->a_ops.adapter_ioremap = aac_nark_ioremap;
80 dev->a_ops.adapter_comm = aac_rx_select_comm;
82 return _aac_rx_init(dev);