>From cb12daa2f7ecbf041655825054a1661668ab7274 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Sat, 19 Sep 2009 19:05:07 +0200 Subject: [PATCH] eepro100: Add RNR interrupt Set RNR (receive unit not ready) interrupt for RU abort command. Signed-off-by: Stefan Weil --- hw/eepro100.c | 15 +++++++++++---- 1 files changed, 11 insertions(+), 4 deletions(-) diff --git a/hw/eepro100.c b/hw/eepro100.c index a8f6b3f..6d49bb8 100644 --- a/hw/eepro100.c +++ b/hw/eepro100.c @@ -114,7 +114,7 @@ #define RU_NOP 0x0000 #define RX_START 0x0001 #define RX_RESUME 0x0002 -#define RX_ABORT 0x0004 +#define RU_ABORT 0x0004 #define RX_ADDR_LOAD 0x0006 #define RX_RESUMENR 0x0007 #define INT_MASK 0x0100 @@ -363,13 +363,11 @@ static void eepro100_fr_interrupt(EEPRO100State * s) eepro100_interrupt(s, 0x40); } -#if 0 static void eepro100_rnr_interrupt(EEPRO100State * s) { /* RU is not ready. */ eepro100_interrupt(s, 0x10); } -#endif static void eepro100_mdi_interrupt(EEPRO100State * s) { @@ -865,6 +863,13 @@ static void eepro100_ru_command(EEPRO100State * s, uint8_t val) } set_ru_state(s, ru_ready); break; + case RU_ABORT: + /* RU abort. */ + if (get_ru_state(s) == ru_ready) { + eepro100_rnr_interrupt(s); + } + set_ru_state(s, ru_idle); + break; case RX_ADDR_LOAD: /* Load RU base. */ TRACE(OTHER, logout("val=0x%02x (RU base address)\n", val)); @@ -872,7 +877,7 @@ static void eepro100_ru_command(EEPRO100State * s, uint8_t val) break; default: logout("val=0x%02x (undefined RU command)\n", val); - missing("Undefined SU command"); + missing("Undefined RU command"); } } @@ -1531,6 +1536,8 @@ static ssize_t nic_receive(VLANClientState *vc, const uint8_t * buf, size_t size if (get_ru_state(s) != ru_ready) { /* No resources available. */ logout("no resources, state=%u\n", get_ru_state(s)); + /* TODO: RNR interrupt only at first failed frame? */ + eepro100_rnr_interrupt(s); s->statistics.rx_resource_errors++; //~ assert(!"no resources"); return -1; -- 1.5.6.5