To the bug *1* (see below). The probe hangs in the NE*000 probe, 
thats the reason, why I wrote "...without NE2000 nic the probe hangs..."

But there are more bugs in the code:

Generally it is not a good idea to used signed char instead of unsigned
char for the physical ethernet address in the 'struct nic'.

In the CS89x0.c driver, for example, this leads to a problem, that the
network card was not able to receive frames, except for the broadcasts.

        /* set the ethernet address */
        for (i=0; i < ETHER_ADDR_SIZE/2; i++)
                writereg(PP_IA+i*2,
                         nic->node_addr[i*2] |
                         (nic->node_addr[i*2+1] << 8));

This code is used to setup the ethernet address in the cs89x0 nic.
As many of the single bytes are > 0x7f, they are interpreted as negative
values. This means, that the compiler converts the signed char into
a signed word, and fills up the higher bits with '1', if the byte was
negativ.

Example:
        Last two bytes are '9a' and 'c9'. The compiler / code does
        following:
                0x9a  ->  0xffffff9a
                0xc9  ->  0xffffffc9, which is shifted (see code above)
                      ->  0xffffc900.
        So if we do the OR operation
                      ->  0xffffff9a is the result instead of 0xffffc99a,
        whereby 0xc99a is written to the nic.

Exactly this happens on my CS89x0. I corrected the code in the following
        way:

        /* set the ethernet address */
        for (i=0; i < ETHER_ADDR_SIZE/2; i++)
                writereg(PP_IA+i*2,
                         ((unsigned char)nic->node_addr[i*2]) |
                         ((unsigned char)nic->node_addr[i*2+1] << 8));

But I think it is a better way to change the 'char' to 'unsigned char'
in the 'struct nic'.

Concerning the diskless grub operations:
        I had not enough time to send the diffs with the correct style
        and makefiles.

Friendly regards

        Christoph Plattner


OKUJI Yoshinori wrote:
> 
> From: Christoph Plattner <[EMAIL PROTECTED]>
> Subject: ** BUGs in netboot part **
> Date: Thu, 06 Apr 2000 10:56:46 +0200
> 
> > *1*   On a computer (JumpTec MOPS586) without NE2000 nic the
> >       probe hangs !
> 
>   Do you know which driver hangs?
> 
> > *2*   The CS8900 (soldered on the above mentioned board) driver
> >       part has incorrect macros:
> >
> >       In Makefile:                    INCLUDE_CS89X0
> >       In C source (config.c)          INCLUDE_CS89x0
> >                                                   ^-- ERROR
> >       No wonder, that the CS8900 nic was never probed !
> 
>   Thanks. I'll fix this when I update the network drivers.
> 
> Okuji

Reply via email to