Staging: rt*: don't confuse user of rt3070 driver with rt2870 strings
[pandora-kernel.git] / drivers / staging / rt2860 / rt_linux.h
1 /*
2  *************************************************************************
3  * Ralink Tech Inc.
4  * 5F., No.36, Taiyuan St., Jhubei City,
5  * Hsinchu County 302,
6  * Taiwan, R.O.C.
7  *
8  * (c) Copyright 2002-2007, Ralink Technology, Inc.
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 of the License, or     *
13  * (at your option) 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; if not, write to the                         *
22  * Free Software Foundation, Inc.,                                       *
23  * 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
24  *                                                                       *
25  *************************************************************************
26  */
27
28 /***********************************************************************/
29 /*                                                                     */
30 /*   Program:    rt_linux.c                                            */
31 /*   Created:    4/21/2006 1:17:38 PM                                  */
32 /*   Author:     Wu Xi-Kun                                             */
33 /*   Comments:   `description`                                         */
34 /*                                                                     */
35 /*---------------------------------------------------------------------*/
36 /*                                                                     */
37 /* History:                                                            */
38 /*    Revision 1.1 4/21/2006 1:17:38 PM  xsikun                        */
39 /*    Initial revision                                                 */
40 /*                                                                     */
41 /***********************************************************************/
42
43 #include "rtmp_type.h"
44 #include <linux/module.h>
45 #include <linux/kernel.h>
46
47 #include <linux/spinlock.h>
48 #include <linux/init.h>
49 #include <linux/string.h>
50 #include <linux/timer.h>
51 #include <linux/errno.h>
52 #include <linux/slab.h>
53 #include <linux/interrupt.h>
54 #include <linux/pci.h>
55 #include <linux/netdevice.h>
56 #include <linux/etherdevice.h>
57 #include <linux/skbuff.h>
58 #include <linux/ethtool.h>
59 #include <linux/wireless.h>
60 #include <linux/proc_fs.h>
61 #include <linux/delay.h>
62 #include <linux/if_arp.h>
63 #include <linux/ctype.h>
64 #include <linux/vmalloc.h>
65
66
67 #ifdef RT30xx
68 #include <linux/wireless.h>
69 #endif
70 #include <net/iw_handler.h>
71
72 // load firmware
73 #define __KERNEL_SYSCALLS__
74 #include <linux/unistd.h>
75 #include <asm/uaccess.h>
76
77
78 #define MEM_ALLOC_FLAG      (GFP_ATOMIC) //(GFP_DMA | GFP_ATOMIC)
79
80 #ifndef IFNAMSIZ
81 #define IFNAMSIZ 16
82 #endif
83
84 //#define CONFIG_CKIP_SUPPORT
85
86 #undef __inline
87 #define __inline           static inline
88
89 typedef int (*HARD_START_XMIT_FUNC)(struct sk_buff *skb, struct net_device *net_dev);
90
91 // add by kathy
92
93 /* order of "if defined()" is important, because for 3070 driver
94    both RT2870 and RT3070 are defined */
95 #if defined(RT2860)
96  #define STA_PROFILE_PATH                       "/etc/Wireless/RT2860STA/RT2860STA.dat"
97  #define STA_RTMP_FIRMWARE_FILE_NAME "/etc/Wireless/RT2860STA/RT2860STA.bin"
98  #define STA_NIC_DEVICE_NAME                    "RT2860STA"
99  #define STA_DRIVER_VERSION                     "1.8.1.1"
100 #elif defined(RT3070)
101  #define STA_PROFILE_PATH                       "/etc/Wireless/RT3070STA/RT3070STA.dat"
102  #define STA_RT2870_IMAGE_FILE_NAME  "/etc/Wireless/RT3070STA/rt2870.bin"
103  #define STA_NIC_DEVICE_NAME                    "RT3070STA"
104  #define STA_DRIVER_VERSION                     "2.0.1.0"
105 #elif defined(RT2870)
106  #define STA_PROFILE_PATH                       "/etc/Wireless/RT2870STA/RT2870STA.dat"
107  #define STA_RT2870_IMAGE_FILE_NAME  "/etc/Wireless/RT2870STA/rt2870.bin"
108  #define STA_NIC_DEVICE_NAME                    "RT2870STA"
109  #define STA_DRIVER_VERSION                     "1.4.0.0"
110 #endif
111
112 #ifdef RT2860
113 #ifndef PCI_DEVICE
114 #define PCI_DEVICE(vend,dev) \
115         .vendor = (vend), .device = (dev), \
116         .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID
117 #endif // PCI_DEVICE //
118 #endif
119
120 #define RTMP_TIME_AFTER(a,b)            \
121         (typecheck(unsigned long, (unsigned long)a) && \
122          typecheck(unsigned long, (unsigned long)b) && \
123          ((long)(b) - (long)(a) < 0))
124
125 #define RTMP_TIME_AFTER_EQ(a,b) \
126         (typecheck(unsigned long, (unsigned long)a) && \
127          typecheck(unsigned long, (unsigned long)b) && \
128          ((long)(a) - (long)(b) >= 0))
129 #define RTMP_TIME_BEFORE(a,b)   RTMP_TIME_AFTER_EQ(b,a)
130
131 #define RT_MOD_INC_USE_COUNT() \
132         if (!try_module_get(THIS_MODULE)) \
133         { \
134                 DBGPRINT(RT_DEBUG_ERROR, ("%s: cannot reserve module\n", __func__)); \
135                 return -1; \
136         }
137
138 #define RT_MOD_DEC_USE_COUNT() module_put(THIS_MODULE);
139
140 #define OS_HZ                   HZ
141
142 #define ETH_LENGTH_OF_ADDRESS   6
143
144 #define IN
145 #define OUT
146
147 #define NDIS_STATUS                             INT
148 #define NDIS_STATUS_SUCCESS                     0x00
149 #define NDIS_STATUS_FAILURE                     0x01
150 #define NDIS_STATUS_INVALID_DATA                                0x02
151 #define NDIS_STATUS_RESOURCES                   0x03
152
153 #define MIN_NET_DEVICE_FOR_AID                  0x00            //0x00~0x3f
154 #define MIN_NET_DEVICE_FOR_MBSSID               0x00            //0x00,0x10,0x20,0x30
155 #define MIN_NET_DEVICE_FOR_WDS                  0x10            //0x40,0x50,0x60,0x70
156 #define MIN_NET_DEVICE_FOR_APCLI                0x20
157 #define MIN_NET_DEVICE_FOR_MESH                 0x30
158 #define MIN_NET_DEVICE_FOR_DLS                  0x40
159
160 #define NDIS_PACKET_TYPE_DIRECTED               0
161 #define NDIS_PACKET_TYPE_MULTICAST              1
162 #define NDIS_PACKET_TYPE_BROADCAST              2
163 #define NDIS_PACKET_TYPE_ALL_MULTICAST  3
164
165 #ifndef RT30xx
166 typedef struct pid *    THREAD_PID;
167 #define THREAD_PID_INIT_VALUE   NULL
168 #define GET_PID(_v)     find_get_pid(_v)
169 #define GET_PID_NUMBER(_v)      pid_nr(_v)
170 #define CHECK_PID_LEGALITY(_pid)        if (pid_nr(_pid) >= 0)
171 #define KILL_THREAD_PID(_A, _B, _C)     kill_pid(_A, _B, _C)
172 #endif
173
174 struct os_lock  {
175         spinlock_t              lock;
176         unsigned long   flags;
177 };
178
179
180 struct os_cookie {
181 #ifdef RT2860
182         struct pci_dev                  *pci_dev;
183         struct pci_dev                  *parent_pci_dev;
184         dma_addr_t                              pAd_pa;
185 #endif
186 #ifdef RT2870
187         struct usb_device               *pUsb_Dev;
188
189 #ifndef RT30xx
190         THREAD_PID                              MLMEThr_pid;
191         THREAD_PID                              RTUSBCmdThr_pid;
192         THREAD_PID                              TimerQThr_pid;
193 #endif
194 #ifdef RT30xx
195         struct pid      *MLMEThr_pid;
196         struct pid      *RTUSBCmdThr_pid;
197         struct pid      *TimerQThr_pid;
198 #endif
199 #endif // RT2870 //
200
201         struct tasklet_struct   rx_done_task;
202         struct tasklet_struct   mgmt_dma_done_task;
203         struct tasklet_struct   ac0_dma_done_task;
204         struct tasklet_struct   ac1_dma_done_task;
205         struct tasklet_struct   ac2_dma_done_task;
206         struct tasklet_struct   ac3_dma_done_task;
207         struct tasklet_struct   hcca_dma_done_task;
208         struct tasklet_struct   tbtt_task;
209 #ifdef RT2860
210         struct tasklet_struct   fifo_statistic_full_task;
211 #endif
212 #ifdef RT2870
213         struct tasklet_struct   null_frame_complete_task;
214         struct tasklet_struct   rts_frame_complete_task;
215         struct tasklet_struct   pspoll_frame_complete_task;
216 #endif // RT2870 //
217
218         unsigned long                   apd_pid; //802.1x daemon pid
219         INT                                             ioctl_if_type;
220         INT                                     ioctl_if;
221 };
222
223 typedef struct _VIRTUAL_ADAPTER
224 {
225         struct net_device               *RtmpDev;
226         struct net_device               *VirtualDev;
227 } VIRTUAL_ADAPTER, PVIRTUAL_ADAPTER;
228
229 #undef  ASSERT
230 #define ASSERT(x)
231
232 typedef struct os_cookie        * POS_COOKIE;
233 typedef struct pci_dev          * PPCI_DEV;
234 typedef struct net_device       * PNET_DEV;
235 typedef void                            * PNDIS_PACKET;
236 typedef char                            NDIS_PACKET;
237 typedef PNDIS_PACKET            * PPNDIS_PACKET;
238 typedef dma_addr_t                      NDIS_PHYSICAL_ADDRESS;
239 typedef dma_addr_t                      * PNDIS_PHYSICAL_ADDRESS;
240 typedef spinlock_t                      NDIS_SPIN_LOCK;
241 typedef struct timer_list       NDIS_MINIPORT_TIMER;
242 typedef void                            * NDIS_HANDLE;
243 typedef char                            * PNDIS_BUFFER;
244
245
246
247 void hex_dump(char *str, unsigned char *pSrcBufVA, unsigned int SrcBufLen);
248
249 dma_addr_t linux_pci_map_single(void *handle, void *ptr, size_t size, int sd_idx, int direction);
250 void linux_pci_unmap_single(void *handle, dma_addr_t dma_addr, size_t size, int direction);
251
252
253 ////////////////////////////////////////
254 // MOVE TO rtmp.h ?
255 /////////////////////////////////////////
256 #define PKTSRC_NDIS             0x7f
257 #define PKTSRC_DRIVER           0x0f
258 #define PRINT_MAC(addr) \
259         addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]
260
261
262 #define RT2860_PCI_DEVICE_ID            0x0601
263
264 #ifdef RT2860
265 #define PCI_MAP_SINGLE(_handle, _ptr, _size, _sd_idx, _dir) \
266         linux_pci_map_single(_handle, _ptr, _size, _sd_idx, _dir)
267
268 #define PCI_UNMAP_SINGLE(_handle, _ptr, _size, _dir) \
269         linux_pci_unmap_single(_handle, _ptr, _size, _dir)
270
271 #define PCI_ALLOC_CONSISTENT(_pci_dev, _size, _ptr) \
272         pci_alloc_consistent(_pci_dev, _size, _ptr)
273
274 #define PCI_FREE_CONSISTENT(_pci_dev, _size, _virtual_addr, _physical_addr) \
275         pci_free_consistent(_pci_dev, _size, _virtual_addr, _physical_addr)
276
277 #define DEV_ALLOC_SKB(_length) \
278         dev_alloc_skb(_length)
279 #endif
280 #ifdef RT2870
281 #define PCI_MAP_SINGLE(_handle, _ptr, _size, _dir) (ULONG)0
282
283 #define PCI_UNMAP_SINGLE(_handle, _ptr, _size, _dir)
284 #endif // RT2870 //
285
286
287 #define BEACON_FRAME_DMA_CACHE_WBACK(_ptr, _size)       \
288         dma_cache_wback(_ptr, _size)
289
290
291 //////////////////////////////////////////
292 //
293 //////////////////////////////////////////
294
295
296 #define NdisMIndicateStatus(_w, _x, _y, _z)
297
298 typedef struct timer_list       RTMP_OS_TIMER;
299
300 #ifdef RT2870
301 /* ----------------- Timer Related MARCO ---------------*/
302 // In RT2870, we have a lot of timer functions and will read/write register, it's
303 //      not allowed in Linux USB sub-system to do it ( because of sleep issue when submit
304 //  to ctrl pipe). So we need a wrapper function to take care it.
305
306 typedef VOID (*RT2870_TIMER_HANDLE)(
307         IN  PVOID   SystemSpecific1,
308         IN  PVOID   FunctionContext,
309         IN  PVOID   SystemSpecific2,
310         IN  PVOID   SystemSpecific3);
311 #endif // RT2870 //
312
313
314 typedef struct  _RALINK_TIMER_STRUCT    {
315     RTMP_OS_TIMER               TimerObj;       // Ndis Timer object
316         BOOLEAN                         Valid;                  // Set to True when call RTMPInitTimer
317     BOOLEAN             State;          // True if timer cancelled
318     BOOLEAN                     PeriodicType;   // True if timer is periodic timer
319     BOOLEAN             Repeat;         // True if periodic timer
320     ULONG               TimerValue;     // Timer value in milliseconds
321         ULONG                           cookie;                 // os specific object
322 #ifdef RT2870
323         RT2870_TIMER_HANDLE     handle;
324         void                            *pAd;
325 #endif // RT2870 //
326 }   RALINK_TIMER_STRUCT, *PRALINK_TIMER_STRUCT;
327
328
329 #ifdef RT2870
330
331 typedef enum _RT2870_KERNEL_THREAD_STATUS_
332 {
333         RT2870_THREAD_UNKNOWN = 0,
334         RT2870_THREAD_INITED = 1,
335         RT2870_THREAD_RUNNING = 2,
336         RT2870_THREAD_STOPED = 4,
337 }RT2870_KERNEL_THREAD_STATUS;
338
339 #define RT2870_THREAD_CAN_DO_INSERT             (RT2870_THREAD_INITED |RT2870_THREAD_RUNNING)
340
341 typedef struct _RT2870_TIMER_ENTRY_
342 {
343         RALINK_TIMER_STRUCT                     *pRaTimer;
344         struct _RT2870_TIMER_ENTRY_     *pNext;
345 }RT2870_TIMER_ENTRY;
346
347
348 #define TIMER_QUEUE_SIZE_MAX    128
349 typedef struct _RT2870_TIMER_QUEUE_
350 {
351         unsigned int            status;
352         UCHAR                           *pTimerQPoll;
353         RT2870_TIMER_ENTRY      *pQPollFreeList;
354         RT2870_TIMER_ENTRY      *pQHead;
355         RT2870_TIMER_ENTRY      *pQTail;
356 }RT2870_TIMER_QUEUE;
357 #endif // RT2870 //
358
359
360 //#define DBG   1
361
362 //
363 //  MACRO for debugging information
364 //
365
366 #ifdef DBG
367 extern ULONG    RTDebugLevel;
368
369 #define DBGPRINT_RAW(Level, Fmt)    \
370 {                                   \
371     if (Level <= RTDebugLevel)      \
372     {                               \
373         printk Fmt;               \
374     }                               \
375 }
376
377 #define DBGPRINT(Level, Fmt)    DBGPRINT_RAW(Level, Fmt)
378
379
380 #define DBGPRINT_ERR(Fmt)           \
381 {                                   \
382     printk("ERROR!!! ");          \
383     printk Fmt;                  \
384 }
385
386 #define DBGPRINT_S(Status, Fmt)         \
387 {                                                                       \
388         printk Fmt;                                     \
389 }
390
391
392 #else
393 #define DBGPRINT(Level, Fmt)
394 #define DBGPRINT_RAW(Level, Fmt)
395 #define DBGPRINT_S(Status, Fmt)
396 #define DBGPRINT_ERR(Fmt)
397 #endif
398
399
400 //
401 //  spin_lock enhanced for Nested spin lock
402 //
403 #define NdisAllocateSpinLock(__lock)      \
404 {                                       \
405     spin_lock_init((spinlock_t *)(__lock));               \
406 }
407
408 #define NdisFreeSpinLock(lock)          \
409 {                                       \
410 }
411
412
413 #define RTMP_SEM_LOCK(__lock)                                   \
414 {                                                                                               \
415         spin_lock_bh((spinlock_t *)(__lock));                           \
416 }
417
418 #define RTMP_SEM_UNLOCK(__lock)                                 \
419 {                                                                                               \
420         spin_unlock_bh((spinlock_t *)(__lock));                         \
421 }
422
423 // sample, use semaphore lock to replace IRQ lock, 2007/11/15
424 #define RTMP_IRQ_LOCK(__lock, __irqflags)                       \
425 {                                                                                                       \
426         __irqflags = 0;                                                                 \
427         spin_lock_bh((spinlock_t *)(__lock));                   \
428         pAd->irq_disabled |= 1; \
429 }
430
431 #define RTMP_IRQ_UNLOCK(__lock, __irqflag)                      \
432 {                                                                                                       \
433         pAd->irq_disabled &= 0; \
434         spin_unlock_bh((spinlock_t *)(__lock));                 \
435 }
436
437 #define RTMP_INT_LOCK(__lock, __irqflags)                       \
438 {                                                                                                       \
439         spin_lock_irqsave((spinlock_t *)__lock, __irqflags);    \
440 }
441
442 #define RTMP_INT_UNLOCK(__lock, __irqflag)                      \
443 {                                                                                                       \
444         spin_unlock_irqrestore((spinlock_t *)(__lock), ((unsigned long)__irqflag));     \
445 }
446
447 #ifdef RT2860
448 #if defined(INF_TWINPASS) || defined(INF_DANUBE) || defined(IKANOS_VX_1X0)
449 //Patch for ASIC turst read/write bug, needs to remove after metel fix
450 #define RTMP_IO_READ32(_A, _R, _pV)                                                                     \
451 {                                                                                                                                       \
452     if ((_A)->bPCIclkOff == FALSE)                                      \
453     {                                                                   \
454         (*_pV = readl((void *)((_A)->CSRBaseAddress + MAC_CSR0)));              \
455         (*_pV = readl((void *)((_A)->CSRBaseAddress + (_R))));                  \
456         (*_pV = SWAP32(*((UINT32 *)(_pV))));                           \
457     }                                                                   \
458 }
459 #define RTMP_IO_FORCE_READ32(_A, _R, _pV)                                                       \
460 {                                                                                                                                       \
461         (*_pV = readl((void *)((_A)->CSRBaseAddress + MAC_CSR0)));              \
462         (*_pV = readl((void *)((_A)->CSRBaseAddress + (_R))));                  \
463         (*_pV = SWAP32(*((UINT32 *)(_pV))));                           \
464 }
465 #define RTMP_IO_READ8(_A, _R, _pV)                                                                      \
466 {                                                                                                                                       \
467         (*_pV = readl((void *)((_A)->CSRBaseAddress + MAC_CSR0)));              \
468         (*_pV = readb((void *)((_A)->CSRBaseAddress + (_R))));                  \
469 }
470 #define RTMP_IO_WRITE32(_A, _R, _V)                                                                     \
471 {                                                                                                                                       \
472     if ((_A)->bPCIclkOff == FALSE)                                      \
473     {                                                                   \
474         UINT32  _Val;                                                                                                   \
475         _Val = readl((void *)((_A)->CSRBaseAddress + MAC_CSR0));                \
476         _Val = SWAP32(_V);                                                                                              \
477         writel(_Val, (void *)((_A)->CSRBaseAddress + (_R)));                    \
478     }                                                                   \
479 }
480 #define RTMP_IO_WRITE8(_A, _R, _V)                                                                      \
481 {                                                                                                                                       \
482         UINT    Val;                                                                                                    \
483         Val = readl((void *)((_A)->CSRBaseAddress + MAC_CSR0));         \
484         writeb((_V), (PUCHAR)((_A)->CSRBaseAddress + (_R)));                    \
485 }
486 #define RTMP_IO_WRITE16(_A, _R, _V)                                                                     \
487 {                                                                                                                                       \
488         UINT    Val;                                                                                                    \
489         Val = readl((void *)((_A)->CSRBaseAddress + MAC_CSR0));         \
490         writew(SWAP16((_V)), (PUSHORT)((_A)->CSRBaseAddress + (_R)));   \
491 }
492 #else
493 //Patch for ASIC turst read/write bug, needs to remove after metel fix
494 #define RTMP_IO_READ32(_A, _R, _pV)                                                             \
495 {                                                                                                                               \
496     if ((_A)->bPCIclkOff == FALSE)                                  \
497     {                                                               \
498                 (*_pV = readl((void *)((_A)->CSRBaseAddress + MAC_CSR0)));              \
499                 (*_pV = readl((void *)((_A)->CSRBaseAddress + (_R))));                  \
500     }                                                               \
501     else                                                                                                                        \
502                 *_pV = 0;                                                                                                       \
503 }
504 #define RTMP_IO_FORCE_READ32(_A, _R, _pV)                                                       \
505 {                                                                                                                                       \
506         (*_pV = readl((void *)((_A)->CSRBaseAddress + MAC_CSR0)));              \
507         (*_pV = readl((void *)((_A)->CSRBaseAddress + (_R))));                  \
508 }
509 #define RTMP_IO_READ8(_A, _R, _pV)                                                              \
510 {                                                                                                                               \
511         (*_pV = readl((void *)((_A)->CSRBaseAddress + MAC_CSR0)));                      \
512         (*_pV = readb((void *)((_A)->CSRBaseAddress + (_R))));                          \
513 }
514 #define RTMP_IO_WRITE32(_A, _R, _V)                                                                                             \
515 {                                                                                                                                                               \
516     if ((_A)->bPCIclkOff == FALSE)                                  \
517     {                                                               \
518         UINT    Val;                                                                                                                            \
519         Val = readl((void *)((_A)->CSRBaseAddress + MAC_CSR0));                 \
520         writel(_V, (void *)((_A)->CSRBaseAddress + (_R)));                                                              \
521     }                                                               \
522 }
523 #if defined(BRCM_6358)
524 #define RTMP_IO_WRITE8(_A, _R, _V)            \
525 {                    \
526         ULONG Val;                \
527         UCHAR _i;                \
528         _i = (_R & 0x3);             \
529         Val = readl((void *)((_A)->CSRBaseAddress + (_R - _i)));   \
530         Val = Val & (~(0x000000ff << ((_i)*8)));         \
531         Val = Val | ((ULONG)_V << ((_i)*8));         \
532         writel((Val), (void *)((_A)->CSRBaseAddress + (_R - _i)));    \
533 }
534 #else
535 #define RTMP_IO_WRITE8(_A, _R, _V)                                                                                              \
536 {                                                                                                                                                               \
537         UINT    Val;                                                                                                                            \
538         Val = readl((void *)((_A)->CSRBaseAddress + MAC_CSR0));                 \
539         writeb((_V), (PUCHAR)((_A)->CSRBaseAddress + (_R)));            \
540 }
541 #endif
542 #define RTMP_IO_WRITE16(_A, _R, _V)                                                                                             \
543 {                                                                                                                                                               \
544         UINT    Val;                                                                                                                            \
545         Val = readl((void *)((_A)->CSRBaseAddress + MAC_CSR0));                 \
546         writew((_V), (PUSHORT)((_A)->CSRBaseAddress + (_R)));   \
547 }
548 #endif
549 #endif /* RT2860 */
550 #ifdef RT2870
551 //Patch for ASIC turst read/write bug, needs to remove after metel fix
552 #define RTMP_IO_READ32(_A, _R, _pV)                                                             \
553         RTUSBReadMACRegister(_A, _R, _pV)
554
555 #define RTMP_IO_READ8(_A, _R, _pV)                                                              \
556 {                                                                                                                               \
557 }
558
559 #define RTMP_IO_WRITE32(_A, _R, _V)                                                             \
560         RTUSBWriteMACRegister(_A, _R, _V)
561
562
563 #define RTMP_IO_WRITE8(_A, _R, _V)                                                              \
564 {                                                                                                                               \
565         USHORT  _Val = _V;                                                                                      \
566         RTUSBSingleWrite(_A, _R, _Val);                                                         \
567 }
568
569
570 #define RTMP_IO_WRITE16(_A, _R, _V)                                                             \
571 {                                                                                                                               \
572         RTUSBSingleWrite(_A, _R, _V);                                                           \
573 }
574 #endif // RT2870 //
575
576 #ifndef wait_event_interruptible_timeout
577 #define __wait_event_interruptible_timeout(wq, condition, ret) \
578 do { \
579         wait_queue_t __wait; \
580         init_waitqueue_entry(&__wait, current); \
581         add_wait_queue(&wq, &__wait); \
582         for (;;) { \
583                 set_current_state(TASK_INTERRUPTIBLE); \
584                 if (condition) \
585                         break; \
586                 if (!signal_pending(current)) { \
587                         ret = schedule_timeout(ret); \
588                         if (!ret) \
589                                 break; \
590                         continue; \
591                 } \
592                 ret = -ERESTARTSYS; \
593                 break; \
594         } \
595         current->state = TASK_RUNNING; \
596         remove_wait_queue(&wq, &__wait); \
597 } while (0)
598
599 #define wait_event_interruptible_timeout(wq, condition, timeout) \
600 ({ \
601         long __ret = timeout; \
602         if (!(condition)) \
603                 __wait_event_interruptible_timeout(wq, condition, __ret); \
604         __ret; \
605 })
606 #endif
607 #define ONE_TICK 1
608 #define OS_WAIT(_time) \
609 {       int _i; \
610         long _loop = ((_time)/(1000/OS_HZ)) > 0 ? ((_time)/(1000/OS_HZ)) : 1;\
611         wait_queue_head_t _wait; \
612         init_waitqueue_head(&_wait); \
613         for (_i=0; _i<(_loop); _i++) \
614                 wait_event_interruptible_timeout(_wait, 0, ONE_TICK); }
615
616
617 typedef void (*TIMER_FUNCTION)(unsigned long);
618
619 #define COPY_MAC_ADDR(Addr1, Addr2)             memcpy((Addr1), (Addr2), MAC_ADDR_LEN)
620
621 #define MlmeAllocateMemory(_pAd, _ppVA) os_alloc_mem(_pAd, _ppVA, MGMT_DMA_BUFFER_SIZE)
622 #define MlmeFreeMemory(_pAd, _pVA)     os_free_mem(_pAd, _pVA)
623
624 #ifdef RT2860
625 #define BUILD_TIMER_FUNCTION(_func)                                                                                             \
626 void linux_##_func(unsigned long data)                                                                                  \
627 {                                                                                                                                                               \
628         PRALINK_TIMER_STRUCT    pTimer = (PRALINK_TIMER_STRUCT) data;                           \
629                                                                                                                                                                 \
630         _func(NULL, (PVOID) pTimer->cookie, NULL, pTimer);                                                      \
631         if (pTimer->Repeat)                                                                                                                     \
632                 RTMP_OS_Add_Timer(&pTimer->TimerObj, pTimer->TimerValue);                               \
633 }
634 #endif
635 #ifdef RT2870
636 #define BUILD_TIMER_FUNCTION(_func)                                                                                                     \
637 void linux_##_func(unsigned long data)                                                                                          \
638 {                                                                                                                                                                       \
639         PRALINK_TIMER_STRUCT    _pTimer = (PRALINK_TIMER_STRUCT)data;                                   \
640         RT2870_TIMER_ENTRY              *_pQNode;                                                                                               \
641         RTMP_ADAPTER                    *_pAd;                                                                                                  \
642                                                                                                                                                                 \
643         _pTimer->handle = _func;                                                                                                                        \
644         _pAd = (RTMP_ADAPTER *)_pTimer->pAd;                                                                                            \
645         _pQNode = RT2870_TimerQ_Insert(_pAd, _pTimer);                                                                  \
646         if ((_pQNode == NULL) && (_pAd->TimerQ.status & RT2870_THREAD_CAN_DO_INSERT))   \
647                 RTMP_OS_Add_Timer(&_pTimer->TimerObj, HZ);                                                      \
648 }
649 #endif // RT2870 //
650
651
652 #define DECLARE_TIMER_FUNCTION(_func)                   \
653 void linux_##_func(unsigned long data)
654
655 #define GET_TIMER_FUNCTION(_func)                               \
656                 linux_##_func
657
658 DECLARE_TIMER_FUNCTION(MlmePeriodicExec);
659 DECLARE_TIMER_FUNCTION(MlmeRssiReportExec);
660 DECLARE_TIMER_FUNCTION(AsicRxAntEvalTimeout);
661 DECLARE_TIMER_FUNCTION(APSDPeriodicExec);
662 DECLARE_TIMER_FUNCTION(AsicRfTuningExec);
663 #ifdef RT2870
664 DECLARE_TIMER_FUNCTION(BeaconUpdateExec);
665 #endif // RT2870 //
666
667 DECLARE_TIMER_FUNCTION(BeaconTimeout);
668 DECLARE_TIMER_FUNCTION(ScanTimeout);
669 DECLARE_TIMER_FUNCTION(AuthTimeout);
670 DECLARE_TIMER_FUNCTION(AssocTimeout);
671 DECLARE_TIMER_FUNCTION(ReassocTimeout);
672 DECLARE_TIMER_FUNCTION(DisassocTimeout);
673 DECLARE_TIMER_FUNCTION(LinkDownExec);
674 DECLARE_TIMER_FUNCTION(StaQuickResponeForRateUpExec);
675 DECLARE_TIMER_FUNCTION(WpaDisassocApAndBlockAssoc);
676 DECLARE_TIMER_FUNCTION(PsPollWakeExec);
677 DECLARE_TIMER_FUNCTION(RadioOnExec);
678
679 void RTMP_GetCurrentSystemTime(LARGE_INTEGER *time);
680
681
682 /*
683  * packet helper
684  *      - convert internal rt packet to os packet or
685  *             os packet to rt packet
686  */
687 #define RTPKT_TO_OSPKT(_p)              ((struct sk_buff *)(_p))
688 #define OSPKT_TO_RTPKT(_p)              ((PNDIS_PACKET)(_p))
689
690 #define GET_OS_PKT_DATAPTR(_pkt) \
691                 (RTPKT_TO_OSPKT(_pkt)->data)
692
693 #define GET_OS_PKT_LEN(_pkt) \
694                 (RTPKT_TO_OSPKT(_pkt)->len)
695
696 #define GET_OS_PKT_DATATAIL(_pkt) \
697                 (RTPKT_TO_OSPKT(_pkt)->tail)
698
699 #define GET_OS_PKT_HEAD(_pkt) \
700                 (RTPKT_TO_OSPKT(_pkt)->head)
701
702 #define GET_OS_PKT_END(_pkt) \
703                 (RTPKT_TO_OSPKT(_pkt)->end)
704
705 #define GET_OS_PKT_NETDEV(_pkt) \
706                 (RTPKT_TO_OSPKT(_pkt)->dev)
707
708 #define GET_OS_PKT_TYPE(_pkt) \
709                 (RTPKT_TO_OSPKT(_pkt))
710
711 #define GET_OS_PKT_NEXT(_pkt) \
712                 (RTPKT_TO_OSPKT(_pkt)->next)
713
714
715 #define OS_NTOHS(_Val) \
716                 (ntohs(_Val))
717 #define OS_HTONS(_Val) \
718                 (htons(_Val))
719 #define OS_NTOHL(_Val) \
720                 (ntohl(_Val))
721 #define OS_HTONL(_Val) \
722                 (htonl(_Val))
723
724 /* statistics counter */
725 #define STATS_INC_RX_PACKETS(_pAd, _dev)
726 #define STATS_INC_TX_PACKETS(_pAd, _dev)
727
728 #define STATS_INC_RX_BYTESS(_pAd, _dev, len)
729 #define STATS_INC_TX_BYTESS(_pAd, _dev, len)
730
731 #define STATS_INC_RX_ERRORS(_pAd, _dev)
732 #define STATS_INC_TX_ERRORS(_pAd, _dev)
733
734 #define STATS_INC_RX_DROPPED(_pAd, _dev)
735 #define STATS_INC_TX_DROPPED(_pAd, _dev)
736
737
738 #define CB_OFF  10
739
740
741 //   check DDK NDIS_PACKET data structure and find out only MiniportReservedEx[0..7] can be used by our driver without
742 //   ambiguity. Fields after pPacket->MiniportReservedEx[8] may be used by other wrapper layer thus crashes the driver
743 //
744
745 // User Priority
746 #define RTMP_SET_PACKET_UP(_p, _prio)                   (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+0] = _prio)
747 #define RTMP_GET_PACKET_UP(_p)                                  (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+0])
748
749 // Fragment #
750 #define RTMP_SET_PACKET_FRAGMENTS(_p, _num)             (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+1] = _num)
751 #define RTMP_GET_PACKET_FRAGMENTS(_p)                   (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+1])
752
753 // 0x0 ~0x7f: TX to AP's own BSS which has the specified AID. if AID>127, set bit 7 in RTMP_SET_PACKET_EMACTAB too.
754 //(this value also as MAC(on-chip WCID) table index)
755 // 0x80~0xff: TX to a WDS link. b0~6: WDS index
756 #define RTMP_SET_PACKET_WCID(_p, _wdsidx)               (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+2] = _wdsidx)
757 #define RTMP_GET_PACKET_WCID(_p)                        ((UCHAR)(RTPKT_TO_OSPKT(_p)->cb[CB_OFF+2]))
758
759 // 0xff: PKTSRC_NDIS, others: local TX buffer index. This value affects how to a packet
760 #define RTMP_SET_PACKET_SOURCE(_p, _pktsrc)             (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+3] = _pktsrc)
761 #define RTMP_GET_PACKET_SOURCE(_p)                      (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+3])
762
763 // RTS/CTS-to-self protection method
764 #define RTMP_SET_PACKET_RTS(_p, _num)                   (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+4] = _num)
765 #define RTMP_GET_PACKET_RTS(_p)                         (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+4])
766 // see RTMP_S(G)ET_PACKET_EMACTAB
767
768 // TX rate index
769 #define RTMP_SET_PACKET_TXRATE(_p, _rate)               (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+5] = _rate)
770 #define RTMP_GET_PACKET_TXRATE(_p)                              (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+5])
771
772 // From which Interface
773 #define RTMP_SET_PACKET_IF(_p, _ifdx)           (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+6] = _ifdx)
774 #define RTMP_GET_PACKET_IF(_p)                          (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+6])
775 #define RTMP_SET_PACKET_NET_DEVICE_MBSSID(_p, _bss)             RTMP_SET_PACKET_IF((_p), (_bss))
776 #define RTMP_SET_PACKET_NET_DEVICE_WDS(_p, _bss)                RTMP_SET_PACKET_IF((_p), ((_bss) + MIN_NET_DEVICE_FOR_WDS))
777 #define RTMP_SET_PACKET_NET_DEVICE_APCLI(_p, _idx)      RTMP_SET_PACKET_IF((_p), ((_idx) + MIN_NET_DEVICE_FOR_APCLI))
778 #define RTMP_SET_PACKET_NET_DEVICE_MESH(_p, _idx)       RTMP_SET_PACKET_IF((_p), ((_idx) + MIN_NET_DEVICE_FOR_MESH))
779 #define RTMP_GET_PACKET_NET_DEVICE_MBSSID(_p)                   RTMP_GET_PACKET_IF((_p))
780 #define RTMP_GET_PACKET_NET_DEVICE(_p)                                  RTMP_GET_PACKET_IF((_p))
781
782 #define RTMP_SET_PACKET_MOREDATA(_p, _morebit)          (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+7] = _morebit)
783 #define RTMP_GET_PACKET_MOREDATA(_p)                            (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+7])
784
785
786 //
787 //      Sepcific Pakcet Type definition
788 //
789 #define RTMP_PACKET_SPECIFIC_CB_OFFSET  11
790
791 #define RTMP_PACKET_SPECIFIC_DHCP               0x01
792 #define RTMP_PACKET_SPECIFIC_EAPOL              0x02
793 #define RTMP_PACKET_SPECIFIC_IPV4               0x04
794 #define RTMP_PACKET_SPECIFIC_WAI                0x08
795 #define RTMP_PACKET_SPECIFIC_VLAN               0x10
796 #define RTMP_PACKET_SPECIFIC_LLCSNAP    0x20
797
798 //Specific
799 #define RTMP_SET_PACKET_SPECIFIC(_p, _flg)              (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+11] = _flg)
800
801 //DHCP
802 #define RTMP_SET_PACKET_DHCP(_p, _flg)                                                                                                          \
803                         do{                                                                                                                                                             \
804                                 if (_flg)                                                                                                                                       \
805                                         (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+11]) |= (RTMP_PACKET_SPECIFIC_DHCP);             \
806                                 else                                                                                                                                            \
807                                         (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+11]) &= (!RTMP_PACKET_SPECIFIC_DHCP);    \
808                         }while(0)
809 #define RTMP_GET_PACKET_DHCP(_p)                (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+11] & RTMP_PACKET_SPECIFIC_DHCP)
810
811 //EAPOL
812 #define RTMP_SET_PACKET_EAPOL(_p, _flg)                                                                                                         \
813                         do{                                                                                                                                                             \
814                                 if (_flg)                                                                                                                                       \
815                                         (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+11]) |= (RTMP_PACKET_SPECIFIC_EAPOL);            \
816                                 else                                                                                                                                            \
817                                         (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+11]) &= (!RTMP_PACKET_SPECIFIC_EAPOL);   \
818                         }while(0)
819 #define RTMP_GET_PACKET_EAPOL(_p)               (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+11] & RTMP_PACKET_SPECIFIC_EAPOL)
820
821 //WAI
822 #define RTMP_SET_PACKET_WAI(_p, _flg)                                                                                                           \
823                         do{                                                                                                                                                             \
824                                 if (_flg)                                                                                                                                       \
825                                         (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+11]) |= (RTMP_PACKET_SPECIFIC_WAI);              \
826                                 else                                                                                                                                            \
827                                         (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+11]) &= (!RTMP_PACKET_SPECIFIC_WAI);     \
828                         }while(0)
829 #define RTMP_GET_PACKET_WAI(_p)         (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+11] & RTMP_PACKET_SPECIFIC_WAI)
830
831 #define RTMP_GET_PACKET_LOWRATE(_p)             (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+11] & (RTMP_PACKET_SPECIFIC_EAPOL | RTMP_PACKET_SPECIFIC_DHCP | RTMP_PACKET_SPECIFIC_WAI))
832
833 //VLAN
834 #define RTMP_SET_PACKET_VLAN(_p, _flg)                                                                                                          \
835                         do{                                                                                                                                                             \
836                                 if (_flg)                                                                                                                                       \
837                                         (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+11]) |= (RTMP_PACKET_SPECIFIC_VLAN);             \
838                                 else                                                                                                                                            \
839                                         (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+11]) &= (!RTMP_PACKET_SPECIFIC_VLAN);    \
840                         }while(0)
841 #define RTMP_GET_PACKET_VLAN(_p)                (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+11] & RTMP_PACKET_SPECIFIC_VLAN)
842
843 //LLC/SNAP
844 #define RTMP_SET_PACKET_LLCSNAP(_p, _flg)                                                                                                       \
845                         do{                                                                                                                                                             \
846                                 if (_flg)                                                                                                                                       \
847                                         (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+11]) |= (RTMP_PACKET_SPECIFIC_LLCSNAP);          \
848                                 else                                                                                                                                            \
849                                         (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+11]) &= (!RTMP_PACKET_SPECIFIC_LLCSNAP);         \
850                         }while(0)
851
852 #define RTMP_GET_PACKET_LLCSNAP(_p)             (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+11] & RTMP_PACKET_SPECIFIC_LLCSNAP)
853
854 // IP
855 #define RTMP_SET_PACKET_IPV4(_p, _flg)                                                                                                          \
856                         do{                                                                                                                                                             \
857                                 if (_flg)                                                                                                                                       \
858                                         (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+11]) |= (RTMP_PACKET_SPECIFIC_IPV4);             \
859                                 else                                                                                                                                            \
860                                         (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+11]) &= (!RTMP_PACKET_SPECIFIC_IPV4);    \
861                         }while(0)
862
863 #define RTMP_GET_PACKET_IPV4(_p)                (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+11] & RTMP_PACKET_SPECIFIC_IPV4)
864
865
866 // If this flag is set, it indicates that this EAPoL frame MUST be clear.
867 #define RTMP_SET_PACKET_CLEAR_EAP_FRAME(_p, _flg)   (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+12] = _flg)
868 #define RTMP_GET_PACKET_CLEAR_EAP_FRAME(_p)         (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+12])
869
870 #define RTMP_SET_PACKET_5VT(_p, _flg)   (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+22] = _flg)
871 #define RTMP_GET_PACKET_5VT(_p)         (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+22])
872
873 #ifdef CONFIG_5VT_ENHANCE
874 #define BRIDGE_TAG 0x35564252    // depends on 5VT define in br_input.c
875 #endif
876
877
878 #define NDIS_SET_PACKET_STATUS(_p, _status)
879
880
881 #define GET_SG_LIST_FROM_PACKET(_p, _sc)        \
882     rt_get_sg_list_from_packet(_p, _sc)
883
884 #define NdisMoveMemory(Destination, Source, Length) memmove(Destination, Source, Length)
885 #define NdisZeroMemory(Destination, Length)         memset(Destination, 0, Length)
886 #define NdisFillMemory(Destination, Length, Fill)   memset(Destination, Fill, Length)
887 #define NdisEqualMemory(Source1, Source2, Length)   (!memcmp(Source1, Source2, Length))
888 #define RTMPEqualMemory(Source1, Source2, Length)       (!memcmp(Source1, Source2, Length))
889
890
891 #define RTMP_INC_REF(_A)                0
892 #define RTMP_DEC_REF(_A)                0
893 #define RTMP_GET_REF(_A)                0
894
895
896
897 /*
898  * ULONG
899  * RTMP_GetPhysicalAddressLow(
900  *   IN NDIS_PHYSICAL_ADDRESS  PhysicalAddress);
901  */
902 #define RTMP_GetPhysicalAddressLow(PhysicalAddress)             (PhysicalAddress)
903
904 /*
905  * ULONG
906  * RTMP_GetPhysicalAddressHigh(
907  *   IN NDIS_PHYSICAL_ADDRESS  PhysicalAddress);
908  */
909 #define RTMP_GetPhysicalAddressHigh(PhysicalAddress)            (0)
910
911 /*
912  * VOID
913  * RTMP_SetPhysicalAddressLow(
914  *   IN NDIS_PHYSICAL_ADDRESS  PhysicalAddress,
915  *   IN ULONG  Value);
916  */
917 #define RTMP_SetPhysicalAddressLow(PhysicalAddress, Value)      \
918                         PhysicalAddress = Value;
919
920 /*
921  * VOID
922  * RTMP_SetPhysicalAddressHigh(
923  *   IN NDIS_PHYSICAL_ADDRESS  PhysicalAddress,
924  *   IN ULONG  Value);
925  */
926 #define RTMP_SetPhysicalAddressHigh(PhysicalAddress, Value)
927
928
929 //CONTAINING_RECORD(pEntry, NDIS_PACKET, MiniportReservedEx);
930 #define QUEUE_ENTRY_TO_PACKET(pEntry) \
931         (PNDIS_PACKET)(pEntry)
932
933 #define PACKET_TO_QUEUE_ENTRY(pPacket) \
934         (PQUEUE_ENTRY)(pPacket)
935
936
937 #ifndef CONTAINING_RECORD
938 #define CONTAINING_RECORD(address, type, field)                 \
939 ((type *)((PCHAR)(address) - offsetof(type, field)))
940 #endif
941
942
943 #define RELEASE_NDIS_PACKET(_pAd, _pPacket, _Status)                    \
944 {                                                                       \
945         RTMPFreeNdisPacket(_pAd, _pPacket);                             \
946 }
947
948
949 #define SWITCH_PhyAB(_pAA, _pBB)    \
950 {                                                                           \
951     ULONG       AABasePaHigh;                           \
952     ULONG       AABasePaLow;                           \
953     ULONG       BBBasePaHigh;                           \
954     ULONG       BBBasePaLow;                           \
955     BBBasePaHigh = RTMP_GetPhysicalAddressHigh(_pBB);                                                 \
956     BBBasePaLow = RTMP_GetPhysicalAddressLow(_pBB);                                                 \
957     AABasePaHigh = RTMP_GetPhysicalAddressHigh(_pAA);                                                 \
958     AABasePaLow = RTMP_GetPhysicalAddressLow(_pAA);                                                 \
959     RTMP_SetPhysicalAddressHigh(_pAA, BBBasePaHigh);                                                 \
960     RTMP_SetPhysicalAddressLow(_pAA, BBBasePaLow);                                                 \
961     RTMP_SetPhysicalAddressHigh(_pBB, AABasePaHigh);                                                 \
962     RTMP_SetPhysicalAddressLow(_pBB, AABasePaLow);                                                 \
963 }
964
965
966 #define NdisWriteErrorLogEntry(_a, _b, _c, _d)
967 #define NdisMAllocateMapRegisters(_a, _b, _c, _d, _e)           NDIS_STATUS_SUCCESS
968
969
970 #define NdisAcquireSpinLock             RTMP_SEM_LOCK
971 #define NdisReleaseSpinLock             RTMP_SEM_UNLOCK
972
973 static inline void NdisGetSystemUpTime(ULONG *time)
974 {
975         *time = jiffies;
976 }
977
978 //pPacket = CONTAINING_RECORD(pEntry, NDIS_PACKET, MiniportReservedEx);
979 #define QUEUE_ENTRY_TO_PKT(pEntry) \
980                 ((PNDIS_PACKET) (pEntry))
981
982 int rt28xx_packet_xmit(struct sk_buff *skb);
983
984
985
986 void rtmp_os_thread_init(PUCHAR pThreadName, PVOID pNotify);
987
988 #ifdef RT2860
989 #if !defined(PCI_CAP_ID_EXP)
990 #define PCI_CAP_ID_EXP                      0x10
991 #endif
992
993 #if !defined(PCI_EXP_LNKCTL)
994 #define PCI_EXP_LNKCTL                      0x10
995 #endif
996
997 #if !defined(PCI_CLASS_BRIDGE_PCI)
998 #define PCI_CLASS_BRIDGE_PCI            0x0604
999 #endif
1000
1001 #define PCIBUS_INTEL_VENDOR         0x8086
1002 #endif
1003