Deleted Added
full compact
if_rl.c (213796) if_rl.c (213893)
1/*-
2 * Copyright (c) 1997, 1998
3 * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 17 unchanged lines hidden (view full) ---

26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
30 * THE POSSIBILITY OF SUCH DAMAGE.
31 */
32
33#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1997, 1998
3 * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 17 unchanged lines hidden (view full) ---

26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
30 * THE POSSIBILITY OF SUCH DAMAGE.
31 */
32
33#include <sys/cdefs.h>
34__FBSDID("$FreeBSD: head/sys/pci/if_rl.c 213796 2010-10-13 17:55:19Z yongari $");
34__FBSDID("$FreeBSD: head/sys/pci/if_rl.c 213893 2010-10-15 14:52:11Z marius $");
35
36/*
37 * RealTek 8129/8139 PCI NIC driver
38 *
39 * Supports several extremely cheap PCI 10/100 adapters based on
40 * the RealTek chipset. Datasheets can be obtained from
41 * www.realtek.com.tw.
42 *

--- 471 unchanged lines hidden (view full) ---

514 struct rl_softc *sc;
515 struct rl_mii_frame frame;
516 uint16_t rval = 0;
517 uint16_t rl8139_reg = 0;
518
519 sc = device_get_softc(dev);
520
521 if (sc->rl_type == RL_8139) {
35
36/*
37 * RealTek 8129/8139 PCI NIC driver
38 *
39 * Supports several extremely cheap PCI 10/100 adapters based on
40 * the RealTek chipset. Datasheets can be obtained from
41 * www.realtek.com.tw.
42 *

--- 471 unchanged lines hidden (view full) ---

514 struct rl_softc *sc;
515 struct rl_mii_frame frame;
516 uint16_t rval = 0;
517 uint16_t rl8139_reg = 0;
518
519 sc = device_get_softc(dev);
520
521 if (sc->rl_type == RL_8139) {
522 /* Pretend the internal PHY is only at address 0 */
523 if (phy) {
524 return (0);
525 }
526 switch (reg) {
527 case MII_BMCR:
528 rl8139_reg = RL_BMCR;
529 break;
530 case MII_BMSR:
531 rl8139_reg = RL_BMSR;
532 break;
533 case MII_ANAR:

--- 38 unchanged lines hidden (view full) ---

572{
573 struct rl_softc *sc;
574 struct rl_mii_frame frame;
575 uint16_t rl8139_reg = 0;
576
577 sc = device_get_softc(dev);
578
579 if (sc->rl_type == RL_8139) {
522 switch (reg) {
523 case MII_BMCR:
524 rl8139_reg = RL_BMCR;
525 break;
526 case MII_BMSR:
527 rl8139_reg = RL_BMSR;
528 break;
529 case MII_ANAR:

--- 38 unchanged lines hidden (view full) ---

568{
569 struct rl_softc *sc;
570 struct rl_mii_frame frame;
571 uint16_t rl8139_reg = 0;
572
573 sc = device_get_softc(dev);
574
575 if (sc->rl_type == RL_8139) {
580 /* Pretend the internal PHY is only at address 0 */
581 if (phy) {
582 return (0);
583 }
584 switch (reg) {
585 case MII_BMCR:
586 rl8139_reg = RL_BMCR;
587 break;
588 case MII_BMSR:
589 rl8139_reg = RL_BMSR;
590 break;
591 case MII_ANAR:

--- 187 unchanged lines hidden (view full) ---

779{
780 uint8_t eaddr[ETHER_ADDR_LEN];
781 uint16_t as[3];
782 struct ifnet *ifp;
783 struct rl_softc *sc;
784 struct rl_type *t;
785 struct sysctl_ctx_list *ctx;
786 struct sysctl_oid_list *children;
576 switch (reg) {
577 case MII_BMCR:
578 rl8139_reg = RL_BMCR;
579 break;
580 case MII_BMSR:
581 rl8139_reg = RL_BMSR;
582 break;
583 case MII_ANAR:

--- 187 unchanged lines hidden (view full) ---

771{
772 uint8_t eaddr[ETHER_ADDR_LEN];
773 uint16_t as[3];
774 struct ifnet *ifp;
775 struct rl_softc *sc;
776 struct rl_type *t;
777 struct sysctl_ctx_list *ctx;
778 struct sysctl_oid_list *children;
787 int error = 0, hwrev, i, pmc, rid;
779 int error = 0, hwrev, i, phy, pmc, rid;
788 int prefer_iomap, unit;
789 uint16_t rl_did = 0;
790 char tn[32];
791
792 sc = device_get_softc(dev);
793 unit = device_get_unit(dev);
794 sc->rl_dev = dev;
795

--- 123 unchanged lines hidden (view full) ---

919
920 ifp = sc->rl_ifp = if_alloc(IFT_ETHER);
921 if (ifp == NULL) {
922 device_printf(dev, "can not if_alloc()\n");
923 error = ENOSPC;
924 goto fail;
925 }
926
780 int prefer_iomap, unit;
781 uint16_t rl_did = 0;
782 char tn[32];
783
784 sc = device_get_softc(dev);
785 unit = device_get_unit(dev);
786 sc->rl_dev = dev;
787

--- 123 unchanged lines hidden (view full) ---

911
912 ifp = sc->rl_ifp = if_alloc(IFT_ETHER);
913 if (ifp == NULL) {
914 device_printf(dev, "can not if_alloc()\n");
915 error = ENOSPC;
916 goto fail;
917 }
918
919#define RL_PHYAD_INTERNAL 0
920
927 /* Do MII setup */
921 /* Do MII setup */
928 if (mii_phy_probe(dev, &sc->rl_miibus,
929 rl_ifmedia_upd, rl_ifmedia_sts)) {
930 device_printf(dev, "MII without any phy!\n");
931 error = ENXIO;
922 phy = MII_PHY_ANY;
923 if (sc->rl_type == RL_8139)
924 phy = RL_PHYAD_INTERNAL;
925 error = mii_attach(dev, &sc->rl_miibus, ifp, rl_ifmedia_upd,
926 rl_ifmedia_sts, BMSR_DEFCAPMASK, phy, MII_OFFSET_ANY, 0);
927 if (error != 0) {
928 device_printf(dev, "attaching PHYs failed\n");
932 goto fail;
933 }
934
935 ifp->if_softc = sc;
936 if_initname(ifp, device_get_name(dev), device_get_unit(dev));
937 ifp->if_mtu = ETHERMTU;
938 ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
939 ifp->if_ioctl = rl_ioctl;

--- 1318 unchanged lines hidden ---
929 goto fail;
930 }
931
932 ifp->if_softc = sc;
933 if_initname(ifp, device_get_name(dev), device_get_unit(dev));
934 ifp->if_mtu = ETHERMTU;
935 ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
936 ifp->if_ioctl = rl_ioctl;

--- 1318 unchanged lines hidden ---