Linux Audio

Check our new training course

Loading...
v3.1
 1/*
 2 *	Adaptec AAC series RAID controller driver
 3 *
 4 * based on the old aacraid driver that is..
 5 * Adaptec aacraid device driver for Linux.
 6 *
 7 * Copyright (c) 2000-2010 Adaptec, Inc.
 8 *               2010 PMC-Sierra, Inc. (aacraid@pmc-sierra.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 *  nark.c
26 *
27 * Abstract: Hardware Device Interface for NEMER/ARK
28 *
29 */
30
31#include <linux/pci.h>
32#include <linux/blkdev.h>
33
34#include <scsi/scsi_host.h>
35
36#include "aacraid.h"
37
38/**
39 *	aac_nark_ioremap
40 *	@size: mapping resize request
41 *
42 */
43static int aac_nark_ioremap(struct aac_dev * dev, u32 size)
44{
45	if (!size) {
46		iounmap(dev->regs.rx);
47		dev->regs.rx = NULL;
48		iounmap(dev->base);
49		dev->base = NULL;
50		return 0;
51	}
52	dev->scsi_host_ptr->base = pci_resource_start(dev->pdev, 2);
53	dev->regs.rx = ioremap((u64)pci_resource_start(dev->pdev, 0) |
54	  ((u64)pci_resource_start(dev->pdev, 1) << 32),
55	  sizeof(struct rx_registers) - sizeof(struct rx_inbound));
56	dev->base = NULL;
57	if (dev->regs.rx == NULL)
58		return -1;
59	dev->base = ioremap(dev->scsi_host_ptr->base, size);
60	if (dev->base == NULL) {
61		iounmap(dev->regs.rx);
62		dev->regs.rx = NULL;
63		return -1;
64	}
65	dev->IndexRegs = &((struct rx_registers __iomem *)dev->base)->IndexRegs;
66	return 0;
67}
68
69/**
70 *	aac_nark_init	-	initialize an NEMER/ARK Split Bar card
71 *	@dev: device to configure
72 *
73 */
74
75int aac_nark_init(struct aac_dev * dev)
76{
77	/*
78	 *	Fill in the function dispatch table.
79	 */
80	dev->a_ops.adapter_ioremap = aac_nark_ioremap;
81	dev->a_ops.adapter_comm = aac_rx_select_comm;
82
83	return _aac_rx_init(dev);
84}
v4.17
 1/*
 2 *	Adaptec AAC series RAID controller driver
 3 *
 4 * based on the old aacraid driver that is..
 5 * Adaptec aacraid device driver for Linux.
 6 *
 7 * Copyright (c) 2000-2010 Adaptec, Inc.
 8 *               2010-2015 PMC-Sierra, Inc. (aacraid@pmc-sierra.com)
 9 *		 2016-2017 Microsemi Corp. (aacraid@microsemi.com)
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2, or (at your option)
14 * any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; see the file COPYING.  If not, write to
23 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
24 *
25 * Module Name:
26 *  nark.c
27 *
28 * Abstract: Hardware Device Interface for NEMER/ARK
29 *
30 */
31
32#include <linux/pci.h>
33#include <linux/blkdev.h>
34
35#include <scsi/scsi_host.h>
36
37#include "aacraid.h"
38
39/**
40 *	aac_nark_ioremap
41 *	@size: mapping resize request
42 *
43 */
44static int aac_nark_ioremap(struct aac_dev * dev, u32 size)
45{
46	if (!size) {
47		iounmap(dev->regs.rx);
48		dev->regs.rx = NULL;
49		iounmap(dev->base);
50		dev->base = NULL;
51		return 0;
52	}
53	dev->base_start = pci_resource_start(dev->pdev, 2);
54	dev->regs.rx = ioremap((u64)pci_resource_start(dev->pdev, 0) |
55	  ((u64)pci_resource_start(dev->pdev, 1) << 32),
56	  sizeof(struct rx_registers) - sizeof(struct rx_inbound));
57	dev->base = NULL;
58	if (dev->regs.rx == NULL)
59		return -1;
60	dev->base = ioremap(dev->base_start, size);
61	if (dev->base == NULL) {
62		iounmap(dev->regs.rx);
63		dev->regs.rx = NULL;
64		return -1;
65	}
66	dev->IndexRegs = &((struct rx_registers __iomem *)dev->base)->IndexRegs;
67	return 0;
68}
69
70/**
71 *	aac_nark_init	-	initialize an NEMER/ARK Split Bar card
72 *	@dev: device to configure
73 *
74 */
75
76int aac_nark_init(struct aac_dev * dev)
77{
78	/*
79	 *	Fill in the function dispatch table.
80	 */
81	dev->a_ops.adapter_ioremap = aac_nark_ioremap;
82	dev->a_ops.adapter_comm = aac_rx_select_comm;
83
84	return _aac_rx_init(dev);
85}