Subject: RE: Intel Ether Express 16
To: 'netbsd-bugs' <netbsd-bugs@NetBSD.ORG>
From: John A. Maier <root@beta.datastorm.com>
List: netbsd-bugs
Date: 02/13/1996 14:22:58
Digging though the src/sys/dev/isa/if_ie.c prob code, I discovered that =
the probe code only recognizes EXP16 cards with the memory-mapped buffer =
set to 32Kbytes.

1) My card was set to no memory-mapping (factory default), which is okay =
if you're running DOS ODI network drivers.

2) After looking through the code I realized I had to have =
memory-mapping turned on, so I ran the DOS Exp16 setup program softset.  =
So that point I didn't realize that the memory-mapping was set to only =
16Kbytes and the auto probe code wanted a 32K region.

3) I started hacking on the code and found that the memory-map codes =
being returned by my card were different from the code.  So I read the =
comments again and then realized that the memory-mapped area had to be a =
32K region.  Changed it via softset.exe and things began to work.

4) Just for fun I hacked the if_ie.c file to support 16K memory-mapped =
areas.  The comments imply that this wont work, but it does, at least =
for me.

         /* 16K buffer support, John A. Maier 02/13/96 14:22
         *
         *      Table for 16K buffers
         *      value   msize   location
         *      =3D=3D=3D=3D=3D   =3D=3D=3D=3D=3D   =
=3D=3D=3D=3D=3D=3D=3D=3D
         *      0x01    0x4000  0xCC000
         *      0x02    0x4000  0xD0000
         *      0x04    0x4000  0xD4000
         *      0x08    0x4000  0xD8000
         *
         *      Table for 32K buffers
         *      value   msize   location
         *      =3D=3D=3D=3D=3D   =3D=3D=3D=3D=3D   =
=3D=3D=3D=3D=3D=3D=3D=3D
         *      0x03    0x8000  0xCC000
         *      0x06    0x8000  0xD0000
         *      0x0C    0x8000  0xD4000
         *      0x18    0x8000  0xD8000
         *
         */

        if ((ia->ia_maddr =3D=3D MADDRUNK) || (ia->ia_msize =3D=3D 0)) {
                i =3D (ee16_read_eeprom(sc, 6) & 0x00ff ) >> 3;
                switch(i) {
                        case 0x01: /* 16K buffer size */
                                ia->ia_maddr =3D 0xCC000;
                                ia->ia_msize =3D 0xx4000;
                                break;
                        case 0x02: /* 16K buffer size */
                                ia->ia_maddr =3D 0xCC000;
                                ia->ia_msize =3D 0x4000;
                                break;
                        case 0x03: /* 32K buffer size */
                                ia->ia_maddr =3D 0xCC000;
                                ia->ia_msize =3D 0x8000;
                                break;
                        case 0x04: /* 16K buffer size */
                                ia->ia_maddr =3D 0xCC000;
                                ia->ia_msize =3D 0x4000;
                                break;
                        case 0x06: /* 32K buffer size */
                                ia->ia_maddr =3D 0xD0000;
                                ia->ia_msize =3D 0x8000;
                                break;
                        case 0x08: /* 16K buffer size */
                                ia->ia_maddr =3D 0xCC000;
                                ia->ia_msize =3D 0x4000;
                                break;
                        case 0x0c: /* 32K buffer size */
                                ia->ia_maddr =3D 0xD4000;
                                ia->ia_msize =3D 0x8000;
                                break;
                        case 0x18: /* 32K buffer size */
                                ia->ia_maddr =3D 0xD8000;
                                ia->ia_msize =3D 0x8000;
                                break;
                        default:
                                printf("ie: An EtherExpress 16 was =
detected but memory-mapping is turned off.\n);
                                printf("ie: Run the Exp16 DOS setup =
program softset.exe to correct this error.\n");
                                printf("ie: Set the Memory-Mapped =
Buffering to 32 Kbytes for optimal performance.\n");
                                return 0 ;
                                break; /* NOTREACHED */
                }
        }
        /*
	  * If the buffer is set to 16K inform the user to bump
        * the buffering up for better performance.
        */
        if(ia->ia_msize =3D=3D 0x4000)
                printf("ie: Set the Memory-Mapped Buffering to 32 Kbytes =
for optimal performance.\n");
=20
        /* need to set these after checking for MADDRUNK */
        sc->sc_maddr =3D ISA_HOLE_VADDR(ia->ia_maddr);
        sc->sc_msize =3D ia->ia_msize;

        /* need to put the 586 in RESET, and leave it */
        outb( PORT + IEE16_ECTRL, IEE16_RESET_586);

        /* read the eeprom and checksum it, should =3D=3D IEE16_ID */
        for(i=3D0 ; i< 0x40 ; i++)
                checksum +=3D ee16_read_eeprom(sc, i);

        if (checksum !=3D IEE16_ID)
                return 0;

        /*
         * Size and test the memory on the board.  The size of the =
memory
         * can be one of 16k, 32k, 48k or 64k.  It can be located in the
         * address range 0xC0000 to 0xEFFFF on 16k boundaries.
         *
         * If the size does not match the passed in memory allocation =
size
         * issue a warning, but continue with the minimum of the two =
sizes.
         */

        switch (ia->ia_msize) {
                case 65536:
                case 32768:
                case 16384:
                        break;
                case 49512:
                default:
                        printf("ieprobe mapped memory size out of =
range\n");
                        return 0;
                        break; /* NOTREACHED */
        }


I realize that a 32K buffer is better than 32K, but just getting the =
Intel EtherExpress 16 to work would have make me happier.  If there is =
some problem with using 16K buffers, it would be nice to at least inform =
the user, during auto-probe, to run the Intel EtherExpress 16 setup =
program and set the buffer size to 32K.  If a user doesn't have =
memory-mapping turned on, return a message informing the user to turn =
memory-mapping on.



        if ((ia->ia_maddr =3D=3D MADDRUNK) || (ia->ia_msize =3D=3D 0)) {
                i =3D (ee16_read_eeprom(sc, 6) & 0x00ff ) >> 3;
                switch(i) {
                        case 0x03: /* 32K buffer size */
                                ia->ia_maddr =3D 0xCC000;
                                ia->ia_msize =3D 0x8000;
                                break;
                        case 0x06: /* 32K buffer size */
                                ia->ia_maddr =3D 0xD0000;
                                ia->ia_msize =3D 0x8000;
                                break;
                        case 0x0c: /* 32K buffer size */
                                ia->ia_maddr =3D 0xD4000;
                                ia->ia_msize =3D 0x8000;
                                break;
                        case 0x18: /* 32K buffer size */
                                ia->ia_maddr =3D 0xD8000;
                                ia->ia_msize =3D 0x8000;
                                break;

                        case 0x01: /* 16K buffer size at 0xCC000*/
                        case 0x02: /* 16K buffer size at 0xD0000*/
                        case 0x04: /* 16K buffer size at 0xD4000*/
                        case 0x08: /* 16K buffer size at 0xD8000*/
                                printf("ie: In DOS, run the =
EtherExpress16 setup program, softset.exe");
                                printf("ie: Change Memory-Mapped Buffer =
to 32K.\n");=20
                                return 0 ;
                                break; /* 16K buffer size isn't current =
supported */
                        default:
                                printf("ie: An EtherExpress 16 was =
detected but memory-mapping is turned off.\n);
                                printf("ie: Run the Exp16 DOS setup =
program softset.exe to correct this error.\n");
                                printf("ie: Be sure to set the =
Memory-Mapped Buffering to 32 Kbytes.\n");
                                return 0 ;
                                break; /* NOTREACHED */
                }
        }