All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2] hw/net/eepro100: Implement read-only bits in MDI registers
@ 2014-06-09 15:03 Peter Maydell
  2014-06-23 22:36 ` Peter Maydell
  2014-06-27 10:25 ` Stefan Hajnoczi
  0 siblings, 2 replies; 3+ messages in thread
From: Peter Maydell @ 2014-06-09 15:03 UTC (permalink / raw)
  To: qemu-devel; +Cc: Stefan Hajnoczi, patches

Although we defined an eepro100_mdi_mask[] array indicating which bits
in the registers are read-only, we weren't actually doing anything with
it. Make the MDI register-write code use it rather than manually making
register 1 read-only and leaving the rest as reads-as-written. (The
special-case handling of register 0 remains as before since its mask is
all-zeros and the special casing happens before we apply the masking.)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1402159924-13853-1-git-send-email-peter.maydell@linaro.org
---
No code change, but I fixed the errors in the commit message.

 hw/net/eepro100.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/net/eepro100.c b/hw/net/eepro100.c
index 3b891ca..9c70cce 100644
--- a/hw/net/eepro100.c
+++ b/hw/net/eepro100.c
@@ -1217,7 +1217,6 @@ static void eepro100_write_mdi(EEPRO100State *s)
                 break;
             case 1:            /* Status Register */
                 missing("not writable");
-                data = s->mdimem[reg];
                 break;
             case 2:            /* PHY Identification Register (Word 1) */
             case 3:            /* PHY Identification Register (Word 2) */
@@ -1230,7 +1229,8 @@ static void eepro100_write_mdi(EEPRO100State *s)
             default:
                 missing("not implemented");
             }
-            s->mdimem[reg] = data;
+            s->mdimem[reg] &= eepro100_mdi_mask[reg];
+            s->mdimem[reg] |= data & ~eepro100_mdi_mask[reg];
         } else if (opcode == 2) {
             /* MDI read */
             switch (reg) {
-- 
1.9.2

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH v2] hw/net/eepro100: Implement read-only bits in MDI registers
  2014-06-09 15:03 [Qemu-devel] [PATCH v2] hw/net/eepro100: Implement read-only bits in MDI registers Peter Maydell
@ 2014-06-23 22:36 ` Peter Maydell
  2014-06-27 10:25 ` Stefan Hajnoczi
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Maydell @ 2014-06-23 22:36 UTC (permalink / raw)
  To: QEMU Developers; +Cc: Stefan Hajnoczi, Patch Tracking

Ping! Stefan, you said you were going to take this via the net queue?

thanks
-- PMM

On 9 June 2014 16:03, Peter Maydell <peter.maydell@linaro.org> wrote:
> Although we defined an eepro100_mdi_mask[] array indicating which bits
> in the registers are read-only, we weren't actually doing anything with
> it. Make the MDI register-write code use it rather than manually making
> register 1 read-only and leaving the rest as reads-as-written. (The
> special-case handling of register 0 remains as before since its mask is
> all-zeros and the special casing happens before we apply the masking.)
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> Message-id: 1402159924-13853-1-git-send-email-peter.maydell@linaro.org
> ---
> No code change, but I fixed the errors in the commit message.
>
>  hw/net/eepro100.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/hw/net/eepro100.c b/hw/net/eepro100.c
> index 3b891ca..9c70cce 100644
> --- a/hw/net/eepro100.c
> +++ b/hw/net/eepro100.c
> @@ -1217,7 +1217,6 @@ static void eepro100_write_mdi(EEPRO100State *s)
>                  break;
>              case 1:            /* Status Register */
>                  missing("not writable");
> -                data = s->mdimem[reg];
>                  break;
>              case 2:            /* PHY Identification Register (Word 1) */
>              case 3:            /* PHY Identification Register (Word 2) */
> @@ -1230,7 +1229,8 @@ static void eepro100_write_mdi(EEPRO100State *s)
>              default:
>                  missing("not implemented");
>              }
> -            s->mdimem[reg] = data;
> +            s->mdimem[reg] &= eepro100_mdi_mask[reg];
> +            s->mdimem[reg] |= data & ~eepro100_mdi_mask[reg];
>          } else if (opcode == 2) {
>              /* MDI read */
>              switch (reg) {
> --
> 1.9.2

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH v2] hw/net/eepro100: Implement read-only bits in MDI registers
  2014-06-09 15:03 [Qemu-devel] [PATCH v2] hw/net/eepro100: Implement read-only bits in MDI registers Peter Maydell
  2014-06-23 22:36 ` Peter Maydell
@ 2014-06-27 10:25 ` Stefan Hajnoczi
  1 sibling, 0 replies; 3+ messages in thread
From: Stefan Hajnoczi @ 2014-06-27 10:25 UTC (permalink / raw)
  To: Peter Maydell; +Cc: qemu-devel, patches

[-- Attachment #1: Type: text/plain, Size: 895 bytes --]

On Mon, Jun 09, 2014 at 04:03:08PM +0100, Peter Maydell wrote:
> Although we defined an eepro100_mdi_mask[] array indicating which bits
> in the registers are read-only, we weren't actually doing anything with
> it. Make the MDI register-write code use it rather than manually making
> register 1 read-only and leaving the rest as reads-as-written. (The
> special-case handling of register 0 remains as before since its mask is
> all-zeros and the special casing happens before we apply the masking.)
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> Message-id: 1402159924-13853-1-git-send-email-peter.maydell@linaro.org
> ---
> No code change, but I fixed the errors in the commit message.
> 
>  hw/net/eepro100.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Thanks, applied to my net tree:
https://github.com/stefanha/qemu/commits/net

Stefan

[-- Attachment #2: Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-06-27 10:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-09 15:03 [Qemu-devel] [PATCH v2] hw/net/eepro100: Implement read-only bits in MDI registers Peter Maydell
2014-06-23 22:36 ` Peter Maydell
2014-06-27 10:25 ` Stefan Hajnoczi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.