patch-2.1.127 linux/drivers/net/tlan.c
Next file: linux/drivers/pci/oldproc.c
Previous file: linux/drivers/net/sktr.c
Back to the patch index
Back to the overall index
- Lines: 157
- Date:
Mon Nov 2 09:11:58 1998
- Orig file:
v2.1.126/linux/drivers/net/tlan.c
- Orig date:
Tue Aug 18 22:02:04 1998
diff -u --recursive --new-file v2.1.126/linux/drivers/net/tlan.c linux/drivers/net/tlan.c
@@ -25,6 +25,11 @@
* Microchip Technology, 24C01A/02A/04A Data Sheet
* available in PDF format from www.microchip.com
*
+ * Change History
+ *
+ * Tigran Aivazian <tigran@sco.com>: TLan_PciProbe() now uses
+ * new PCI BIOS interface.
+ *
********************************************************************/
@@ -32,7 +37,6 @@
#include "tlan.h"
-#include <linux/bios32.h>
#include <linux/ioport.h>
#include <linux/pci.h>
#include <linux/etherdevice.h>
@@ -152,7 +156,7 @@
};
-static int TLan_PciProbe( u8 *, u8 *, u8 *, u8 *, u32 *, u32 * );
+static int TLan_PciProbe( u8 *, u8 *, u8 *, u32 *, u32 * );
static int TLan_Init( struct device * );
static int TLan_Open(struct device *dev);
static int TLan_StartTx(struct sk_buff *, struct device *);
@@ -269,7 +273,6 @@
extern int init_module(void)
{
TLanPrivateInfo *priv;
- u8 bus;
struct device *dev;
size_t dev_size;
u8 dfn;
@@ -296,7 +299,7 @@
dev_size = sizeof(struct device) + sizeof(TLanPrivateInfo);
- while ( ( found = TLan_PciProbe( &bus, &dfn, &irq, &rev, &io_base, &index ) ) ) {
+ while ( ( found = TLan_PciProbe( &dfn, &irq, &rev, &io_base, &index ) ) ) {
dev = (struct device *) kmalloc( dev_size, GFP_KERNEL );
if ( dev == NULL ) {
printk( "TLAN: Could not allocate memory for device.\n" );
@@ -417,10 +420,10 @@
TLanPrivateInfo *priv;
static int pad_allocated = 0;
int found;
- u8 bus, dfn, irq, rev;
+ u8 dfn, irq, rev;
u32 io_base, index;
- found = TLan_PciProbe( &bus, &dfn, &irq, &rev, &io_base, &index );
+ found = TLan_PciProbe( &dfn, &irq, &rev, &io_base, &index );
if ( ! found ) {
return -ENODEV;
@@ -502,8 +505,6 @@
* Returns:
* 1 if another TLAN card was found, 0 if not.
* Parms:
- * pci_bus The PCI bus the card was found
- * on.
* pci_dfn The PCI whatever the card was
* found at.
* pci_irq The IRQ of the found adapter.
@@ -522,33 +523,26 @@
*
**************************************************************/
-int TLan_PciProbe( u8 *pci_bus, u8 *pci_dfn, u8 *pci_irq, u8 *pci_rev, u32 *pci_io_base, u32 *dl_ix )
+int TLan_PciProbe(u8 *pci_dfn, u8 *pci_irq, u8 *pci_rev, u32 *pci_io_base, u32 *dl_ix )
{
static int dl_index = 0;
- static int pci_index = 0;
-
- int not_found;
- u8 pci_latency;
+ static struct pci_dev * pdev = NULL;
u16 pci_command;
int reg;
- if ( ! pcibios_present() ) {
+ if ( ! pci_present() ) {
printk( "TLAN: PCI Bios not present.\n" );
return 0;
}
for (; TLanAdapterList[dl_index].vendorId != 0; dl_index++) {
- not_found = pcibios_find_device(
+ pdev = pci_find_device(
TLanAdapterList[dl_index].vendorId,
- TLanAdapterList[dl_index].deviceId,
- pci_index,
- pci_bus,
- pci_dfn
- );
+ TLanAdapterList[dl_index].deviceId, pdev);
- if ( ! not_found ) {
+ if ( pdev ) {
TLAN_DBG(
TLAN_DEBUG_GNRL,
@@ -557,19 +551,14 @@
TLanAdapterList[dl_index].deviceId
);
- pcibios_read_config_byte ( *pci_bus, *pci_dfn, PCI_REVISION_ID, pci_rev);
- pcibios_read_config_byte ( *pci_bus, *pci_dfn, PCI_INTERRUPT_LINE, pci_irq);
- pcibios_read_config_word ( *pci_bus, *pci_dfn, PCI_COMMAND, &pci_command);
- pcibios_read_config_dword( *pci_bus, *pci_dfn, PCI_BASE_ADDRESS_0, pci_io_base);
- pcibios_read_config_byte ( *pci_bus, *pci_dfn, PCI_LATENCY_TIMER, &pci_latency);
-
- if (pci_latency < 0x10) {
- pcibios_write_config_byte( *pci_bus, *pci_dfn, PCI_LATENCY_TIMER, 0xff);
- TLAN_DBG( TLAN_DEBUG_GNRL, "TLAN: Setting latency timer to max.\n");
- }
+ *pci_irq = pdev->irq;
+ *pci_io_base = pdev->base_address[0] & PCI_BASE_ADDRESS_IO_MASK;
+ *pci_dfn = pdev->devfn;
+ pci_read_config_byte ( pdev, PCI_REVISION_ID, pci_rev);
+ pci_read_config_word ( pdev, PCI_COMMAND, &pci_command);
for ( reg = PCI_BASE_ADDRESS_0; reg <= PCI_BASE_ADDRESS_5; reg +=4 ) {
- pcibios_read_config_dword( *pci_bus, *pci_dfn, reg, pci_io_base);
+ pci_read_config_dword( pdev, reg, pci_io_base);
if ((pci_command & PCI_COMMAND_IO) && (*pci_io_base & 0x3)) {
*pci_io_base &= PCI_BASE_ADDRESS_IO_MASK;
TLAN_DBG( TLAN_DEBUG_GNRL, "TLAN: IO mapping is available at %x.\n", *pci_io_base);
@@ -582,12 +571,7 @@
if ( *pci_io_base == 0 )
printk("TLAN: IO mapping not available, ignoring device.\n");
- if ( ! ( pci_command & PCI_COMMAND_MASTER ) ) {
- pcibios_write_config_word ( *pci_bus, *pci_dfn, PCI_COMMAND, pci_command | PCI_COMMAND_MASTER );
- printk( "TLAN: Activating PCI bus mastering for this device.\n" );
- }
-
- pci_index++;
+ pci_set_master(pdev);
if ( *pci_io_base ) {
*dl_ix = dl_index;
@@ -595,7 +579,7 @@
}
} else {
- pci_index = 0;
+ pdev = NULL;
}
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov