Add npcm7xx emc model
PATCH v5 1/3 hw/net: Add npcm7xx emc model
In reply to Doug Evans viaThis is a 10/100 ethernet device that has several features. Only the ones needed by the Linux driver have been implemented. See npcm7xx_emc.c for a list of unimplemented features.
---
Differences from v4:
- no change
Differences from v3:
- no change
Differences from v2:
- move call to qemu_set_irq
- remove use of C99 mixed decls/statements
- add use of g_autofree
hw/net/meson.build | 1 + hw/net/npcm7xx_emc.c | 857 +++++++++++++++++++++++++++++++++++ hw/net/trace-events | 17 + include/hw/net/npcm7xx_emc.h | 286 ++++++++++++ 4 files changed, 1161 insertions(+) create mode 100644 hw/net/npcm7xx_emc.c create mode 100644 include/hw/net/npcm7xx_emc.h
hw/net/meson.build +1 -0
@@ -35,6 +35,7 @@ softmmu_ss.add(when: 'CONFIG_I82596_COMMON', if_true: files('i82596.c')) softmmu_ss.add(when: 'CONFIG_SUNHME', if_true: files('sunhme.c')) softmmu_ss.add(when: 'CONFIG_FTGMAC100', if_true: files('ftgmac100.c')) softmmu_ss.add(when: 'CONFIG_SUNGEM', if_true: files('sungem.c')) +softmmu_ss.add(when: 'CONFIG_NPCM7XX', if_true: files('npcm7xx_emc.c')) softmmu_ss.add(when: 'CONFIG_ETRAXFS', if_true: files('etraxfs_eth.c')) softmmu_ss.add(when: 'CONFIG_COLDFIRE', if_true: files('mcf_fec.c'))
hw/net/npcm7xx_emc.c new file +857 -0
857 lines not on this page · raw message
hw/net/trace-events +17 -0
@@ -429,3 +429,20 @@ imx_fec_receive_last(int last) "rx frame flags 0x%04x" imx_enet_receive(size_t size) "len %zu" imx_enet_receive_len(uint64_t addr, int len) "rx_bd 0x%"PRIx64" length %d" imx_enet_receive_last(int last) "rx frame flags 0x%04x" + +# npcm7xx_emc.c +npcm7xx_emc_reset(int emc_num) "Resetting emc%d" +npcm7xx_emc_update_tx_irq(int level) "Setting tx irq to %d" +npcm7xx_emc_update_rx_irq(int level) "Setting rx irq to %d" +npcm7xx_emc_set_mista(uint32_t flags) "ORing 0x%x into MISTA" +npcm7xx_emc_cpu_owned_desc(uint32_t addr) "Can't process cpu-owned descriptor @0x%x" +npcm7xx_emc_sent_packet(uint32_t len) "Sent %u byte packet" +npcm7xx_emc_tx_done(uint32_t ctxdsa) "TX done, CTXDSA=0x%x" +npcm7xx_emc_can_receive(int can_receive) "Can receive: %d" +npcm7xx_emc_packet_filtered_out(const char* fail_reason) "Packet filtered out: %s" +npcm7xx_emc_packet_dropped(uint32_t len) "%u byte packet dropped" +npcm7xx_emc_receiving_packet(uint32_t len) "Receiving %u byte packet" +npcm7xx_emc_received_packet(uint32_t len) "Received %u byte packet" +npcm7xx_emc_rx_done(uint32_t crxdsa) "RX done, CRXDSA=0x%x" +npcm7xx_emc_reg_read(int emc_num, uint32_t result, const char *name, int regno) "emc%d: 0x%x = reg[%s/%d]" +npcm7xx_emc_reg_write(int emc_num, const char *name, int regno, uint32_t value) "emc%d: reg[%s/%d] = 0x%x"
include/hw/net/npcm7xx_emc.h new file +286 -0
286 lines not on this page · raw message
Signature · 1 line
2.30.0.617.g56c4b15f3c-goog
PATCH v5 3/3 tests/qtests: Add npcm7xx emc model test
In reply to Doug Evans via---
Differences from v4:
- handle --disable-slirp
Differences from v3:
- handle big endian hosts, tested on sparc64
Differences from v2:
- remove use of C99 mixed decls/statements
tests/qtest/meson.build | 3 +- tests/qtest/npcm7xx_emc-test.c | 862 +++++++++++++++++++++++++++++++++ 2 files changed, 864 insertions(+), 1 deletion(-) create mode 100644 tests/qtest/npcm7xx_emc-test.c
tests/qtest/meson.build +2 -1
@@ -141,7 +141,8 @@ qtests_npcm7xx = \ 'npcm7xx_rng-test', 'npcm7xx_smbus-test', 'npcm7xx_timer-test', - 'npcm7xx_watchdog_timer-test'] + 'npcm7xx_watchdog_timer-test'] + \ + (slirp.found() ? ['npcm7xx_emc-test'] : []) qtests_arm = \ (config_all_devices.has_key('CONFIG_CMSDK_APB_DUALTIMER') ? ['cmsdk-apb-dualtimer-test'] : []) + \ (config_all_devices.has_key('CONFIG_CMSDK_APB_TIMER') ? ['cmsdk-apb-timer-test'] : []) + \
tests/qtest/npcm7xx_emc-test.c new file +862 -0
862 lines not on this page · raw message
Signature · 1 line
2.30.0.617.g56c4b15f3c-goog
PATCH v5 2/3 hw/arm: Add npcm7xx emc model
In reply to Doug Evans viaThis is a 10/100 ethernet device that has several features. Only the ones needed by the Linux driver have been implemented. See npcm7xx_emc.c for a list of unimplemented features.
---
Differences from v4:
- no change
Differences from v3:
- no change
Differences from v2:
- none, patch ok as is
docs/system/arm/nuvoton.rst | 3 ++- hw/arm/npcm7xx.c | 50 +++++++++++++++++++++++++++++++++++-- include/hw/arm/npcm7xx.h | 2 ++ 3 files changed, 52 insertions(+), 3 deletions(-)
docs/system/arm/nuvoton.rst +2 -1
@@ -44,6 +44,7 @@ Supported devices * Analog to Digital Converter (ADC) * Pulse Width Modulation (PWM) * SMBus controller (SMBF) + * Ethernet controller (EMC) Missing devices ---------------
@@ -57,7 +58,7 @@ Missing devices * Shared memory (SHM) * eSPI slave interface - * Ethernet controllers (GMAC and EMC) + * Ethernet controller (GMAC) * USB device (USBD) * Peripheral SPI controller (PSPI) * SD/MMC host
hw/arm/npcm7xx.c +48 -2
86 lines not on this page · raw message
include/hw/arm/npcm7xx.h +2 -0
@@ -26,6 +26,7 @@#include "hw/misc/npcm7xx_gcr.h" #include "hw/misc/npcm7xx_pwm.h" #include "hw/misc/npcm7xx_rng.h" +#include "hw/net/npcm7xx_emc.h" #include "hw/nvram/npcm7xx_otp.h" #include "hw/timer/npcm7xx_timer.h" #include "hw/ssi/npcm7xx_fiu.h"
@@ -90,6 +91,7 @@ typedef struct NPCM7xxState {EHCISysBusState ehci;OHCISysBusState ohci;NPCM7xxFIUState fiu[2 ]; +NPCM7xxEMCState emc[2 ]; } NPCM7xxState;#define TYPE_NPCM7XX "npcm7xx"
Signature · 1 line
2.30.0.617.g56c4b15f3c-goog
v5 cover Add npcm7xx emc model
This is a 10/100 ethernet device that has several features. Only the ones needed by the Linux driver have been implemented. See npcm7xx_emc.c for a list of unimplemented features.
Doug Evans (3):
hw/net: Add npcm7xx emc model
hw/arm: Add npcm7xx emc model
tests/qtests: Add npcm7xx emc model test
docs/system/arm/nuvoton.rst | 3 +- hw/arm/npcm7xx.c | 50 +- hw/net/meson.build | 1 + hw/net/npcm7xx_emc.c | 857 ++++++++++++++++++++++++++++++++ hw/net/trace-events | 17 + include/hw/arm/npcm7xx.h | 2 + include/hw/net/npcm7xx_emc.h | 286 +++++++++++ tests/qtest/meson.build | 3 +- tests/qtest/npcm7xx_emc-test.c | 862 +++++++++++++++++++++++++++++++++ 9 files changed, 2077 insertions(+), 4 deletions(-) create mode 100644 hw/net/npcm7xx_emc.c create mode 100644 include/hw/net/npcm7xx_emc.h create mode 100644 tests/qtest/npcm7xx_emc-test.c
Signature · 36 lines
2.30.0.617.g56c4b15f3c-goog Differences from v4: 1/3 hw/net: Add npcm7xx emc model - no change 2/3 hw/arm: Add npcm7xx emc model - no change 3/3 tests/qtests: Add npcm7xx emc model test - handle --disable-slirp Differences from v3: 1/3 hw/net: Add npcm7xx emc model - no change 2/3 hw/arm: Add npcm7xx emc model - no change 3/3 tests/qtests: Add npcm7xx emc model test - handle big endian hosts, tested on sparc64 Differences from v2: 1/3 hw/net: Add npcm7xx emc model - move call to qemu_set_irq - remove use of C99 mixed decls/statements - add use of g_autofree 2/3 hw/arm: Add npcm7xx emc model - none, patch ok as is 3/3 tests/qtests: Add npcm7xx emc model test - remove use of C99 mixed decls/statements
Ping.
Quoted 61 lines · Doug Evans
This is a 10/100 ethernet device that has several features. Only the ones needed by the Linux driver have been implemented. See
npcm7xx_emc.cfor a list of unimplemented features.Doug Evans (3):
hw/net: Add npcm7xx emc model
hw/arm: Add npcm7xx emc model
tests/qtests: Add npcm7xx emc model testdocs/system/arm/nuvoton.rst | 3 +- hw/arm/npcm7xx.c | 50 +- hw/net/meson.build | 1 + hw/net/npcm7xx_emc.c | 857 ++++++++++++++++++++++++++++++++ hw/net/trace-events | 17 + include/hw/arm/npcm7xx.h | 2 + include/hw/net/npcm7xx_emc.h | 286 +++++++++++ tests/qtest/meson.build | 3 +- tests/qtest/npcm7xx_emc-test.c | 862 +++++++++++++++++++++++++++++++++ 9 files changed, 2077 insertions(+), 4 deletions(-) create mode 100644 hw/net/npcm7xx_emc.c create mode 100644 include/hw/net/npcm7xx_emc.h create mode 100644 tests/qtest/npcm7xx_emc-test.c--
2.30.0.617.g56c4b15f3c-googDifferences from v4:
1/3 hw/net: Add npcm7xx emc model
- no change2/3 hw/arm: Add npcm7xx emc model
- no change3/3 tests/qtests: Add npcm7xx emc model test
- handle --disable-slirpDifferences from v3:
1/3 hw/net: Add npcm7xx emc model
- no change2/3 hw/arm: Add npcm7xx emc model
- no change3/3 tests/qtests: Add npcm7xx emc model test
- handle big endian hosts, tested on sparc64Differences from v2:
1/3 hw/net: Add npcm7xx emc model
- move call toqemu_set_irq
- remove use of C99 mixed decls/statements
- add use ofg_autofree2/3 hw/arm: Add npcm7xx emc model
- none, patch ok as is3/3 tests/qtests: Add npcm7xx emc model test
- remove use of C99 mixed decls/statements
Peter Maydell
AppliedQuoted 9 lines · Doug Evans
This is a 10/100 ethernet device that has several features. Only the ones needed by the Linux driver have been implemented. See
npcm7xx_emc.cfor a list of unimplemented features.Doug Evans (3):
hw/net: Add npcm7xx emc model
hw/arm: Add npcm7xx emc model
tests/qtests: Add npcm7xx emc model test
Applied to target-arm.next, thanks.
-- PMM