From: Daniele Venzano <webvenza@libero.it>
To: NetDev <netdev@oss.sgi.com>, Jeff Garzik <jgarzik@pobox.com>
Subject: [PATCH 3/5] sis900 printk and stack usage audit
Date: Wed, 8 Dec 2004 12:06:10 +0100 [thread overview]
Message-ID: <20041208110610.GD31707@picchio.gall.it> (raw)
In-Reply-To: <20041208104721.GA31707@picchio.gall.it>
[-- Attachment #1.1: Type: text/plain, Size: 278 bytes --]
Chip revision is now a member of sis_priv structure
Kill all calls to pci_read_config_byte but one
Change the code to use sis_priv->chipset_rev
Signed-off-by: Daniele Venzano <webvenza@libero.it>
--
-----------------------------
Daniele Venzano
Web: http://teg.homeunix.org
[-- Attachment #1.2: sis900-chipset-revision.diff --]
[-- Type: text/plain, Size: 5030 bytes --]
Index: sis900.c
===================================================================
--- a/drivers/net/sis900.c (revision 41)
+++ b/drivers/net/sis900.c (revision 42)
@@ -173,6 +173,7 @@
unsigned int tx_full; /* The Tx queue is full. */
u8 host_bridge_rev;
+ u8 chipset_rev;
u32 pci_state[16];
};
@@ -387,7 +388,6 @@
void *ring_space;
long ioaddr;
int i, ret;
- u8 revision;
char *card_name = card_names[pci_id->driver_data];
/* setup various bits in PCI command register */
@@ -455,20 +455,20 @@
if (ret)
goto err_unmap_rx;
- pci_read_config_byte(pci_dev, PCI_CLASS_REVISION, &revision);
+ pci_read_config_byte(pci_dev, PCI_CLASS_REVISION, &(sis_priv->chipset_rev));
if(sis900_debug > 0)
printk(KERN_DEBUG "%s: detected revision %2.2x,"
"trying to get MAC address...\n",
- net_dev->name, revision);
+ net_dev->name, sis_priv->chipset_rev);
/* Get Mac address according to the chip revision */
ret = 0;
- if (revision == SIS630E_900_REV)
+ if (sis_priv->chipset_rev == SIS630E_900_REV)
ret = sis630e_get_mac_addr(pci_dev, net_dev);
- else if ((revision > 0x81) && (revision <= 0x90) )
+ else if ((sis_priv->chipset_rev > 0x81) && (sis_priv->chipset_rev <= 0x90))
ret = sis635_get_mac_addr(pci_dev, net_dev);
- else if (revision == SIS96x_900_REV)
+ else if (sis_priv->chipset_rev == SIS96x_900_REV)
ret = sis96x_get_mac_addr(pci_dev, net_dev);
else
ret = sis900_get_mac_addr(pci_dev, net_dev);
@@ -480,7 +480,7 @@
}
/* 630ET : set the mii access mode as software-mode */
- if (revision == SIS630ET_900_REV)
+ if (sis_priv->chipset_rev == SIS630ET_900_REV)
outl(ACCESSMODE | inl(ioaddr + cr), ioaddr + cr);
/* probe for mii transceiver */
@@ -535,7 +535,6 @@
u16 poll_bit = MII_STAT_LINK, status = 0;
unsigned long timeout = jiffies + 5 * HZ;
int phy_addr;
- u8 revision;
sis_priv->mii = NULL;
@@ -632,8 +631,7 @@
}
}
- pci_read_config_byte(sis_priv->pci_dev, PCI_CLASS_REVISION, &revision);
- if (revision == SIS630E_900_REV) {
+ if (sis_priv->chipset_rev == SIS630E_900_REV) {
/* SiS 630E has some bugs on default value of PHY registers */
mdio_write(net_dev, sis_priv->cur_phy, MII_ANADV, 0x05e1);
mdio_write(net_dev, sis_priv->cur_phy, MII_CONFIG1, 0x22);
@@ -948,15 +946,13 @@
{
struct sis900_private *sis_priv = net_dev->priv;
long ioaddr = net_dev->base_addr;
- u8 revision;
int ret;
/* Soft reset the chip. */
sis900_reset(net_dev);
/* Equalizer workaround Rule */
- pci_read_config_byte(sis_priv->pci_dev, PCI_CLASS_REVISION, &revision);
- sis630_set_eq(net_dev, revision);
+ sis630_set_eq(net_dev, sis_priv->chipset_rev);
ret = request_irq(net_dev->irq, &sis900_interrupt, SA_SHIRQ,
net_dev->name, net_dev);
@@ -1224,7 +1220,6 @@
struct mii_phy *mii_phy = sis_priv->mii;
static int next_tick = 5*HZ;
u16 status;
- u8 revision;
if (!sis_priv->autong_complete){
int speed, duplex = 0;
@@ -1232,9 +1227,7 @@
sis900_read_mode(net_dev, &speed, &duplex);
if (duplex){
sis900_set_mode(net_dev->base_addr, speed, duplex);
- pci_read_config_byte(sis_priv->pci_dev,
- PCI_CLASS_REVISION, &revision);
- sis630_set_eq(net_dev, revision);
+ sis630_set_eq(net_dev, sis_priv->chipset_rev);
netif_start_queue(net_dev);
}
@@ -1268,9 +1261,7 @@
((mii_phy->phy_id1 & 0xFFF0) == 0x8000))
sis900_reset_phy(net_dev, sis_priv->cur_phy);
- pci_read_config_byte(sis_priv->pci_dev,
- PCI_CLASS_REVISION, &revision);
- sis630_set_eq(net_dev, revision);
+ sis630_set_eq(net_dev, sis_priv->chipset_rev);
goto LookForLink;
}
@@ -2102,11 +2093,10 @@
u16 mc_filter[16] = {0}; /* 256/128 bits multicast hash table */
int i, table_entries;
u32 rx_mode;
- u8 revision;
/* 635 Hash Table entires = 256(2^16) */
- pci_read_config_byte(sis_priv->pci_dev, PCI_CLASS_REVISION, &revision);
- if((revision >= SIS635A_900_REV) || (revision == SIS900B_900_REV))
+ if((sis_priv->chipset_rev >= SIS635A_900_REV) ||
+ (sis_priv->chipset_rev == SIS900B_900_REV))
table_entries = 16;
else
table_entries = 8;
@@ -2132,7 +2122,7 @@
mclist && i < net_dev->mc_count;
i++, mclist = mclist->next) {
unsigned int bit_nr =
- sis900_mcast_bitnr(mclist->dmi_addr, revision);
+ sis900_mcast_bitnr(mclist->dmi_addr, sis_priv->chipset_rev);
mc_filter[bit_nr >> 4] |= (1 << (bit_nr & 0xf));
}
}
@@ -2178,7 +2168,6 @@
long ioaddr = net_dev->base_addr;
int i = 0;
u32 status = TxRCMP | RxRCMP;
- u8 revision;
outl(0, ioaddr + ier);
outl(0, ioaddr + imr);
@@ -2191,8 +2180,8 @@
status ^= (inl(isr + ioaddr) & status);
}
- pci_read_config_byte(sis_priv->pci_dev, PCI_CLASS_REVISION, &revision);
- if( (revision >= SIS635A_900_REV) || (revision == SIS900B_900_REV) )
+ if( (sis_priv->chipset_rev >= SIS635A_900_REV) ||
+ (sis_priv->chipset_rev == SIS900B_900_REV) )
outl(PESEL | RND_CNT, ioaddr + cfg);
else
outl(PESEL, ioaddr + cfg);
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
next prev parent reply other threads:[~2004-12-08 11:06 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-12-08 10:47 [PATCH 0/5] sis900 printk and stack usage audit Daniele Venzano
2004-12-08 11:01 ` [PATCH 1/5] " Daniele Venzano
2004-12-11 19:04 ` Jeff Garzik
2004-12-11 19:06 ` Jeff Garzik
2004-12-12 8:15 ` Daniele Venzano
2004-12-08 11:04 ` [PATCH 2/5] " Daniele Venzano
2004-12-11 19:09 ` Jeff Garzik
2004-12-12 8:19 ` Daniele Venzano
2004-12-08 11:06 ` Daniele Venzano [this message]
2004-12-11 19:09 ` [PATCH 3/5] " Jeff Garzik
2004-12-08 11:08 ` [PATCH 4/5] " Daniele Venzano
2004-12-11 19:11 ` Jeff Garzik
2004-12-12 8:23 ` Daniele Venzano
2004-12-08 11:10 ` [PATCH 5/5] " Daniele Venzano
2004-12-11 19:11 ` Jeff Garzik
2004-12-12 8:27 ` Daniele Venzano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20041208110610.GD31707@picchio.gall.it \
--to=webvenza@libero.it \
--cc=jgarzik@pobox.com \
--cc=netdev@oss.sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).