User Tools

Site Tools


Lance Driver Fix

<!> This fix is only necessary for MINIX versions below 3.1.4.

In MINIX 3.1.3, the AMD Lance NIC device driver does not work. There are two reasons for that problem:

  1. The lance driver needs to be loaded within the first 16MiB of memory, for DMA purposes. The servers loaded before the lance driver add up to more than 16MiB, so that the lance driver falls outside that area.
  2. RS needs to have information about the lance driver, in order to grant it the right permissions. That information comes from “/etc/drivers.conf”, where, until recently, no entry was present for the lance driver.

The following sections outline the details and solutions of those two issues. The result should be a working lance driver. You do need to reboot afterwards, for the changes to take effect.

Issue 1

This issue will manifest itself by presenting you with the following error, at startup:

LANCE: DMA denied because address out of range

Solution 1

You can solve that problem by following the steps that are described here.

That fix is easier to do than the two hacks below – they are obsolete!

The main memory hogs in the low 16MiB region are the caches of the various MFS server instances: there are four of them (for the ramdisk, “/”, “/usr”, and “/home”); and, each has about 5MiB of cache assigned to it. You can solve that problem either by recompiling MFS with a smaller cache, or by starting lance before at least two of the MFS instances. See below.

Solution 2

To lower the size of the cache, you must edit NR_BUFS in “/usr/include/minix/config.h” – the default is 1200 (the number of 4KiB block buffers), and recompile and restart MINIX3. Remember that make includes overwrites any changes in “/usr/include”. See the “docs/UPDATING” file for more details about recompiling MINIX3.

Solution 3

If you do not want to change the MFS cache size (or go through the trouble of recompiling MINIX3, for that matter), then you can follow these three steps instead:

  1. Copy “/usr/sbin/lance” to “/sbin”.
cp /usr/sbin/lance /sbin

Note that we have to start lance before the MFS instance for “/usr” is started, so a symbolic link will not do. Also note that, after recompiling and reinstalling MINIX3, you must repeat that step.

  1. Edit “/etc/rc” to start lance very early on.
vi /etc/rc

Insert the following line right after the 9-line declaration of the up() function. That is, add this line after the closing } bracket of the up() block, but before the while getopts 'saf' opt line:

up lance -args "LANCE0=on" -period 5HZ

Yes, that's a zero there. :)

  1. Remove lance from the list of drivers in “/usr/etc/rc”, so that it won't be started twice.
vi /usr/etc/rc

Look for the one line that contains “lance” (it's a list of network drivers), and remove the word “lance” from that line. The end result will look something like this:

for driver in rtl8139 fxp dpeth dp8390 orinoco

Issue 2

You can fix the second issue by adding an entry for lance to “/etc/drivers.conf”. This part is necessary for MINIX3 versions prior to revision 3170 (July 22, 2008). That includes releases 3.1.3 and 3.1.3a. Since revision 3170, the lance entry is already there; so, if you track SVN, you can skip this step.

Add the following entry to your “/etc/drivers.conf” file:

driver lance
                UMAP            # 14
                IRQCTL          # 19
                DEVIO           # 21
                #SDEVIO         # 22
                TIMES           # 25
                GETINFO         # 26
                SAFECOPYFROM    # 31
                SAFECOPYTO      # 32
                SETGRANT        # 34
        pci device      1022/2000;
        uid     0;

It's probably easiest to start by making a copy of the entry of some other driver; and then, edit that.

lancefix.txt · Last modified: 2014/11/11 14:52 (external edit)