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