1/*******************************************************************
2 * This file is part of the Emulex Linux Device Driver for         *
3 * Fibre Channel Host Bus Adapters.                                *
4 * Copyright (C) 2017-2018 Broadcom. All Rights Reserved. The term *
5 * ���Broadcom��� refers to Broadcom Inc. and/or its subsidiaries.     *
6 * Copyright (C) 2004-2016 Emulex.  All rights reserved.           *
7 * EMULEX and SLI are trademarks of Emulex.                        *
8 * www.broadcom.com                                                *
9 * Portions Copyright (C) 2004-2005 Christoph Hellwig              *
10 *                                                                 *
11 * This program is free software; you can redistribute it and/or   *
12 * modify it under the terms of version 2 of the GNU General       *
13 * Public License as published by the Free Software Foundation.    *
14 * This program is distributed in the hope that it will be useful. *
15 * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND          *
16 * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY,  *
17 * FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT, ARE      *
18 * DISCLAIMED, EXCEPT TO THE EXTENT THAT SUCH DISCLAIMERS ARE HELD *
19 * TO BE LEGALLY INVALID.  See the GNU General Public License for  *
20 * more details, a copy of which can be found in the file COPYING  *
21 * included with this package.                                     *
22 *******************************************************************/
23
24#define LPFC_ATTR(name, defval, minval, maxval, desc) \
25static uint lpfc_##name = defval;\
26module_param(lpfc_##name, uint, S_IRUGO);\
27MODULE_PARM_DESC(lpfc_##name, desc);\
28lpfc_param_init(name, defval, minval, maxval)
29
30#define LPFC_ATTR_R(name, defval, minval, maxval, desc) \
31static uint lpfc_##name = defval;\
32module_param(lpfc_##name, uint, S_IRUGO);\
33MODULE_PARM_DESC(lpfc_##name, desc);\
34lpfc_param_show(name)\
35lpfc_param_init(name, defval, minval, maxval)\
36static DEVICE_ATTR(lpfc_##name, S_IRUGO, lpfc_##name##_show, NULL)
37
38#define LPFC_ATTR_RW(name, defval, minval, maxval, desc) \
39static uint lpfc_##name = defval;\
40module_param(lpfc_##name, uint, S_IRUGO);\
41MODULE_PARM_DESC(lpfc_##name, desc);\
42lpfc_param_show(name)\
43lpfc_param_init(name, defval, minval, maxval)\
44lpfc_param_set(name, defval, minval, maxval)\
45lpfc_param_store(name)\
46static DEVICE_ATTR(lpfc_##name, S_IRUGO | S_IWUSR,\
47		   lpfc_##name##_show, lpfc_##name##_store)
48
49#define LPFC_BBCR_ATTR_RW(name, defval, minval, maxval, desc) \
50static uint lpfc_##name = defval;\
51module_param(lpfc_##name, uint, 0444);\
52MODULE_PARM_DESC(lpfc_##name, desc);\
53lpfc_param_show(name)\
54lpfc_param_init(name, defval, minval, maxval)\
55lpfc_param_store(name)\
56static DEVICE_ATTR(lpfc_##name, 0444 | 0644,\
57		   lpfc_##name##_show, lpfc_##name##_store)
58
59#define LPFC_ATTR_HEX_R(name, defval, minval, maxval, desc) \
60static uint lpfc_##name = defval;\
61module_param(lpfc_##name, uint, S_IRUGO);\
62MODULE_PARM_DESC(lpfc_##name, desc);\
63lpfc_param_hex_show(name)\
64lpfc_param_init(name, defval, minval, maxval)\
65static DEVICE_ATTR(lpfc_##name, S_IRUGO, lpfc_##name##_show, NULL)
66
67#define LPFC_ATTR_HEX_RW(name, defval, minval, maxval, desc) \
68static uint lpfc_##name = defval;\
69module_param(lpfc_##name, uint, S_IRUGO);\
70MODULE_PARM_DESC(lpfc_##name, desc);\
71lpfc_param_hex_show(name)\
72lpfc_param_init(name, defval, minval, maxval)\
73lpfc_param_set(name, defval, minval, maxval)\
74lpfc_param_store(name)\
75static DEVICE_ATTR(lpfc_##name, S_IRUGO | S_IWUSR,\
76		   lpfc_##name##_show, lpfc_##name##_store)
77
78#define LPFC_VPORT_ATTR(name, defval, minval, maxval, desc) \
79static uint lpfc_##name = defval;\
80module_param(lpfc_##name, uint, S_IRUGO);\
81MODULE_PARM_DESC(lpfc_##name, desc);\
82lpfc_vport_param_init(name, defval, minval, maxval)
83
84#define LPFC_VPORT_ATTR_R(name, defval, minval, maxval, desc) \
85static uint lpfc_##name = defval;\
86module_param(lpfc_##name, uint, S_IRUGO);\
87MODULE_PARM_DESC(lpfc_##name, desc);\
88lpfc_vport_param_show(name)\
89lpfc_vport_param_init(name, defval, minval, maxval)\
90static DEVICE_ATTR(lpfc_##name, S_IRUGO, lpfc_##name##_show, NULL)
91
92#define LPFC_VPORT_ULL_ATTR_R(name, defval, minval, maxval, desc) \
93static uint64_t lpfc_##name = defval;\
94module_param(lpfc_##name, ullong, S_IRUGO);\
95MODULE_PARM_DESC(lpfc_##name, desc);\
96lpfc_vport_param_show(name)\
97lpfc_vport_param_init(name, defval, minval, maxval)\
98static DEVICE_ATTR(lpfc_##name, S_IRUGO, lpfc_##name##_show, NULL)
99
100#define LPFC_VPORT_ATTR_RW(name, defval, minval, maxval, desc) \
101static uint lpfc_##name = defval;\
102module_param(lpfc_##name, uint, S_IRUGO);\
103MODULE_PARM_DESC(lpfc_##name, desc);\
104lpfc_vport_param_show(name)\
105lpfc_vport_param_init(name, defval, minval, maxval)\
106lpfc_vport_param_set(name, defval, minval, maxval)\
107lpfc_vport_param_store(name)\
108static DEVICE_ATTR(lpfc_##name, S_IRUGO | S_IWUSR,\
109		   lpfc_##name##_show, lpfc_##name##_store)
110
111#define LPFC_VPORT_ATTR_HEX_R(name, defval, minval, maxval, desc) \
112static uint lpfc_##name = defval;\
113module_param(lpfc_##name, uint, S_IRUGO);\
114MODULE_PARM_DESC(lpfc_##name, desc);\
115lpfc_vport_param_hex_show(name)\
116lpfc_vport_param_init(name, defval, minval, maxval)\
117static DEVICE_ATTR(lpfc_##name, S_IRUGO, lpfc_##name##_show, NULL)
118
119#define LPFC_VPORT_ATTR_HEX_RW(name, defval, minval, maxval, desc) \
120static uint lpfc_##name = defval;\
121module_param(lpfc_##name, uint, S_IRUGO);\
122MODULE_PARM_DESC(lpfc_##name, desc);\
123lpfc_vport_param_hex_show(name)\
124lpfc_vport_param_init(name, defval, minval, maxval)\
125lpfc_vport_param_set(name, defval, minval, maxval)\
126lpfc_vport_param_store(name)\
127static DEVICE_ATTR(lpfc_##name, S_IRUGO | S_IWUSR,\
128		   lpfc_##name##_show, lpfc_##name##_store)
129