diff options
| author | Peter Maydell <peter.maydell@linaro.org> | 2016-06-27 15:46:32 +0100 |
|---|---|---|
| committer | Peter Maydell <peter.maydell@linaro.org> | 2016-06-27 15:46:33 +0100 |
| commit | f12103afaa28b473515ccfcb66c2b42d6d057af0 (patch) | |
| tree | 1d00454103726adb3afd3404545f26fcfb39894d /hw/net/cadence_gem.c | |
| parent | aa8151b7df6b1c521b46583badfec504715018c5 (diff) | |
| parent | 3830c7a460b8252dc975f8115fdaed8c562d2d75 (diff) | |
| download | focaccia-qemu-f12103afaa28b473515ccfcb66c2b42d6d057af0.tar.gz focaccia-qemu-f12103afaa28b473515ccfcb66c2b42d6d057af0.zip | |
Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20160627' into staging
target-arm queue: * arm_gicv3: add missing 'break' statements * cadence_uart: protect against transmit errors * cadence_gem: avoid infinite loops with misconfigured buffer * cadence_gem: set the 'last' bit when 'wrap' is set * reenable tmp105 test case * palmetto-bmc: add ASPEED system control unit model * m25p80: add new 512Mbit and 1Gbit devices # gpg: Signature made Mon 27 Jun 2016 15:43:42 BST # gpg: using RSA key 0x3C2525ED14360CDE # gpg: Good signature from "Peter Maydell <peter.maydell@linaro.org>" # gpg: aka "Peter Maydell <pmaydell@gmail.com>" # gpg: aka "Peter Maydell <pmaydell@chiark.greenend.org.uk>" # Primary key fingerprint: E1A5 C593 CD41 9DE2 8E83 15CF 3C25 25ED 1436 0CDE * remotes/pmaydell/tags/pull-target-arm-20160627: m25p80: Fix WINBOND fast read command handling m25p80: New flash devices. m25p80: Fast read commands family changes. m25p80: Introduce configuration registers. m25p80: Introduce quad and equad modes. m25p80: Add additional flash commands: m25p80: Introduce COLLECTING_VAR_LEN_DATA state. m25p80: Allow more than four banks. m25p80: Make a table for JEDEC ID. m25p80: Replace JEDEC ID masking with function. palmetto-bmc: Configure the SCU's hardware strapping register ast2400: Integrate the SCU model and set silicon revision hw/misc: Add a model for the ASPEED System Control Unit arm: Re-enable tmp105 test cadence_gem: Set the last bit when wrap is set cadence_gem: Avoid infinite loops with a misconfigured buffer cadence_uart: Protect against transmit errors hw/intc/arm_gicv3: Add missing break Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/net/cadence_gem.c')
| -rw-r--r-- | hw/net/cadence_gem.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/hw/net/cadence_gem.c b/hw/net/cadence_gem.c index 0346f3e335..8a4be1e667 100644 --- a/hw/net/cadence_gem.c +++ b/hw/net/cadence_gem.c @@ -274,6 +274,11 @@ static inline unsigned tx_desc_get_last(unsigned *desc) return (desc[1] & DESC_1_TX_LAST) ? 1 : 0; } +static inline void tx_desc_set_last(unsigned *desc) +{ + desc[1] |= DESC_1_TX_LAST; +} + static inline unsigned tx_desc_get_length(unsigned *desc) { return desc[1] & DESC_1_LENGTH; @@ -664,6 +669,13 @@ static ssize_t gem_receive(NetClientState *nc, const uint8_t *buf, size_t size) GEM_DMACFG_RBUFSZ_S) * GEM_DMACFG_RBUFSZ_MUL; bytes_to_copy = size; + /* Hardware allows a zero value here but warns against it. To avoid QEMU + * indefinite loops we enforce a minimum value here + */ + if (rxbufsize < GEM_DMACFG_RBUFSZ_MUL) { + rxbufsize = GEM_DMACFG_RBUFSZ_MUL; + } + /* Pad to minimum length. Assume FCS field is stripped, logic * below will increment it to the real minimum of 64 when * not FCS stripping @@ -932,6 +944,7 @@ static void gem_transmit(CadenceGEMState *s) /* read next descriptor */ if (tx_desc_get_wrap(desc)) { + tx_desc_set_last(desc); packet_desc_addr = s->regs[GEM_TXQBASE]; } else { packet_desc_addr += 8; |