Hi Martin, good afternoon. First of all, I want to thank your reply with the comments about the device driver. I answer you email next to you comments.
2015-11-09 11:30 GMT+01:00 Martin Pieuchot <[email protected]>: > Hello Guillermo, > > On 08/11/15(Sun) 17:06, Guillermo Bernaldo de Quiros Maraver wrote: > > Hi, good afternoon. > > > > I don't know if this is the correct list to post the next email so, I'm > > sorry if this isn't the correct place. > > > > My laptop computer wich is an MSI GE70 2QE has a network interface which > > currently it seems to be not supported by -current so I tried to port the > > device driver to OpenBSD based on the driver from FreeBSD which is > similar > > and now the network interface is working correctly. Next I paste some > > information about the hardware and the device driver: > > > > 1º Dmesg: > > alc0 at pci4 dev 0 function 0 "Attansic Technology E2200" rev 0x13: msi, > > address d8:cb:8a:84:db:cc > > atphy0 at alc0 phy 0: F1 10/100/1000 PHY, rev. 9 > > > > 2º Output of ifconfig alc0 > > alc0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500 > > lladdr d8:cb:8a:84:db:cc > > priority: 0 > > groups: egress > > media: Ethernet autoselect (1000baseT full-duplex,rxpause,txpause) > > status: active > > inet 192.168.1.7 netmask 0xffffff00 broadcast 192.168.1.255 > > 3º full dmesg in the attachment > > 4º cvs diff if_alc.c and cvs diff in the attachments. > > > > I don't know if you're interested to apply the diff's into base but I > think > > that could be a good idea. > > Some comments inline. > > > alc0: could not disable Rx/Tx MAC(0x40009e00)! > > Did you investigate what does that mean? > No, I didn't because I hadn't enough time to investigate this problem but I'll investigate as soon as I have free time. > > > Index: if_alc.c > > =================================================================== > > RCS file: /cvs/src/sys/dev/pci/if_alc.c,v > > retrieving revision 1.35 > > diff -u -p -r1.35 if_alc.c > > --- if_alc.c 25 Oct 2015 13:04:28 -0000 1.35 > > +++ if_alc.c 8 Nov 2015 16:02:09 -0000 > > @@ -120,7 +120,8 @@ const struct pci_matchid alc_devices[] = > > { PCI_VENDOR_ATTANSIC, PCI_PRODUCT_ATTANSIC_L1D }, > > { PCI_VENDOR_ATTANSIC, PCI_PRODUCT_ATTANSIC_L1D_1 }, > > { PCI_VENDOR_ATTANSIC, PCI_PRODUCT_ATTANSIC_L2C_1 }, > > - { PCI_VENDOR_ATTANSIC, PCI_PRODUCT_ATTANSIC_L2C_2 } > > + { PCI_VENDOR_ATTANSIC, PCI_PRODUCT_ATTANSIC_L2C_2 }, > > + { PCI_VENDOR_ATTANSIC, PCI_PRODUCT_ATTANSIC_E2200 } > > }; > > > > struct cfattach alc_ca = { > > @@ -525,6 +526,7 @@ alc_phy_down(struct alc_softc *sc) > > switch (sc->sc_product) { > > case PCI_PRODUCT_ATTANSIC_L1D: > > case PCI_PRODUCT_ATTANSIC_L1D_1: > > + case PCI_PRODUCT_ATTANSIC_E2200: > > /* > > * GPHY power down caused more problems on AR8151 v2.0. > > * When driver is reloaded after GPHY power down, > > @@ -783,10 +785,14 @@ alc_attach(struct device *parent, struct > > case PCI_PRODUCT_ATTANSIC_L1D_1: > > sc->alc_flags |= ALC_FLAG_APS; > > /* FALLTHROUGH */ > > + case PCI_PRODUCT_ATTANSIC_E2200: > > + sc->alc_flags |= ALC_FLAG_AR816X_FAMILY; > > + break; > > default: > > break; > > } > > - sc->alc_flags |= ALC_FLAG_ASPM_MON | ALC_FLAG_JUMBO; > > + //sc->alc_flags |= ALC_FLAG_ASPM_MON | ALC_FLAG_JUMBO; > > + sc->alc_flags |= ALC_FLAG_JUMBO; > > Why did you change this flag? This cannot be committed as-is if this is > really needed then you could add a conditional statement based on the > product ID. > Sorry I changed this flag because in the FreeBSD device driver this flag doesn't seems to exist. I'll fix this maybe tomorrow morning. > > > > @@ -797,6 +803,7 @@ alc_attach(struct device *parent, struct > > case PCI_PRODUCT_ATTANSIC_L1D_1: > > case PCI_PRODUCT_ATTANSIC_L2C_1: > > case PCI_PRODUCT_ATTANSIC_L2C_2: > > + case PCI_PRODUCT_ATTANSIC_E2200: > > sc->alc_max_framelen = 6 * 1024; > > break; > > } > > @@ -2035,7 +2042,9 @@ alc_reset(struct alc_softc *sc) > > printf("%s: master reset timeout!\n", sc->sc_dev.dv_xname); > > > > for (i = ALC_RESET_TIMEOUT; i > 0; i--) { > > - if ((reg = CSR_READ_4(sc, ALC_IDLE_STATUS)) == 0) > > + reg = CSR_READ_4(sc,ALC_IDLE_STATUS); > > + if ((reg & (IDLE_STATUS_RXMAC | IDLE_STATUS_TXMAC | > > + IDLE_STATUS_RXQ | IDLE_STATUS_TXQ)) == 0) > > Isn't this related to the message in your dmesg? > Maybe, I just tried to write the same code as the FreeBSD device driver source code. But in fact, if you omit this code, the network doesn't works. > > > break; > > DELAY(10); > > } > > @@ -2485,6 +2494,7 @@ alc_stop_queue(struct alc_softc *sc) > > reg &= ~TXQ_CFG_ENB; > > CSR_WRITE_4(sc, ALC_TXQ_CFG, reg); > > } > > + DELAY(40); > > for (i = ALC_TIMEOUT; i > 0; i--) { > > reg = CSR_READ_4(sc, ALC_IDLE_STATUS); > > if ((reg & (IDLE_STATUS_RXQ | IDLE_STATUS_TXQ)) == 0) > > > Index: if_alcreg.h > > =================================================================== > > RCS file: /cvs/src/sys/dev/pci/if_alcreg.h,v > > retrieving revision 1.5 > > diff -u -p -r1.5 if_alcreg.h > > --- if_alcreg.h 27 Nov 2014 14:52:04 -0000 1.5 > > +++ if_alcreg.h 8 Nov 2015 16:05:42 -0000 > > @@ -1164,6 +1164,7 @@ struct alc_softc { > > #define ALC_FLAG_L0S 0x0400 > > #define ALC_FLAG_L1S 0x0800 > > #define ALC_FLAG_APS 0x1000 > > +#define ALC_FLAG_AR816X_FAMILY 0x2000 > > Please use a tab here, to be coherent with the rest of the defines. > Sorry about this. I'll fix. > > > #define ALC_FLAG_DETACH 0x4000 > > #define ALC_FLAG_LINK 0x8000 > > > > Tomorrow, I have the whole day to investigate much more about the device driver so I'll tell you something tomorrow if I change the code. Anyway, I don't have any documentation, specification or datasheet about the device driver. I just have the source code of FreeBSD which I ported to OpenBSD so I'm sorry if I did something wrong. It wasn't my idea. Have a nice day, Guille
