Linux Device Drivers in Mach UK22

March 29, 1996

Contents

Overview
Changes to Mach4
Driver Status
Configuring Linux drivers into Mach4
Device Naming
Miscellaneous features, bugs, etc.

Overview

The Linux device driver emulation code provides the glue that allows mostly unmodified Linux device drivers to work within Mach. Shantanu Goel (goel@cs.utah.edu) has continuted his Linux device driver emulation work that first appeared in Mach4 UK02p21 to support not only network devices, but also block and SCSI host adapters.

The original work is described the paper ``Linux Device Driver Emulation in Mach'' by Shantanu Goel and Dan Duchamp. (For non Usenix members, a postscript version of the paper can be found at ftp://mancos.cs.utah.edu/papers/linuxemu.ps.Z.)

The Linux device drivers in Mach have been updated to correspond to release 1.3.68 of Linux.

Be aware that since the drivers are from Linux and the device emulation code was developed from Linux source, all of the Linux device emulation code is covered by the GPL.


Changes to Mach4

  • On the i386, the routines previously in mach4/kernel/device/ds_routines.c are now implemented by mach4-i386/kernel/i386at/i386at_ds_routines.c. In effect, the device server is now machine dependent. This is to allow multiple emulations and maximum flexibility in the implementation. The old routines are still used to support the native Mach drivers.

  • The kernel now supports Linux block drivers and Linux SCSI host adapters. Block driver support is currently limited to those drivers that use block_read/block_write to service I/O requests. Fortunately, most drivers do this. One important exception is the SCSI tape driver which uses its own routines.

    For more information about block driver support, take a look at:

    mach4-i386/kernel/i386at/gpl/linux/linux_block.c.

  • The linux PCI support code is now included in the kernel, although it is only used by the linux device drivers. Because of this, PCI network drivers are now supported, along with PCI block and SCSI devices.

  • Linux network driver support code has been mostly rewritten since the last release. This support can be found in:

    mach4-i386/kernel/i386at/gpl/linux/linux_net.c.


  • Driver Status

    The drivers that we have tested are:

    Network:

    Various Novell NE2000 clones
    HP PCLAN/Plus
    SMC Etherpower 10/100 (PCI)
    SCSI host adapters:
    Adaptec 1542CF and 1542CP (with Plug and Play turned off)
    Adaptec 2940 (PCI)
    Adaptec 2740AT (EISA)
    NCR 810 and 825 (PCI)
    Ultrastor 34F (Local Bus)
    Block:
    IDE disk/CDROM (with trition chipset, regular IDE)
    Floppy
    SCSI disk
    SCSI CDROM
    To configure drivers for your kernel, you'll have to edit mach4-i386/kernel/i386at/gpl/linux/include/linux/autoconf.h to #define the driver you want, or #undef those that you don't.

    You cannot specify which drivers will be included in your kernel. By default any file with a .c extension will be compiled and included. This is a deficiency of the build process. If you want to get a smaller kernel, you'll either have to rename those drivers that you don't want, or remove them. Make sure that any drivers that you remove are #undef'ed in autoconf.h.

    Since we have only been able to test a small fraction of these drivers, please send reports about success/failure to mach4-users@cs.utah.edu!

    Network Drivers 32 Total

    CONFIG_AC3200		Ansel Communications AC3200 (EISA)
    CONFIG_APRICOT		Apricot 82596
    CONFIG_AT1500		Allied Telesis AT1500 and HP J2405A
    CONFIG_AT1700		Allied Telesis AT1700
    CONFIG_ATP		RealTek (aka AT-Lan-Tec) pocket ethernet adapter
    CONFIG_DE4X5		DEC DE425, DE434, DE435, DE500 and
    			  others using the DEC 21040, 21041, 21140 chips.
    CONFIG_DE600		D-Link DE-600
    CONFIG_DE620		D-Link DE-620
    CONFIG_DEPCA		DEPCA and EtherWORKS (DEPCA, DE100, DE101, DE200 Turbo
    			  DE201 Turbo, DE202 Turbo, DE210, DE422)
    CONFIG_E2100		Cabletron E2100
    CONFIG_EEXPRESS		Intel EtherExpress
    CONFIG_EEXPRESS_PRO	Intel EtherExpress Pro/10
    CONFIG_EL1		3Com Etherlink 3c501 
    CONFIG_EL2		3Com Etherlink II/16 3c503
    CONFIG_ELPLUS		3Com Etherlink Plus 3c505 
    CONFIG_EL16		3Com Etherlink 16 3c507 
    CONFIG_EL3		3Com Etherlink III 3c509 
    CONFIG_ETH16I		ICL EtherTeam 16i and 32 EISA
    CONFIG_EWRK3		DEC EtherWORKS 3 (DE203 Turbo, DE204 Turbo, 
    			DE205 Turbo)
    CONFIG_HP100		HP HP10/100VG ANYLAN (HP J2577, HP J2573, HP 27248B,
    			  HP J2577, HP J2573, HP J2585)
    CONFIG_HPLAN		HP PCLAN
    CONFIG_HPLAN_PLUS	HP PCLAN/plus
    CONFIG_NE2000		NE1000, NE2000
    CONFIG_NI52		NI5210 (i82586 Ethernet chip)
    CONFIG_NI65		ni6510 (am7990 'lance' chip)
    CONFIG_SEEQ8005		SEEQ 8005 based boards
    CONFIG_SK_G16		Schneider & Koch (SK) G16
    CONFIG_ULTRA		SMC Ultra and SMC EtherEZ (shared memory only)
    CONFIG_VORTEX		3Com Etherlink III (PCI) 3c590, 3c595-Tx 
    CONFIG_WAVELAN		AT&T GIS WaveLAN (Intel 82586)
    CONFIG_WD80x3		WD80x3 (WD8003 and WD8013 "compatible" ethercards)
    CONFIG_ZNOTE		Zenith Z-Note (i82593)
    
    SCSI Host Adapters 22 Total
    CONFIG_SCSI_NCR53C7xxx		NCR53c810/815/820/825/700/710/720 
    CONFIG_SCSI_AM53C974		AM53/79C974 (PCscsi)
    CONFIG_SCSI_BUSLOGIC		Buslogic Adapters (see below)
    CONFIG_SCSI_GENERIC_NCR5380	NCR 5380 and NR53c400
    CONFIG_SCSI_NCR53C406A		NCR53c406a
    CONFIG_SCSI_ADVANSYS		AdvanSys SCSI Adapters
    CONFIG_SCSI_AHA152X		Adaptec 152x cards
    CONFIG_SCSI_AHA1542		Adaptec 154x cards
    CONFIG_SCSI_AHA1740		Adaptec 174x cards
    CONFIG_SCSI_AIC7XXX		Adaptec 274x, 284x, 294x, 3940, 3985 boards
    CONFIG_SCSI_EATA		EATA/DMA SCSI host adapter
    CONFIG_SCSI_EATA_DMA		DPT PM2011B/9X, PM2021A/9X, PM2012A,
    				  PM2012B, PM2022A/9X, PM2122A/9X,
    				  PM2322A/9X
    CONFIG_SCSI_EATA_PIO		All EATA-PIO baords
    CONFIG_SCSI_FUTURE_DOMAIN	Future Domain TMC-1660/1680 TMC-1650/1670,
    				  and TMC-3260 
    CONFIG_SCSI_IN2000		IN-2000
    CONFIG_SCSI_PAS16		Pro Audio Spectrum/Studio 16
    CONFIG_SCSI_QLOGIC		Qlogic boards
    CONFIG_SCSI_SEAGATE		ST01/ST02, Future Domain TMC-885, TMC-950
    CONFIG_SCSI_T128		Trantor T128/T128F/T228
    CONFIG_SCSI_U14_34F		UltraStor 14F/34F
    CONFIG_SCSI_ULTRASTOR		UltraStor 14F, 24F, and 34F
    CONFIG_SCSI_7000FASST		WD7000-FASST2, WD7000-ASC, WD7000-AX,
    				WD7000-MX, WD7000-EX
    
    Buslogic Adapters supported by the Buslogic driver:
    
    BusLogic "C" Series Host Adapters:
         BT-946C/956C/956CD/747C/757C/757CD/445C/545C/540CF
    BusLogic "S" Series Host Adapters:
         BT-747S/747D/757S/757D/445S/545S/542D
         BT-542B/742A (revision H)
    BusLogic "A" Series Host Adapters:
         BT-542B/742A (revision G and below)
    AMI FastDisk VLB/EISA BusLogic Clone Host Adapter
    
    Special Configuration
    CONFIG_BLK_DEV_CMD640		CMD Technologies 0640 IDE interface chip
    CONFIG_BLK_DEV_RZ1000		Support for RZ1000 IDE chipset
    CONFIG_BLK_DEV_TRITON		Intel PCI Triton chipset (82371FB)
    

    Configuation

    To enable Linux devices, add --enable-linuxdev to your mach4 configure line.

    This will enable ALL Linux devices. Basically this means that you can either use the native Mach devices, or the Linux devices. Generally this won't be too much of a problem, since there are so many more devices supported by the Linux device code.

    By default, all linux devices are configured into the kernel. You'll probably want to remove the drivers that you aren't using, since the kernels tend to be rather large this way. To change which drivers that will be compiled into the kernel, you should do this:

  • Edit mach4-i386/kernel/i386at/gpl/linux/include/linux/autoconf.h and add the appropriate #define for the driver (to figure out which #define goes with which driver, you'll probably have to do a little searching around).

  • If the driver is for a block device and there isn't a name translation for it already, you'll have to add an entry for it in name_to_major[] in mach4-i386/kernel/i386at/gpl/linux/linux_block.c

  • If you want more than 2 network interfaces in your, you will have to edit mach4-i386/kernel/i386at/gpl/linux/net/Space.c.

  • Recompile the kernel and reboot.

  • Device Naming

  • SCSI devices are named independent of their SCSI bus ID and are assigned device numbers in the order that they are probed. For example, If you have one host adapter in the machine and a disk with ID 1 and a CDROM with ID 3, the disk will be named "sd0", and the CDROM "cd0". This is unlike native Mach SCSI drivers, where device unit numbers correspond to their SCSI bus IDs (ie. a disk with ID 5 would be sd5).

  • IDE CDROMs are name "wcd0", "wcd1", etc. Because IDE CD-ROM support is handled by the IDE device driver, the device number depends on where it is installed in the system. For example, if it is the slave device on the 2nd IDE controller, it will be named "wcd3". Likewise, if it was the master device, it would be "wcd2". This is in contrast to FreeBSD which names IDE CDROMs irrepective of where they reside.

  • Ethernet devices are named "eth0", "eth1", etc. This is analogous to the way Linux names them.

  • Miscellaneous features, bugs, etc.

    Features

  • Unlike the Mach drivers, when using Linux block drivers, arbitrary length read/write requests are supported.
  • There is no 16 MB memory limit since the Linux drivers support bounce buffers.
  • The network drivers are named "eth0", "eth1", etc. as in Linux when using Linux drivers. This is unlike the previous version of the Linux device driver code.
  • PCI devices are now supported through the use of the Linux PCI configuration code.

    Bugs

  • You cannot specify which drivers will be compiled into your kernel. By default any file with a .c extension will be compiled and included with your kernel. If you want to get a smaller kernel, you'll either have to rename those drivers that you don't want, or remove them.
  • Presently Linux and native drivers cannot be mixed. Specifying --enable-linuxdev when you configure mach4 causes both Linux network and block drivers to be used. Ideally, there would be separate options for each so that Mach network and Linux block drivers can be mixed.
  • Linux block driver emulation is not complete due to the requirement that drivers use block_read/block_write (some drivers misbehave in this respect, most notably the scsi tape driver).
  • Linux character and sound drivers are not supported.
  • The Linux driver support is not MP safe.
  • Linux driver ioctls are presently not supported. To do this properly will require addition of a `device_ioctl' call similar to Unix to the Mach device interface.
  • The standalone (proprietary interface) CDROM drivers have not been tested (since we don't have any) though they should work since Linux treats them as block devices. You'll have to add a name translation for them in mach4-i386/kernel/i386at/gpl/linux/linux_block.c if you want to try them out.
  • No partitioning (disklabel, etc.) ioctls are supported by the Linux emulation. To initialize a disk, you will have to use *BSDs. Disklabels are, however, read and understood by the kernel.
  • Configuration Issues.

  • The Linux driver for the SMC Etherpower network card is mach4-i386/kernel/i386at/gpl/linux/net/de4x5.c. If you have a real DEC board you will need to #undef IS_NOT_DEC at line 254.
  • To make the generic NCR5380 driver compile, I have #define'd CONFIG_SCSI_G_NCR5380_MEM in mach4-i386/kernel/i386at/gpl/linux/scsi/g_NCR5380.c, line 65. You'll have to change it if your board is I/O mapped.
  • The hp100 driver uses I/O mapped I/O since Mach does not currently support the Linux vremap() function. Look in mach4-i386/kernel/i386at/gpl/linux/net/hp100.c.


    Stephen Clawson <sclawson@cs.utah.edu>
    Shantanu Goel <goel@cs.utah.edu>
    March 29, 1996