65 #include <wireless/wl_version.h>
67 #include <linux/module.h>
68 #include <linux/kernel.h>
69 #include <linux/errno.h>
70 #include <linux/pci.h>
72 #include <linux/sched.h>
73 #include <linux/ptrace.h>
74 #include <linux/ctype.h>
75 #include <linux/string.h>
82 #include <asm/bitops.h>
83 #include <asm/uaccess.h>
85 #include <linux/ethtool.h>
86 #include <linux/netdevice.h>
89 #include <linux/if_arp.h>
92 #include <hcf/debug.h>
98 #include <wireless/wl_if.h>
99 #include <wireless/wl_internal.h>
100 #include <wireless/wl_util.h>
101 #include <wireless/wl_main.h>
102 #include <wireless/wl_netdev.h>
103 #include <wireless/wl_pci.h>
110 extern dbg_info_t *DbgInfo;
157 void wl_pci_dma_hcf_reclaim_rx(
struct wl_private *
lp );
195 DBG_FUNC(
"wl_adapter_init_module()" );
197 DBG_TRACE( DbgInfo,
"wl_adapter_init_module() -- PCI\n" );
199 result = pci_register_driver( &wl_driver );
227 DBG_FUNC(
"wl_adapter_cleanup_module" );
231 DBG_TRACE( DbgInfo,
"wl_adapter_cleanup_module() -- PCI\n" );
265 DBG_TRACE( DbgInfo,
"wl_adapter_insert() -- PCI\n" );
268 DBG_ERROR( DbgInfo,
"net_device pointer is NULL!!!\n" );
269 }
else if( dev->priv ==
NULL ) {
270 DBG_ERROR( DbgInfo,
"wl_private pointer is NULL!!!\n" );
274 DBG_TRACE( DbgInfo,
"wl_insert() FAILED\n" );
307 DBG_TRACE( DbgInfo,
"wl_adapter_open() -- PCI\n" );
342 DBG_TRACE( DbgInfo,
"wl_adapter_close() -- PCI\n" );
343 DBG_TRACE( DbgInfo,
"%s: Shutting down adapter.\n", dev->
name );
449 DBG_ERROR( DbgInfo,
"PCI subsys passed in an invalid pci_dev pointer\n" );
453 dev = pci_get_drvdata( pdev );
455 DBG_ERROR( DbgInfo,
"Could not retrieve net_device structure\n" );
464 wl_pci_dma_free( pdev, dev->priv );
504 DBG_ERROR( DbgInfo,
"PCI subsys passed in an invalid pci_dev pointer\n" );
510 DBG_ERROR( DbgInfo,
"pci_enable_device() failed\n" );
516 DBG_TRACE( DbgInfo,
"Found our device, now registering\n" );
519 DBG_ERROR( DbgInfo,
"Could not register device!!!\n" );
525 if( dev->priv ==
NULL ) {
526 DBG_ERROR( DbgInfo,
"Private adapter struct was not allocated!!!\n" );
534 if( wl_pci_dma_alloc( pdev, dev->priv ) < 0 ) {
535 DBG_ERROR( DbgInfo,
"Could not allocate DMA descriptor memory!!!\n" );
543 pci_set_drvdata( pdev, dev );
547 SET_MODULE_OWNER( dev );
554 DBG_ERROR( DbgInfo,
"wl_adapter_insert() FAILED!!!\n" );
561 DBG_TRACE( DbgInfo,
"Registering ISR...\n" );
565 DBG_WARNING( DbgInfo,
"Could not register ISR!!!\n" );
577 DBG_TRACE( DbgInfo,
"This is a PCI/CardBus card, enable interrupts\n" );
613 u32 func_evt_mask_reg;
614 void *mem_addr_kern =
NULL;
617 DBG_FUNC(
"wl_pci_enable_cardbus_interrupts" );
621 bar2_reg = 0xdeadbeef;
622 mem_addr_bus = 0xdeadbeef;
631 mem_addr_kern =
ioremap( mem_addr_bus, 0x200 );
634 #define REG_OFFSET 0x07F4
636 #define REG_OFFSET 0x01F4
644 func_evt_mask_reg |=
BIT15;
766 status = wl_pci_dma_free_rx_packet( pdev, lp, &lp->
dma.
rx_packet[i] );
768 DBG_WARNING( DbgInfo,
"Problem freeing Rx packet\n" );
777 DBG_WARNING( DbgInfo,
"Problem freeing Rx reclaim descriptor\n" );
784 status = wl_pci_dma_free_tx_packet( pdev, lp, &lp->
dma.
tx_packet[i] );
786 DBG_WARNING( DbgInfo,
"Problem freeing Tx packet\n" );
795 DBG_WARNING( DbgInfo,
"Problem freeing Tx reclaim descriptor\n" );
879 if( *desc ==
NULL ) {
885 if( status == 0 && (*desc)->next_desc_addr ) {
886 status = wl_pci_dma_free_desc_and_buf( pdev, lp, &(*desc)->next_desc_addr );
889 status = wl_pci_dma_free_desc_and_buf( pdev, lp, desc );
985 if( *desc ==
NULL ) {
996 status = wl_pci_dma_free_desc( pdev, lp, &p );
1003 status = wl_pci_dma_free_desc_and_buf( pdev, lp, desc );
1076 if( desc ==
NULL ) {
1079 if( status == 0 && *desc ==
NULL ) {
1083 status = wl_pci_dma_free_buf( pdev, lp, *desc );
1086 status = wl_pci_dma_free_desc( pdev, lp, desc );
1165 if( *desc ==
NULL ) {
1254 if( desc ==
NULL ) {
1297 void wl_pci_dma_hcf_supply(
struct wl_private *lp )
1302 DBG_FUNC(
"wl_pci_dma_hcf_supply" );
1360 void wl_pci_dma_hcf_reclaim(
struct wl_private *lp )
1365 DBG_FUNC(
"wl_pci_dma_hcf_reclaim" );
1368 wl_pci_dma_hcf_reclaim_rx( lp );
1376 wl_pci_dma_hcf_reclaim_tx( lp );
1407 void wl_pci_dma_hcf_reclaim_rx(
struct wl_private *lp )
1413 DBG_FUNC(
"wl_pci_dma_hcf_reclaim_rx" );
1418 while ( ( p = hcf_dma_rx_get( &lp->
hcfCtx ) ) !=
NULL ) {
1423 DBG_PRINT(
"reclaim_descriptor: 0x%p\n", p );
1470 if( i != NUM_TX_DESC ) {
1512 if( i != NUM_TX_DESC ) {
1538 void wl_pci_dma_hcf_reclaim_tx(
struct wl_private *lp )
1544 DBG_FUNC(
"wl_pci_dma_hcf_reclaim_tx" );
1549 while ( ( p = hcf_dma_tx_get( &lp->
hcfCtx ) ) !=
NULL ) {
1555 DBG_PRINT(
"reclaim_descriptor: 0x%p\n", p );
1571 netif_wake_queue( lp->
dev );
1579 #endif // ENABLE_DMA