File qemu-rtl8139.patch of Package kvm

# Attempt to fix the Link detection in MacOS (not complete yet)
# Author Alex Graf - agraf@suse
Index: qemu/hw/rtl8139.c
===================================================================
--- qemu.orig/hw/rtl8139.c
+++ qemu/hw/rtl8139.c
@@ -422,6 +422,9 @@ static void RTL8139TallyCounters_load(QE
 /* Saves values of tally counters to VM state file */
 static void RTL8139TallyCounters_save(QEMUFile* f, RTL8139TallyCounters *tally_counters);
 
+static uint32_t rtl8139_io_readb(void *opaque, uint8_t addr);
+static uint32_t rtl8139_io_readw(void *opaque, uint8_t addr);
+
 typedef struct RTL8139State {
     uint8_t phys[8]; /* mac address */
     uint8_t mult[8]; /* multicast mask array */
@@ -1189,6 +1192,7 @@ static void rtl8139_reset(RTL8139State *
     s->eeprom.contents[2] = 0x8139;
 #endif
 
+
     s->eeprom.contents[7] = s->macaddr[0] | s->macaddr[1] << 8;
     s->eeprom.contents[8] = s->macaddr[2] | s->macaddr[3] << 8;
     s->eeprom.contents[9] = s->macaddr[4] | s->macaddr[5] << 8;
@@ -1227,7 +1231,7 @@ static void rtl8139_reset(RTL8139State *
     s->Config0 = 0x0; /* No boot ROM */
     s->Config1 = 0xC; /* IO mapped and MEM mapped registers available */
     s->Config3 = 0x1; /* fast back-to-back compatible */
-    s->Config5 = 0x0;
+    s->Config5 = Cfg5_LDPS;
 
     s->CSCR = CSCR_F_LINK_100 | CSCR_HEART_BIT | CSCR_LD;
 
@@ -1251,6 +1255,13 @@ static void rtl8139_reset(RTL8139State *
     s->TimerInt = 0;
     s->TCTR_base = 0;
 
+    s->eeprom.contents[10] = s->Config0 | s->Config1 << 8;
+    s->eeprom.contents[6] = (rtl8139_io_readb(s, MediaStatus) & 0xc0) | ((rtl8139_io_readw(s, BasicModeCtrl) >> 8) & 0x23)
+                          | (s->Config3 << 8);
+    s->eeprom.contents[12] = s->Config4 << 8;
+
+    s->eeprom.contents[15] = s->Config5 << 8;
+
     /* reset tally counters */
     RTL8139TallyCounters_clear(&s->tally_counters);
 }
openSUSE Build Service is sponsored by