[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC PATCH v1 1/2] e1000: clean up set_phy_ctrl functio
From: |
Gabriel L. Somlo |
Subject: |
Re: [Qemu-devel] [RFC PATCH v1 1/2] e1000: clean up set_phy_ctrl function |
Date: |
Mon, 30 Jun 2014 15:35:36 -0400 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
Sorry for the repeated self-replies, I appear to be thinking in very
small increments today :)
On Mon, Jun 30, 2014 at 03:29:57PM -0400, Gabriel L. Somlo wrote:
> > > Weird.
> > > So does this mean have_autoneg is always false then?
> > > How does it work?
>
> Oh, I think I know what's going on now:
>
> In set_mdic() we have:
>
> ...
> } else {
> if (addr < NPHYWRITEOPS && phyreg_writeops[addr]) {
> phyreg_writeops[addr](s, index, data);
> }
> s->phy_reg[addr] = data;
> }
> ...
Of course, we could change this to
...
} else {
if (addr < NPHYWRITEOPS && phyreg_writeops[addr]) {
phyreg_writeops[addr](s, index, data);
} else {
s->phy_reg[addr] = data;
}
}
and have phy_set_ctrl() be a proper write_op, expected to actually
write the data as well as do other things. That would at least be a
step toward the principle of least WTF, IMHO :)
I'll send out an updated patch shortly...
Thanks,
--Gabriel
> ...
>
> Basically, phyreg_writeops[PHY_CTRL] == set_phy_ctrl() is the only
> one that applies, but it's like a "pre-write" writeop, the write
> happens *after* the write_op completes :) :) Fun stuff...
>
> Leaving it as-is is probably OK, although it does indeed not handle
> SC bits properly.
>
> I could rewrite have_autoneg() to accept the *value* of the phy control
> register, then we can use it from set_phy_ctrl() before the register
> is actually written. Not sure about whether that would be more or less
> ugly than the current form :)
>
> Thanks,
> --Gabriel
[Qemu-devel] [RFC PATCH v1 2/2] e1000: adjust initial autoneg timing (for piix/osx), Gabriel L. Somlo, 2014/06/30