[PATCH] hw/net/tulip: add chip status register values

Sven Schnelle posted 1 patch 2 years ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20240205194717.2056026-1-svens@stackframe.org
Maintainers: Sven Schnelle <svens@stackframe.org>, Jason Wang <jasowang@redhat.com>
hw/net/tulip.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[PATCH] hw/net/tulip: add chip status register values
Posted by Sven Schnelle 2 years ago
Netbsd isn't able to detect a link on the emulated tulip card. That's
because netbsd reads the Chip Status Register of the Phy (address
0x14). The default phy data in the qemu tulip driver is all zero,
which means no link is established and autonegotation isn't complete.

Therefore set the register to 0x3b40, which means:

Link is up, Autonegotation complete, Full Duplex, 100MBit/s Link
speed.

Also clear the mask because this register is read only.

Signed-off-by: Sven Schnelle <svens@stackframe.org>
---
 hw/net/tulip.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/net/tulip.c b/hw/net/tulip.c
index 6d4fb06dad..1f2ef20977 100644
--- a/hw/net/tulip.c
+++ b/hw/net/tulip.c
@@ -421,7 +421,7 @@ static uint16_t tulip_mdi_default[] = {
     /* MDI Registers 8 - 15 */
     0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
     /* MDI Registers 16 - 31 */
-    0x0003, 0x0000, 0x0001, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    0x0003, 0x0000, 0x0001, 0x0000, 0x3b40, 0x0000, 0x0000, 0x0000,
     0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
 };
 
@@ -429,7 +429,7 @@ static uint16_t tulip_mdi_default[] = {
 static const uint16_t tulip_mdi_mask[] = {
     0x0000, 0xffff, 0xffff, 0xffff, 0xc01f, 0xffff, 0xffff, 0x0000,
     0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-    0x0fff, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+    0x0fff, 0x0000, 0xffff, 0xffff, 0x0000, 0xffff, 0xffff, 0xffff,
     0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
 };
 
-- 
2.43.0
Re: [PATCH] hw/net/tulip: add chip status register values
Posted by Helge Deller 2 years ago
On 2/5/24 20:47, Sven Schnelle wrote:
> Netbsd isn't able to detect a link on the emulated tulip card. That's
> because netbsd reads the Chip Status Register of the Phy (address
> 0x14). The default phy data in the qemu tulip driver is all zero,
> which means no link is established and autonegotation isn't complete.
>
> Therefore set the register to 0x3b40, which means:
>
> Link is up, Autonegotation complete, Full Duplex, 100MBit/s Link
> speed.
>
> Also clear the mask because this register is read only.
>
> Signed-off-by: Sven Schnelle <svens@stackframe.org>

Reviewed-by: Helge Deller <deller@gmx.de>
Tested-by: Helge Deller <deller@gmx.de>

Can be easily tested without installation:
Download: wget https://cdn.netbsd.org/pub/NetBSD/NetBSD-9.3/iso/NetBSD-9.3-hppa.iso
Run: ./qemu-system-hppa -cdrom NetBSD-9.3-hppa.iso -nographic
-> a) Installation on English
-> e) Utility Menu
-> c) configure network

Helge

> ---
>   hw/net/tulip.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/hw/net/tulip.c b/hw/net/tulip.c
> index 6d4fb06dad..1f2ef20977 100644
> --- a/hw/net/tulip.c
> +++ b/hw/net/tulip.c
> @@ -421,7 +421,7 @@ static uint16_t tulip_mdi_default[] = {
>       /* MDI Registers 8 - 15 */
>       0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
>       /* MDI Registers 16 - 31 */
> -    0x0003, 0x0000, 0x0001, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
> +    0x0003, 0x0000, 0x0001, 0x0000, 0x3b40, 0x0000, 0x0000, 0x0000,
>       0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
>   };
>
> @@ -429,7 +429,7 @@ static uint16_t tulip_mdi_default[] = {
>   static const uint16_t tulip_mdi_mask[] = {
>       0x0000, 0xffff, 0xffff, 0xffff, 0xc01f, 0xffff, 0xffff, 0x0000,
>       0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
> -    0x0fff, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
> +    0x0fff, 0x0000, 0xffff, 0xffff, 0x0000, 0xffff, 0xffff, 0xffff,
>       0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
>   };
>
Re: [PATCH] hw/net/tulip: add chip status register values
Posted by Helge Deller 1 year, 12 months ago
On 2/6/24 23:33, Helge Deller wrote:
> On 2/5/24 20:47, Sven Schnelle wrote:
>> Netbsd isn't able to detect a link on the emulated tulip card. That's
>> because netbsd reads the Chip Status Register of the Phy (address
>> 0x14). The default phy data in the qemu tulip driver is all zero,
>> which means no link is established and autonegotation isn't complete.
>>
>> Therefore set the register to 0x3b40, which means:
>>
>> Link is up, Autonegotation complete, Full Duplex, 100MBit/s Link
>> speed.
>>
>> Also clear the mask because this register is read only.
>>
>> Signed-off-by: Sven Schnelle <svens@stackframe.org>
>
> Reviewed-by: Helge Deller <deller@gmx.de>
> Tested-by: Helge Deller <deller@gmx.de>

Unless someone complains, I'll include this patch
in the upcoming hppa pull request...

Helge
Re: [PATCH] hw/net/tulip: add chip status register values
Posted by Philippe Mathieu-Daudé 2 years ago
On 5/2/24 20:47, Sven Schnelle wrote:
> Netbsd isn't able to detect a link on the emulated tulip card. That's
> because netbsd reads the Chip Status Register of the Phy (address
> 0x14). The default phy data in the qemu tulip driver is all zero,
> which means no link is established and autonegotation isn't complete.
> 
> Therefore set the register to 0x3b40, which means:
> 
> Link is up, Autonegotation complete, Full Duplex, 100MBit/s Link
> speed.
> 
> Also clear the mask because this register is read only.
> 
> Signed-off-by: Sven Schnelle <svens@stackframe.org>
> ---
>   hw/net/tulip.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>