hw/net/opencores_eth: Trivial patches
cover hw/net/opencores_eth: Trivial patches
Remove unnecessary mask, use #define instead of magic.
Philippe Mathieu-Daudé (2):
hw/net/opencores_eth: Use definitions instead of magic values hw/net/opencores_eth: Remove unnecessary address masking
hw/net/opencores_eth.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
Signature · 1 line
2.21.3
PATCH 1/2 hw/net/opencores_eth: Use definitions instead of magic values
Use definitions from "hw/net/mii.h".
This also helps when using git-grep.
--- hw/net/opencores_eth.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
hw/net/opencores_eth.c +2 -2
@@ -86,8 +86,8 @@ static void mii_reset(Mii *s) s->regs[MII_BMSR ] =MII_BMSR_100TX_FD |MII_BMSR_100TX_HD |MII_BMSR_10T_FD |MII_BMSR_10T_HD |MII_BMSR_MFPS |MII_BMSR_AN_COMP |MII_BMSR_AUTONEG ; - s->regs[MII_PHYID1 ] =0x2000 ; - s->regs[MII_PHYID2 ] =0x5c90 ; + s->regs[MII_PHYID1 ] =DP83848_PHYID1 ; + s->regs[MII_PHYID2 ] =DP83848_PHYID2 ; s->regs[MII_ANAR ] =MII_ANAR_TXFD |MII_ANAR_TX |MII_ANAR_10FD |MII_ANAR_10 |MII_ANAR_CSMACD ;mii_set_link (s, s->link_ok);
Signature · 1 line
2.21.3
Re: [PATCH 1/2] hw/net/opencores_eth: Use definitions instead of magic values
Quoted 8 lines · Philippe Mathieu-Daudé
Use definitions from "
hw/net/mii.h".
This also helps when using git-grep.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/net/opencores_eth.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Signature · 2 lines
Thanks. -- Max
PATCH 2/2 hw/net/opencores_eth: Remove unnecessary address masking
In reply to Philippe Mathieu-DaudéThe memory region is limited to 1 KiB, so the address is garantied to be in that range. No need to mask.
711 static const MemoryRegionOps open_eth_desc_ops = {
712 .read = open_eth_desc_read,
713 .write = open_eth_desc_write,
714 };
...
725 memory_region_init_io(&s->desc_io, OBJECT(dev),
725 &open_eth_desc_ops, s,
726 "open_eth.desc", 0x400);
--- hw/net/opencores_eth.c | 2 -- 1 file changed, 2 deletions(-)
hw/net/opencores_eth.c +0 -2
@@ -687,7 +687,6 @@ static uint64_t open_eth_desc_read(void *opaque,OpenEthState *s = opaque;uint64_t v =0 ; - addr &=0x3ff ;memcpy (&v, (uint8_t *)s->desc + addr, size);trace_open_eth_desc_read ((uint32_t )addr, (uint32_t )v);return v;
@@ -698,7 +697,6 @@ static void open_eth_desc_write(void *opaque, {OpenEthState *s = opaque; - addr &=0x3ff ;trace_open_eth_desc_write ((uint32_t )addr, (uint32_t )val);memcpy ((uint8_t *)s->desc + addr, &val, size);open_eth_check_start_xmit (s);
Signature · 1 line
2.21.3
Re: [PATCH 2/2] hw/net/opencores_eth: Remove unnecessary address masking
Quoted 13 lines · Philippe Mathieu-Daudé
The memory region is limited to 1 KiB, so the address is garantied to be in that range. No need to mask.
711 static const MemoryRegionOps
open_eth_desc_ops= {
712 .read =open_eth_desc_read,
713 .write =open_eth_desc_write,
714 };
...
725 memory_region_init_io(&s->desc_io, OBJECT(dev),
725&open_eth_desc_ops, s,
726 "open_eth.desc",0x400);
Quoted 4 lines
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/net/opencores_eth.c | 2 -- 1 file changed, 2 deletions(-)
Signature · 2 lines
Thanks. -- Max
Quoted 9 lines · Philippe Mathieu-Daudé
Remove unnecessary mask, use #define instead of magic.
Philippe Mathieu-Daudé (2):
hw/net/opencores_eth: Use definitions instead of magic values hw/net/opencores_eth: Remove unnecessary address maskinghw/net/opencores_eth.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
Ping to Jason as the series is reviewed :)
Quoted 7 lines · Philippe Mathieu-Daudé
Quoted 6 lines · Philippe Mathieu-Daudé
Remove unnecessary mask, use #define instead of magic.
Philippe Mathieu-Daudé (2):
hw/net/opencores_eth: Use definitions instead of magic values hw/net/opencores_eth: Remove unnecessary address masking
Quoted 5 lines
Quoted 3 lines
hw/net/opencores_eth.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)Ping to Jason as the series is reviewed :)
Ping^2
Jason Wang
AppliedQuoted 8 lines · Philippe Mathieu-Daudé
Quoted 7 lines · Philippe Mathieu-Daudé
Quoted 6 lines · Philippe Mathieu-Daudé
Remove unnecessary mask, use #define instead of magic.
Philippe Mathieu-Daudé (2):
hw/net/opencores_eth: Use definitions instead of magic values hw/net/opencores_eth: Remove unnecessary address masking
Quoted 6 lines
Quoted 4 lines
Quoted 3 lines
hw/net/opencores_eth.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)Ping to Jason as the series is reviewed :)
Ping^2
Applied.
Thanks