xref: /openbmc/linux/drivers/scsi/lpfc/lpfc_attr.h (revision 3a35093a)
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) \
25 static uint lpfc_##name = defval;\
26 module_param(lpfc_##name, uint, S_IRUGO);\
27 MODULE_PARM_DESC(lpfc_##name, desc);\
28 lpfc_param_init(name, defval, minval, maxval)
29 
30 #define LPFC_ATTR_R(name, defval, minval, maxval, desc) \
31 static uint lpfc_##name = defval;\
32 module_param(lpfc_##name, uint, S_IRUGO);\
33 MODULE_PARM_DESC(lpfc_##name, desc);\
34 lpfc_param_show(name)\
35 lpfc_param_init(name, defval, minval, maxval)\
36 static DEVICE_ATTR(lpfc_##name, S_IRUGO, lpfc_##name##_show, NULL)
37 
38 #define LPFC_ATTR_RW(name, defval, minval, maxval, desc) \
39 static uint lpfc_##name = defval;\
40 module_param(lpfc_##name, uint, S_IRUGO);\
41 MODULE_PARM_DESC(lpfc_##name, desc);\
42 lpfc_param_show(name)\
43 lpfc_param_init(name, defval, minval, maxval)\
44 lpfc_param_set(name, defval, minval, maxval)\
45 lpfc_param_store(name)\
46 static 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) \
50 static uint lpfc_##name = defval;\
51 module_param(lpfc_##name, uint, 0444);\
52 MODULE_PARM_DESC(lpfc_##name, desc);\
53 lpfc_param_show(name)\
54 lpfc_param_init(name, defval, minval, maxval)\
55 lpfc_param_store(name)\
56 static 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) \
60 static uint lpfc_##name = defval;\
61 module_param(lpfc_##name, uint, S_IRUGO);\
62 MODULE_PARM_DESC(lpfc_##name, desc);\
63 lpfc_param_hex_show(name)\
64 lpfc_param_init(name, defval, minval, maxval)\
65 static DEVICE_ATTR(lpfc_##name, S_IRUGO, lpfc_##name##_show, NULL)
66 
67 #define LPFC_ATTR_HEX_RW(name, defval, minval, maxval, desc) \
68 static uint lpfc_##name = defval;\
69 module_param(lpfc_##name, uint, S_IRUGO);\
70 MODULE_PARM_DESC(lpfc_##name, desc);\
71 lpfc_param_hex_show(name)\
72 lpfc_param_init(name, defval, minval, maxval)\
73 lpfc_param_set(name, defval, minval, maxval)\
74 lpfc_param_store(name)\
75 static 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) \
79 static uint lpfc_##name = defval;\
80 module_param(lpfc_##name, uint, S_IRUGO);\
81 MODULE_PARM_DESC(lpfc_##name, desc);\
82 lpfc_vport_param_init(name, defval, minval, maxval)
83 
84 #define LPFC_VPORT_ATTR_R(name, defval, minval, maxval, desc) \
85 static uint lpfc_##name = defval;\
86 module_param(lpfc_##name, uint, S_IRUGO);\
87 MODULE_PARM_DESC(lpfc_##name, desc);\
88 lpfc_vport_param_show(name)\
89 lpfc_vport_param_init(name, defval, minval, maxval)\
90 static DEVICE_ATTR(lpfc_##name, S_IRUGO, lpfc_##name##_show, NULL)
91 
92 #define LPFC_VPORT_ULL_ATTR_R(name, defval, minval, maxval, desc) \
93 static uint64_t lpfc_##name = defval;\
94 module_param(lpfc_##name, ullong, S_IRUGO);\
95 MODULE_PARM_DESC(lpfc_##name, desc);\
96 lpfc_vport_param_show(name)\
97 lpfc_vport_param_init(name, defval, minval, maxval)\
98 static DEVICE_ATTR(lpfc_##name, S_IRUGO, lpfc_##name##_show, NULL)
99 
100 #define LPFC_VPORT_ATTR_RW(name, defval, minval, maxval, desc) \
101 static uint lpfc_##name = defval;\
102 module_param(lpfc_##name, uint, S_IRUGO);\
103 MODULE_PARM_DESC(lpfc_##name, desc);\
104 lpfc_vport_param_show(name)\
105 lpfc_vport_param_init(name, defval, minval, maxval)\
106 lpfc_vport_param_set(name, defval, minval, maxval)\
107 lpfc_vport_param_store(name)\
108 static 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) \
112 static uint lpfc_##name = defval;\
113 module_param(lpfc_##name, uint, S_IRUGO);\
114 MODULE_PARM_DESC(lpfc_##name, desc);\
115 lpfc_vport_param_hex_show(name)\
116 lpfc_vport_param_init(name, defval, minval, maxval)\
117 static DEVICE_ATTR(lpfc_##name, S_IRUGO, lpfc_##name##_show, NULL)
118 
119 #define LPFC_VPORT_ATTR_HEX_RW(name, defval, minval, maxval, desc) \
120 static uint lpfc_##name = defval;\
121 module_param(lpfc_##name, uint, S_IRUGO);\
122 MODULE_PARM_DESC(lpfc_##name, desc);\
123 lpfc_vport_param_hex_show(name)\
124 lpfc_vport_param_init(name, defval, minval, maxval)\
125 lpfc_vport_param_set(name, defval, minval, maxval)\
126 lpfc_vport_param_store(name)\
127 static DEVICE_ATTR(lpfc_##name, S_IRUGO | S_IWUSR,\
128 		   lpfc_##name##_show, lpfc_##name##_store)
129