Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
DISCONTINUED:openSUSE:11.1:Update
kvm
kvm-qemu-rtl8139-link.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File kvm-qemu-rtl8139-link.patch of Package kvm
# Fix the Link detection in MacOS # Author Alex Graf - agraf@suse Index: qemu-kvm-0.10.5/hw/rtl8139.c =================================================================== --- qemu-kvm-0.10.5.orig/hw/rtl8139.c +++ qemu-kvm-0.10.5/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 */ @@ -462,6 +465,7 @@ typedef struct RTL8139State { uint16_t CpCmd; uint8_t TxThresh; + enum NICLink link; PCIDevice *pci_dev; VLANClientState *vc; @@ -1229,7 +1233,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; @@ -1255,6 +1259,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); } @@ -2852,7 +2863,7 @@ static uint32_t rtl8139_io_readb(void *o break; case MediaStatus: - ret = 0xd0; + ret = 0xd0 | ((s->link == Link_10mbps) << 3); DEBUG_PRINT(("RTL8139: MediaStatus read 0x%x\n", ret)); break; @@ -3480,6 +3491,15 @@ PCIDevice *pci_rtl8139_init(PCIBus *bus, s->pci_dev = (PCIDevice *)d; memcpy(s->macaddr, nd->macaddr, 6); + switch(nd->link) { + case Link_10mbps: + case Link_100mbps: + s->link = nd->link; + break; + default: + s->link = Link_100mbps; + break; + } rtl8139_reset(s); s->vc = qemu_new_vlan_client(nd->vlan, nd->model, nd->name, rtl8139_receive, rtl8139_can_receive, Index: qemu-kvm-0.10.5/net.h =================================================================== --- qemu-kvm-0.10.5.orig/net.h +++ qemu-kvm-0.10.5/net.h @@ -68,6 +68,13 @@ void tap_using_vnet_hdr(void *opaque, in #define MAX_NICS 8 +enum NICLink { + Link_default, + Link_10mbps, + Link_100mbps, + Link_1000mbps, +}; + struct NICInfo { uint8_t macaddr[6]; const char *model; @@ -75,6 +82,7 @@ struct NICInfo { VLANState *vlan; void *private; int used; + enum NICLink link; }; extern int nb_nics; Index: qemu-kvm-0.10.5/net.c =================================================================== --- qemu-kvm-0.10.5.orig/net.c +++ qemu-kvm-0.10.5/net.c @@ -1853,6 +1853,7 @@ int net_client_init(const char *device, } nd->vlan = vlan; nd->name = name; + nd->link = Link_default; nd->used = 1; name = NULL; nb_nics++; Index: qemu-kvm-0.10.5/hw/pc.c =================================================================== --- qemu-kvm-0.10.5.orig/hw/pc.c +++ qemu-kvm-0.10.5/hw/pc.c @@ -1101,7 +1101,10 @@ vga_bios_error: if (model == MODEL_ISA || (nd->model && strcmp(nd->model, "ne2k_isa") == 0)) pc_init_ne2k_isa(nd, i8259); - else + else if (model == MODEL_MAC) { + nd->link = Link_10mbps; + pci_nic_init(pci_bus, nd, -1, "rtl8139"); + } else pci_nic_init(pci_bus, nd, -1, "rtl8139"); }
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor