How To Create The Sis191 Gigabit Ethernet Driver On Linux 2.6

Want to support HowtoForge? Become a subscriber!
 
Submitted by admin (Contact Author) (Forums) on Tue, 2008-01-29 11:59. :: Linux

How To Create The Sis191 Gigabit Ethernet Driver On Linux 2.6

Sis191 Driver Problem

This how-to is for those people wich have a sis191 gigabit ethernet integrated interface (on-board LAN), but cannot get sis191 default driver working (actually, the driver is called sis190, the FastEthernet version of this card). My Acer Aspire SA90 is one good example.

NOTE: this howto was created using Ubuntu 7.10 with kernel 2.6.22 

 

The Problem

When executing

modprobe sis190

, under a vanilla 2.6.x kernel (mine is 2.6.22 from ubuntu 7.10), you will see this error:

'Can not find ISA bridge'

And no networking interface will be found. If you're unlucky, as I was until I bought a PCI network card, you'll have no network so this how-to will be impossible for you to reach.

The reason is that vanilla driver searches for ISA bridge ID 965, but mine is 968, as I saught executing

lspci -nn

00:02.0 ISA bridge [0601]: Silicon Integrated Systems [SiS] SiS968 [MuTIOL Media IO] [1039:0968] (rev 01)

[...]

00:04.0 Ethernet controller [0200]: Silicon Integrated Systems [SiS] 191 Gigabit Ethernet Adapter [1039:0191] (rev 02)

As you can see, I actually have an Ethernet controller model 191 from SIS ;) 

 

The Solution

We must change the ISA bridge ID from the vanilla driver, from 0x965 to 0x968, or whatever ID you have (see output from lspci)

Ignore the sis191 official driver download. It is completely out-of date (see www.sis.com/download, then Download Center > Network Driver : SiS191 Gigabit & SiS190 LAN : Linux)

Instead, go to www.kernel.org and grab the .tar.gz file for your current kernel version (see

uname -r

). Once uncompressed with

tar -xvzf [file.tar.gz]

edit the driver' source file in '[kernel_src_folder]/drivers/net/sis190.c'. At line 1576 you'll find this section:

 *      sis190_get_mac_addr_from_apc - Get MAC address for SiS965 model
 *      @pci_dev: the sis190 pci device
 *      @net_dev: the net device to get address for
 *
 *      SiS965 model, use APC CMOS RAM to store MAC address.
 *      APC CMOS RAM is accessed through ISA bridge.
 *      MAC address is read into @net_dev->dev_addr.
 */
static int __devinit sis190_get_mac_addr_from_apc(struct pci_dev * pci_dev, struct net_device *net_dev)
{
        struct pci_dev *isa_bridge = NULL;
        struct sis190_private * sis_priv = net_dev->priv;
        u8 reg, temp;
        int i;

        printk(KERN_INFO "%s: Read MAC address from APC\n", net_dev->name);
        
        isa_bridge = pci_find_device(0x1039, 0x0965, isa_bridge);
        if (!isa_bridge) {
                printk("%s: Can not find ISA bridge\n", net_dev->name);
                return 0;
        }

Now change the line

isa_bridge = pci_find_device(0x1039, 0x0965, isa_bridge);

to

isa_bridge = pci_find_device(0x1039, 0x0968, isa_bridge);

Or whatever ID you actually have (mine is 0x0968, remember).

 

Compile And Use The New Module

Now copy your kernel config file (in ubuntu, located in /boot/config-2.6.22-14-generic) to your kernel source folder, and rename it to ".config". This step might be unnecesary if you know what to do with a kernel source.

Now exec

make oldconfig

and then

make modules

but quit it using Ctrl+C after 10 seconds or so, in order to avoid compiling the whole kernel tree. If we don't make modules, the temporary files needed to do the next step won't be created.

The important thing to build is _only_ our driver, and we can make it executing

make drivers/net/sis190.ko

This is a "wrong" way of compiling kernel modules, but is the easiest and fastest way.

Once compiled, try to load it with

insmod drivers/net/sis190.ko

You might need to unload first the current, vanilla driver with

rmmod sis190

You can see if it has worked by typing

dmesg

and

ifconfig -a

Enable the interface manuall (with ifconfig) or automatically (with dhclient or equivalent DHCP client command).

Now to permanently install the new driver, copy the sis190.ko file into the modules directory. Mine is located in /lib/modules/2.6.22-14-generic/kernel/drivers/net. But first do a backup of the original one! In order to copy, is as simply as typing

cp [kernel_src_folder]/drivers/net/sis190.ko /lib/modules/2.6.22-14-generic/kernel/drivers/net

And that's all, folks! Good luck!


Please do not use the comment function to ask for help! If you need help, please use our forum.
Comments will be published after administrator approval.
Submitted by Muise (registered user) on Sat, 2008-02-23 21:53.

I must say, very well done, tried it out on my machine, an HP EX470, and it worked no problems! Though I might recommend a slight modification to your patch. Instead of replacing "0x0965" with "0x0968" you could add an extra line so that it doesn't cripple the driver for systems that use the 965 Southbridge:

static int __devinit sis190_get_mac_addr_from_apc(struct pci_dev * pci_dev, struct net_device *net_dev)
{
        struct pci_dev *isa_bridge = NULL;
        struct sis190_private * sis_priv = net_dev->priv;
        u8 reg, temp;
        int i;

        printk(KERN_INFO "%s: Read MAC address from APC\n", net_dev->name);
        
        isa_bridge = pci_find_device(0x1039, 0x0965, isa_bridge);
        if (!isa_bridge)
                isa_bridge = pci_find_device(0x1039, 0x0968, isa_bridge);
        if (!isa_bridge) {
                printk("%s: Can not find ISA bridge\n", net_dev->name);
                return 0;
        }


 

Submitted by SteffJay (not registered) on Tue, 2009-08-25 11:21.
I have tried installing Ubuntu 7.10 on my EX470 but to no avail. I have, however, installed Ubuntu 9.04 onto it. There are still two issues that need to be addressed. Firstly, the sis191 (eth0) is still not working but i have the Linux (outdated) driver which was made in 2004. I tried the above workaround but my kernal is 2.6.28-11 generic and it trashed the system. I reinstalled 9.04 to get back to the begining. The second problem is the VGA output. The screen is extreemly corrupt and difficult to see. This is not so much of an issue as i normaly use remote using VNC viewer, which works fine.  Any help on this will be greatly welcome.