Message ID | 20180928135003.8650-3-clg@kaod.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | net: convert SysBus init method to a realize method | expand |
On 28 September 2018 at 14:49, Cédric Le Goater <clg@kaod.org> wrote: > Cc: Edgar E. Iglesias <edgar.iglesias@gmail.com> > Signed-off-by: Cédric Le Goater <clg@kaod.org> > --- > hw/net/etraxfs_eth.c | 10 ++++++++-- > 1 file changed, 8 insertions(+), 2 deletions(-) > > diff --git a/hw/net/etraxfs_eth.c b/hw/net/etraxfs_eth.c > index 64ab3df1ae38..552a18c7c730 100644 > --- a/hw/net/etraxfs_eth.c > +++ b/hw/net/etraxfs_eth.c > @@ -585,6 +585,13 @@ static NetClientInfo net_etraxfs_info = { > .link_status_changed = eth_set_link, > }; > > +static void etraxfs_eth_reset(DeviceState *dev) > +{ > + ETRAXFSEthState *s = ETRAX_FS_ETH(dev); > + > + tdk_init(&s->phy); > +} > + > static void etraxfs_eth_realize(DeviceState *dev, Error **errp) > { > SysBusDevice *sbd = SYS_BUS_DEVICE(dev); > @@ -609,8 +616,6 @@ static void etraxfs_eth_realize(DeviceState *dev, Error **errp) > object_get_typename(OBJECT(s)), dev->id, s); > qemu_format_nic_info_str(qemu_get_queue(s->nic), s->conf.macaddr.a); > > - > - tdk_init(&s->phy); > mdio_attach(&s->mdio_bus, &s->phy, s->phyaddr); > } > > @@ -627,6 +632,7 @@ static void etraxfs_eth_class_init(ObjectClass *klass, void *data) > DeviceClass *dc = DEVICE_CLASS(klass); > > dc->realize = etraxfs_eth_realize; > + dc->reset = etraxfs_eth_reset; > dc->props = etraxfs_eth_properties; > /* Reason: pointer properties "dma_out", "dma_in" */ > dc->user_creatable = false; This device definitely needs a reset method, but I'm pretty sure that we need to do more than just call tdk_init(). eth->regs[] needs to be reset, and very likely other state too. thanks -- PMM
On 9/28/18 4:47 PM, Peter Maydell wrote: > On 28 September 2018 at 14:49, Cédric Le Goater <clg@kaod.org> wrote: >> Cc: Edgar E. Iglesias <edgar.iglesias@gmail.com> >> Signed-off-by: Cédric Le Goater <clg@kaod.org> >> --- >> hw/net/etraxfs_eth.c | 10 ++++++++-- >> 1 file changed, 8 insertions(+), 2 deletions(-) >> >> diff --git a/hw/net/etraxfs_eth.c b/hw/net/etraxfs_eth.c >> index 64ab3df1ae38..552a18c7c730 100644 >> --- a/hw/net/etraxfs_eth.c >> +++ b/hw/net/etraxfs_eth.c >> @@ -585,6 +585,13 @@ static NetClientInfo net_etraxfs_info = { >> .link_status_changed = eth_set_link, >> }; >> >> +static void etraxfs_eth_reset(DeviceState *dev) >> +{ >> + ETRAXFSEthState *s = ETRAX_FS_ETH(dev); >> + >> + tdk_init(&s->phy); >> +} >> + >> static void etraxfs_eth_realize(DeviceState *dev, Error **errp) >> { >> SysBusDevice *sbd = SYS_BUS_DEVICE(dev); >> @@ -609,8 +616,6 @@ static void etraxfs_eth_realize(DeviceState *dev, Error **errp) >> object_get_typename(OBJECT(s)), dev->id, s); >> qemu_format_nic_info_str(qemu_get_queue(s->nic), s->conf.macaddr.a); >> >> - >> - tdk_init(&s->phy); >> mdio_attach(&s->mdio_bus, &s->phy, s->phyaddr); >> } >> >> @@ -627,6 +632,7 @@ static void etraxfs_eth_class_init(ObjectClass *klass, void *data) >> DeviceClass *dc = DEVICE_CLASS(klass); >> >> dc->realize = etraxfs_eth_realize; >> + dc->reset = etraxfs_eth_reset; >> dc->props = etraxfs_eth_properties; >> /* Reason: pointer properties "dma_out", "dma_in" */ >> dc->user_creatable = false; > > This device definitely needs a reset method, but I'm pretty sure > that we need to do more than just call tdk_init(). eth->regs[] > needs to be reset, and very likely other state too. Yes. That was a start with obvious calls from the former init routine. Thanks, C. > > thanks > -- PMM >
diff --git a/hw/net/etraxfs_eth.c b/hw/net/etraxfs_eth.c index 64ab3df1ae38..552a18c7c730 100644 --- a/hw/net/etraxfs_eth.c +++ b/hw/net/etraxfs_eth.c @@ -585,6 +585,13 @@ static NetClientInfo net_etraxfs_info = { .link_status_changed = eth_set_link, }; +static void etraxfs_eth_reset(DeviceState *dev) +{ + ETRAXFSEthState *s = ETRAX_FS_ETH(dev); + + tdk_init(&s->phy); +} + static void etraxfs_eth_realize(DeviceState *dev, Error **errp) { SysBusDevice *sbd = SYS_BUS_DEVICE(dev); @@ -609,8 +616,6 @@ static void etraxfs_eth_realize(DeviceState *dev, Error **errp) object_get_typename(OBJECT(s)), dev->id, s); qemu_format_nic_info_str(qemu_get_queue(s->nic), s->conf.macaddr.a); - - tdk_init(&s->phy); mdio_attach(&s->mdio_bus, &s->phy, s->phyaddr); } @@ -627,6 +632,7 @@ static void etraxfs_eth_class_init(ObjectClass *klass, void *data) DeviceClass *dc = DEVICE_CLASS(klass); dc->realize = etraxfs_eth_realize; + dc->reset = etraxfs_eth_reset; dc->props = etraxfs_eth_properties; /* Reason: pointer properties "dma_out", "dma_in" */ dc->user_creatable = false;
Cc: Edgar E. Iglesias <edgar.iglesias@gmail.com> Signed-off-by: Cédric Le Goater <clg@kaod.org> --- hw/net/etraxfs_eth.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)