On Sat, 5 Oct 2024 at 21:57, Bernhard Beschow <shen...@gmail.com> wrote: > > A very similar implementation of the same device exists in imx_fec. Prepare > for > a common implementation by extracting the code into its own files. > > Signed-off-by: Bernhard Beschow <shen...@gmail.com> > --- > include/hw/net/lan9118_phy.h | 31 ++++++++ > hw/net/lan9118.c | 133 ++++++----------------------------- > hw/net/lan9118_phy.c | 117 ++++++++++++++++++++++++++++++ > hw/net/Kconfig | 4 ++ > hw/net/meson.build | 1 + > 5 files changed, 174 insertions(+), 112 deletions(-) > create mode 100644 include/hw/net/lan9118_phy.h > create mode 100644 hw/net/lan9118_phy.c > > diff --git a/include/hw/net/lan9118_phy.h b/include/hw/net/lan9118_phy.h > new file mode 100644 > index 0000000000..50e3559b12 > --- /dev/null > +++ b/include/hw/net/lan9118_phy.h > @@ -0,0 +1,31 @@ > +/* > + * SMSC LAN9118 PHY emulation > + * > + * Copyright (c) 2009 CodeSourcery, LLC. > + * Written by Paul Brook > + * > + * This work is licensed under the terms of the GNU GPL, version 2 or later. > + * See the COPYING file in the top-level directory. > + */ > + > +#ifndef HW_NET_LAN9118_PHY_H > +#define HW_NET_LAN9118_PHY_H > + > +#include "hw/irq.h" > + > +typedef struct Lan9118PhyState { > + uint32_t status; > + uint32_t control; > + uint32_t advertise; > + uint32_t ints; > + uint32_t int_mask; > + IRQState irq; > + bool link_down; > +} Lan9118PhyState;
This takes state that was in a QOM object, and moves it into something that's kind of a device but not a QOM object. I think we should avoid that, because at some point somebody's going to have to QOMify this. Making this a QOM device is a bit awkward for migration compatibility, unfortunately. thanks -- PMM