Subject: Re: AE memory size
To: Henry B. Hotz <hotz@jpl.nasa.gov>
From: Hauke Fath <hauke@Espresso.Rhein-Neckar.DE>
List: port-mac68k
Date: 09/24/2001 08:47:34
At 1:14 Uhr +0200 24.9.2001, Henry B. Hotz wrote:
>At 6:43 PM -0400 9/22/01, John Ruschmeyer wrote:
>>  > From: Hauke Fath <hauke@Espresso.Rhein-Neckar.DE>
>>>  Back then, Allen suspected problems with cards that have fragmented buf=
fer
>>>  memory. I have no such card, only some very old fullsize 3COM cards and=
 an
>>>  Asant=E9 card in my SE/30 which all have 16K and run fine with the patc=
h.
>>
>>One thing, the patch seems to omit the extra testing required if the card
>>has <64K but mirrors memory from unavailable banks.
>
>I'd have to think too much to be sure, but isn't that the reason why
>the code word is different for each size?

Yes, exactly. It's been a while since I wrapped my brain around this...

Looking around, I found an updated version of the patch in my local cvs
repository. This is from the trunk, updated last time in April or so -
there are a few more comments, and the sequence of setting the probe values
is reversed:

<snip from=3Dmac68k/dev/if_ae.c>

int
ae_size_card_memory(bst, bsh, ofs)
        bus_space_tag_t bst;
        bus_space_handle_t bsh;
        int ofs;
{
        int i1, i2, i3, i4, i8;

        /*
         * banks of 8K; also assume it will generally mirror
         * in upper banks if not installed.
         */
        i1 =3D (8192 * 0);
        i2 =3D (8192 * 1);
        i3 =3D (8192 * 2);
        i4 =3D (8192 * 3);
        i8 =3D (8192 * 4);

        /*
         * 1) If the memory range is decoded completely, it does not
         *    matter what we write first: High tags written into
         *    the void are lost.
         * 2) If the memory range is not decoded completely (banks are
         *    mirrored), high tags are overwritten by lower ones.
         * 3) Lazy implementation of pathological cases.
         */
        bus_space_write_2(bst, bsh, ofs + i8, 0x8888);
        bus_space_write_2(bst, bsh, ofs + i4, 0x4444);
        bus_space_write_2(bst, bsh, ofs + i3, 0x3333);
        bus_space_write_2(bst, bsh, ofs + i2, 0x2222);
        bus_space_write_2(bst, bsh, ofs + i1, 0x1111);

        /* Eight banks at 1-8 */
        if (bus_space_read_2(bst, bsh, ofs + i1) =3D=3D 0x1111 &&
            bus_space_read_2(bst, bsh, ofs + i2) =3D=3D 0x2222 &&
            bus_space_read_2(bst, bsh, ofs + i3) =3D=3D 0x3333 &&
            bus_space_read_2(bst, bsh, ofs + i4) =3D=3D 0x4444 &&
            bus_space_read_2(bst, bsh, ofs + i8) =3D=3D 0x8888)
                return 8192 * 8;

        /* Four banks at 1-4 */
        if (bus_space_read_2(bst, bsh, ofs + i1) =3D=3D 0x1111 &&
            bus_space_read_2(bst, bsh, ofs + i2) =3D=3D 0x2222 &&
            bus_space_read_2(bst, bsh, ofs + i3) =3D=3D 0x3333 &&
            bus_space_read_2(bst, bsh, ofs + i4) =3D=3D 0x4444)
                return 8192 * 4;

        /* Two banks either at 1&2 or at 3&4 (relevant?) */
        if ((bus_space_read_2(bst, bsh, ofs + i1) =3D=3D 0x1111 &&
            bus_space_read_2(bst, bsh, ofs + i2) =3D=3D 0x2222) ||
            (bus_space_read_2(bst, bsh, ofs + i1) =3D=3D 0x3333 &&
            bus_space_read_2(bst, bsh, ofs + i2) =3D=3D 0x4444))
                return 8192 * 2;

        /* One bank either at 1 or at 4 (relevant?) */
        if (bus_space_read_2(bst, bsh, ofs + i1) =3D=3D 0x1111 ||
            bus_space_read_2(bst, bsh, ofs + i1) =3D=3D 0x4444)
                return 8192;

        return 0;
}

</snip>

I think reversing the probes addresses the "mirrored memory" issues better.

Comments?

	hauke

--
"It's never straight up and down"     (DEVO)