Skip to contentSkip to conversation

net: tulip: Set PCI revision to match dec21143

PATCH In review Marek Vasut 3 participants 6 messages Apr 18, 2020 – Jun 10, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: tulip: Set PCI revision to match dec21143

The tulip driver claims to emulate dec21143 and it does not emulate dec21142. The dec21142 and dec21143 can be discerned by the PCI revision register, where dec21142 reports value < 0x20 and dec21143 value >= 0x20. E.g. the U-Boot 'tulip' driver also only supports dec21143 and verifies that the PCI revision ID is >= 0x20, otherwise refuses to operate such a card.

This patch sets the PCI revision ID to 0x20 to match the dec21143 and thus also permits e.g. U-Boot to work with the tulip emulation.

Fixes 34ea023d4b95 ("net: add tulip (dec21143) driver")
Cc Marc-André Lureau <[email protected]>
Cc Paolo Bonzini <[email protected]>
Cc Peter Maydell <[email protected]>
Cc Prasad J Pandit <[email protected]>
Cc Sven Schnelle <[email protected]>
---
 hw/net/tulip.c | 2 ++
 1 file changed, 2 insertions(+)
hw/net/tulip.c +2 -0
index 1295f51d07..ffb6c2479a 100644
@@ -962,6 +962,8 @@ static void pci_tulip_realize(PCIDevice *pci_dev, Error **errp)
 
     pci_conf = s->dev.config;
     pci_conf[PCI_INTERRUPT_PIN] = 1; /* interrupt pin A */
+    /* Anything with revision < 0x20 is DC21142, anything >= 0x20 is DC21143 */
+    pci_conf[PCI_REVISION_ID] = 0x20;
 
     s->eeprom = eeprom93xx_new(&pci_dev->qdev, 64);
     tulip_fill_eeprom(s);
Signature · 1 line
2.25.1
#1 lore raw
Quoted 9 lines · Marek Vasut

The tulip driver claims to emulate dec21143 and it does not emulate dec21142. The dec21142 and dec21143 can be discerned by the PCI revision register, where dec21142 reports value < 0x20 and dec21143 value >= 0x20. E.g. the U-Boot 'tulip' driver also only supports dec21143 and verifies that the PCI revision ID is >= 0x20, otherwise refuses to operate such a card.

This patch sets the PCI revision ID to 0x20 to match the dec21143 and thus also permits e.g. U-Boot to work with the tulip emulation.

Quoted 7 lines
Fixes 34ea023d4b95 ("net: add tulip (dec21143) driver")
Cc Marc-André Lureau <[email protected]>
Cc Paolo Bonzini <[email protected]>
Cc Peter Maydell <[email protected]>
Cc Prasad J Pandit <[email protected]>
Cc Sven Schnelle <[email protected]>

Bump, any news on this ? This is a bugfix.

#2 lore raw
In reply to Marek Vasut

Hi Sven, could you review thiw one-line patch?

Quoted 34 lines · Marek Vasut

The tulip driver claims to emulate dec21143 and it does not emulate dec21142. The dec21142 and dec21143 can be discerned by the PCI revision register, where dec21142 reports value < 0x20 and dec21143 value >= 0x20. E.g. the U-Boot 'tulip' driver also only supports dec21143 and verifies that the PCI revision ID is >= 0x20, otherwise refuses to operate such a card.

This patch sets the PCI revision ID to 0x20 to match the dec21143 and thus also permits e.g. U-Boot to work with the tulip emulation.

Fixes 34ea023d4b95 ("net: add tulip (dec21143) driver")
Cc Marc-André Lureau <[email protected]>
Cc Paolo Bonzini <[email protected]>
Cc Peter Maydell <[email protected]>
Cc Prasad J Pandit <[email protected]>
Cc Sven Schnelle <[email protected]>
---
 hw/net/tulip.c | 2 ++
 1 file changed, 2 insertions(+)
hw/net/tulip.c +2 -0
index 1295f51d07..ffb6c2479a 100644
@@ -962,6 +962,8 @@ static void pci_tulip_realize(PCIDevice *pci_dev, Error **errp)
 
     pci_conf = s->dev.config;
     pci_conf[PCI_INTERRUPT_PIN] = 1; /* interrupt pin A */
+    /* Anything with revision < 0x20 is DC21142, anything >= 0x20 is DC21143 */
+    pci_conf[PCI_REVISION_ID] = 0x20;
 
     s->eeprom = eeprom93xx_new(&pci_dev->qdev, 64);
     tulip_fill_eeprom(s);
#3 lore raw
Quoted 29 lines · Philippe Mathieu-Daudé

Hi Sven, could you review thiw one-line patch?

Quoted 26 lines · Marek Vasut

The tulip driver claims to emulate dec21143 and it does not emulate dec21142. The dec21142 and dec21143 can be discerned by the PCI revision register, where dec21142 reports value < 0x20 and dec21143 value >= 0x20. E.g. the U-Boot 'tulip' driver also only supports dec21143 and verifies that the PCI revision ID is >= 0x20, otherwise refuses to operate such a card.

This patch sets the PCI revision ID to 0x20 to match the dec21143 and thus also permits e.g. U-Boot to work with the tulip emulation.

Fixes 34ea023d4b95 ("net: add tulip (dec21143) driver")
Cc Marc-André Lureau <[email protected]>
Cc Paolo Bonzini <[email protected]>
Cc Peter Maydell <[email protected]>
Cc Prasad J Pandit <[email protected]>
Cc Sven Schnelle <[email protected]>
---
 hw/net/tulip.c | 2 ++
 1 file changed, 2 insertions(+)
hw/net/tulip.c +0 -0
index 1295f51d07..ffb6c2479a 100644
@@ -962,6 +962,8 @@ static void pci_tulip_realize(PCIDevice *pci_dev, Error **errp)
 
Quoted 9 lines

hw/net/tulip.c static void pci_tulip_realize(PCIDevice *pci_dev, Error **errp) · line 969

Quoted 8 lines
hw/net/tulip.c +2 -0
     pci_conf = s->dev.config;
     pci_conf[PCI_INTERRUPT_PIN] = 1; /* interrupt pin A */
+    /* Anything with revision < 0x20 is DC21142, anything >= 0x20 is DC21143 */
+    pci_conf[PCI_REVISION_ID] = 0x20;
 
     s->eeprom = eeprom93xx_new(&pci_dev->qdev, 64);
     tulip_fill_eeprom(s);

The intel datasheet for the DEC21143 lists only Rev IDs > 30 for this particular family:

21143-PB,TB,PC,TC - 0x30
21143-PD,TD - x041

but maybe older DEC chips used 0x20 - don't know. The most interesting question is whether ancient OS' like HP-UX or Windows XP would still work with this patch, but i don't have test images at hand right now.

Regards
Sven

#4 lore raw
Quoted 40 lines · Sven Schnelle
Quoted 29 lines · Philippe Mathieu-Daudé

Hi Sven, could you review thiw one-line patch?

Quoted 26 lines · Marek Vasut

The tulip driver claims to emulate dec21143 and it does not emulate dec21142. The dec21142 and dec21143 can be discerned by the PCI revision register, where dec21142 reports value < 0x20 and dec21143 value >= 0x20. E.g. the U-Boot 'tulip' driver also only supports dec21143 and verifies that the PCI revision ID is >= 0x20, otherwise refuses to operate such a card.

This patch sets the PCI revision ID to 0x20 to match the dec21143 and thus also permits e.g. U-Boot to work with the tulip emulation.

Fixes 34ea023d4b95 ("net: add tulip (dec21143) driver")
Cc Marc-André Lureau <[email protected]>
Cc Paolo Bonzini <[email protected]>
Cc Peter Maydell <[email protected]>
Cc Prasad J Pandit <[email protected]>
Cc Sven Schnelle <[email protected]>
---
 hw/net/tulip.c | 2 ++
 1 file changed, 2 insertions(+)
hw/net/tulip.c +0 -0
index 1295f51d07..ffb6c2479a 100644
@@ -962,6 +962,8 @@ static void pci_tulip_realize(PCIDevice *pci_dev, Error **errp)
 
Quoted 9 lines

hw/net/tulip.c static void pci_tulip_realize(PCIDevice *pci_dev, Error **errp) · line 969

Quoted 8 lines
hw/net/tulip.c +2 -0
     pci_conf = s->dev.config;
     pci_conf[PCI_INTERRUPT_PIN] = 1; /* interrupt pin A */
+    /* Anything with revision < 0x20 is DC21142, anything >= 0x20 is DC21143 */
+    pci_conf[PCI_REVISION_ID] = 0x20;
 
     s->eeprom = eeprom93xx_new(&pci_dev->qdev, 64);
     tulip_fill_eeprom(s);
Quoted 8 lines

The intel datasheet for the DEC21143 lists only Rev IDs > 30 for this particular family:

21143-PB,TB,PC,TC - 0x30
21143-PD,TD - x041

but maybe older DEC chips used 0x20 - don't know. The most interesting question is whether ancient OS' like HP-UX or Windows XP would still work with this patch, but i don't have test images at hand right now.

So the question is whether your HP-UX/WinXP images also boot with a DEC21142 (you aimed to model a DEC21143, and it is tested anyway).

Marek, suggestion:

Make pci_tulip_realize() abstract, add dec21142 and dec21143 models as you suggested, making 'tulip' an alias of dec21142 for backward compatibility. You can then use the dec21143.

#5 lore raw
Quoted 50 lines · Philippe Mathieu-Daudé
Quoted 40 lines · Sven Schnelle
Quoted 29 lines · Philippe Mathieu-Daudé

Hi Sven, could you review thiw one-line patch?

Quoted 26 lines · Marek Vasut

The tulip driver claims to emulate dec21143 and it does not emulate dec21142. The dec21142 and dec21143 can be discerned by the PCI revision register, where dec21142 reports value < 0x20 and dec21143 value >= 0x20. E.g. the U-Boot 'tulip' driver also only supports dec21143 and verifies that the PCI revision ID is >= 0x20, otherwise refuses to operate such a card.

This patch sets the PCI revision ID to 0x20 to match the dec21143 and thus also permits e.g. U-Boot to work with the tulip emulation.

Fixes 34ea023d4b95 ("net: add tulip (dec21143) driver")
Cc Marc-André Lureau <[email protected]>
Cc Paolo Bonzini <[email protected]>
Cc Peter Maydell <[email protected]>
Cc Prasad J Pandit <[email protected]>
Cc Sven Schnelle <[email protected]>
---
 hw/net/tulip.c | 2 ++
 1 file changed, 2 insertions(+)
hw/net/tulip.c +0 -0
index 1295f51d07..ffb6c2479a 100644
@@ -962,6 +962,8 @@ static void pci_tulip_realize(PCIDevice *pci_dev, Error **errp)
 
Quoted 9 lines

hw/net/tulip.c static void pci_tulip_realize(PCIDevice *pci_dev, Error **errp) · line 969

Quoted 8 lines
hw/net/tulip.c +2 -0
     pci_conf = s->dev.config;
     pci_conf[PCI_INTERRUPT_PIN] = 1; /* interrupt pin A */
+    /* Anything with revision < 0x20 is DC21142, anything >= 0x20 is DC21143 */
+    pci_conf[PCI_REVISION_ID] = 0x20;
 
     s->eeprom = eeprom93xx_new(&pci_dev->qdev, 64);
     tulip_fill_eeprom(s);
Quoted 8 lines

The intel datasheet for the DEC21143 lists only Rev IDs > 30 for this particular family:

21143-PB,TB,PC,TC - 0x30
21143-PD,TD - x041

but maybe older DEC chips used 0x20 - don't know. The most interesting question is whether ancient OS' like HP-UX or Windows XP would still work with this patch, but i don't have test images at hand right now.

Quoted 8 lines

So the question is whether your HP-UX/WinXP images also boot with a DEC21142 (you aimed to model a DEC21143, and it is tested anyway).

Marek, suggestion:

Make pci_tulip_realize() abstract, add dec21142 and dec21143 models as you suggested, making 'tulip' an alias of dec21142 for backward compatibility. You can then use the dec21143.

I don't have any way to test dec21142 , I only have dec21143 support in U-Boot. U-Boot actually checks for this revision field and does not work with dec21142 , so these older models must be somehow incompatible. Hence, if we model only the dec21143 anyway, we should set that revision ID to model it fully.