1#ifndef _IF_LMC_LINUXVER_ 2#define _IF_LMC_LINUXVER_ 3 4 /* 5 * Copyright (c) 1997-2000 LAN Media Corporation (LMC) 6 * All rights reserved. www.lanmedia.com 7 * 8 * This code is written by: 9 * Andrew Stanley-Jones (asj@cban.com) 10 * Rob Braun (bbraun@vix.com), 11 * Michael Graff (explorer@vix.com) and 12 * Matt Thomas (matt@3am-software.com). 13 * 14 * This software may be used and distributed according to the terms 15 * of the GNU General Public License version 2, incorporated herein by reference. 16 */ 17 18 /* 19 * This file defines and controls all linux version 20 * differences. 21 * 22 * This is being done to keep 1 central location where all linux 23 * version differences can be kept and maintained. as this code was 24 * found version issues where pepered throughout the source code and 25 * made the souce code not only hard to read but version problems hard 26 * to track down. If I'm overiding a function/etc with something in 27 * this file it will be prefixed by "LMC_" which will mean look 28 * here for the version dependant change that's been done. 29 * 30 */ 31 32#if LINUX_VERSION_CODE < 0x20363 33#define net_device device 34#endif 35 36#if LINUX_VERSION_CODE < 0x20363 37#define LMC_XMITTER_BUSY(x) (x)->tbusy = 1 38#define LMC_XMITTER_FREE(x) (x)->tbusy = 0 39#define LMC_XMITTER_INIT(x) (x)->tbusy = 0 40#else 41#define LMC_XMITTER_BUSY(x) netif_stop_queue(x) 42#define LMC_XMITTER_FREE(x) netif_wake_queue(x) 43#define LMC_XMITTER_INIT(x) netif_start_queue(x) 44 45#endif 46 47 48#if LINUX_VERSION_CODE < 0x20100 49//typedef unsigned int u_int32_t; 50 51#define LMC_SETUP_20_DEV {\ 52 int indx; \ 53 for (indx = 0; indx < DEV_NUMBUFFS; indx++) \ 54 skb_queue_head_init (&dev->buffs[indx]); \ 55 } \ 56 dev->family = AF_INET; \ 57 dev->pa_addr = 0; \ 58 dev->pa_brdaddr = 0; \ 59 dev->pa_mask = 0xFCFFFFFF; \ 60 dev->pa_alen = 4; /* IP addr. sizeof(u32) */ 61 62#else 63 64#define LMC_SETUP_20_DEV 65 66#endif 67 68 69#if LINUX_VERSION_CODE < 0x20155 /* basically 2.2 plus */ 70 71#define LMC_DEV_KFREE_SKB(skb) dev_kfree_skb((skb), FREE_WRITE) 72#define LMC_PCI_PRESENT() pcibios_present() 73 74#else /* Mostly 2.0 kernels */ 75 76#define LMC_DEV_KFREE_SKB(skb) dev_kfree_skb(skb) 77#define LMC_PCI_PRESENT() pci_present() 78 79#endif 80 81#if LINUX_VERSION_CODE < 0x20200 82#else 83 84#endif 85 86#if LINUX_VERSION_CODE < 0x20100 87#define LMC_SKB_FREE(skb, val) (skb->free = val) 88#else 89#define LMC_SKB_FREE(skb, val) 90#endif 91 92 93#if (LINUX_VERSION_CODE >= 0x20200) 94 95#define LMC_SPIN_FLAGS unsigned long flags; 96#define LMC_SPIN_LOCK_INIT(x) spin_lock_init(&(x)->lmc_lock); 97#define LMC_SPIN_UNLOCK(x) ((x)->lmc_lock = SPIN_LOCK_UNLOCKED) 98#define LMC_SPIN_LOCK_IRQSAVE(x) spin_lock_irqsave (&(x)->lmc_lock, flags); 99#define LMC_SPIN_UNLOCK_IRQRESTORE(x) spin_unlock_irqrestore (&(x)->lmc_lock, flags); 100#else 101#define LMC_SPIN_FLAGS 102#define LMC_SPIN_LOCK_INIT(x) 103#define LMC_SPIN_UNLOCK(x) 104#define LMC_SPIN_LOCK_IRQSAVE(x) 105#define LMC_SPIN_UNLOCK_IRQRESTORE(x) 106#endif 107 108 109#if LINUX_VERSION_CODE >= 0x20100 110#define LMC_COPY_FROM_USER(x, y, z) if(copy_from_user ((x), (y), (z))) return -EFAULT 111#define LMC_COPY_TO_USER(x, y, z) if(copy_to_user ((x), (y), (z))) return -EFAULT 112#else 113#define LMC_COPY_FROM_USER(x, y, z) if(verify_area(VERIFY_READ, (y), (z))) \ 114 return -EFAULT; \ 115 memcpy_fromfs ((x), (y), (z)) 116 117#define LMC_COPY_TO_USER(x, y, z) if(verify_area(VERIFY_WRITE, (x), (z))) \ 118 return -EFAULT; \ 119 memcpy_tofs ((x), (y), (z)) 120#endif 121 122 123#endif 124