diff options
author | Stephen Hemminger <shemminger@vyatta.com> | 2008-05-30 12:49:55 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2008-05-30 22:17:59 -0400 |
commit | 93e16847c9db0093065c98063cfc639cdfccf19a (patch) | |
tree | cbf906f30e2e225feeda519f6f478e6700b91de3 | |
parent | 92cee9f6804786da6b63255edce7983bebf75655 (diff) |
tlan: 64bit conversion
Make this driver compile cleanly on 64 bit platforms.
Compile tested only.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
-rw-r--r-- | drivers/net/Kconfig | 2 | ||||
-rw-r--r-- | drivers/net/tlan.c | 38 |
2 files changed, 18 insertions, 22 deletions
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index 8178a4dfd09c..07a91251bcac 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig | |||
@@ -1670,7 +1670,7 @@ config SUNDANCE_MMIO | |||
1670 | 1670 | ||
1671 | config TLAN | 1671 | config TLAN |
1672 | tristate "TI ThunderLAN support" | 1672 | tristate "TI ThunderLAN support" |
1673 | depends on NET_PCI && (PCI || EISA) && !64BIT | 1673 | depends on NET_PCI && (PCI || EISA) |
1674 | ---help--- | 1674 | ---help--- |
1675 | If you have a PCI Ethernet network card based on the ThunderLAN chip | 1675 | If you have a PCI Ethernet network card based on the ThunderLAN chip |
1676 | which is supported by this driver, say Y and read the | 1676 | which is supported by this driver, say Y and read the |
diff --git a/drivers/net/tlan.c b/drivers/net/tlan.c index c14d2919c48a..aee2a458adc3 100644 --- a/drivers/net/tlan.c +++ b/drivers/net/tlan.c | |||
@@ -346,23 +346,21 @@ static void TLan_EeReceiveByte( u16, u8 *, int ); | |||
346 | static int TLan_EeReadByte( struct net_device *, u8, u8 * ); | 346 | static int TLan_EeReadByte( struct net_device *, u8, u8 * ); |
347 | 347 | ||
348 | 348 | ||
349 | static void | 349 | static inline void |
350 | TLan_StoreSKB( struct tlan_list_tag *tag, struct sk_buff *skb) | 350 | TLan_StoreSKB( struct tlan_list_tag *tag, struct sk_buff *skb) |
351 | { | 351 | { |
352 | unsigned long addr = (unsigned long)skb; | 352 | unsigned long addr = (unsigned long)skb; |
353 | tag->buffer[9].address = (u32)addr; | 353 | tag->buffer[9].address = addr; |
354 | addr >>= 31; /* >>= 32 is undefined for 32bit arch, stupid C */ | 354 | tag->buffer[8].address = upper_32_bits(addr); |
355 | addr >>= 1; | ||
356 | tag->buffer[8].address = (u32)addr; | ||
357 | } | 355 | } |
358 | 356 | ||
359 | static struct sk_buff * | 357 | static inline struct sk_buff * |
360 | TLan_GetSKB( struct tlan_list_tag *tag) | 358 | TLan_GetSKB( const struct tlan_list_tag *tag) |
361 | { | 359 | { |
362 | unsigned long addr = tag->buffer[8].address; | 360 | unsigned long addr; |
363 | addr <<= 31; | 361 | |
364 | addr <<= 1; | 362 | addr = tag->buffer[8].address; |
365 | addr |= tag->buffer[9].address; | 363 | addr |= (tag->buffer[9].address << 16) << 16; |
366 | return (struct sk_buff *) addr; | 364 | return (struct sk_buff *) addr; |
367 | } | 365 | } |
368 | 366 | ||
@@ -858,7 +856,8 @@ static int TLan_Init( struct net_device *dev ) | |||
858 | dma_size = ( TLAN_NUM_RX_LISTS + TLAN_NUM_TX_LISTS ) | 856 | dma_size = ( TLAN_NUM_RX_LISTS + TLAN_NUM_TX_LISTS ) |
859 | * ( sizeof(TLanList) ); | 857 | * ( sizeof(TLanList) ); |
860 | } | 858 | } |
861 | priv->dmaStorage = pci_alloc_consistent(priv->pciDev, dma_size, &priv->dmaStorageDMA); | 859 | priv->dmaStorage = pci_alloc_consistent(priv->pciDev, |
860 | dma_size, &priv->dmaStorageDMA); | ||
862 | priv->dmaSize = dma_size; | 861 | priv->dmaSize = dma_size; |
863 | 862 | ||
864 | if ( priv->dmaStorage == NULL ) { | 863 | if ( priv->dmaStorage == NULL ) { |
@@ -867,11 +866,11 @@ static int TLan_Init( struct net_device *dev ) | |||
867 | return -ENOMEM; | 866 | return -ENOMEM; |
868 | } | 867 | } |
869 | memset( priv->dmaStorage, 0, dma_size ); | 868 | memset( priv->dmaStorage, 0, dma_size ); |
870 | priv->rxList = (TLanList *) | 869 | priv->rxList = (TLanList *) ALIGN((unsigned long)priv->dmaStorage, 8); |
871 | ( ( ( (u32) priv->dmaStorage ) + 7 ) & 0xFFFFFFF8 ); | 870 | priv->rxListDMA = ALIGN(priv->dmaStorageDMA, 8); |
872 | priv->rxListDMA = ( ( ( (u32) priv->dmaStorageDMA ) + 7 ) & 0xFFFFFFF8 ); | ||
873 | priv->txList = priv->rxList + TLAN_NUM_RX_LISTS; | 871 | priv->txList = priv->rxList + TLAN_NUM_RX_LISTS; |
874 | priv->txListDMA = priv->rxListDMA + sizeof(TLanList) * TLAN_NUM_RX_LISTS; | 872 | priv->txListDMA = priv->rxListDMA + sizeof(TLanList) * TLAN_NUM_RX_LISTS; |
873 | |||
875 | if ( bbuf ) { | 874 | if ( bbuf ) { |
876 | priv->rxBuffer = (u8 *) ( priv->txList + TLAN_NUM_TX_LISTS ); | 875 | priv->rxBuffer = (u8 *) ( priv->txList + TLAN_NUM_TX_LISTS ); |
877 | priv->rxBufferDMA =priv->txListDMA + sizeof(TLanList) * TLAN_NUM_TX_LISTS; | 876 | priv->rxBufferDMA =priv->txListDMA + sizeof(TLanList) * TLAN_NUM_TX_LISTS; |
@@ -1584,7 +1583,7 @@ static u32 TLan_HandleRxEOF( struct net_device *dev, u16 host_int ) | |||
1584 | if ( new_skb != NULL ) { | 1583 | if ( new_skb != NULL ) { |
1585 | skb = TLan_GetSKB(head_list); | 1584 | skb = TLan_GetSKB(head_list); |
1586 | pci_unmap_single(priv->pciDev, head_list->buffer[0].address, TLAN_MAX_FRAME_SIZE, PCI_DMA_FROMDEVICE); | 1585 | pci_unmap_single(priv->pciDev, head_list->buffer[0].address, TLAN_MAX_FRAME_SIZE, PCI_DMA_FROMDEVICE); |
1587 | skb_trim( skb, frameSize ); | 1586 | skb_put( skb, frameSize ); |
1588 | 1587 | ||
1589 | dev->stats.rx_bytes += frameSize; | 1588 | dev->stats.rx_bytes += frameSize; |
1590 | 1589 | ||
@@ -1592,9 +1591,8 @@ static u32 TLan_HandleRxEOF( struct net_device *dev, u16 host_int ) | |||
1592 | netif_rx( skb ); | 1591 | netif_rx( skb ); |
1593 | 1592 | ||
1594 | skb_reserve( new_skb, 2 ); | 1593 | skb_reserve( new_skb, 2 ); |
1595 | t = (void *) skb_put( new_skb, TLAN_MAX_FRAME_SIZE ); | ||
1596 | head_list->buffer[0].address = pci_map_single(priv->pciDev, new_skb->data, TLAN_MAX_FRAME_SIZE, PCI_DMA_FROMDEVICE); | 1594 | head_list->buffer[0].address = pci_map_single(priv->pciDev, new_skb->data, TLAN_MAX_FRAME_SIZE, PCI_DMA_FROMDEVICE); |
1597 | head_list->buffer[8].address = (u32) t; | 1595 | |
1598 | TLan_StoreSKB(head_list, new_skb); | 1596 | TLan_StoreSKB(head_list, new_skb); |
1599 | } else | 1597 | } else |
1600 | printk(KERN_WARNING "TLAN: Couldn't allocate memory for received data.\n" ); | 1598 | printk(KERN_WARNING "TLAN: Couldn't allocate memory for received data.\n" ); |
@@ -2003,10 +2001,8 @@ static void TLan_ResetLists( struct net_device *dev ) | |||
2003 | } else { | 2001 | } else { |
2004 | skb->dev = dev; | 2002 | skb->dev = dev; |
2005 | skb_reserve( skb, 2 ); | 2003 | skb_reserve( skb, 2 ); |
2006 | t = (void *) skb_put( skb, TLAN_MAX_FRAME_SIZE ); | ||
2007 | } | 2004 | } |
2008 | list->buffer[0].address = pci_map_single(priv->pciDev, t, TLAN_MAX_FRAME_SIZE, PCI_DMA_FROMDEVICE); | 2005 | list->buffer[0].address = pci_map_single(priv->pciDev, t, TLAN_MAX_FRAME_SIZE, PCI_DMA_FROMDEVICE); |
2009 | list->buffer[8].address = (u32) t; | ||
2010 | TLan_StoreSKB(list, skb); | 2006 | TLan_StoreSKB(list, skb); |
2011 | } | 2007 | } |
2012 | list->buffer[1].count = 0; | 2008 | list->buffer[1].count = 0; |
@@ -2108,7 +2104,7 @@ static void TLan_PrintList( TLanList *list, char *type, int num) | |||
2108 | { | 2104 | { |
2109 | int i; | 2105 | int i; |
2110 | 2106 | ||
2111 | printk( "TLAN: %s List %d at 0x%08x\n", type, num, (u32) list ); | 2107 | printk( "TLAN: %s List %d at %p\n", type, num, list ); |
2112 | printk( "TLAN: Forward = 0x%08x\n", list->forward ); | 2108 | printk( "TLAN: Forward = 0x%08x\n", list->forward ); |
2113 | printk( "TLAN: CSTAT = 0x%04hx\n", list->cStat ); | 2109 | printk( "TLAN: CSTAT = 0x%04hx\n", list->cStat ); |
2114 | printk( "TLAN: Frame Size = 0x%04hx\n", list->frameSize ); | 2110 | printk( "TLAN: Frame Size = 0x%04hx\n", list->frameSize ); |