Skip to contentSkip to conversation

net: add tulip (dec21143) driver

PATCH Applied Sven Schnelle 2 participants 2 messages Oct 23, 2019 – Oct 25, 2019

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 net: add tulip (dec21143) driver

This adds the basic functionality to emulate a Tulip NIC.

Implemented are:

- RX and TX functionality
- Perfect Frame Filtering
- Big/Little Endian descriptor support
- 93C46 EEPROM support
- LXT970 PHY

Not implemented, mostly because i had no OS using these functions:

- Imperfect frame filtering
- General Purpose Timer
- Transmit automatic polling
- Boot ROM support
- SIA interface
- Big/Little Endian data buffer conversion

Successfully tested with the following Operating Systems:

- MSDOS with Microsoft Network Client 3.0 and DEC ODI drivers
- HPPA Linux
- Windows XP
- HP-UX

Message-Id: <[email protected]>

---

Changes in v3:
- fix whitespace
- fix format string in read/write functions

Changes in v2:
- changed tulip_desc_{read,write} to take a struct descriptor * and no longer use a single pci DMA write, instead write one struct member at a time.
- fix _tulip_receive function name
- fix reset function and provide tulip_qdev_reset() for dc->reset.
- no longer write registers in the default case in tulip_write()
- set .impl.min_access_size and .impl.max_access_size

 MAINTAINERS              |    6 +
 hw/net/Kconfig           |    5 +
 hw/net/Makefile.objs     |    1 +
 hw/net/trace-events      |   14 +
 hw/net/tulip.c           | 1029 ++++++++++++++++++++++++++++++++++++++
 hw/net/tulip.h           |  267 ++++++++++
 include/hw/pci/pci_ids.h |    1 +
 7 files changed, 1323 insertions(+)
 create mode 100644 hw/net/tulip.c
 create mode 100644 hw/net/tulip.h
MAINTAINERS +6 -0
index 250ce8e7a1..a12031c389 100644
@@ -1638,6 +1638,12 @@ M: Stefan Weil <[email protected]>
 S: Maintained
 F: hw/net/eepro100.c
 
+tulip
+M: Sven Schnelle <[email protected]>
+S: Maintained
+F: hw/net/tulip.c
+F: hw/net/tulip.h
+
 Generic Loader
 M: Alistair Francis <[email protected]>
 S: Maintained
hw/net/Kconfig +5 -0
index 4ef86dc3a5..3856417d42 100644
@@ -24,6 +24,11 @@ config PCNET_PCI
 config PCNET_COMMON
     bool
 
+config TULIP
+    bool
+    default y if PCI_DEVICES
+    depends on PCI
+
 config E1000_PCI
     bool
     default y if PCI_DEVICES
hw/net/Makefile.objs +1 -0
index 9904273b06..7907d2c199 100644
@@ -13,6 +13,7 @@ common-obj-$(CONFIG_E1000E_PCI_EXPRESS) += e1000e.o e1000e_core.o e1000x_common.
 common-obj-$(CONFIG_RTL8139_PCI) += rtl8139.o
 common-obj-$(CONFIG_VMXNET3_PCI) += net_tx_pkt.o net_rx_pkt.o
 common-obj-$(CONFIG_VMXNET3_PCI) += vmxnet3.o
+common-obj-$(CONFIG_TULIP) += tulip.o
 
 common-obj-$(CONFIG_SMC91C111) += smc91c111.o
 common-obj-$(CONFIG_LAN9118) += lan9118.o
hw/net/trace-events +14 -0
index 58665655cc..e70f12bee1 100644
@@ -367,3 +367,17 @@ virtio_net_announce_notify(void) ""
 virtio_net_announce_timer(int round) "%d"
 virtio_net_handle_announce(int round) "%d"
 virtio_net_post_load_device(void)
+
+# tulip.c
+tulip_reg_write(uint64_t addr, const char *name, int size, uint64_t val) "addr 0x%02"PRIx64" (%s) size %d value 0x%08"PRIx64
+tulip_reg_read(uint64_t addr, const char *name, int size, uint64_t val) "addr 0x%02"PRIx64" (%s) size %d value 0x%08"PRIx64
+tulip_receive(const uint8_t *buf, size_t len) "buf %p size %zu"
+tulip_descriptor(const char *prefix, uint32_t addr, uint32_t status, uint32_t control, uint32_t len1, uint32_t len2, uint32_t buf1, uint32_t buf2) "%s 0x%08x: status 0x%08x control 0x%03x len1 %4d len2 %4d buf1 0x%08x buf2 0x%08x"
+tulip_rx_state(const char *state) "RX %s"
+tulip_tx_state(const char *state) "TX %s"
+tulip_irq(uint32_t mask, uint32_t en, const char *state) "mask 0x%08x ie 0x%08x %s"
+tulip_mii_write(int phy, int reg, uint16_t data) "phy 0x%x reg 0x%x data 0x%04x"
+tulip_mii_read(int phy, int reg, uint16_t data) "phy 0x%x, reg 0x%x data 0x%04x"
+tulip_reset(void) ""
+tulip_setup_frame(void) ""
+tulip_setup_filter(int n, uint8_t a, uint8_t b, uint8_t c, uint8_t d, uint8_t e, uint8_t f) "%d: %02x:%02x:%02x:%02x:%02x:%02x"
hw/net/tulip.c new file +1029 -0

1,029 lines not on this page · raw message

hw/net/tulip.h new file +267 -0

267 lines not on this page · raw message

include/hw/pci/pci_ids.h +1 -0
index 0abe27a53a..11f8ab7149 100644
@@ -164,6 +164,7 @@
 #define PCI_DEVICE_ID_LSI_SAS0079        0x0079
 
 #define PCI_VENDOR_ID_DEC                0x1011
+#define PCI_DEVICE_ID_DEC_21143          0x0019
 #define PCI_DEVICE_ID_DEC_21154          0x0026
 
 #define PCI_VENDOR_ID_CIRRUS             0x1013
Signature · 1 line
2.23.0
Applied
#1 lore raw

MAINTAINERS

Quoted 56 lines · Sven Schnelle

This adds the basic functionality to emulate a Tulip NIC.

Implemented are:

- RX and TX functionality
- Perfect Frame Filtering
- Big/Little Endian descriptor support
- 93C46 EEPROM support
- LXT970 PHY

Not implemented, mostly because i had no OS using these functions:

- Imperfect frame filtering
- General Purpose Timer
- Transmit automatic polling
- Boot ROM support
- SIA interface
- Big/Little Endian data buffer conversion

Successfully tested with the following Operating Systems:

- MSDOS with Microsoft Network Client 3.0 and DEC ODI drivers
- HPPA Linux
- Windows XP
- HP-UX

Message-Id:<[email protected]>

---

Changes in v3:
- fix whitespace
- fix format string in read/write functions

Changes in v2:
- changed tulip_desc_{read,write} to take a struct descriptor * and no longer use a single pci DMA write, instead write one struct member at a time.
- fix _tulip_receive function name
- fix reset function and provide tulip_qdev_reset() for dc->reset.
- no longer write registers in the default case in tulip_write()
- set .impl.min_access_size and .impl.max_access_size

  MAINTAINERS              |    6 +
  hw/net/Kconfig           |    5 +
  hw/net/Makefile.objs     |    1 +
  hw/net/trace-events      |   14 +
  hw/net/tulip.c           | 1029 ++++++++++++++++++++++++++++++++++++++
  hw/net/tulip.h           |  267 ++++++++++
  include/hw/pci/pci_ids.h |    1 +
  7 files changed, 1323 insertions(+)

create mode 100644 hw/net/tulip.c
create mode 100644 hw/net/tulip.h

MAINTAINERS +0 -0

Applied.

Thanks