AFHBA404
AFHBA404 connects ACQ2106 to PCI-Express
afhba_core.c
Go to the documentation of this file.
1 /* ------------------------------------------------------------------------- */
2 /* afhba_core.c AFHBA */
3 /*
4  * afhba_core.c
5  *
6  * Created on: 24 Jan 2015
7  * Author: pgm
8  */
9 
10 /* ------------------------------------------------------------------------- */
11 /* Copyright (C) 2015 Peter Milne, D-TACQ Solutions Ltd *
12  * <peter dot milne at D hyphen TACQ dot com> *
13  * *
14  * This program is free software; you can redistribute it and/or modify *
15  * it under the terms of Version 2 of the GNU General Public License *
16  * as published by the Free Software Foundation; *
17  * *
18  * This program is distributed in the hope that it will be useful, *
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
21  * GNU General Public License for more details. *
22  * *
23  * You should have received a copy of the GNU General Public License *
24  * along with this program; if not, write to the Free Software *
25  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
26 /* ------------------------------------------------------------------------- */
27 
28 #include "acq-fiber-hba.h"
29 
30 /* this fragment of code is linked into >1 module
31  * debugs individually switched from module params
32  * do not use dev_dbg - multiple instances same file..
33  */
36 
37 #define VBS1 (reg_access_verbose >= 1)
38 #define VBS2 (reg_access_verbose >= 2)
39 
40 void afhba_write_reg(struct AFHBA_DEV *adev, int regoff, u32 value)
41 {
42  void* va = adev->mappings[REGS_BAR].va + regoff;
43  if (VBS1) dev_info(pdev(adev), "afhba_write_reg %04x = %08x", regoff, value);
44  writel(value, va);
45  if (VBS2) dev_info(pdev(adev), "%p : %08x", va, readl(va));
46 }
47 
48 u32 afhba_read_reg(struct AFHBA_DEV *adev, int regoff)
49 {
50  void* va = adev->mappings[REGS_BAR].va + regoff;
51  u32 rv = readl(va);
52  if (VBS1) dev_info(pdev(adev), "afhba_read_reg %04x = %08x", regoff, rv);
53  return rv;
54 }
55 
module_param
module_param(reg_access_verbose, int, 0644)
AFHBA_DEV::PciMapping::va
void * va
Definition: acq-fiber-hba.h:125
pdev
#define pdev(adev)
Definition: acq-fiber-hba.h:176
VBS1
#define VBS1
Definition: afhba_core.c:37
VBS2
#define VBS2
Definition: afhba_core.c:38
afhba_write_reg
void afhba_write_reg(struct AFHBA_DEV *adev, int regoff, u32 value)
Definition: afhba_core.c:40
REGS_BAR
#define REGS_BAR
Definition: acq-fiber-hba.h:181
AFHBA_DEV
Definition: acq-fiber-hba.h:111
afhba_read_reg
u32 afhba_read_reg(struct AFHBA_DEV *adev, int regoff)
Definition: afhba_core.c:48
reg_access_verbose
int reg_access_verbose
Definition: afhba_core.c:34
AFHBA_DEV::mappings
struct AFHBA_DEV::PciMapping mappings[MAP_COUNT_MAX]
acq-fiber-hba.h
u32
unsigned u32
Definition: local.h:60