Commit 511979cc authored by Jeff Garzik's avatar Jeff Garzik

Merge pobox.com:/garz/repo/netdev-2.6/defxx

into pobox.com:/garz/repo/net-drivers-2.6
parents 598cb23f 06073da7
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
* LVS Lawrence V. Stefani <lstefani@yahoo.com> * LVS Lawrence V. Stefani <lstefani@yahoo.com>
* *
* Maintainers: * Maintainers:
* macro Maciej W. Rozycki <macro@ds2.pg.gda.pl> * macro Maciej W. Rozycki <macro@linux-mips.org>
* *
* Credits: * Credits:
* I'd like to thank Patricia Cross for helping me get started with * I'd like to thank Patricia Cross for helping me get started with
...@@ -190,6 +190,7 @@ ...@@ -190,6 +190,7 @@
* Feb 2001 Skb allocation fixes * Feb 2001 Skb allocation fixes
* Feb 2001 davej PCI enable cleanups. * Feb 2001 davej PCI enable cleanups.
* 04 Aug 2003 macro Converted to the DMA API. * 04 Aug 2003 macro Converted to the DMA API.
* 14 Aug 2004 macro Fix device names reported.
*/ */
/* Include files */ /* Include files */
...@@ -214,12 +215,14 @@ ...@@ -214,12 +215,14 @@
#include "defxx.h" #include "defxx.h"
/* Version information string - should be updated prior to each new release!!! */ /* Version information string should be updated prior to each new release! */
#define DRV_NAME "defxx"
#define DRV_VERSION "v1.07"
#define DRV_RELDATE "2004/08/14"
static char version[] __devinitdata = static char version[] __devinitdata =
"defxx.c:v1.06 2003/08/04 Lawrence V. Stefani and others\n"; DRV_NAME ": " DRV_VERSION " " DRV_RELDATE
" Lawrence V. Stefani and others\n";
#define DRV_NAME "defxx"
#define DYNAMIC_BUFFERS 1 #define DYNAMIC_BUFFERS 1
...@@ -235,7 +238,7 @@ static char version[] __devinitdata = ...@@ -235,7 +238,7 @@ static char version[] __devinitdata =
static void dfx_bus_init(struct net_device *dev); static void dfx_bus_init(struct net_device *dev);
static void dfx_bus_config_check(DFX_board_t *bp); static void dfx_bus_config_check(DFX_board_t *bp);
static int dfx_driver_init(struct net_device *dev); static int dfx_driver_init(struct net_device *dev, const char *print_name);
static int dfx_adap_init(DFX_board_t *bp, int get_buffers); static int dfx_adap_init(DFX_board_t *bp, int get_buffers);
static int dfx_open(struct net_device *dev); static int dfx_open(struct net_device *dev);
...@@ -404,24 +407,25 @@ static inline void dfx_port_read_long( ...@@ -404,24 +407,25 @@ static inline void dfx_port_read_long(
*/ */
static int __devinit dfx_init_one_pci_or_eisa(struct pci_dev *pdev, long ioaddr) static int __devinit dfx_init_one_pci_or_eisa(struct pci_dev *pdev, long ioaddr)
{ {
static int version_disp;
char *print_name = DRV_NAME;
struct net_device *dev; struct net_device *dev;
DFX_board_t *bp; /* board pointer */ DFX_board_t *bp; /* board pointer */
int alloc_size; /* total buffer size used */ int alloc_size; /* total buffer size used */
int err; int err;
#ifndef MODULE if (!version_disp) { /* display version info if adapter is found */
static int version_disp;
if (!version_disp) /* display version info if adapter is found */
{
version_disp = 1; /* set display flag to TRUE so that */ version_disp = 1; /* set display flag to TRUE so that */
printk(version); /* we only display this string ONCE */ printk(version); /* we only display this string ONCE */
} }
#endif
if (pdev != NULL)
print_name = pdev->slot_name;
dev = alloc_fddidev(sizeof(*bp)); dev = alloc_fddidev(sizeof(*bp));
if (!dev) { if (!dev) {
printk (KERN_ERR "defxx: unable to allocate fddidev, aborting\n"); printk(KERN_ERR "%s: unable to allocate fddidev, aborting\n",
print_name);
return -ENOMEM; return -ENOMEM;
} }
...@@ -437,9 +441,12 @@ static int __devinit dfx_init_one_pci_or_eisa(struct pci_dev *pdev, long ioaddr) ...@@ -437,9 +441,12 @@ static int __devinit dfx_init_one_pci_or_eisa(struct pci_dev *pdev, long ioaddr)
bp = dev->priv; bp = dev->priv;
if (!request_region (ioaddr, pdev ? PFI_K_CSR_IO_LEN : PI_ESIC_K_CSR_IO_LEN, DRV_NAME)) { if (!request_region(ioaddr,
printk (KERN_ERR "%s: Cannot reserve I/O resource 0x%x @ 0x%lx, aborting\n", pdev ? PFI_K_CSR_IO_LEN : PI_ESIC_K_CSR_IO_LEN,
DRV_NAME, PFI_K_CSR_IO_LEN, ioaddr); print_name)) {
printk(KERN_ERR "%s: Cannot reserve I/O resource "
"0x%x @ 0x%lx, aborting\n", print_name,
pdev ? PFI_K_CSR_IO_LEN : PI_ESIC_K_CSR_IO_LEN, ioaddr);
err = -EBUSY; err = -EBUSY;
goto err_out; goto err_out;
} }
...@@ -468,7 +475,7 @@ static int __devinit dfx_init_one_pci_or_eisa(struct pci_dev *pdev, long ioaddr) ...@@ -468,7 +475,7 @@ static int __devinit dfx_init_one_pci_or_eisa(struct pci_dev *pdev, long ioaddr)
pci_set_master (pdev); pci_set_master (pdev);
} }
if (dfx_driver_init(dev) != DFX_K_SUCCESS) { if (dfx_driver_init(dev, print_name) != DFX_K_SUCCESS) {
err = -ENODEV; err = -ENODEV;
goto err_out_region; goto err_out_region;
} }
...@@ -477,6 +484,7 @@ static int __devinit dfx_init_one_pci_or_eisa(struct pci_dev *pdev, long ioaddr) ...@@ -477,6 +484,7 @@ static int __devinit dfx_init_one_pci_or_eisa(struct pci_dev *pdev, long ioaddr)
if (err) if (err)
goto err_out_kfree; goto err_out_kfree;
printk("%s: registered as %s\n", print_name, dev->name);
return 0; return 0;
err_out_kfree: err_out_kfree:
...@@ -770,6 +778,7 @@ static void __devinit dfx_bus_config_check(DFX_board_t *bp) ...@@ -770,6 +778,7 @@ static void __devinit dfx_bus_config_check(DFX_board_t *bp)
* *
* Arguments: * Arguments:
* dev - pointer to device information * dev - pointer to device information
* print_name - printable device name
* *
* Functional Description: * Functional Description:
* This function allocates additional resources such as the host memory * This function allocates additional resources such as the host memory
...@@ -792,7 +801,8 @@ static void __devinit dfx_bus_config_check(DFX_board_t *bp) ...@@ -792,7 +801,8 @@ static void __devinit dfx_bus_config_check(DFX_board_t *bp)
* returning from this routine. * returning from this routine.
*/ */
static int __devinit dfx_driver_init(struct net_device *dev) static int __devinit dfx_driver_init(struct net_device *dev,
const char *print_name)
{ {
DFX_board_t *bp = dev->priv; DFX_board_t *bp = dev->priv;
int alloc_size; /* total buffer size needed */ int alloc_size; /* total buffer size needed */
...@@ -841,26 +851,20 @@ static int __devinit dfx_driver_init(struct net_device *dev) ...@@ -841,26 +851,20 @@ static int __devinit dfx_driver_init(struct net_device *dev)
/* Read the factory MAC address from the adapter then save it */ /* Read the factory MAC address from the adapter then save it */
if (dfx_hw_port_ctrl_req(bp, if (dfx_hw_port_ctrl_req(bp, PI_PCTRL_M_MLA, PI_PDATA_A_MLA_K_LO, 0,
PI_PCTRL_M_MLA, &data) != DFX_K_SUCCESS) {
PI_PDATA_A_MLA_K_LO, printk("%s: Could not read adapter factory MAC address!\n",
0, print_name);
&data) != DFX_K_SUCCESS)
{
printk("%s: Could not read adapter factory MAC address!\n", dev->name);
return(DFX_K_FAILURE); return(DFX_K_FAILURE);
} }
memcpy(&bp->factory_mac_addr[0], &data, sizeof(u32)); memcpy(&bp->factory_mac_addr[0], &data, sizeof(u32));
if (dfx_hw_port_ctrl_req(bp, if (dfx_hw_port_ctrl_req(bp, PI_PCTRL_M_MLA, PI_PDATA_A_MLA_K_HI, 0,
PI_PCTRL_M_MLA, &data) != DFX_K_SUCCESS) {
PI_PDATA_A_MLA_K_HI, printk("%s: Could not read adapter factory MAC address!\n",
0, print_name);
&data) != DFX_K_SUCCESS)
{
printk("%s: Could not read adapter factory MAC address!\n", dev->name);
return(DFX_K_FAILURE); return(DFX_K_FAILURE);
} }
memcpy(&bp->factory_mac_addr[4], &data, sizeof(u16)); memcpy(&bp->factory_mac_addr[4], &data, sizeof(u16));
/* /*
...@@ -872,27 +876,19 @@ static int __devinit dfx_driver_init(struct net_device *dev) ...@@ -872,27 +876,19 @@ static int __devinit dfx_driver_init(struct net_device *dev)
memcpy(dev->dev_addr, bp->factory_mac_addr, FDDI_K_ALEN); memcpy(dev->dev_addr, bp->factory_mac_addr, FDDI_K_ALEN);
if (bp->bus_type == DFX_BUS_TYPE_EISA) if (bp->bus_type == DFX_BUS_TYPE_EISA)
printk("%s: DEFEA at I/O addr = 0x%lX, IRQ = %d, Hardware addr = %02X-%02X-%02X-%02X-%02X-%02X\n", printk("%s: DEFEA at I/O addr = 0x%lX, IRQ = %d, "
dev->name, "Hardware addr = %02X-%02X-%02X-%02X-%02X-%02X\n",
dev->base_addr, print_name, dev->base_addr, dev->irq,
dev->irq, dev->dev_addr[0], dev->dev_addr[1],
dev->dev_addr[0], dev->dev_addr[2], dev->dev_addr[3],
dev->dev_addr[1], dev->dev_addr[4], dev->dev_addr[5]);
dev->dev_addr[2],
dev->dev_addr[3],
dev->dev_addr[4],
dev->dev_addr[5]);
else else
printk("%s: DEFPA at I/O addr = 0x%lX, IRQ = %d, Hardware addr = %02X-%02X-%02X-%02X-%02X-%02X\n", printk("%s: DEFPA at I/O addr = 0x%lX, IRQ = %d, "
dev->name, "Hardware addr = %02X-%02X-%02X-%02X-%02X-%02X\n",
dev->base_addr, print_name, dev->base_addr, dev->irq,
dev->irq, dev->dev_addr[0], dev->dev_addr[1],
dev->dev_addr[0], dev->dev_addr[2], dev->dev_addr[3],
dev->dev_addr[1], dev->dev_addr[4], dev->dev_addr[5]);
dev->dev_addr[2],
dev->dev_addr[3],
dev->dev_addr[4],
dev->dev_addr[5]);
/* /*
* Get memory for descriptor block, consumer block, and other buffers * Get memory for descriptor block, consumer block, and other buffers
...@@ -909,11 +905,11 @@ static int __devinit dfx_driver_init(struct net_device *dev) ...@@ -909,11 +905,11 @@ static int __devinit dfx_driver_init(struct net_device *dev)
(PI_ALIGN_K_DESC_BLK - 1); (PI_ALIGN_K_DESC_BLK - 1);
bp->kmalloced = top_v = pci_alloc_consistent(bp->pci_dev, alloc_size, bp->kmalloced = top_v = pci_alloc_consistent(bp->pci_dev, alloc_size,
&bp->kmalloced_dma); &bp->kmalloced_dma);
if (top_v == NULL) if (top_v == NULL) {
{ printk("%s: Could not allocate memory for host buffers "
printk("%s: Could not allocate memory for host buffers and structures!\n", dev->name); "and structures!\n", print_name);
return(DFX_K_FAILURE); return(DFX_K_FAILURE);
} }
memset(top_v, 0, alloc_size); /* zero out memory before continuing */ memset(top_v, 0, alloc_size); /* zero out memory before continuing */
top_p = bp->kmalloced_dma; /* get physical address of buffer */ top_p = bp->kmalloced_dma; /* get physical address of buffer */
...@@ -970,14 +966,20 @@ static int __devinit dfx_driver_init(struct net_device *dev) ...@@ -970,14 +966,20 @@ static int __devinit dfx_driver_init(struct net_device *dev)
/* Display virtual and physical addresses if debug driver */ /* Display virtual and physical addresses if debug driver */
DBG_printk("%s: Descriptor block virt = %0lX, phys = %0X\n", dev->name, (long)bp->descr_block_virt, bp->descr_block_phys); DBG_printk("%s: Descriptor block virt = %0lX, phys = %0X\n",
DBG_printk("%s: Command Request buffer virt = %0lX, phys = %0X\n", dev->name, (long)bp->cmd_req_virt, bp->cmd_req_phys); print_name,
DBG_printk("%s: Command Response buffer virt = %0lX, phys = %0X\n", dev->name, (long)bp->cmd_rsp_virt, bp->cmd_rsp_phys); (long)bp->descr_block_virt, bp->descr_block_phys);
DBG_printk("%s: Receive buffer block virt = %0lX, phys = %0X\n", dev->name, (long)bp->rcv_block_virt, bp->rcv_block_phys); DBG_printk("%s: Command Request buffer virt = %0lX, phys = %0X\n",
DBG_printk("%s: Consumer block virt = %0lX, phys = %0X\n", dev->name, (long)bp->cons_block_virt, bp->cons_block_phys); print_name, (long)bp->cmd_req_virt, bp->cmd_req_phys);
DBG_printk("%s: Command Response buffer virt = %0lX, phys = %0X\n",
print_name, (long)bp->cmd_rsp_virt, bp->cmd_rsp_phys);
DBG_printk("%s: Receive buffer block virt = %0lX, phys = %0X\n",
print_name, (long)bp->rcv_block_virt, bp->rcv_block_phys);
DBG_printk("%s: Consumer block virt = %0lX, phys = %0X\n",
print_name, (long)bp->cons_block_virt, bp->cons_block_phys);
return(DFX_K_SUCCESS); return(DFX_K_SUCCESS);
} }
/* /*
...@@ -2668,12 +2670,12 @@ static int dfx_hw_dma_uninit(DFX_board_t *bp, PI_UINT32 type) ...@@ -2668,12 +2670,12 @@ static int dfx_hw_dma_uninit(DFX_board_t *bp, PI_UINT32 type)
static void my_skb_align(struct sk_buff *skb, int n) static void my_skb_align(struct sk_buff *skb, int n)
{ {
unsigned long x=(unsigned long)skb->data; unsigned long x = (unsigned long)skb->data;
unsigned long v; unsigned long v;
v=(x+n-1)&~(n-1); /* Where we want to be */ v = ALIGN(x, n); /* Where we want to be */
skb_reserve(skb, v-x); skb_reserve(skb, v - x);
} }
...@@ -3428,11 +3430,6 @@ static int __init dfx_init(void) ...@@ -3428,11 +3430,6 @@ static int __init dfx_init(void)
{ {
int rc_pci, rc_eisa; int rc_pci, rc_eisa;
/* when a module, this is printed whether or not devices are found in probe */
#ifdef MODULE
printk(version);
#endif
rc_pci = pci_module_init(&dfx_driver); rc_pci = pci_module_init(&dfx_driver);
if (rc_pci >= 0) dfx_have_pci = 1; if (rc_pci >= 0) dfx_have_pci = 1;
...@@ -3453,6 +3450,9 @@ static void __exit dfx_cleanup(void) ...@@ -3453,6 +3450,9 @@ static void __exit dfx_cleanup(void)
module_init(dfx_init); module_init(dfx_init);
module_exit(dfx_cleanup); module_exit(dfx_cleanup);
MODULE_AUTHOR("Lawrence V. Stefani");
MODULE_DESCRIPTION("DEC FDDIcontroller EISA/PCI (DEFEA/DEFPA) driver "
DRV_VERSION " " DRV_RELDATE);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
* LVS Lawrence V. Stefani <lstefani@yahoo.com> * LVS Lawrence V. Stefani <lstefani@yahoo.com>
* *
* Maintainers: * Maintainers:
* macro Maciej W. Rozycki <macro@ds2.pg.gda.pl> * macro Maciej W. Rozycki <macro@linux-mips.org>
* *
* Modification History: * Modification History:
* Date Name Description * Date Name Description
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment