1239eab19SMark Haverkamp /* 2239eab19SMark Haverkamp * Adaptec AAC series RAID controller driver 3239eab19SMark Haverkamp * 4239eab19SMark Haverkamp * based on the old aacraid driver that is.. 5239eab19SMark Haverkamp * Adaptec aacraid device driver for Linux. 6239eab19SMark Haverkamp * 7e8b12f0fSMahesh Rajashekhara * Copyright (c) 2000-2010 Adaptec, Inc. 8e8b12f0fSMahesh Rajashekhara * 2010 PMC-Sierra, Inc. (aacraid@pmc-sierra.com) 9239eab19SMark Haverkamp * 10239eab19SMark Haverkamp * This program is free software; you can redistribute it and/or modify 11239eab19SMark Haverkamp * it under the terms of the GNU General Public License as published by 12239eab19SMark Haverkamp * the Free Software Foundation; either version 2, or (at your option) 13239eab19SMark Haverkamp * any later version. 14239eab19SMark Haverkamp * 15239eab19SMark Haverkamp * This program is distributed in the hope that it will be useful, 16239eab19SMark Haverkamp * but WITHOUT ANY WARRANTY; without even the implied warranty of 17239eab19SMark Haverkamp * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18239eab19SMark Haverkamp * GNU General Public License for more details. 19239eab19SMark Haverkamp * 20239eab19SMark Haverkamp * You should have received a copy of the GNU General Public License 21239eab19SMark Haverkamp * along with this program; see the file COPYING. If not, write to 22239eab19SMark Haverkamp * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 23239eab19SMark Haverkamp * 24239eab19SMark Haverkamp * Module Name: 25239eab19SMark Haverkamp * nark.c 26239eab19SMark Haverkamp * 27239eab19SMark Haverkamp * Abstract: Hardware Device Interface for NEMER/ARK 28239eab19SMark Haverkamp * 29239eab19SMark Haverkamp */ 30239eab19SMark Haverkamp 31239eab19SMark Haverkamp #include <linux/pci.h> 32239eab19SMark Haverkamp #include <linux/blkdev.h> 33239eab19SMark Haverkamp 34239eab19SMark Haverkamp #include <scsi/scsi_host.h> 35239eab19SMark Haverkamp 36239eab19SMark Haverkamp #include "aacraid.h" 37239eab19SMark Haverkamp 38239eab19SMark Haverkamp /** 39239eab19SMark Haverkamp * aac_nark_ioremap 40239eab19SMark Haverkamp * @size: mapping resize request 41239eab19SMark Haverkamp * 42239eab19SMark Haverkamp */ 43239eab19SMark Haverkamp static int aac_nark_ioremap(struct aac_dev * dev, u32 size) 44239eab19SMark Haverkamp { 45239eab19SMark Haverkamp if (!size) { 46239eab19SMark Haverkamp iounmap(dev->regs.rx); 47239eab19SMark Haverkamp dev->regs.rx = NULL; 48239eab19SMark Haverkamp iounmap(dev->base); 49239eab19SMark Haverkamp dev->base = NULL; 50239eab19SMark Haverkamp return 0; 51239eab19SMark Haverkamp } 52*ff08784bSBen Collins dev->base_start = pci_resource_start(dev->pdev, 2); 53239eab19SMark Haverkamp dev->regs.rx = ioremap((u64)pci_resource_start(dev->pdev, 0) | 54239eab19SMark Haverkamp ((u64)pci_resource_start(dev->pdev, 1) << 32), 55239eab19SMark Haverkamp sizeof(struct rx_registers) - sizeof(struct rx_inbound)); 56239eab19SMark Haverkamp dev->base = NULL; 57239eab19SMark Haverkamp if (dev->regs.rx == NULL) 58239eab19SMark Haverkamp return -1; 59*ff08784bSBen Collins dev->base = ioremap(dev->base_start, size); 60239eab19SMark Haverkamp if (dev->base == NULL) { 61239eab19SMark Haverkamp iounmap(dev->regs.rx); 62239eab19SMark Haverkamp dev->regs.rx = NULL; 63239eab19SMark Haverkamp return -1; 64239eab19SMark Haverkamp } 65239eab19SMark Haverkamp dev->IndexRegs = &((struct rx_registers __iomem *)dev->base)->IndexRegs; 66239eab19SMark Haverkamp return 0; 67239eab19SMark Haverkamp } 68239eab19SMark Haverkamp 69239eab19SMark Haverkamp /** 70239eab19SMark Haverkamp * aac_nark_init - initialize an NEMER/ARK Split Bar card 71239eab19SMark Haverkamp * @dev: device to configure 72239eab19SMark Haverkamp * 73239eab19SMark Haverkamp */ 74239eab19SMark Haverkamp 75239eab19SMark Haverkamp int aac_nark_init(struct aac_dev * dev) 76239eab19SMark Haverkamp { 77239eab19SMark Haverkamp /* 78239eab19SMark Haverkamp * Fill in the function dispatch table. 79239eab19SMark Haverkamp */ 80239eab19SMark Haverkamp dev->a_ops.adapter_ioremap = aac_nark_ioremap; 81239eab19SMark Haverkamp dev->a_ops.adapter_comm = aac_rx_select_comm; 82239eab19SMark Haverkamp 83239eab19SMark Haverkamp return _aac_rx_init(dev); 84239eab19SMark Haverkamp } 85