1 /******************************************************************************
2  *
3  * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms of version 2 of the GNU General Public License as
7  * published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12  * more details.
13  *
14  * You should have received a copy of the GNU General Public License along with
15  * this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
17  *
18  *
19  ******************************************************************************/
20 #ifndef _RTW_IOCTL_H_
21 #define _RTW_IOCTL_H_
22 
23 #include <osdep_service.h>
24 #include <drv_types.h>
25 
26 
27 #ifndef OID_802_11_CAPABILITY
28 	#define OID_802_11_CAPABILITY	0x0d010122
29 #endif
30 
31 #ifndef OID_802_11_PMKID
32 	#define OID_802_11_PMKID	0x0d010123
33 #endif
34 
35 
36 /*  For DDK-defined OIDs */
37 #define OID_NDIS_SEG1	0x00010100
38 #define OID_NDIS_SEG2	0x00010200
39 #define OID_NDIS_SEG3	0x00020100
40 #define OID_NDIS_SEG4	0x01010100
41 #define OID_NDIS_SEG5	0x01020100
42 #define OID_NDIS_SEG6	0x01020200
43 #define OID_NDIS_SEG7	0xFD010100
44 #define OID_NDIS_SEG8	0x0D010100
45 #define OID_NDIS_SEG9	0x0D010200
46 #define OID_NDIS_SEG10	0x0D020200
47 
48 #define SZ_OID_NDIS_SEG1	23
49 #define SZ_OID_NDIS_SEG2	3
50 #define SZ_OID_NDIS_SEG3	6
51 #define SZ_OID_NDIS_SEG4	6
52 #define SZ_OID_NDIS_SEG5	4
53 #define SZ_OID_NDIS_SEG6	8
54 #define SZ_OID_NDIS_SEG7	7
55 #define SZ_OID_NDIS_SEG8	36
56 #define SZ_OID_NDIS_SEG9	24
57 #define SZ_OID_NDIS_SEG10	19
58 
59 /*  For Realtek-defined OIDs */
60 #define OID_MP_SEG1		0xFF871100
61 #define OID_MP_SEG2		0xFF818000
62 
63 #define OID_MP_SEG3		0xFF818700
64 #define OID_MP_SEG4		0xFF011100
65 
66 #define DEBUG_OID(dbg, str)						\
67 	if ((!dbg)) {							\
68 		RT_TRACE(_module_rtl871x_ioctl_c_, _drv_info_,		\
69 			 ("%s(%d): %s", __func__, __line__, str));	\
70 	}
71 
72 enum oid_type {
73 	QUERY_OID,
74 	SET_OID
75 };
76 
77 struct oid_funs_node {
78 	unsigned int oid_start; /* the starting number for OID */
79 	unsigned int oid_end; /* the ending number for OID */
80 	struct oid_obj_priv *node_array;
81 	unsigned int array_sz; /* the size of node_array */
82 	int query_counter; /* count the number of query hits for this segment */
83 	int set_counter; /* count the number of set hits for this segment */
84 };
85 
86 struct oid_par_priv {
87 	void		*adapter_context;
88 	NDIS_OID	oid;
89 	void		*information_buf;
90 	u32		information_buf_len;
91 	u32		*bytes_rw;
92 	u32		*bytes_needed;
93 	enum oid_type	type_of_oid;
94 	u32		dbg;
95 };
96 
97 struct oid_obj_priv {
98 	unsigned char	dbg; /*  0: without OID debug message
99 			      *  1: with OID debug message */
100 	int (*oidfuns)(struct oid_par_priv *poid_par_priv);
101 };
102 
103 #if defined(_RTW_MP_IOCTL_C_)
oid_null_function(struct oid_par_priv * poid_par_priv)104 static int oid_null_function(struct oid_par_priv *poid_par_priv) {
105 	return NDIS_STATUS_SUCCESS;
106 }
107 #endif
108 
109 extern struct iw_handler_def  rtw_handlers_def;
110 
111 int drv_query_info(struct  net_device *miniportadaptercontext, NDIS_OID oid,
112 		   void *informationbuffer, u32 informationbufferlength,
113 		   u32 *byteswritten, u32 *bytesneeded);
114 
115 int drv_set_info(struct  net_device *MiniportAdapterContext,
116 		 NDIS_OID oid, void *informationbuffer,
117 		 u32 informationbufferlength, u32 *bytesread,
118 		 u32 *bytesneeded);
119 
120 #endif /*  #ifndef __INC_CEINFO_ */
121