From nobody@FreeBSD.org  Sat Mar 26 19:31:52 2005
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id B7A6916A4CE
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 26 Mar 2005 19:31:52 +0000 (GMT)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 8AC8243D4C
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 26 Mar 2005 19:31:52 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.13.1/8.13.1) with ESMTP id j2QJVqBu025023
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 26 Mar 2005 19:31:52 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id j2QJVquU025022;
	Sat, 26 Mar 2005 19:31:52 GMT
	(envelope-from nobody)
Message-Id: <200503261931.j2QJVquU025022@www.freebsd.org>
Date: Sat, 26 Mar 2005 19:31:52 GMT
From: Liudas <liudasb@centras.lt>
To: freebsd-gnats-submit@FreeBSD.org
Subject: Adaptec ANA-6922 not fully supported
X-Send-Pr-Version: www-2.3

>Number:         79262
>Category:       kern
>Synopsis:       [dc] Adaptec ANA-6922 not fully supported
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    yongari
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Mar 26 19:40:02 GMT 2005
>Closed-Date:    Mon Mar 28 00:36:40 UTC 2011
>Last-Modified:  Mon Mar 28 00:36:40 UTC 2011
>Originator:     Liudas
>Release:        FreeBSD 4.11
>Organization:
N/A
>Environment:
FreeBSD medeina.vdvm.lt 4.11-STABLE FreeBSD 4.11-STABLE #7: Sat Mar 26 20:38:00 EET 2005     adm@medeina.vdvm.lt:/usr/src/sys/compile/MEDEINA  i386
>Description:
With dc driver first port (dc0) works fine and second (dc1) port not.
dc1 have MAC address of FF:FF:FF:FF:FF:FF.
With de driver both ports works fine (both have correct MAC address),
but not at full speed (netperf shows about 70 KB/s, when with dc
driver first port - ~9.8 MB/s).

>How-To-Repeat:

>Fix:
      
>Release-Note:
>Audit-Trail:

From: "Liudas B." <liudasb@centras.lt>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/79262: [if_dc] Adaptec ANA-6922 not fully supported
Date: Thu, 26 May 2005 09:19:50 +0300

 Same problems with FreeBSD 5.4
 uname -a:
 
 FreeBSD ausrine.b15.vu.lt 5.4-RELEASE FreeBSD 5.4-RELEASE #3: Wed May 
 25 23:02:11 EEST 2005     adm@ausrine.vu.lt:/usr/src/sys/i386/compile/
 AUSRINE  i386
 
 dmesg output (kernel_options="-v"):
 
 ioapic0: intpin 7 polarity: high
 ioapic0: intpin 8 bus ISA
 ioapic0: intpin 8 trigger: edge
 ioapic0: intpin 8 polarity: high
 ioapic0: intpin 9 bus ISA
 ioapic0: intpin 9 trigger: level
 ioapic0: intpin 9 polarity: high
 ioapic0: intpin 10 bus ISA
 ioapic0: intpin 10 trigger: level
 ioapic0: intpin 10 polarity: high
 ioapic0: intpin 11 bus ISA
 ioapic0: intpin 11 trigger: level
 ioapic0: intpin 11 polarity: high
 ioapic0: intpin 12 bus ISA
 ioapic0: intpin 12 trigger: edge
 ioapic0: intpin 12 polarity: high
 ioapic0: intpin 13 bus ISA
 ioapic0: intpin 13 trigger: edge
 ioapic0: intpin 13 polarity: high
 ioapic0: intpin 14 bus ISA
 ioapic0: intpin 14 trigger: edge
 ioapic0: intpin 14 polarity: high
 ioapic0: intpin 15 bus ISA
 ioapic0: intpin 15 trigger: level
 ioapic0: intpin 15 polarity: high
 lapic: Routing ExtINT -> LINT0
 lapic: LINT0 trigger: edge
 lapic: LINT0 polarity: active-high
 lapic: Routing NMI -> LINT1
 lapic: LINT1 trigger: edge
 lapic: LINT1 polarity: active-high
 ioapic0 <Version 1.1> irqs 0-31 on motherboard
 cpu0 BSP:
      ID: 0x01000000   VER: 0x00040011 LDR: 0x02000000 DFR: 0x0fffffff
   lint0: 0x00010700 lint1: 0x00000400 TPR: 0x00000000 SVR: 0x000001ff
 null: <null device, zero device>
 io: <I/O>
 random: <entropy source, Software, Yarrow>
 mem: <memory>
 Pentium Pro MTRR support enabled
 npx0: [FAST]
 npx0: <math processor> on motherboard
 npx0: INT 16 interface
 cpu0 on motherboard
 cpu1 on motherboard
 pci_open(1):	mode 1 addr port (0x0cf8) is 0x80000058
 pci_open(1a):	mode1res=0x80000000 (0x80000000)
 pci_cfgcheck:	device 0 [class=060000] [hdr=00] is there 
 (id=71a08086)
 pcibios: BIOS version 2.10
 Found $PIR table, 15 entries at 0xc00fded0
 PCI-Only Interrupts: none
 Location  Bus Device Pin  Link  IRQs
 slot 7      1    0    A   0x6a  3 4 5 6 7 9 10 11 12 14 15
 slot 7      1    0    B   0x6b  3 4 5 6 7 9 10 11 12 14 15
 embedded    0    7    D   0x63  3 4 5 6 7 9 10 11 12 14 15
 embedded    0    4    A   0x69  3 4 5 6 7 9 10 11 12 14 15
 slot 1      0   12    A   0x60  3 4 5 6 7 9 10 11 12 14 15
 slot 1      0   12    B   0x61  3 4 5 6 7 9 10 11 12 14 15
 slot 1      0   12    C   0x62  3 4 5 6 7 9 10 11 12 14 15
 slot 1      0   12    D   0x63  3 4 5 6 7 9 10 11 12 14 15
 slot 2      0   13    A   0x61  3 4 5 6 7 9 10 11 12 14 15
 slot 2      0   13    B   0x62  3 4 5 6 7 9 10 11 12 14 15
 slot 2      0   13    C   0x63  3 4 5 6 7 9 10 11 12 14 15
 slot 2      0   13    D   0x60  3 4 5 6 7 9 10 11 12 14 15
 slot 3      0   14    A   0x62  3 4 5 6 7 9 10 11 12 14 15
 slot 3      0   14    B   0x63  3 4 5 6 7 9 10 11 12 14 15
 slot 3      0   14    C   0x60  3 4 5 6 7 9 10 11 12 14 15
 slot 3      0   14    D   0x61  3 4 5 6 7 9 10 11 12 14 15
 slot 4      2    8    A   0x64  3 4 5 6 7 9 10 11 12 14 15
 slot 4      2    8    B   0x65  3 4 5 6 7 9 10 11 12 14 15
 slot 4      2    8    C   0x66  3 4 5 6 7 9 10 11 12 14 15
 slot 4      2    8    D   0x67  3 4 5 6 7 9 10 11 12 14 15
 slot 5      2    9    A   0x65  3 4 5 6 7 9 10 11 12 14 15
 slot 5      2    9    B   0x66  3 4 5 6 7 9 10 11 12 14 15
 slot 5      2    9    C   0x67  3 4 5 6 7 9 10 11 12 14 15
 slot 5      2    9    D   0x64  3 4 5 6 7 9 10 11 12 14 15
 slot 6      2   10    A   0x66  3 4 5 6 7 9 10 11 12 14 15
 slot 6      2   10    B   0x67  3 4 5 6 7 9 10 11 12 14 15
 slot 6      2   10    C   0x64  3 4 5 6 7 9 10 11 12 14 15
 slot 6      2   10    D   0x65  3 4 5 6 7 9 10 11 12 14 15
 embedded    2    1    A   0x67  3 4 5 6 7 9 10 11 12 14 15
 pcib0: <Intel 82443GX host to PCI bridge> pcibus 0 on motherboard
 pir0: <PCI Interrupt Routing Table: 15 Entries> on motherboard
 $PIR: Links after initial probe:
 Link  IRQ  Rtd  Ref  IRQs
 0x6a  255   N     1  3 4 5 6 7 9 10 11 12 14 15
 0x6b  255   N     1  3 4 5 6 7 9 10 11 12 14 15
 0x63  255   N     4  3 4 5 6 7 9 10 11 12 14 15
 0x69  255   N     1  3 4 5 6 7 9 10 11 12 14 15
 0x60  255   N     3  3 4 5 6 7 9 10 11 12 14 15
 0x61  255   N     3  3 4 5 6 7 9 10 11 12 14 15
 0x62  255   N     3  3 4 5 6 7 9 10 11 12 14 15
 0x64  255   N     3  3 4 5 6 7 9 10 11 12 14 15
 0x65  255   N     3  3 4 5 6 7 9 10 11 12 14 15
 0x66  255   N     3  3 4 5 6 7 9 10 11 12 14 15
 0x67  255   N     4  3 4 5 6 7 9 10 11 12 14 15
 $PIR: Found matching pin for 0.7.INTD at func 2: 11
 $PIR: Found matching pin for 0.4.INTA at func 0: 9
 $PIR: Found matching pin for 2.9.INTA at func 0: 7
 $PIR: Found matching pin for 2.1.INTA at func 0: 10
 $PIR: Links after initial IRQ discovery:
 Link  IRQ  Rtd  Ref  IRQs
 0x6a  255   N     1  3 4 5 6 7 9 10 11 12 14 15
 0x6b  255   N     1  3 4 5 6 7 9 10 11 12 14 15
 0x63   11   Y     4  3 4 5 6 7 9 10 11 12 14 15
 0x69    9   Y     1  3 4 5 6 7 9 10 11 12 14 15
 0x60  255   N     3  3 4 5 6 7 9 10 11 12 14 15
 0x61  255   N     3  3 4 5 6 7 9 10 11 12 14 15
 0x62  255   N     3  3 4 5 6 7 9 10 11 12 14 15
 0x64  255   N     3  3 4 5 6 7 9 10 11 12 14 15
 0x65    7   Y     3  3 4 5 6 7 9 10 11 12 14 15
 0x66  255   N     3  3 4 5 6 7 9 10 11 12 14 15
 0x67   10   Y     4  3 4 5 6 7 9 10 11 12 14 15
 $PIR: IRQs used by BIOS: 7 9 10 11
 $PIR: Interrupt Weights:
 [    0   1   2   3   4   5   6   7   8   9  10  11  12  13  14  15 ]
 [    0   0   0   0   0   0   0   3   0   1   4   4   0   0   0   0 ]
 pci0: <PCI bus> on pcib0
 pci0: physical bus=0
 	map[10]: type 3, range 32, base f8000000, size 26, enabled
 found->	vendor=0x8086, dev=0x71a0, revid=0x00
 	bus=0, slot=0, func=0
 	class=06-00-00, hdrtype=0x00, mfdev=0
 	cmdreg=0x0146, statreg=0x2210, cachelnsz=0 (dwords)
 	lattimer=0x40 (1920 ns), mingnt=0x00 (0 ns), maxlat=0x00 (0 ns)
 found->	vendor=0x8086, dev=0x71a1, revid=0x00
 	bus=0, slot=1, func=0
 	class=06-04-00, hdrtype=0x01, mfdev=0
 	cmdreg=0x011f, statreg=0x0220, cachelnsz=0 (dwords)
 	lattimer=0x48 (2160 ns), mingnt=0x85 (33250 ns), maxlat=0x00 (0 
 ns)
 	map[10]: type 1, range 32, base fec00000, size 10, enabled
 found->	vendor=0x110a, dev=0x0015, revid=0x02
 	bus=0, slot=2, func=0
 	class=08-80-00, hdrtype=0x00, mfdev=0
 	cmdreg=0x0142, statreg=0x0280, cachelnsz=0 (dwords)
 	lattimer=0x00 (0 ns), mingnt=0x00 (0 ns), maxlat=0x00 (0 ns)
 found->	vendor=0x1011, dev=0x0024, revid=0x03
 	bus=0, slot=3, func=0
 	class=06-04-00, hdrtype=0x01, mfdev=0
 	cmdreg=0x0147, statreg=0x0290, cachelnsz=8 (dwords)
 	lattimer=0x60 (2880 ns), mingnt=0x0f (3750 ns), maxlat=0x03 (750 
 ns)
 	map[10]: type 1, range 32, base f4100000, size 12, enabled
 	map[14]: type 4, range 32, base 00001000, size  3, enabled
 	map[18]: type 1, range 32, base f4000000, size 20, enabled
 $PIR: 0:4 INTA routed to irq 9
 found->	vendor=0x110a, dev=0x001d, revid=0x01
 	bus=0, slot=4, func=0
 	class=ff-00-00, hdrtype=0x00, mfdev=0
 	cmdreg=0x0147, statreg=0x0200, cachelnsz=0 (dwords)
 	lattimer=0x40 (1920 ns), mingnt=0x00 (0 ns), maxlat=0x00 (0 ns)
 	intpin=a, irq=9
 found->	vendor=0x8086, dev=0x7110, revid=0x02
 	bus=0, slot=7, func=0
 	class=06-01-00, hdrtype=0x00, mfdev=1
 	cmdreg=0x010f, statreg=0x0280, cachelnsz=0 (dwords)
 	lattimer=0x00 (0 ns), mingnt=0x00 (0 ns), maxlat=0x00 (0 ns)
 	map[20]: type 4, range 32, base 00001800, size  4, port disabled
 found->	vendor=0x8086, dev=0x7111, revid=0x01
 	bus=0, slot=7, func=1
 	class=01-01-80, hdrtype=0x00, mfdev=0
 	cmdreg=0x0004, statreg=0x0280, cachelnsz=0 (dwords)
 	lattimer=0x40 (1920 ns), mingnt=0x00 (0 ns), maxlat=0x00 (0 ns)
 	map[20]: type 4, range 32, base 00001400, size  5, enabled
 $PIR: 0:7 INTD routed to irq 11
 found->	vendor=0x8086, dev=0x7112, revid=0x01
 	bus=0, slot=7, func=2
 	class=0c-03-00, hdrtype=0x00, mfdev=0
 	cmdreg=0x0005, statreg=0x0280, cachelnsz=0 (dwords)
 	lattimer=0x40 (1920 ns), mingnt=0x00 (0 ns), maxlat=0x00 (0 ns)
 	intpin=d, irq=11
 	map[90]: type 4, range 32, base 0000f0b0, size  4, enabled
 found->	vendor=0x8086, dev=0x7113, revid=0x02
 	bus=0, slot=7, func=3
 	class=06-80-00, hdrtype=0x00, mfdev=0
 	cmdreg=0x0003, statreg=0x0280, cachelnsz=0 (dwords)
 	lattimer=0x00 (0 ns), mingnt=0x00 (0 ns), maxlat=0x00 (0 ns)
 pcib1: <PCIBIOS PCI-PCI bridge> at device 1.0 on pci0
 pcib1:   secondary bus     1
 pcib1:   subordinate bus   1
 pcib1:   I/O decode        0xf000-0xfff
 pcib1:   memory decode     0xfff00000-0xfffff
 pcib1:   prefetched decode 0xfff00000-0xfffff
 pci1: <PCI bus> on pcib1
 pci1: physical bus=1
 pci0: <base peripheral> at device 2.0 (no driver attached)
 pcib2: <PCIBIOS PCI-PCI bridge> at device 3.0 on pci0
 pcib2:   secondary bus     2
 pcib2:   subordinate bus   3
 pcib2:   I/O decode        0x2000-0x3fff
 pcib2:   memory decode     0xf4200000-0xf44fffff
 pcib2:   prefetched decode 0xf4500000-0xf7ffffff
 pci2: <PCI bus> on pcib2
 pci2: physical bus=2
 	map[10]: type 3, range 32, base f6000000, size 25, enabled
 pcib2: device (null) requested decoded memory range 0xf6000000-
 0xf7ffffff
 	map[14]: type 1, range 32, base f4300000, size 12, enabled
 pcib2: device (null) requested decoded memory range 0xf4300000-
 0xf4300fff
 found->	vendor=0x1013, dev=0x00b8, revid=0x45
 	bus=2, slot=0, func=0
 	class=03-00-00, hdrtype=0x00, mfdev=0
 	cmdreg=0x0003, statreg=0x0200, cachelnsz=0 (dwords)
 	lattimer=0x00 (0 ns), mingnt=0x00 (0 ns), maxlat=0x00 (0 ns)
 	map[10]: type 4, range 32, base 00002000, size  8, enabled
 pcib2: device (null) requested decoded I/O range 0x2000-0x20ff
 	map[14]: type 1, range 32, base f4302000, size  8, enabled
 pcib2: device (null) requested decoded memory range 0xf4302000-
 0xf43020ff
 	map[18]: type 1, range 32, base f4301000, size 12, enabled
 pcib2: device (null) requested decoded memory range 0xf4301000-
 0xf4301fff
 $PIR: 2:1 INTA routed to irq 10
 found->	vendor=0x1000, dev=0x000c, revid=0x01
 	bus=2, slot=1, func=0
 	class=01-00-00, hdrtype=0x00, mfdev=0
 	cmdreg=0x0157, statreg=0x0200, cachelnsz=8 (dwords)
 	lattimer=0xf7 (7410 ns), mingnt=0x1e (7500 ns), maxlat=0x40 
 (16000 ns)
 	intpin=a, irq=10
 	map[10]: type 3, range 32, base f4500000, size 12, enabled
 pcib2: device (null) requested decoded memory range 0xf4500000-
 0xf4500fff
 	map[14]: type 4, range 32, base 00002400, size  5, enabled
 pcib2: device (null) requested decoded I/O range 0x2400-0x241f
 	map[18]: type 1, range 32, base f4200000, size 20, enabled
 pcib2: device (null) requested decoded memory range 0xf4200000-
 0xf42fffff
 $PIR: 2:9 INTA routed to irq 7
 found->	vendor=0x8086, dev=0x1229, revid=0x05
 	bus=2, slot=9, func=0
 	class=02-00-00, hdrtype=0x00, mfdev=0
 	cmdreg=0x0157, statreg=0x0290, cachelnsz=8 (dwords)
 	lattimer=0x42 (1980 ns), mingnt=0x08 (2000 ns), maxlat=0x38 
 (14000 ns)
 	intpin=a, irq=7
 	powerspec 1  supports D0 D1 D2 D3  current D0
 found->	vendor=0x1011, dev=0x0024, revid=0x03
 	bus=2, slot=10, func=0
 	class=06-04-00, hdrtype=0x01, mfdev=0
 	cmdreg=0x0147, statreg=0x0290, cachelnsz=8 (dwords)
 	lattimer=0x40 (1920 ns), mingnt=0x07 (1750 ns), maxlat=0x00 (0 
 ns)
 pci2: <display, VGA> at device 0.0 (no driver attached)
 sym0: <895> port 0x2000-0x20ff mem 0xf4301000-0xf4301fff,0xf4302000-
 0xf43020ff irq 10 at device 1.0 on pci2
 sym0: Reserved 0x100 bytes for rid 0x14 type 3 at 0xf4302000
 sym0: Reserved 0x1000 bytes for rid 0x18 type 3 at 0xf4301000
 sym0: Symbios NVRAM, ID 7, Fast-40, LVD, parity checking
 sym0: open drain IRQ line driver, using on-chip SRAM
 sym0: using LOAD/STORE-based firmware.
 sym0: initial SCNTL3/DMODE/DCNTL/CTEST3/4/5 = (hex) 07/4e/a0/01/00/24
 sym0: final   SCNTL3/DMODE/DCNTL/CTEST3/4/5 = (hex) 07/4e/80/01/08/24
 sym0: SCAN FOR LUNS disabled for targets 0 1 2.
 sym0: Delay (GEN=11): 233 msec, 38147 KHz
 sym0: Delay (GEN=11): 266 msec, 33414 KHz
 sym0: Delay (GEN=11): 265 msec, 33540 KHz
 sym0: [GIANT-LOCKED]
 sym0: enabling clock multiplier
 sym0: Downloading SCSI SCRIPTS.
 fxp0: <Intel 82558 Pro/100 Ethernet> port 0x2400-0x241f mem 
 0xf4200000-0xf42fffff,0xf4500000-0xf4500fff irq 7 at device 9.0 on 
 pci2
 fxp0: Reserved 0x1000 bytes for rid 0x10 type 3 at 0xf4500000
 fxp0: using memory space register mapping
 fxp0: PCI IDs: 8086 1229 0e11 b0d7 0005
 fxp0: Dynamic Standby mode is disabled
 miibus0: <MII bus> on fxp0
 inphy0: <i82555 10/100 media interface> on miibus0
 inphy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
 fxp0: bpf attached
 fxp0: Ethernet address: 00:50:8b:01:ad:97
 fxp0: [MPSAFE]
 pcib3: <PCI-PCI bridge> at device 10.0 on pci2
 pcib3:   secondary bus     3
 pcib3:   subordinate bus   3
 pcib3:   I/O decode        0x3000-0x3fff
 pcib3:   memory decode     0xf4400000-0xf44fffff
 pcib3:   prefetched decode 0xfff00000-0xfffff
 pci3: <PCI bus> on pcib3
 pci3: physical bus=3
 	map[10]: type 4, range 32, base 00003000, size  7, enabled
 pcib3: device (null) requested decoded I/O range 0x3000-0x307f
 pcib2: device (null) requested decoded I/O range 0x3000-0x307f
 	map[14]: type 1, range 32, base f4400000, size 10, enabled
 pcib3: device (null) requested decoded memory range 0xf4400000-
 0xf44003ff
 pcib2: device (null) requested decoded memory range 0xf4400000-
 0xf44003ff
 $PIR: Found IRQ 9 for link 0x66 from 7 9 10 11
 ioapic0: Changing polarity for pin 9 to low
 $PIR: 2:10 INTA routed to irq 9
 pcib3: slot 4 INTA is routed to irq 9
 found->	vendor=0x1011, dev=0x0019, revid=0x41
 	bus=3, slot=4, func=0
 	class=02-00-00, hdrtype=0x00, mfdev=0
 	cmdreg=0x0157, statreg=0x0280, cachelnsz=8 (dwords)
 	lattimer=0xa5 (4950 ns), mingnt=0x14 (5000 ns), maxlat=0x28 
 (10000 ns)
 	intpin=a, irq=9
 	map[10]: type 4, range 32, base 00003400, size  7, enabled
 pcib3: device (null) requested decoded I/O range 0x3400-0x347f
 pcib2: device (null) requested decoded I/O range 0x3400-0x347f
 	map[14]: type 1, range 32, base f4400400, size 10, enabled
 pcib3: device (null) requested decoded memory range 0xf4400400-
 0xf44007ff
 pcib2: device (null) requested decoded memory range 0xf4400400-
 0xf44007ff
 $PIR: 2:10 INTA routed to irq 9
 pcib3: slot 8 INTA is routed to irq 9
 found->	vendor=0x1011, dev=0x0019, revid=0x41
 	bus=3, slot=8, func=0
 	class=02-00-00, hdrtype=0x00, mfdev=0
 	cmdreg=0x0157, statreg=0x0280, cachelnsz=8 (dwords)
 	lattimer=0xa5 (4950 ns), mingnt=0x14 (5000 ns), maxlat=0x28 
 (10000 ns)
 	intpin=a, irq=9
 dc0: <Intel 21143 10/100BaseTX> port 0x3000-0x307f mem 0xf4400000-
 0xf44003ff irq 9 at device 4.0 on pci3
 dc0: Reserved 0x80 bytes for rid 0x10 type 4 at 0x3000
 miibus1: <MII bus> on dc0
 nsphy0: <DP83840 10/100 media interface> on miibus1
 nsphy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
 dc0: bpf attached
 dc0: Ethernet address: 00:00:d1:1d:d7:47
 dc0: if_start running deferred for Giant
 dc0: [GIANT-LOCKED]
 dc1: <Intel 21143 10/100BaseTX> port 0x3400-0x347f mem 0xf4400400-
 0xf44007ff irq 9 at device 8.0 on pci3
 dc1: Reserved 0x80 bytes for rid 0x10 type 4 at 0x3400
 miibus2: <MII bus> on dc1
 dcphy0: <Intel 21143 NWAY media interface> on miibus2
 dcphy0:  10baseT, 10baseT-FDX, auto
 dc1: bpf attached
 dc1: Ethernet address: ff:ff:ff:ff:ff:ff
 dc1: if_start running deferred for Giant
 dc1: [GIANT-LOCKED]
 pci0: <unknown> at device 4.0 (no driver attached)
 isab0: <PCI-ISA bridge> at device 7.0 on pci0
 isa0: <ISA bus> on isab0
 pci0: <mass storage, ATA> at device 7.1 (no driver attached)
 pci0: <serial bus, USB> at device 7.2 (no driver attached)
 piix0: <PIIX Timecounter> port 0xf0b0-0xf0bf at device 7.3 on pci0
 Timecounter "PIIX" frequency 3579545 Hz quality 0
 Trying Read_Port at 203
 Trying Read_Port at 243
 Trying Read_Port at 283
 Trying Read_Port at 2c3
 Trying Read_Port at 303
 Trying Read_Port at 343
 Trying Read_Port at 383
 Trying Read_Port at 3c3
 pnpbios: 17 devices, largest 170 bytes
 PNP0c02: adding fixed memory32 range 0xfee00000-0xfee00fff, 
 size=0x1000
 pnpbios: handle 0 device ID PNP0c02 (020cd041)
 PNP0c02: adding io range 0x80-0x80, size=0x1, align=0x1
 PNP0c02: adding io range 0xea-0xeb, size=0x2, align=0x1
 PNP0c02: adding fixed memory32 range 0xfffe0000-0xffffffff, 
 size=0x20000
 pnpbios: handle 1 device ID PNP0c02 (020cd041)
 PNP0c01: adding fixed memory32 range 0-0x9ffff, size=0xa0000
 PNP0c01: adding fixed memory32 range 0xe0000-0xfffff, size=0x20000
 PNP0c01: adding fixed memory32 range 0x100000-0x17ffffff, 
 size=0x17f00000
 pnpbios: handle 2 device ID PNP0c01 (010cd041)
 PNP0200: adding io range 0-0xf, size=0x10, align=0x1
 PNP0200: adding io range 0x81-0x8f, size=0xf, align=0x1
 PNP0200: adding io range 0xc0-0xdf, size=0x20, align=0x1
 PNP0200: adding dma mask 0x10
 pnpbios: handle 3 device ID PNP0200 (0002d041)
 PNP0100: adding io range 0x40-0x43, size=0x4, align=0x1
 PNP0100: adding irq mask 0x1
 pnpbios: handle 5 device ID PNP0100 (0001d041)
 PNP0b00: adding io range 0x70-0x71, size=0x2, align=0x1
 PNP0b00: adding irq mask 0x100
 pnpbios: handle 6 device ID PNP0b00 (000bd041)
 PNP0303: adding io range 0x60-0x60, size=0x1, align=0x1
 PNP0303: adding io range 0x64-0x64, size=0x1, align=0x1
 PNP0303: adding irq mask 0x2
 pnpbios: handle 7 device ID PNP0303 (0303d041)
 PNP0c04: adding io range 0xf0-0xff, size=0x10, align=0x1
 PNP0c04: adding irq mask 0x2000
 pnpbios: handle 8 device ID PNP0c04 (040cd041)
 PNP0800: adding io range 0x61-0x61, size=0x1, align=0x1
 pnpbios: handle 9 device ID PNP0800 (0008d041)
 pnpbios: handle 10 device ID PNP0c02 (020cd041)
 PNP0a03: adding io range 0xcf8-0xcff, size=0x8, align=0x1
 pnpbios: handle 11 device ID PNP0a03 (030ad041)
 PNP0c02: adding io range 0x4d0-0x4d1, size=0x2, align=0x1
 PNP0c02: adding io range 0xf0c0-0xf0ff, size=0x40, align=0x1
 PNP0c02: adding io range 0xf0b0-0xf0bf, size=0x10, align=0x1
 PNP0c02: adding io range 0x10-0x18, size=0x9, align=0x1
 PNP0c02: adding io range 0x1f-0x1f, size=0x1, align=0x1
 PNP0c02: adding io range 0x24-0x25, size=0x2, align=0x1
 PNP0c02: adding io range 0x28-0x29, size=0x2, align=0x1
 PNP0c02: adding io range 0x2c-0x2d, size=0x2, align=0x1
 PNP0c02: adding io range 0x30-0x31, size=0x2, align=0x1
 PNP0c02: adding io range 0x34-0x35, size=0x2, align=0x1
 PNP0c02: adding io range 0x38-0x39, size=0x2, align=0x1
 PNP0c02: adding io range 0x3c-0x3d, size=0x2, align=0x1
 PNP0c02: adding io range 0x50-0x52, size=0x3, align=0x1
 PNP0c02: adding io range 0x72-0x77, size=0x6, align=0x1
 PNP0c02: adding io range 0x90-0x9f, size=0x10, align=0x1
 PNP0c02: adding io range 0xa4-0xa5, size=0x2, align=0x1
 PNP0c02: adding io range 0xa8-0xa9, size=0x2, align=0x1
 PNP0c02: adding io range 0xac-0xad, size=0x2, align=0x1
 PNP0c02: adding io range 0xb0-0xbd, size=0xe, align=0x1
 pnpbios: handle 12 device ID PNP0c02 (020cd041)
 pnpbios: handle 14 device ID PNP0c02 (020cd041)
 PNP0501: adding io range 0x3f8-0x3ff, size=0x8, align=0x8
 PNP0501: adding irq mask 0x10
 pnpbios: handle 16 device ID PNP0501 (0105d041)
 PNP0501: adding io range 0x2f8-0x2ff, size=0x8, align=0x8
 PNP0501: adding irq mask 0x8
 pnpbios: handle 17 device ID PNP0501 (0105d041)
 PNP0700: adding io range 0x3f0-0x3f5, size=0x6, align=0x8
 PNP0700: adding io range 0x3f7-0x3f7, size=0x1, align=0x1
 PNP0700: adding irq mask 0x40
 PNP0700: adding dma mask 0x4
 pnpbios: handle 18 device ID PNP0700 (0007d041)
 sc: sc0 already exists; skipping it
 vga: vga0 already exists; skipping it
 isa_probe_children: disabling PnP devices
 isa_probe_children: probing non-PnP devices
 orm0: <ISA Option ROMs> at iomem 0xcb800-0xcbfff,0xc8000-0xcb7ff,
 0xc0000-0xc7fff on isa0
 adv0: not probed (disabled)
 aha0: not probed (disabled)
 aic0: not probed (disabled)
 ata0 failed to probe at port 0x1f0 irq 14 on isa0
 ata1 failed to probe at port 0x170 irq 15 on isa0
 atkbdc0: <Keyboard controller (i8042)> at port 0x64,0x60 on isa0
 atkbd0: <AT Keyboard> irq 1 on atkbdc0
 atkbd: the current kbd controller command byte 0065
 atkbd: keyboard ID 0x41ab (2)
 kbd0 at atkbd0
 kbd0: atkbd0, AT 101/102 (2), config:0x0, flags:0x3d0000
 atkbd0: [GIANT-LOCKED]
 bt0: not probed (disabled)
 cs0: not probed (disabled)
 ed0: not probed (disabled)
 fdc0: ic_type 90 part_id 80
 fdc0: <Enhanced floppy controller> at port 0x3f0-0x3f5 irq 6 drq 2 on 
 isa0
 fdc0: ic_type 90 part_id 80
 fdc0: [MPSAFE]
 fdc0: [FAST]
 fd0: <1440-KB 3.5" drive> on fdc0 drive 0
 fe0: not probed (disabled)
 ie0: not probed (disabled)
 lnc0: not probed (disabled)
 pcic0 failed to probe at port 0x3e0 iomem 0xd0000 on isa0
 pcic1: not probed (disabled)
 ppc0 failed to probe at irq 7 on isa0
 sc0: <System console> at flags 0x100 on isa0
 sc0: VGA <16 virtual consoles, flags=0x300>
 sc0: fb0, kbd0, terminal emulator: sc (syscons terminal)
 sio0: irq maps: 0xa001 0xa011 0xa001 0xa001
 sio0 at port 0x3f8-0x3ff irq 4 flags 0x10 on isa0
 sio0: type 16550A
 sio1: irq maps: 0xa001 0xa009 0xa001 0xa001
 sio1 at port 0x2f8-0x2ff irq 3 on isa0
 sio1: type 16550A
 sio2: not probed (disabled)
 sio3: not probed (disabled)
 sn0: not probed (disabled)
 vga0: <Generic ISA VGA> at port 0x3c0-0x3df iomem 0xa0000-0xbffff on 
 isa0
 fb0: vga0, vga, type:VGA (5), flags:0x7007f
 fb0: port:0x3c0-0x3df, crtc:0x3d4, mem:0xa0000 0x20000
 fb0: init mode:24, bios mode:3, current mode:24
 fb0: window:0xc00b8000 size:32k gran:32k, buf:0 size:32k
 VGA parameters upon power-up
 50 18 10 00 00 00 03 00 02 67 5f 4f 50 82 55 81 
 bf 1f 00 4f 0d 0e 00 00 05 50 9c 8e 8f 28 1f 96 
 b9 a3 ff 00 01 02 03 04 05 14 07 38 39 3a 3b 3c 
 3d 3e 3f 0c 00 0f 08 00 00 00 00 00 10 0e 00 ff 
 VGA parameters in BIOS for mode 24
 50 18 10 00 10 00 03 00 02 67 5f 4f 50 82 55 81 
 bf 1f 00 4f 0d 0e 00 00 00 00 9c 8e 8f 28 1f 96 
 b9 a3 ff 00 01 02 03 04 05 14 07 38 39 3a 3b 3c 
 3d 3e 3f 0c 00 0f 08 00 00 00 00 00 10 0e 00 ff 
 EGA/VGA parameters to be used for mode 24
 50 18 10 00 10 00 03 00 02 67 5f 4f 50 82 55 81 
 bf 1f 00 4f 0d 0e 00 00 00 00 9c 8e 8f 28 1f 96 
 b9 a3 ff 00 01 02 03 04 05 14 07 38 39 3a 3b 3c 
 3d 3e 3f 0c 00 0f 08 00 00 00 00 00 10 0e 00 ff 
 vt0: not probed (disabled)
 isa_probe_children: probing PnP devices
 unknown: <PNP0303> can't assign resources (port)
 unknown: <PNP0303> at port 0x60 on isa0
 unknown: <PNP0800> failed to probe at port 0x61 on isa0
 unknown: <PNP0c02> can't assign resources (port)
 unknown: <PNP0c02> at port 0x4d0-0x4d1 on isa0
 unknown: <PNP0501> can't assign resources (port)
 unknown: <PNP0501> at port 0x3f8-0x3ff on isa0
 unknown: <PNP0501> can't assign resources (port)
 unknown: <PNP0501> at port 0x2f8-0x2ff on isa0
 unknown: <PNP0700> can't assign resources (port)
 unknown: <PNP0700> at port 0x3f0-0x3f5 on isa0
 Device configuration finished.
 procfs registered
 Timecounter "TSC" frequency 396820206 Hz quality -100
 Timecounters tick every 10.000 msec
 IP Filter: v3.4.35 initialized.  Default = pass all, Logging = enabled
 lo0: bpf attached
 Waiting 2 seconds for SCSI devices to settle
 (noperiph:sym0:0:-1:-1): SCSI BUS reset delivered.
 sym0: enabling clock multiplier
 sym0: Downloading SCSI SCRIPTS.
 Interrupt storm detected on "irq9: dc0 dc1"; throttling interrupt 
 source
 (probe0:sym0:0:0:0): Retrying Command
 (probe1:sym0:0:1:0): Retrying Command
 (probe2:sym0:0:2:0): Retrying Command
 (probe5:sym0:0:5:0): error 22
 (probe5:sym0:0:5:0): Unretryable Error
 (probe7:sym0:0:8:0): phase change 6-7 6@0020df8c resid=4.
 (probe1:sym0:0:1:1): error 22
 (probe1:sym0:0:1:1): Unretryable Error
 (probe1:sym0:0:1:2): error 22
 (probe1:sym0:0:1:2): Unretryable Error
 (probe1:sym0:0:1:3): error 22
 (probe1:sym0:0:1:3): Unretryable Error
 (probe1:sym0:0:1:4): error 22
 (probe1:sym0:0:1:4): Unretryable Error
 (probe1:sym0:0:1:5): error 22
 (probe1:sym0:0:1:5): Unretryable Error
 (probe1:sym0:0:1:6): error 22
 (probe1:sym0:0:1:6): Unretryable Error
 (probe1:sym0:0:1:7): error 22
 (probe1:sym0:0:1:7): Unretryable Error
 (probe0:sym0:0:0:1): error 22
 (probe0:sym0:0:0:1): Unretryable Error
 (probe0:sym0:0:0:2): error 22
 (probe0:sym0:0:0:2): Unretryable Error
 (probe0:sym0:0:0:3): error 22
 (probe0:sym0:0:0:3): Unretryable Error
 (probe0:sym0:0:0:4): error 22
 (probe0:sym0:0:0:4): Unretryable Error
 (probe0:sym0:0:0:5): error 22
 (probe0:sym0:0:0:5): Unretryable Error
 (probe0:sym0:0:0:6): error 22
 (probe0:sym0:0:0:6): Unretryable Error
 (probe0:sym0:0:0:7): error 22
 (probe0:sym0:0:0:7): Unretryable Error
 (probe0:sym0:0:2:1): error 22
 (probe0:sym0:0:2:1): Unretryable Error
 (probe0:sym0:0:2:2): error 22
 (probe0:sym0:0:2:2): Unretryable Error
 (probe0:sym0:0:2:3): error 22
 (probe0:sym0:0:2:3): Unretryable Error
 (probe0:sym0:0:2:4): error 22
 (probe0:sym0:0:2:4): Unretryable Error
 (probe0:sym0:0:2:5): error 22
 (probe0:sym0:0:2:5): Unretryable Error
 (probe0:sym0:0:2:6): error 22
 (probe0:sym0:0:2:6): Unretryable Error
 (probe0:sym0:0:2:7): error 22
 (probe0:sym0:0:2:7): Unretryable Error
 ses0 at sym0 bus 0 target 8 lun 0
 ses0: <SIEMENS STM/L S1 4.1b> Fixed Processor SCSI-2 device 
 ses0: Serial Number 1
 ses0: 3.300MB/s transfers
 ses0: SAF-TE Compliant Device
 pass0 at sym0 bus 0 target 0 lun 0
 pass0: <HP 18.2GB A 80-B005 B005> Fixed Direct Access SCSI-2 device 
 pass0: Serial Number 3AK0A5ZJ000010071Z8W
 pass0: 80.000MB/s transfers (40.000MHz, offset 15, 16bit), Tagged 
 Queueing Enabled
 pass1 at sym0 bus 0 target 1 lun 0
 pass1: <FUJITSU MAG3091LC 5210> Fixed Direct Access SCSI-2 device 
 pass1: Serial Number     00002277
 pass1: 80.000MB/s transfers (40.000MHz, offset 31, 16bit), Tagged 
 Queueing Enabled
 pass2 at sym0 bus 0 target 2 lun 0
 pass2: <FUJITSU MAG3091LC 5210> Fixed Direct Access SCSI-2 device 
 pass2: Serial Number     00001305
 pass2: 80.000MB/s transfers (40.000MHz, offset 31, 16bit), Tagged 
 Queueing Enabled
 pass3 at sym0 bus 0 target 5 lun 0
 pass3: <NEC CD-ROM DRIVE:465 1.13> Removable CD-ROM SCSI-2 device 
 pass3: 20.000MB/s transfers (20.000MHz, offset 16)
 pass4 at sym0 bus 0 target 8 lun 0
 pass4: <SIEMENS STM/L S1 4.1b> Fixed Processor SCSI-2 device 
 pass4: Serial Number 1
 pass4: 3.300MB/s transfers
 GEOM: new disk cd0
 GEOM: new disk da0
 GEOM: new disk da1
 GEOM: new disk da2
 SMP: AP CPU #1 Launched!
 cpu1 AP:
      ID: 0x00000000   VER: 0x00040011 LDR: 0x01000000 DFR: 0x0fffffff
   lint0: 0x00010700 lint1: 0x00010400 TPR: 0x00000000 SVR: 0x000001ff
 ioapic0: routing intpin 1 (ISA IRQ 1) to cluster 0
 ioapic0: routing intpin 2 (ISA IRQ 0) to cluster 0
 ioapic0: routing intpin 3 (ISA IRQ 3) to cluster 0
 ioapic0: routing intpin 4 (ISA IRQ 4) to cluster 0
 ioapic0: routing intpin 6 (ISA IRQ 6) to cluster 0
 ioapic0: routing intpin 7 (ISA IRQ 7) to cluster 0
 ioapic0: routing intpin 8 (ISA IRQ 8) to cluster 0
 ioapic0: routing intpin 9 (ISA IRQ 9) to cluster 0
 ioapic0: routing intpin 10 (ISA IRQ 10) to cluster 0
 ioapic0: routing intpin 13 (ISA IRQ 13) to cluster 0
 (cd0:sym0:0:5:0): Retrying Command
 da2 at sym0 bus 0 target 2 lun 0
 da2: <FUJITSU MAG3091LC 5210> Fixed Direct Access SCSI-2 device 
 da2: Serial Number     00001305
 da2: 80.000MB/s transfers (40.000MHz, offset 31, 16bit), Tagged 
 Queueing Enabled
 da2: 8704MB (17827698 512 byte sectors: 255H 63S/T 1109C)
 da1 at sym0 bus 0 target 1 lun 0
 da1: <FUJITSU MAG3091LC 5210> Fixed Direct Access SCSI-2 device 
 da1: Serial Number     00002277
 da1: 80.000MB/s transfers (40.000MHz, offset 31, 16bit), Tagged 
 Queueing Enabled
 da1: 8704MB (17827698 512 byte sectors: 255H 63S/T 1109C)
 da0 at sym0 bus 0 target 0 lun 0
 da0: <HP 18.2GB A 80-B005 B005> Fixed Direct Access SCSI-2 device 
 da0: Serial Number 3AK0A5ZJ000010071Z8W
 da0: 80.000MB/s transfers (40.000MHz, offset 15, 16bit), Tagged 
 Queueing Enabled
 da0: 17366MB (35566480 512 byte sectors: 255H 63S/T 2213C)
 (cd0:sym0:0:5:0): error 6
 (cd0:sym0:0:5:0): Unretryable Error
 cd0 at sym0 bus 0 target 5 lun 0
 cd0: <NEC CD-ROM DRIVE:465 1.13> Removable CD-ROM SCSI-2 device 
 cd0: 20.000MB/s transfers (20.000MHz, offset 16)
 cd0: Attempt to query device size failed: NOT READY, Medium not 
 present
 (cd0:sym0:0:5:0): error 6
 (cd0:sym0:0:5:0): Unretryable Error
 (cd0:sym0:0:5:0): error 6
 (cd0:sym0:0:5:0): Unretryable Error
 (cd0:sym0:0:5:0): error 6
 (cd0:sym0:0:5:0): Unretryable Error
 [0] f:80 typ:165 s(CHS):0/1/1 e(CHS):1023/254/63 s:63 l:35551782
 [1] f:00 typ:0 s(CHS):0/0/0 e(CHS):0/0/0 s:0 l:0
 [2] f:00 typ:0 s(CHS):0/0/0 e(CHS):0/0/0 s:0 l:0
 [3] f:00 typ:0 s(CHS):0/0/0 e(CHS):0/0/0 s:0 l:0
 GEOM: Configure da0s1, start 32256 length 18202512384 end 18202544639
 GEOM: Configure da1c, start 0 length 9127781376 end 9127781375
 GEOM: Configure da1d, start 32256 length 9127749120 end 9127781375
 GEOM: Configure da2c, start 0 length 9127781376 end 9127781375
 GEOM: Configure da2d, start 32256 length 9127749120 end 9127781375
 [0] f:00 typ:0 s(CHS):0/0/0 e(CHS):0/0/0 s:0 l:0
 [1] f:00 typ:0 s(CHS):0/0/0 e(CHS):0/0/0 s:0 l:0
 [2] f:00 typ:0 s(CHS):0/0/0 e(CHS):0/0/0 s:0 l:0
 [3] f:80 typ:165 s(CHS):0/0/1 e(CHS):1023/254/63 s:0 l:50000
 GEOM: Configure da0s1a, start 0 length 123731968 end 123731967
 GEOM: Configure da0s1b, start 123731968 length 1073741824 end 
 1197473791
 GEOM: Configure da0s1c, start 0 length 18202512384 end 18202512383
 GEOM: Configure da0s1d, start 1197473792 length 1073741824 end 
 2271215615
 GEOM: Configure da0s1e, start 2271215616 length 2147483648 end 
 4418699263
 GEOM: Configure da0s1f, start 4418699264 length 13783813120 end 
 18202512383
 [0] f:00 typ:0 s(CHS):0/0/0 e(CHS):0/0/0 s:0 l:0
 [1] f:00 typ:0 s(CHS):0/0/0 e(CHS):0/0/0 s:0 l:0
 [2] f:00 typ:0 s(CHS):0/0/0 e(CHS):0/0/0 s:0 l:0
 [3] f:80 typ:165 s(CHS):0/0/1 e(CHS):1023/254/63 s:0 l:50000
 [0] f:00 typ:0 s(CHS):0/0/0 e(CHS):0/0/0 s:0 l:0
 [1] f:00 typ:0 s(CHS):0/0/0 e(CHS):0/0/0 s:0 l:0
 [2] f:00 typ:0 s(CHS):0/0/0 e(CHS):0/0/0 s:0 l:0
 [3] f:80 typ:165 s(CHS):0/0/1 e(CHS):1023/254/63 s:0 l:50000
 [0] f:0e typ:162 s(CHS):256/82/1 e(CHS):458/238/17 s:-609674986 l:-
 612337923
 [1] f:20 typ:230 s(CHS):922/28/36 e(CHS):673/52/56 s:-1119163435 l:
 234863854
 [2] f:3a typ:203 s(CHS):351/90/10 e(CHS):519/233/51 s:-938304081 l:-
 752965650
 [3] f:73 typ:121 s(CHS):961/226/25 e(CHS):219/32/18 s:-278924650 l:-
 898031409
 Mounting root from ufs:/dev/da0s1a
 start_init: trying /sbin/init
 [0] f:0e typ:162 s(CHS):256/82/1 e(CHS):458/238/17 s:-609674986 l:-
 612337923
 [1] f:20 typ:230 s(CHS):922/28/36 e(CHS):673/52/56 s:-1119163435 l:
 234863854
 [2] f:3a typ:203 s(CHS):351/90/10 e(CHS):519/233/51 s:-938304081 l:-
 752965650
 [3] f:73 typ:121 s(CHS):961/226/25 e(CHS):219/32/18 s:-278924650 l:-
 898031409
 (da0:sym0:0:0:0): QUEUE FULL
 (da0:sym0:0:0:0): Queue Full
 (da0:sym0:0:0:0): tagged openings now 63
 (da0:sym0:0:0:0): Retrying Command
 (da0:sym0:0:0:0): QUEUE FULL
 (da0:sym0:0:0:0): Queue Full
 (da0:sym0:0:0:0): tagged openings now 62
 (da0:sym0:0:0:0): Retrying Command
 (da0:sym0:0:0:0): QUEUE FULL
 (da0:sym0:0:0:0): Queue Full
 (da0:sym0:0:0:0): tagged openings now 61
 (da0:sym0:0:0:0): Retrying Command
 (da0:sym0:0:0:0): QUEUE FULL
 (da0:sym0:0:0:0): Queue Full
 (da0:sym0:0:0:0): tagged openings now 60
 (da0:sym0:0:0:0): Retrying Command
 (da0:sym0:0:0:0): QUEUE FULL
 (da0:sym0:0:0:0): Queue Full
 (da0:sym0:0:0:0): tagged openings now 59
 (da0:sym0:0:0:0): Retrying Command
 (da0:sym0:0:0:0): QUEUE FULL
 (da0:sym0:0:0:0): Queue Full
 (da0:sym0:0:0:0): tagged openings now 58
 (da0:sym0:0:0:0): Retrying Command
 (da0:sym0:0:0:0): QUEUE FULL
 (da0:sym0:0:0:0): Queue Full
 (da0:sym0:0:0:0): tagged openings now 57
 (da0:sym0:0:0:0): Retrying Command
 (da0:sym0:0:0:0): QUEUE FULL
 (da0:sym0:0:0:0): Queue Full
 (da0:sym0:0:0:0): tagged openings now 56
 (da0:sym0:0:0:0): Retrying Command
 (da0:sym0:0:0:0): QUEUE FULL
 (da0:sym0:0:0:0): Queue Full
 (da0:sym0:0:0:0): tagged openings now 55
 (da0:sym0:0:0:0): Retrying Command
 (da0:sym0:0:0:0): QUEUE FULL
 (da0:sym0:0:0:0): Queue Full
 (da0:sym0:0:0:0): tagged openings now 54
 (da0:sym0:0:0:0): Retrying Command
 
 Kernel configuration file:
 
 machine         i386
 cpu             I686_CPU
 ident           AUSRINE
 
 # IPfilter packet filter
 options         IPFILTER
 options         IPFILTER_LOG
 
 # ALTQ
 options         ALTQ                    # enable ALTQ
 options         ALTQ_CBQ                # build the ``Class Based 
 Queuing'' discipline.
 #options         ALTQ_RED                # build the ``Random Early 
 Drop'' extension.
 #options         ALTQ_RIO                # build ``Random Early Drop'' 
 for input and output.
 options         ALTQ_HFSC               # build the ``Hierarchical 
 Packet Scheduler'' discipline.
 options         ALTQ_CDNR               # build the traffic 
 conditioner.  This option is meaningless at
 		                        # the moment as the conditioner is 
 not used by any of the
 		                        # available disciplines or 
 consumer.
 options         ALTQ_PRIQ               # build the ``Priority 
 Queuing'' discipline.
 options         ALTQ_NOPCC              # required for SMP builds.
 #options         ALTQ_DEBUG              # enable additional debugging 
 facilities.
 
 makeoptions     COPTFLAGS="-O2 -pipe -funroll-loops -ffast-math"
 
 options         SCHED_4BSD              # 4BSD scheduler
 options         INET                    # InterNETworking
 options         FFS                     # Berkeley Fast Filesystem
 options         SOFTUPDATES             # Enable FFS soft updates 
 support
 options         UFS_DIRHASH             # Improve performance on big 
 directories
 options         MD_ROOT                 # MD is a potential root 
 device
 options         MSDOSFS                 # MSDOS Filesystem
 options         CD9660                  # ISO 9660 Filesystem
 options         PROCFS                  # Process filesystem (requires 
 PSEUDOFS)
 options         PSEUDOFS                # Pseudo-filesystem framework
 options         GEOM_GPT                # GUID Partition Tables.
 options         COMPAT_43               # Compatible with BSD 4.3 
 [KEEP THIS!]
 options         COMPAT_FREEBSD4         # Compatible with FreeBSD4
 options         SCSI_DELAY=2000         # Delay (in ms) before probing 
 SCSI
 options         KTRACE                  # ktrace(1) support
 options         SYSVSHM                 # SYSV-style shared memory
 options         SYSVMSG                 # SYSV-style message queues
 options         SYSVSEM                 # SYSV-style semaphores
 options         _KPOSIX_PRIORITY_SCHEDULING # POSIX P1003_1B real-time 
 extensions
 options         KBD_INSTALL_CDEV        # install a CDEV entry in /dev
 options         AHC_REG_PRETTY_PRINT    # Print register bitfields in 
 debug
                                         # output.  Adds ~128k to 
 driver.
 options         AHD_REG_PRETTY_PRINT    # Print register bitfields in 
 debug
                                         # output.  Adds ~215k to 
 driver.
 options         ADAPTIVE_GIANT          # Giant mutex is adaptive.
 
 # Enables building of a Symmetric MultiProcessor kernel: 
 options         SMP
 options         NO_MIXED_MODE           # Disable use of mixed mode
 device          apic                    # I/O APIC
 
 # Bus support.  Do not remove isa, even if you have no isa slots
 device          isa
 device          pci
 
 # Floppy drives
 device          fdc
 
 
 # SCSI Controllers
 device          sym             # NCR/Symbios Logic (newer chipsets + 
 those of `ncr')
 
 # SCSI peripherals
 device          scbus           # SCSI bus (required for SCSI)
 device          ch              # SCSI media changers
 device          da              # Direct Access (disks)
 device          sa              # Sequential Access (tape etc)
 device          cd              # CD
 device          pass            # Passthrough device (direct SCSI 
 access)
 device          ses             # SCSI Environmental Services (and 
 SAF-TE)
 
 # atkbdc0 controls both the keyboard and the PS/2 mouse
 device          atkbdc          # AT keyboard controller
 device          atkbd           # AT keyboard
 
 device          vga             # VGA video card driver
 
 # syscons is the default console driver, resembling an SCO console
 device          sc
 
 # Floating point support - do not disable.
 device          npx
 
 # Serial (COM) ports
 device          sio             # 8250, 16[45]50 based serial ports
 
 # Parallel port
 device          ppbus           # Parallel port bus (required)
 
 
 # PCI Ethernet NICs.
 #device          de              # DEC/Intel DC21x4x (``Tulip'')
 # PCI Ethernet NICs that use the common MII bus controller code.
 # NOTE: Be sure to keep the 'device miibus' line in order to use these 
 NICs!
 device          miibus          # MII bus support
 device          fxp
 device          dc              # DEC/Intel 21143 and various 
 workalikes
 
 # Pseudo devices.
 device          loop            # Network loopback
 device          mem             # Memory and kernel memory devices
 device          io              # I/O device
 device          random          # Entropy device
 device          ether           # Ethernet support
 device          pty             # Pseudo-ttys (telnet etc)
 device          md              # Memory "disks"
 
 # The `bpf' device enables the Berkeley Packet Filter.
 # Be aware of the administrative consequences of enabling this!
 # Note that 'bpf' is required for DHCP.
 device          bpf             # Berkeley packet filter
 
 # USB support
 device          usb             # USB Bus (required)
 

From: "Liudas B." <liudasb@centras.lt>
To: bug-followup@FreeBSD.org, liudasb@centras.lt
Cc:  
Subject: Re: kern/79262: [dc] Adaptec ANA-6922 not fully supported
Date: Mon, 22 May 2006 16:34:36 +0300

 Hi,
 
 ANA-6922 seems to have only one ROM (shared ROM). When attaching dc 
 driver for second port dc_eeprom_getword function return only 0xFFFF 
 (that explains why MAC address is FF-FF-FF-FF-FF-FF).
 Workaround is to use first (and the only one) ROM for second port. 
 NetBSD tlp driver use this solution. Linux tulip driver seems to 
 have another approach.
 
 
 ---------
 Liudas
State-Changed-From-To: open->feedback 
State-Changed-By: vwe 
State-Changed-When: Wed Jan 14 21:32:23 UTC 2009 
State-Changed-Why:  
Liudas, 
is this issue still true for recent releases? 


Responsible-Changed-From-To: freebsd-bugs->freebsd-net 
Responsible-Changed-By: vwe 
Responsible-Changed-When: Wed Jan 14 21:32:23 UTC 2009 
Responsible-Changed-Why:  

Over to maintainer(s). 

http://www.freebsd.org/cgi/query-pr.cgi?pr=79262 
Responsible-Changed-From-To: freebsd-net->yongari 
Responsible-Changed-By: andre 
Responsible-Changed-When: Mon Aug 23 18:22:28 UTC 2010 
Responsible-Changed-Why:  
Over to expert. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=79262 

From: Pyun YongHyeon <pyunyh@gmail.com>
To: Liudas <liudasb@centras.lt>
Cc: freebsd-net@freebsd.org, yongari@freebsd.org, bug-followup@FreeBSD.org
Subject: Re: kern/79262: [dc] Adaptec ANA-6922 not fully supported
Date: Mon, 23 Aug 2010 19:03:51 -0700

 On Mon, Aug 23, 2010 at 06:22:58PM +0000, andre@freebsd.org wrote:
 > Synopsis: [dc] Adaptec ANA-6922 not fully supported
 > 
 > Responsible-Changed-From-To: freebsd-net->yongari
 > Responsible-Changed-By: andre
 > Responsible-Changed-When: Mon Aug 23 18:22:28 UTC 2010
 > Responsible-Changed-Why: 
 > Over to expert.
 > 
 > http://www.freebsd.org/cgi/query-pr.cgi?pr=79262
 
 Would you try the following patch and let me know how it goes on
 your box? I don't have dc(4) controller so it's hard to verify this
 at this moment.
 http://people.freebsd.org/~yongari/dc.eaddr.patch

From: Pyun YongHyeon <pyunyh@gmail.com>
To: Liudas Bak??ys <liudasb@centras.lt>
Cc: bug-followup@FreeBSD.org
Subject: Re: Re: kern/79262: [dc] Adaptec ANA-6922 not fully supported
Date: Thu, 23 Sep 2010 13:48:50 -0700

 On Thu, Sep 23, 2010 at 08:54:47PM +0300, Liudas Bak??ys wrote:
 > Hello,
 > 
 > I tried your patch and result is the same. Please find attached file with dmesg output.
 
 Ok, on second thought I noticed the patch lacks check for shared a
 slaved ROM. In order to do that I have to know whether the
 controller has multi-port or not. I'm not sure what that could be
 tested at this time but could you show me the output of "pciconf
 -lcbv"? I guess I could get pcidomain, bus, device, function values
 from there.
 
 > If it helps I could send you one ANA-6922 card.
 > 
 
 Thanks for the offer. But that means you lose the opportunity of
 using dc(4) controller so I'm somewhat reluctant to do that. Let's
 try hard to get fixed and then think about the offer later.
 
 > --
 > Liudas
 > 
 > 
 > 
 > Nuo:  "Pyun YongHyeon" 
 > Si??sta:  2010 08 24   05:03
 > Tema:  Re: kern/79262: [dc] Adaptec ANA-6922 not fully supported
 > 
 > 
 > 
 > 
 > On Mon, Aug 23, 2010 at 06:22:58PM +0000, andre@freebsd.org wrote:
 > > Synopsis: [dc] Adaptec ANA-6922 not fully supported
 > > 
 > > Responsible-Changed-From-To: freebsd-net->yongari
 > > Responsible-Changed-By: andre
 > > Responsible-Changed-When: Mon Aug 23 18:22:28 UTC 2010
 > > Responsible-Changed-Why: 
 > > Over to expert.
 > > 
 > > http://www.freebsd.org/cgi/query-pr.cgi?pr=79262
 > 
 > Would you try the following patch and let me know how it goes on
 > your box? I don't have dc(4) controller so it's hard to verify this
 > at this moment.
 > http://people.freebsd.org/~yongari/dc.eaddr.patch
 > 
 
 > Copyright (c) 1992-2010 The FreeBSD Project.
 > Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
 >         The Regents of the University of California. All rights reserved.
 > FreeBSD is a registered trademark of The FreeBSD Foundation.
 > FreeBSD 8.1-RELEASE #0: Thu Sep 23 20:21:48 UTC 2010
 >     root@zoidberg:/usr/obj/usr/src/sys/GENERIC i386
 > Timecounter "i8254" frequency 1193182 Hz quality 0
 > CPU: Intel(R) Xeon(TM) CPU 2.40GHz (2394.14-MHz 686-class CPU)
 >   Origin = "GenuineIntel"  Id = 0xf27  Family = f  Model = 2  Stepping = 7
 >   Features=0xbfebfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,DTS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE>
 >   Features2=0x400<CNXT-ID>
 > real memory  = 1073741824 (1024 MB)
 > avail memory = 1035370496 (987 MB)
 > ACPI APIC Table: <PTLTD          APIC  >
 > FreeBSD/SMP: Multiprocessor System Detected: 4 CPUs
 > FreeBSD/SMP: 2 package(s) x 1 core(s) x 2 HTT threads
 >  cpu0 (BSP): APIC ID:  0
 >  cpu1 (AP/HT): APIC ID:  1
 >  cpu2 (AP): APIC ID:  6
 >  cpu3 (AP/HT): APIC ID:  7
 > ioapic0 <Version 2.0> irqs 0-23 on motherboard
 > ioapic1 <Version 2.0> irqs 24-47 on motherboard
 > kbd1 at kbdmux0
 > acpi0: <PTLTD   RSDT> on motherboard
 > acpi0: [ITHREAD]
 > acpi0: Power Button (fixed)
 > Timecounter "ACPI-fast" frequency 3579545 Hz quality 1000
 > acpi_timer0: <24-bit timer at 3.579545MHz> port 0x1008-0x100b on acpi0
 > cpu0: <ACPI CPU> on acpi0
 > cpu1: <ACPI CPU> on acpi0
 > pcib0: <ACPI Host-PCI bridge> port 0xcf8-0xcff on acpi0
 > pci0: <ACPI PCI bus> on pcib0
 > agp0: <Intel 82860 host to AGP bridge> on hostb0
 > pcib1: <ACPI PCI-PCI bridge> at device 1.0 on pci0
 > pci1: <ACPI PCI bus> on pcib1
 > vgapci0: <VGA-compatible display> port 0x2000-0x20ff mem 0xe0000000-0xefffffff,0xf4000000-0xf400ffff irq 16 at device 0.0 on pci1
 > vgapci1: <VGA-compatible display> mem 0xf4010000-0xf401ffff at device 0.1 on pci1
 > pcib2: <ACPI PCI-PCI bridge> at device 2.0 on pci0
 > pci2: <ACPI PCI bus> on pcib2
 > pcib3: <ACPI PCI-PCI bridge> at device 31.0 on pci2
 > pci3: <ACPI PCI bus> on pcib3
 > sym0: <1010-66> port 0x3000-0x30ff mem 0xf4105000-0xf41053ff,0xf4100000-0xf4101fff irq 23 at device 8.0 on pci3
 > sym0: Symbios NVRAM, ID 7, Fast-80, LVD, parity checking
 > sym0: open drain IRQ line driver, using on-chip SRAM
 > sym0: using LOAD/STORE-based firmware.
 > sym0: handling phase mismatch from SCRIPTS.
 > sym0: [ITHREAD]
 > sym1: <1010-66> port 0x3400-0x34ff mem 0xf4105400-0xf41057ff,0xf4102000-0xf4103fff irq 19 at device 8.1 on pci3
 > sym1: Symbios NVRAM, ID 7, Fast-80, LVD, parity checking
 > sym1: open drain IRQ line driver, using on-chip SRAM
 > sym1: using LOAD/STORE-based firmware.
 > sym1: handling phase mismatch from SCRIPTS.
 > sym1: [ITHREAD]
 > pcib4: <ACPI PCI-PCI bridge> at device 30.0 on pci0
 > pci4: <ACPI PCI bus> on pcib4
 > pcib5: <PCI-PCI bridge> at device 9.0 on pci4
 > pci5: <PCI bus> on pcib5
 > dc0: <Intel 21143 10/100BaseTX> port 0x5000-0x507f mem 0xf4300000-0xf43003ff irq 19 at device 4.0 on pci5
 > miibus0: <MII bus> on dc0
 > nsphy0: <DP83840 10/100 media interface> PHY 1 on miibus0
 > nsphy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
 > dc0: Ethernet address: 00:00:d1:1e:4a:15
 > dc0: [ITHREAD]
 > dc1: <Intel 21143 10/100BaseTX> port 0x5080-0x50ff mem 0xf4300400-0xf43007ff irq 19 at device 8.0 on pci5
 > dc1: No checksum found in SROM
 > dc1: Unknown or invalid SROM format
 > miibus1: <MII bus> on dc1
 > dcphy0: <Intel 21143 NWAY media interface> PHY 31 on miibus1
 > dcphy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
 > dc1: Ethernet address: ff:ff:ff:ff:ff:ff
 > dc1: [ITHREAD]
 > fxp0: <Intel 82550 Pro/100 Ethernet> port 0x4000-0x403f mem 0xf4220000-0xf4220fff,0xf4200000-0xf421ffff irq 21 at device 13.0 on pci4
 > miibus2: <MII bus> on fxp0
 > inphy0: <i82555 10/100 media interface> PHY 1 on miibus2
 > inphy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
 > fxp0: Ethernet address: 00:e0:81:00:bf:5e
 > fxp0: [ITHREAD]
 > isab0: <PCI-ISA bridge> at device 31.0 on pci0
 > isa0: <ISA bus> on isab0
 > atapci0: <Intel ICH2 UDMA100 controller> port 0x1f0-0x1f7,0x3f6,0x170-0x177,0x376,0x10e0-0x10ef at device 31.1 on pci0
 > ata0: <ATA channel 0> on atapci0
 > ata0: [ITHREAD]
 > ata1: <ATA channel 1> on atapci0
 > ata1: [ITHREAD]
 > uhci0: <Intel 82801BA/BAM (ICH2) USB controller USB-A> port 0x10c0-0x10df irq 19 at device 31.2 on pci0
 > uhci0: [ITHREAD]
 > uhci0: LegSup = 0x2f00
 > usbus0: <Intel 82801BA/BAM (ICH2) USB controller USB-A> on uhci0
 > pci0: <serial bus, SMBus> at device 31.3 (no driver attached)
 > pci0: <multimedia, audio> at device 31.5 (no driver attached)
 > acpi_button0: <Power Button> on acpi0
 > atrtc0: <AT realtime clock> port 0x70-0x71 irq 8 on acpi0
 > atkbdc0: <Keyboard controller (i8042)> port 0x60,0x64 irq 1 on acpi0
 > atkbd0: <AT Keyboard> irq 1 on atkbdc0
 > kbd0 at atkbd0
 > atkbd0: [GIANT-LOCKED]
 > atkbd0: [ITHREAD]
 > fdc0: <floppy drive controller> port 0x3f0-0x3f5,0x3f7 irq 6 drq 2 on acpi0
 > fdc0: [FILTER]
 > fd0: <1440-KB 3.5" drive> on fdc0 drive 0
 > uart0: <16550 or compatible> port 0x3f8-0x3ff irq 4 flags 0x10 on acpi0
 > uart0: [FILTER]
 > uart0: console (9600,n,8,1)
 > uart1: <16550 or compatible> port 0x2f8-0x2ff irq 3 on acpi0
 > uart1: [FILTER]
 > ppc0: <Parallel port> port 0x378-0x37f,0x778-0x77f irq 7 drq 1 on acpi0
 > ppc0: SMC-like chipset (ECP/EPP/PS2/NIBBLE) in COMPATIBLE mode
 > ppc0: FIFO with 16/16/8 bytes threshold
 > ppc0: [ITHREAD]
 > ppbus0: <Parallel port bus> on ppc0
 > plip0: <PLIP network interface> on ppbus0
 > plip0: [ITHREAD]
 > lpt0: <Printer> on ppbus0
 > lpt0: [ITHREAD]
 > lpt0: Interrupt-driven port
 > ppi0: <Parallel I/O> on ppbus0
 > pmtimer0 on isa0
 > orm0: <ISA Option ROMs> at iomem 0xc0000-0xce7ff,0xce800-0xd27ff pnpid ORM0000 on isa0
 > sc0: <System console> at flags 0x100 on isa0
 > sc0: VGA <16 virtual consoles, flags=0x100>
 > vga0: <Generic ISA VGA> at port 0x3c0-0x3df iomem 0xa0000-0xbffff on isa0
 > p4tcc0: <CPU Frequency Thermal Control> on cpu0
 > p4tcc1: <CPU Frequency Thermal Control> on cpu1
 > Timecounters tick every 1.000 msec
 > usbus0: 12Mbps Full Speed USB v1.0
 > ata1: DMA limited to UDMA33, controller found non-ATA66 cable
 > ugen0.1: <Intel> at usbus0
 > uhub0: <Intel UHCI root HUB, class 9/0, rev 1.00/1.00, addr 1> on usbus0
 > acd0: DVDR <PIONEER DVD-RW DVR-112D/1.15> at ata1-master UDMA33 
 > (noperiph:sym0:0:-1:-1): SCSI BUS reset delivered.
 > (noperiph:sym1:0:-1:-1): SCSI BUS reset delivered.
 > uhub0: 2 ports with 2 removable, self powered
 > da0 at sym0 bus 0 scbus0 target 0 lun 0
 > da0: <FUJITSU MAN3367MP HPF1> Fixed Direct Access SCSI-2 device 
 > da0: 160.000MB/s transfers (80.000MHz DT, offset 62, 16bit)
 > da0: Command Queueing enabled
 > da0: 34732MB (71132960 512 byte sectors: 255H 63S/T 4427C)
 > SMP: AP CPU #2 Launched!
 > SMP: AP CPU #1 Launched!
 > SMP: AP CPU #3 Launched!
 > Trying to mount root from ufs:/dev/da0s1a

From: =?utf-8?B?TGl1ZGFzIEJha8WheXM=?= <liudasb@centras.lt>
To: pyunyh@gmail.com
Cc: =?utf-8?B?TGl1ZGFzIEJha8WheXM=?= <liudasb@centras.lt>, bug-followup@FreeBSD.org
Subject: Re: Re: Re: kern/79262: [dc] Adaptec ANA-6922 not fully supported
Date: Tue, 05 Oct 2010 23:28:59 +0300

 Sorry for late response. Next time I=E2=80=99ll respond quicker.
 
 Yes it is multiport adapter with PCI bus and two DEC chips. Here is pciconf=
  output:
 
 zoidberg# pciconf -lcbv
 hostb0@pci0:0:0:0:      class=3D0x060000 card=3D0x1274103c chip=3D0x2531808=
 6 rev=3D0x04 hdr=3D0x00
     vendor     =3D 'Intel Corporation'
     device     =3D '82860 (860) CPU to I/O Hub Bridge (Interface A)'
     class      =3D bridge
     subclass   =3D HOST-PCI
     bar   [10] =3D type Prefetchable Memory, range 32, base 0xf0000000, siz=
 e 67108864, enabled
     cap 02[a0] =3D AGP 4x 2x 1x SBA disabled
 pcib1@pci0:0:1:0:       class=3D0x060400 card=3D0x00000000 chip=3D0x2532808=
 6 rev=3D0x04 hdr=3D0x01
     vendor     =3D 'Intel Corporation'
     device     =3D 'AGP Bridge (82850/850E/860)'
     class      =3D bridge
     subclass   =3D PCI-PCI
 pcib2@pci0:0:2:0:       class=3D0x060400 card=3D0x00000000 chip=3D0x2533808=
 6 rev=3D0x04 hdr=3D0x01
     vendor     =3D 'Intel Corporation'
     device     =3D '82860 (860) PCI Bridge (Hub Interface B)'
     class      =3D bridge
     subclass   =3D PCI-PCI
 pcib4@pci0:0:30:0:      class=3D0x060400 card=3D0x00000000 chip=3D0x244e808=
 6 rev=3D0x04 hdr=3D0x01
     vendor     =3D 'Intel Corporation'
     device     =3D '82801 Family (ICH2/3/4/5/6/7/8/9,63xxESB) Hub Interface=
  to PCI Bridge'
     class      =3D bridge
     subclass   =3D PCI-PCI
 isab0@pci0:0:31:0:      class=3D0x060100 card=3D0x00000000 chip=3D0x2440808=
 6 rev=3D0x04 hdr=3D0x00
     vendor     =3D 'Intel Corporation'
     device     =3D '82801BA (ICH2) LPC Interface Controller'
     class      =3D bridge
     subclass   =3D PCI-ISA
 atapci0@pci0:0:31:1:    class=3D0x010180 card=3D0x1274103c chip=3D0x244b808=
 6 rev=3D0x04 hdr=3D0x00
     vendor     =3D 'Intel Corporation'
     device     =3D '82801BA (ICH2) UltraATA/100 IDE Controller'
     class      =3D mass storage
     subclass   =3D ATA
     bar   [20] =3D type I/O Port, range 32, base 0x10e0, size 16, enabled
 uhci0@pci0:0:31:2:      class=3D0x0c0300 card=3D0x1274103c chip=3D0x2442808=
 6 rev=3D0x04 hdr=3D0x00
     vendor     =3D 'Intel Corporation'
     device     =3D '82801BA/BAM (ICH2/ICH2-M) USB Universal Host Controller=
 '
     class      =3D serial bus
     subclass   =3D USB
     bar   [20] =3D type I/O Port, range 32, base 0x10c0, size 32, enabled
 none0@pci0:0:31:3:      class=3D0x0c0500 card=3D0x1274103c chip=3D0x2443808=
 6 rev=3D0x04 hdr=3D0x00
     vendor     =3D 'Intel Corporation'
     device     =3D '82801BA/BAM (ICH2/ICH2-M) SMBus Controller'
     class      =3D serial bus
     subclass   =3D SMBus
     bar   [20] =3D type I/O Port, range 32, base 0x10f0, size 16, enabled
 none1@pci0:0:31:5:      class=3D0x040100 card=3D0x1274103c chip=3D0x2445808=
 6 rev=3D0x04 hdr=3D0x00
     vendor     =3D 'Intel Corporation'
     device     =3D '82801BA/BAM (ICH2/ICH2-M) AC'97 Audio Controller'
     class      =3D multimedia
     subclass   =3D audio
     bar   [10] =3D type I/O Port, range 32, base 0x1400, size 256, enabled
     bar   [14] =3D type I/O Port, range 32, base 0x1080, size 64, enabled
 vgapci0@pci0:1:0:0:     class=3D0x030000 card=3D0x23021002 chip=3D0x5e4b100=
 2 rev=3D0x00 hdr=3D0x00
     vendor     =3D 'ATI Technologies Inc. / Advanced Micro Devices, Inc.'
     device     =3D 'ATI RADEON X700 PRO (RV410)'
     class      =3D display
     subclass   =3D VGA
     bar   [10] =3D type Prefetchable Memory, range 32, base 0xe0000000, siz=
 e 268435456, enabled
     bar   [14] =3D type I/O Port, range 32, base 0x2000, size 256, enabled
     bar   [18] =3D type Memory, range 32, base 0xf4000000, size 65536, enab=
 led
     cap 01[50] =3D powerspec 2  supports D0 D1 D2 D3  current D0
     cap 02[58] =3D AGP 4x 2x 1x SBA disabled
     cap 05[80] =3D MSI supports 1 message, 64 bit=20
 vgapci1@pci0:1:0:1:     class=3D0x038000 card=3D0x23031002 chip=3D0x5e6b100=
 2 rev=3D0x00 hdr=3D0x00
     vendor     =3D 'ATI Technologies Inc. / Advanced Micro Devices, Inc.'
     device     =3D 'ATI RADEON X700 PRO Secondary (RV410)'
     class      =3D display
     bar   [10] =3D type Memory, range 32, base 0xf4010000, size 65536, enab=
 led
     cap 01[50] =3D powerspec 2  supports D0 D1 D2 D3  current D0
 pcib3@pci0:2:31:0:      class=3D0x060400 card=3D0x00000000 chip=3D0x1360808=
 6 rev=3D0x03 hdr=3D0x01
     vendor     =3D 'Intel Corporation'
     device     =3D 'Hub Interface to PCI Bridge (82806AA)'
     class      =3D bridge
     subclass   =3D PCI-PCI
 ioapic0@pci0:3:0:0:     class=3D0x080020 card=3D0x11618086 chip=3D0x1161808=
 6 rev=3D0x01 hdr=3D0x00
     vendor     =3D 'Intel Corporation'
     device     =3D '82806AA PCI64 Hub Advanced Programmable Interrupt Contr=
 oller'
     class      =3D base peripheral
     subclass   =3D interrupt controller
     bar   [10] =3D type Memory, range 32, base 0xf4104000, size 4096, enabl=
 ed
 sym0@pci0:3:8:0:        class=3D0x010000 card=3D0x1010103c chip=3D0x0021100=
 0 rev=3D0x01 hdr=3D0x00
     vendor     =3D 'LSI Logic (Was: Symbios Logic, NCR)'
     device     =3D 'PCI to Ultra160 SCSI Controller (LSI53C1000/1000R/1010R=
 /1010-66)'
     class      =3D mass storage
     subclass   =3D SCSI
     bar   [10] =3D type I/O Port, range 32, base 0x3000, size 256, enabled
     bar   [14] =3D type Memory, range 64, base 0xf4105000, size 1024, enabl=
 ed
     bar   [1c] =3D type Memory, range 64, base 0xf4100000, size 8192, enabl=
 ed
     cap 01[40] =3D powerspec 2  supports D0 D1 D2 D3  current D0
 sym1@pci0:3:8:1:        class=3D0x010000 card=3D0x1010103c chip=3D0x0021100=
 0 rev=3D0x01 hdr=3D0x00
     vendor     =3D 'LSI Logic (Was: Symbios Logic, NCR)'
     device     =3D 'PCI to Ultra160 SCSI Controller (LSI53C1000/1000R/1010R=
 /1010-66)'
     class      =3D mass storage
     subclass   =3D SCSI
     bar   [10] =3D type I/O Port, range 32, base 0x3400, size 256, enabled
     bar   [14] =3D type Memory, range 64, base 0xf4105400, size 1024, enabl=
 ed
     bar   [1c] =3D type Memory, range 64, base 0xf4102000, size 8192, enabl=
 ed
     cap 01[40] =3D powerspec 2  supports D0 D1 D2 D3  current D0
 pcib5@pci0:4:9:0:       class=3D0x060400 card=3D0x00000000 chip=3D0x0024101=
 1 rev=3D0x03 hdr=3D0x01
     vendor     =3D 'Digital Equipment Corporation'
     device     =3D 'PCI-PCI Bridge (DC21151/2)'
     class      =3D bridge
     subclass   =3D PCI-PCI
     cap 01[dc] =3D powerspec 1  supports D0 D3  current D0
 fxp0@pci0:4:13:0:       class=3D0x020000 card=3D0x1274103c chip=3D0x1229808=
 6 rev=3D0x0c hdr=3D0x00
     vendor     =3D 'Intel Corporation'
     device     =3D '82550/1/7/8/9 EtherExpress PRO/100(B) Ethernet Adapter'
     class      =3D network
     subclass   =3D ethernet
     bar   [10] =3D type Memory, range 32, base 0xf4220000, size 4096, enabl=
 ed
     bar   [14] =3D type I/O Port, range 32, base 0x4000, size 64, enabled
     bar   [18] =3D type Memory, range 32, base 0xf4200000, size 131072, ena=
 bled
     cap 01[dc] =3D powerspec 2  supports D0 D1 D2 D3  current D0
 dc0@pci0:5:4:0: class=3D0x020000 card=3D0x30001109 chip=3D0x00191011 rev=3D=
 0x41 hdr=3D0x00
     vendor     =3D 'Digital Equipment Corporation'
     device     =3D 'PCI/CardBus 10/100 Mbit Ethernet Ctlr (DC21142/3)'
     class      =3D network
     subclass   =3D ethernet
     bar   [10] =3D type I/O Port, range 32, base 0x5000, size 128, enabled
     bar   [14] =3D type Memory, range 32, base 0xf4300000, size 1024, enabl=
 ed
 dc1@pci0:5:8:0: class=3D0x020000 card=3D0x00000000 chip=3D0x00191011 rev=3D=
 0x41 hdr=3D0x00
     vendor     =3D 'Digital Equipment Corporation'
     device     =3D 'PCI/CardBus 10/100 Mbit Ethernet Ctlr (DC21142/3)'
     class      =3D network
     subclass   =3D ethernet
     bar   [10] =3D type I/O Port, range 32, base 0x5080, size 128, enabled
     bar   [14] =3D type Memory, range 32, base 0xf4300400, size 1024, enabl=
 ed
 
 There is some documentation in Adaptec site. Maybe it will help. Here is th=
 e link: http://www.adaptec.com/en-US/support/_eol/net_dec-based/ANA-6922A/=
 =20
 
 
 
 
 
 
 Nuo:  "Pyun YongHyeon"=20
 Si=C5=B3sta:  2010 09 23   23:48
 Tema:  Re: Re: kern/79262: [dc] Adaptec ANA-6922 not fully supported
 
 
 
 
 On Thu, Sep 23, 2010 at 08:54:47PM +0300, Liudas Bak??ys wrote:
 > Hello,
 >=20
 > I tried your patch and result is the same. Please find attached file with=
  dmesg output.
 
 Ok, on second thought I noticed the patch lacks check for shared a
 slaved ROM. In order to do that I have to know whether the
 controller has multi-port or not. I'm not sure what that could be
 tested at this time but could you show me the output of "pciconf
 -lcbv"? I guess I could get pcidomain, bus, device, function values
 from there.
 
 > If it helps I could send you one ANA-6922 card.
 >=20
 
 Thanks for the offer. But that means you lose the opportunity of
 using dc(4) controller so I'm somewhat reluctant to do that. Let's
 try hard to get fixed and then think about the offer later.
 
 > --
 > Liudas
 >=20
 >=20
 >=20
 > Nuo:  "Pyun YongHyeon"=20
 > Si??sta:  2010 08 24   05:03
 > Tema:  Re: kern/79262: [dc] Adaptec ANA-6922 not fully supported
 >=20
 >=20
 >=20
 >=20
 > On Mon, Aug 23, 2010 at 06:22:58PM +0000, andre@freebsd.org wrote:
 > > Synopsis: [dc] Adaptec ANA-6922 not fully supported
 > >=20
 > > Responsible-Changed-From-To: freebsd-net->yongari
 > > Responsible-Changed-By: andre
 > > Responsible-Changed-When: Mon Aug 23 18:22:28 UTC 2010
 > > Responsible-Changed-Why:=20
 > > Over to expert.
 > >=20
 > > http://www.freebsd.org/cgi/query-pr.cgi?pr=3D79262
 >=20
 > Would you try the following patch and let me know how it goes on
 > your box? I don't have dc(4) controller so it's hard to verify this
 > at this moment.
 > http://people.freebsd.org/~yongari/dc.eaddr.patch
 >=20
 
 > Copyright (c) 1992-2010 The FreeBSD Project.
 > Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
 >         The Regents of the University of California. All rights reserved.
 > FreeBSD is a registered trademark of The FreeBSD Foundation.
 > FreeBSD 8.1-RELEASE #0: Thu Sep 23 20:21:48 UTC 2010
 >     root@zoidberg:/usr/obj/usr/src/sys/GENERIC i386
 > Timecounter "i8254" frequency 1193182 Hz quality 0
 > CPU: Intel(R) Xeon(TM) CPU 2.40GHz (2394.14-MHz 686-class CPU)
 >   Origin =3D "GenuineIntel"  Id =3D 0xf27  Family =3D f  Model =3D 2  Ste=
 pping =3D 7
 >   Features=3D0xbfebfbff
 >   Features2=3D0x400
 > real memory  =3D 1073741824 (1024 MB)
 > avail memory =3D 1035370496 (987 MB)
 > ACPI APIC Table:=20
 > FreeBSD/SMP: Multiprocessor System Detected: 4 CPUs
 > FreeBSD/SMP: 2 package(s) x 1 core(s) x 2 HTT threads
 >  cpu0 (BSP): APIC ID:  0
 >  cpu1 (AP/HT): APIC ID:  1
 >  cpu2 (AP): APIC ID:  6
 >  cpu3 (AP/HT): APIC ID:  7
 > ioapic0  irqs 0-23 on motherboard
 > ioapic1  irqs 24-47 on motherboard
 > kbd1 at kbdmux0
 > acpi0:  on motherboard
 > acpi0: [ITHREAD]
 > acpi0: Power Button (fixed)
 > Timecounter "ACPI-fast" frequency 3579545 Hz quality 1000
 > acpi_timer0:  port 0x1008-0x100b on acpi0
 > cpu0:  on acpi0
 > cpu1:  on acpi0
 > pcib0:  port 0xcf8-0xcff on acpi0
 > pci0:  on pcib0
 > agp0:  on hostb0
 > pcib1:  at device 1.0 on pci0
 > pci1:  on pcib1
 > vgapci0:  port 0x2000-0x20ff mem 0xe0000000-0xefffffff,0xf4000000-0xf400f=
 fff irq 16 at device 0.0 on pci1
 > vgapci1:  mem 0xf4010000-0xf401ffff at device 0.1 on pci1
 > pcib2:  at device 2.0 on pci0
 > pci2:  on pcib2
 > pcib3:  at device 31.0 on pci2
 > pci3:  on pcib3
 > sym0:  port 0x3000-0x30ff mem 0xf4105000-0xf41053ff,0xf4100000-0xf4101fff=
  irq 23 at device 8.0 on pci3
 > sym0: Symbios NVRAM, ID 7, Fast-80, LVD, parity checking
 > sym0: open drain IRQ line driver, using on-chip SRAM
 > sym0: using LOAD/STORE-based firmware.
 > sym0: handling phase mismatch from SCRIPTS.
 > sym0: [ITHREAD]
 > sym1:  port 0x3400-0x34ff mem 0xf4105400-0xf41057ff,0xf4102000-0xf4103fff=
  irq 19 at device 8.1 on pci3
 > sym1: Symbios NVRAM, ID 7, Fast-80, LVD, parity checking
 > sym1: open drain IRQ line driver, using on-chip SRAM
 > sym1: using LOAD/STORE-based firmware.
 > sym1: handling phase mismatch from SCRIPTS.
 > sym1: [ITHREAD]
 > pcib4:  at device 30.0 on pci0
 > pci4:  on pcib4
 > pcib5:  at device 9.0 on pci4
 > pci5:  on pcib5
 > dc0:  port 0x5000-0x507f mem 0xf4300000-0xf43003ff irq 19 at device 4.0 o=
 n pci5
 > miibus0:  on dc0
 > nsphy0:  PHY 1 on miibus0
 > nsphy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
 > dc0: Ethernet address: 00:00:d1:1e:4a:15
 > dc0: [ITHREAD]
 > dc1:  port 0x5080-0x50ff mem 0xf4300400-0xf43007ff irq 19 at device 8.0 o=
 n pci5
 > dc1: No checksum found in SROM
 > dc1: Unknown or invalid SROM format
 > miibus1:  on dc1
 > dcphy0:  PHY 31 on miibus1
 > dcphy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
 > dc1: Ethernet address: ff:ff:ff:ff:ff:ff
 > dc1: [ITHREAD]
 > fxp0:  port 0x4000-0x403f mem 0xf4220000-0xf4220fff,0xf4200000-0xf421ffff=
  irq 21 at device 13.0 on pci4
 > miibus2:  on fxp0
 > inphy0:  PHY 1 on miibus2
 > inphy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
 > fxp0: Ethernet address: 00:e0:81:00:bf:5e
 > fxp0: [ITHREAD]
 > isab0:  at device 31.0 on pci0
 > isa0:  on isab0
 > atapci0:  port 0x1f0-0x1f7,0x3f6,0x170-0x177,0x376,0x10e0-0x10ef at devic=
 e 31.1 on pci0
 > ata0:  on atapci0
 > ata0: [ITHREAD]
 > ata1:  on atapci0
 > ata1: [ITHREAD]
 > uhci0:  port 0x10c0-0x10df irq 19 at device 31.2 on pci0
 > uhci0: [ITHREAD]
 > uhci0: LegSup =3D 0x2f00
 > usbus0:  on uhci0
 > pci0:  at device 31.3 (no driver attached)
 > pci0:  at device 31.5 (no driver attached)
 > acpi_button0:  on acpi0
 > atrtc0:  port 0x70-0x71 irq 8 on acpi0
 > atkbdc0:  port 0x60,0x64 irq 1 on acpi0
 > atkbd0:  irq 1 on atkbdc0
 > kbd0 at atkbd0
 > atkbd0: [GIANT-LOCKED]
 > atkbd0: [ITHREAD]
 > fdc0:  port 0x3f0-0x3f5,0x3f7 irq 6 drq 2 on acpi0
 > fdc0: [FILTER]
 > fd0:  on fdc0 drive 0
 > uart0:  port 0x3f8-0x3ff irq 4 flags 0x10 on acpi0
 > uart0: [FILTER]
 > uart0: console (9600,n,8,1)
 > uart1:  port 0x2f8-0x2ff irq 3 on acpi0
 > uart1: [FILTER]
 > ppc0:  port 0x378-0x37f,0x778-0x77f irq 7 drq 1 on acpi0
 > ppc0: SMC-like chipset (ECP/EPP/PS2/NIBBLE) in COMPATIBLE mode
 > ppc0: FIFO with 16/16/8 bytes threshold
 > ppc0: [ITHREAD]
 > ppbus0:  on ppc0
 > plip0:  on ppbus0
 > plip0: [ITHREAD]
 > lpt0:  on ppbus0
 > lpt0: [ITHREAD]
 > lpt0: Interrupt-driven port
 > ppi0:  on ppbus0
 > pmtimer0 on isa0
 > orm0:  at iomem 0xc0000-0xce7ff,0xce800-0xd27ff pnpid ORM0000 on isa0
 > sc0:  at flags 0x100 on isa0
 > sc0: VGA=20
 > vga0:  at port 0x3c0-0x3df iomem 0xa0000-0xbffff on isa0
 > p4tcc0:  on cpu0
 > p4tcc1:  on cpu1
 > Timecounters tick every 1.000 msec
 > usbus0: 12Mbps Full Speed USB v1.0
 > ata1: DMA limited to UDMA33, controller found non-ATA66 cable
 > ugen0.1:  at usbus0
 > uhub0:  on usbus0
 > acd0: DVDR  at ata1-master UDMA33=20
 > (noperiph:sym0:0:-1:-1): SCSI BUS reset delivered.
 > (noperiph:sym1:0:-1:-1): SCSI BUS reset delivered.
 > uhub0: 2 ports with 2 removable, self powered
 > da0 at sym0 bus 0 scbus0 target 0 lun 0
 > da0:  Fixed Direct Access SCSI-2 device=20
 > da0: 160.000MB/s transfers (80.000MHz DT, offset 62, 16bit)
 > da0: Command Queueing enabled
 > da0: 34732MB (71132960 512 byte sectors: 255H 63S/T 4427C)
 > SMP: AP CPU #2 Launched!
 > SMP: AP CPU #1 Launched!
 > SMP: AP CPU #3 Launched!
 > Trying to mount root from ufs:/dev/da0s1a
 
 

From: Pyun YongHyeon <pyunyh@gmail.com>
To: Liudas Bak??ys <liudasb@centras.lt>
Cc: bug-followup@FreeBSD.org
Subject: Re: Re: Re: kern/79262: [dc] Adaptec ANA-6922 not fully supported
Date: Sat, 9 Oct 2010 18:15:59 -0700

 --sm4nu43k4a2Rpi4c
 Content-Type: text/plain; charset=utf-8
 Content-Disposition: inline
 Content-Transfer-Encoding: 8bit
 
 On Tue, Oct 05, 2010 at 11:28:59PM +0300, Liudas Bak??ys wrote:
 > 
 > Sorry for late response. Next time I’ll respond quicker.
 > 
 > Yes it is multiport adapter with PCI bus and two DEC chips. Here is pciconf output:
 > 
 > zoidberg# pciconf -lcbv
 > hostb0@pci0:0:0:0:      class=0x060000 card=0x1274103c chip=0x25318086 rev=0x04 hdr=0x00
 >     vendor     = 'Intel Corporation'
 >     device     = '82860 (860) CPU to I/O Hub Bridge (Interface A)'
 >     class      = bridge
 >     subclass   = HOST-PCI
 >     bar   [10] = type Prefetchable Memory, range 32, base 0xf0000000, size 67108864, enabled
 >     cap 02[a0] = AGP 4x 2x 1x SBA disabled
 > pcib1@pci0:0:1:0:       class=0x060400 card=0x00000000 chip=0x25328086 rev=0x04 hdr=0x01
 >     vendor     = 'Intel Corporation'
 >     device     = 'AGP Bridge (82850/850E/860)'
 >     class      = bridge
 >     subclass   = PCI-PCI
 > pcib2@pci0:0:2:0:       class=0x060400 card=0x00000000 chip=0x25338086 rev=0x04 hdr=0x01
 >     vendor     = 'Intel Corporation'
 >     device     = '82860 (860) PCI Bridge (Hub Interface B)'
 >     class      = bridge
 >     subclass   = PCI-PCI
 > pcib4@pci0:0:30:0:      class=0x060400 card=0x00000000 chip=0x244e8086 rev=0x04 hdr=0x01
 >     vendor     = 'Intel Corporation'
 >     device     = '82801 Family (ICH2/3/4/5/6/7/8/9,63xxESB) Hub Interface to PCI Bridge'
 >     class      = bridge
 >     subclass   = PCI-PCI
 > isab0@pci0:0:31:0:      class=0x060100 card=0x00000000 chip=0x24408086 rev=0x04 hdr=0x00
 >     vendor     = 'Intel Corporation'
 >     device     = '82801BA (ICH2) LPC Interface Controller'
 >     class      = bridge
 >     subclass   = PCI-ISA
 > atapci0@pci0:0:31:1:    class=0x010180 card=0x1274103c chip=0x244b8086 rev=0x04 hdr=0x00
 >     vendor     = 'Intel Corporation'
 >     device     = '82801BA (ICH2) UltraATA/100 IDE Controller'
 >     class      = mass storage
 >     subclass   = ATA
 >     bar   [20] = type I/O Port, range 32, base 0x10e0, size 16, enabled
 > uhci0@pci0:0:31:2:      class=0x0c0300 card=0x1274103c chip=0x24428086 rev=0x04 hdr=0x00
 >     vendor     = 'Intel Corporation'
 >     device     = '82801BA/BAM (ICH2/ICH2-M) USB Universal Host Controller'
 >     class      = serial bus
 >     subclass   = USB
 >     bar   [20] = type I/O Port, range 32, base 0x10c0, size 32, enabled
 > none0@pci0:0:31:3:      class=0x0c0500 card=0x1274103c chip=0x24438086 rev=0x04 hdr=0x00
 >     vendor     = 'Intel Corporation'
 >     device     = '82801BA/BAM (ICH2/ICH2-M) SMBus Controller'
 >     class      = serial bus
 >     subclass   = SMBus
 >     bar   [20] = type I/O Port, range 32, base 0x10f0, size 16, enabled
 > none1@pci0:0:31:5:      class=0x040100 card=0x1274103c chip=0x24458086 rev=0x04 hdr=0x00
 >     vendor     = 'Intel Corporation'
 >     device     = '82801BA/BAM (ICH2/ICH2-M) AC'97 Audio Controller'
 >     class      = multimedia
 >     subclass   = audio
 >     bar   [10] = type I/O Port, range 32, base 0x1400, size 256, enabled
 >     bar   [14] = type I/O Port, range 32, base 0x1080, size 64, enabled
 > vgapci0@pci0:1:0:0:     class=0x030000 card=0x23021002 chip=0x5e4b1002 rev=0x00 hdr=0x00
 >     vendor     = 'ATI Technologies Inc. / Advanced Micro Devices, Inc.'
 >     device     = 'ATI RADEON X700 PRO (RV410)'
 >     class      = display
 >     subclass   = VGA
 >     bar   [10] = type Prefetchable Memory, range 32, base 0xe0000000, size 268435456, enabled
 >     bar   [14] = type I/O Port, range 32, base 0x2000, size 256, enabled
 >     bar   [18] = type Memory, range 32, base 0xf4000000, size 65536, enabled
 >     cap 01[50] = powerspec 2  supports D0 D1 D2 D3  current D0
 >     cap 02[58] = AGP 4x 2x 1x SBA disabled
 >     cap 05[80] = MSI supports 1 message, 64 bit 
 > vgapci1@pci0:1:0:1:     class=0x038000 card=0x23031002 chip=0x5e6b1002 rev=0x00 hdr=0x00
 >     vendor     = 'ATI Technologies Inc. / Advanced Micro Devices, Inc.'
 >     device     = 'ATI RADEON X700 PRO Secondary (RV410)'
 >     class      = display
 >     bar   [10] = type Memory, range 32, base 0xf4010000, size 65536, enabled
 >     cap 01[50] = powerspec 2  supports D0 D1 D2 D3  current D0
 > pcib3@pci0:2:31:0:      class=0x060400 card=0x00000000 chip=0x13608086 rev=0x03 hdr=0x01
 >     vendor     = 'Intel Corporation'
 >     device     = 'Hub Interface to PCI Bridge (82806AA)'
 >     class      = bridge
 >     subclass   = PCI-PCI
 > ioapic0@pci0:3:0:0:     class=0x080020 card=0x11618086 chip=0x11618086 rev=0x01 hdr=0x00
 >     vendor     = 'Intel Corporation'
 >     device     = '82806AA PCI64 Hub Advanced Programmable Interrupt Controller'
 >     class      = base peripheral
 >     subclass   = interrupt controller
 >     bar   [10] = type Memory, range 32, base 0xf4104000, size 4096, enabled
 > sym0@pci0:3:8:0:        class=0x010000 card=0x1010103c chip=0x00211000 rev=0x01 hdr=0x00
 >     vendor     = 'LSI Logic (Was: Symbios Logic, NCR)'
 >     device     = 'PCI to Ultra160 SCSI Controller (LSI53C1000/1000R/1010R/1010-66)'
 >     class      = mass storage
 >     subclass   = SCSI
 >     bar   [10] = type I/O Port, range 32, base 0x3000, size 256, enabled
 >     bar   [14] = type Memory, range 64, base 0xf4105000, size 1024, enabled
 >     bar   [1c] = type Memory, range 64, base 0xf4100000, size 8192, enabled
 >     cap 01[40] = powerspec 2  supports D0 D1 D2 D3  current D0
 > sym1@pci0:3:8:1:        class=0x010000 card=0x1010103c chip=0x00211000 rev=0x01 hdr=0x00
 >     vendor     = 'LSI Logic (Was: Symbios Logic, NCR)'
 >     device     = 'PCI to Ultra160 SCSI Controller (LSI53C1000/1000R/1010R/1010-66)'
 >     class      = mass storage
 >     subclass   = SCSI
 >     bar   [10] = type I/O Port, range 32, base 0x3400, size 256, enabled
 >     bar   [14] = type Memory, range 64, base 0xf4105400, size 1024, enabled
 >     bar   [1c] = type Memory, range 64, base 0xf4102000, size 8192, enabled
 >     cap 01[40] = powerspec 2  supports D0 D1 D2 D3  current D0
 > pcib5@pci0:4:9:0:       class=0x060400 card=0x00000000 chip=0x00241011 rev=0x03 hdr=0x01
 >     vendor     = 'Digital Equipment Corporation'
 >     device     = 'PCI-PCI Bridge (DC21151/2)'
 >     class      = bridge
 >     subclass   = PCI-PCI
 >     cap 01[dc] = powerspec 1  supports D0 D3  current D0
 > fxp0@pci0:4:13:0:       class=0x020000 card=0x1274103c chip=0x12298086 rev=0x0c hdr=0x00
 >     vendor     = 'Intel Corporation'
 >     device     = '82550/1/7/8/9 EtherExpress PRO/100(B) Ethernet Adapter'
 >     class      = network
 >     subclass   = ethernet
 >     bar   [10] = type Memory, range 32, base 0xf4220000, size 4096, enabled
 >     bar   [14] = type I/O Port, range 32, base 0x4000, size 64, enabled
 >     bar   [18] = type Memory, range 32, base 0xf4200000, size 131072, enabled
 >     cap 01[dc] = powerspec 2  supports D0 D1 D2 D3  current D0
 > dc0@pci0:5:4:0: class=0x020000 card=0x30001109 chip=0x00191011 rev=0x41 hdr=0x00
 >     vendor     = 'Digital Equipment Corporation'
 >     device     = 'PCI/CardBus 10/100 Mbit Ethernet Ctlr (DC21142/3)'
 >     class      = network
 >     subclass   = ethernet
 >     bar   [10] = type I/O Port, range 32, base 0x5000, size 128, enabled
 >     bar   [14] = type Memory, range 32, base 0xf4300000, size 1024, enabled
 > dc1@pci0:5:8:0: class=0x020000 card=0x00000000 chip=0x00191011 rev=0x41 hdr=0x00
 >     vendor     = 'Digital Equipment Corporation'
 >     device     = 'PCI/CardBus 10/100 Mbit Ethernet Ctlr (DC21142/3)'
 >     class      = network
 >     subclass   = ethernet
 >     bar   [10] = type I/O Port, range 32, base 0x5080, size 128, enabled
 >     bar   [14] = type Memory, range 32, base 0xf4300400, size 1024, enabled
 > 
 
 Thank you for the pciconf output.
 
 > There is some documentation in Adaptec site. Maybe it will help. Here is the link: http://www.adaptec.com/en-US/support/_eol/net_dec-based/ANA-6922A/ 
 > 
 
 The data sheet is for StarFire controller.
 Anyway, would you try attached patch and let me know whether it
 makes any difference?
 
 --sm4nu43k4a2Rpi4c
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: attachment; filename="dc.eaddr.patch2"
 
 Index: sys/dev/dc/if_dc.c
 ===================================================================
 --- sys/dev/dc/if_dc.c	(revision 213663)
 +++ sys/dev/dc/if_dc.c	(working copy)
 @@ -293,6 +293,7 @@
  static void dc_decode_leaf_mii(struct dc_softc *, struct dc_eblock_mii *);
  static void dc_decode_leaf_sym(struct dc_softc *, struct dc_eblock_sym *);
  static void dc_apply_fixup(struct dc_softc *, int);
 +static int dc_check_multiport(struct dc_softc *);
  
  #ifdef DC_USEIOSPACE
  #define DC_RES			SYS_RES_IOPORT
 @@ -2088,6 +2089,18 @@
  		break;
  	}
  
 +	bcopy(eaddr, sc->dc_eaddr, sizeof(eaddr));
 +	/*
 +	 * If we still have invalid station address, see whether we can
 +	 * find station address for chip 0.  Some multi-port controllers
 +	 * just store station address for chip 0 if they have a shared
 +	 * SROM.
 +	 */
 +	if ((sc->dc_eaddr[0] == 0 && (sc->dc_eaddr[1] & ~0xffff) == 0) ||
 +	    (sc->dc_eaddr[0] == 0xffffffff &&
 +	    (sc->dc_eaddr[1] & ~0xffff) == 0xffff))
 +		dc_check_multiport(sc);
 +
  	/* Allocate a busdma tag and DMA safe memory for TX/RX descriptors. */
  	error = bus_dma_tag_create(bus_get_dma_tag(dev), PAGE_SIZE, 0,
  	    BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL,
 @@ -3808,3 +3821,34 @@
  
  	return (0);
  }
 +
 +static int
 +dc_check_multiport(struct dc_softc *sc)
 +{
 +	struct dc_softc *dsc;
 +	devclass_t dc;
 +	device_t child;
 +	uint8_t *eaddr;
 +	int unit;
 +
 +	dc = devclass_find("dc");
 +	for (unit = 0; unit < devclass_get_maxunit(dc); unit++) {
 +		child = devclass_get_device(dc, unit);
 +		if (child == NULL)
 +			continue;
 +		if (child == sc->dc_dev)
 +			continue;
 +		if (device_get_parent(child) != device_get_parent(sc->dc_dev))
 +			continue;
 +		if (unit > device_get_unit(sc->dc_dev))
 +			continue;
 +		dsc = device_get_softc(child);
 +		device_printf(sc->dc_dev, "Use station address of %s as base",
 +		    device_get_nameunit(child));
 +		bcopy(dsc->dc_eaddr, sc->dc_eaddr, ETHER_ADDR_LEN);
 +		eaddr = (uint8_t *)sc->dc_eaddr;
 +		eaddr[5]++;
 +		return (0);
 +	}
 +	return (ENOENT);
 +}
 Index: sys/dev/dc/if_dcreg.h
 ===================================================================
 --- sys/dev/dc/if_dcreg.h	(revision 213663)
 +++ sys/dev/dc/if_dcreg.h	(working copy)
 @@ -745,6 +745,7 @@
  	int			dc_if_media;
  	u_int32_t		dc_flags;
  	u_int32_t		dc_txthresh;
 +	u_int32_t		dc_eaddr[2];
  	u_int8_t		*dc_srom;
  	struct dc_mediainfo	*dc_mi;
  	struct dc_list_data	*dc_ldata;
 
 --sm4nu43k4a2Rpi4c--

From: Pyun YongHyeon <pyunyh@gmail.com>
To: Liudas Bak??ys <liudasb@centras.lt>
Cc: bug-followup@FreeBSD.org
Subject: Re: Re: Re: kern/79262: [dc] Adaptec ANA-6922 not fully supported
Date: Sat, 9 Oct 2010 18:22:36 -0700

 --Bn2rw/3z4jIqBvZU
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 
 On Sat, Oct 09, 2010 at 06:15:59PM -0700, Pyun YongHyeon wrote:
 
 [...]
 
 > Anyway, would you try attached patch and let me know whether it
 > makes any difference?
 
 Oops, there was a bug in previous patch. Use this one instead.
 
 --Bn2rw/3z4jIqBvZU
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: attachment; filename="dc.eaddr.patch3"
 
 Index: sys/dev/dc/if_dc.c
 ===================================================================
 --- sys/dev/dc/if_dc.c	(revision 213663)
 +++ sys/dev/dc/if_dc.c	(working copy)
 @@ -293,6 +293,7 @@
  static void dc_decode_leaf_mii(struct dc_softc *, struct dc_eblock_mii *);
  static void dc_decode_leaf_sym(struct dc_softc *, struct dc_eblock_sym *);
  static void dc_apply_fixup(struct dc_softc *, int);
 +static int dc_check_multiport(struct dc_softc *);
  
  #ifdef DC_USEIOSPACE
  #define DC_RES			SYS_RES_IOPORT
 @@ -2088,6 +2089,20 @@
  		break;
  	}
  
 +	bcopy(eaddr, sc->dc_eaddr, sizeof(eaddr));
 +	/*
 +	 * If we still have invalid station address, see whether we can
 +	 * find station address for chip 0.  Some multi-port controllers
 +	 * just store station address for chip 0 if they have a shared
 +	 * SROM.
 +	 */
 +	if ((sc->dc_eaddr[0] == 0 && (sc->dc_eaddr[1] & ~0xffff) == 0) ||
 +	    (sc->dc_eaddr[0] == 0xffffffff &&
 +	    (sc->dc_eaddr[1] & ~0xffff) == 0xffff)) {
 +		if (dc_check_multiport(sc) == 0)
 +			bcopy(sc->dc_eaddr, eaddr, sizeof(eaddr));
 +	}
 +
  	/* Allocate a busdma tag and DMA safe memory for TX/RX descriptors. */
  	error = bus_dma_tag_create(bus_get_dma_tag(dev), PAGE_SIZE, 0,
  	    BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL,
 @@ -3808,3 +3823,34 @@
  
  	return (0);
  }
 +
 +static int
 +dc_check_multiport(struct dc_softc *sc)
 +{
 +	struct dc_softc *dsc;
 +	devclass_t dc;
 +	device_t child;
 +	uint8_t *eaddr;
 +	int unit;
 +
 +	dc = devclass_find("dc");
 +	for (unit = 0; unit < devclass_get_maxunit(dc); unit++) {
 +		child = devclass_get_device(dc, unit);
 +		if (child == NULL)
 +			continue;
 +		if (child == sc->dc_dev)
 +			continue;
 +		if (device_get_parent(child) != device_get_parent(sc->dc_dev))
 +			continue;
 +		if (unit > device_get_unit(sc->dc_dev))
 +			continue;
 +		dsc = device_get_softc(child);
 +		device_printf(sc->dc_dev, "Use station address of %s as base",
 +		    device_get_nameunit(child));
 +		bcopy(dsc->dc_eaddr, sc->dc_eaddr, ETHER_ADDR_LEN);
 +		eaddr = (uint8_t *)sc->dc_eaddr;
 +		eaddr[5]++;
 +		return (0);
 +	}
 +	return (ENOENT);
 +}
 Index: sys/dev/dc/if_dcreg.h
 ===================================================================
 --- sys/dev/dc/if_dcreg.h	(revision 213663)
 +++ sys/dev/dc/if_dcreg.h	(working copy)
 @@ -745,6 +745,7 @@
  	int			dc_if_media;
  	u_int32_t		dc_flags;
  	u_int32_t		dc_txthresh;
 +	u_int32_t		dc_eaddr[2];
  	u_int8_t		*dc_srom;
  	struct dc_mediainfo	*dc_mi;
  	struct dc_list_data	*dc_ldata;
 
 --Bn2rw/3z4jIqBvZU--

From: =?utf-8?B?TGl1ZGFzIEJha8WheXM=?= <liudasb@centras.lt>
To: pyunyh@gmail.com
Cc: =?utf-8?B?TGl1ZGFzIEJha8WheXM=?= <liudasb@centras.lt>, bug-followup@FreeBSD.org
Subject: Re: Re: Re: Re: kern/79262: [dc] Adaptec ANA-6922 not fully supported
Date: Mon, 11 Oct 2010 20:45:38 +0300

 I have loaded if_dc as kernel module so no point to attach whole dmesg outp=
 ut. Here is the dmesg output when I loaded if_dc with patch3.
 
 dc0: <Intel 21143 10/100BaseTX> port 0x5000-0x507f mem 0xf4300000-0xf43003f=
 f irq 19 at device 4.0 on pci5
 miibus1: <MII bus> on dc0
 nsphy0: <DP83840 10/100 media interface> PHY 1 on miibus1
 nsphy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
 dc0: Ethernet address: 00:00:d1:1e:4a:15
 dc0: [ITHREAD]
 dc1: <Intel 21143 10/100BaseTX> port 0x5080-0x50ff mem 0xf4300400-0xf43007f=
 f irq 19 at device 8.0 on pci5
 dc1: No checksum found in SROM
 dc1: Unknown or invalid SROM format
 miibus2: <MII bus> on dc1
 ukphy0: <Generic IEEE 802.3u media interface> PHY 31 on miibus2
 ukphy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 100baseT4
 dc1: Ethernet address: ff:ff:ff:ff:ff:ff
 dc1: [ITHREAD]
 dc0: link state changed to DOWN
 dc1: link state changed to DOWN
 
 In my case, following condition is not true and function dc_check_multiport=
  not executed.
 
         if ((sc->dc_eaddr[0] =3D=3D 0 && (sc->dc_eaddr[1] & ~0xffff) =3D=3D=
  0) ||=20
             (sc->dc_eaddr[0] =3D=3D 0xffffffff &&
             (sc->dc_eaddr[1] & ~0xffff) =3D=3D 0xffff)) {
                 if (dc_check_multiport(sc) =3D=3D 0)=20
                         bcopy(sc->dc_eaddr, eaddr, sizeof(eaddr));
         }
 
 Here are dc_eaddr values when loading dc0 and dc1:
 
 dc0:
 dc_eaddr[0] =3D 1ed10000
 dc_eaddr[1] =3D 154a
 
 dc1:
 dc_eaddr[0] =3D ffffffff
 dc_eaddr[1] =3D ffff
 
 I don=E2=80=99t understand following part of condition (sc->dc_eaddr[1] & ~=
 0xffff) =3D=3D 0xffff, but I changed it to see how dc_if works when dc_chec=
 k_multiport gets executed. So I changed it into (sc->dc_eaddr[1] & 0xffff) =
 =3D=3D 0xffff (without not). Here is the output:=20
 
 dc0: <Intel 21143 10/100BaseTX> port 0x5000-0x507f mem 0xf4300000-0xf43003f=
 f irq 19 at device 4.0 on pci5
 dc0: Checking for multiport: dc_eaddr0 1ed10000, dc_eaddr1 154a
 miibus1: <MII bus> on dc0
 nsphy0: <DP83840 10/100 media interface> PHY 1 on miibus1
 nsphy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
 dc0: Ethernet address: 00:00:d1:1e:4a:15
 dc0: [ITHREAD]
 dc1: <Intel 21143 10/100BaseTX> port 0x5080-0x50ff mem 0xf4300400-0xf43007f=
 f irq 19 at device 8.0 on pci5
 dc1: No checksum found in SROM
 dc1: Unknown or invalid SROM format
 dc1: Checking for multiport: dc_eaddr0 ffffffff, dc_eaddr1 ffff
 dc1: Use station address of dc0 as basemiibus2: <MII bus> on dc1
 ukphy0: <Generic IEEE 802.3u media interface> PHY 31 on miibus2
 ukphy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 100baseT4
 dc1: Ethernet address: 00:00:d1:1e:4a:16
 dc1: [ITHREAD]
 dc0: link state changed to DOWN
 dc1: link state changed to DOWN
 dc0: link state changed to UP
 dc0: link state changed to DOWN
 dc0: link state changed to UP
 dc0: link state changed to DOWN
 
 Notice how the link state changes. When I connect a cable to dc0 then link =
 state changes to UP and then to DOWN, when I connect a cable to dc1 then li=
 nk state does not changes and stays DOWN.
 
 
 
 
 Nuo:  "Pyun YongHyeon"=20
 Si=C5=B3sta:  2010 10 10   04:22
 Tema:  Re: Re: Re: kern/79262: [dc] Adaptec ANA-6922 not fully supported
 
 
 On Sat, Oct 09, 2010 at 06:15:59PM -0700, Pyun YongHyeon wrote:
 
 [...]
 
 > Anyway, would you try attached patch and let me know whether it
 > makes any difference?
 
 Oops, there was a bug in previous patch. Use this one instead.
 
 

From: Pyun YongHyeon <pyunyh@gmail.com>
To: Liudas Bak??ys <liudasb@centras.lt>
Cc: bug-followup@FreeBSD.org
Subject: Re: Re: Re: Re: kern/79262: [dc] Adaptec ANA-6922 not fully supported
Date: Mon, 11 Oct 2010 11:31:47 -0700

 On Mon, Oct 11, 2010 at 08:45:38PM +0300, Liudas Bak??ys wrote:
 > 
 > I have loaded if_dc as kernel module so no point to attach whole dmesg output. Here is the dmesg output when I loaded if_dc with patch3.
 > 
 > dc0: <Intel 21143 10/100BaseTX> port 0x5000-0x507f mem 0xf4300000-0xf43003ff irq 19 at device 4.0 on pci5
 > miibus1: <MII bus> on dc0
 > nsphy0: <DP83840 10/100 media interface> PHY 1 on miibus1
 > nsphy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
 > dc0: Ethernet address: 00:00:d1:1e:4a:15
 > dc0: [ITHREAD]
 > dc1: <Intel 21143 10/100BaseTX> port 0x5080-0x50ff mem 0xf4300400-0xf43007ff irq 19 at device 8.0 on pci5
 > dc1: No checksum found in SROM
 > dc1: Unknown or invalid SROM format
 > miibus2: <MII bus> on dc1
 > ukphy0: <Generic IEEE 802.3u media interface> PHY 31 on miibus2
 > ukphy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 100baseT4
 > dc1: Ethernet address: ff:ff:ff:ff:ff:ff
 > dc1: [ITHREAD]
 > dc0: link state changed to DOWN
 > dc1: link state changed to DOWN
 > 
 > In my case, following condition is not true and function dc_check_multiport not executed.
 > 
 >         if ((sc->dc_eaddr[0] == 0 && (sc->dc_eaddr[1] & ~0xffff) == 0) || 
 >             (sc->dc_eaddr[0] == 0xffffffff &&
 >             (sc->dc_eaddr[1] & ~0xffff) == 0xffff)) {
 >                 if (dc_check_multiport(sc) == 0) 
 >                         bcopy(sc->dc_eaddr, eaddr, sizeof(eaddr));
 >         }
 > 
 > Here are dc_eaddr values when loading dc0 and dc1:
 > 
 > dc0:
 > dc_eaddr[0] = 1ed10000
 > dc_eaddr[1] = 154a
 > 
 > dc1:
 > dc_eaddr[0] = ffffffff
 > dc_eaddr[1] = ffff
 > 
 > I don’t understand following part of condition (sc->dc_eaddr[1] & ~0xffff) == 0xffff, but I changed it to see how dc_if works when dc_check_multiport gets executed. So I changed it into (sc->dc_eaddr[1] & 0xffff) == 0xffff (without not). Here is the output: 
 > 
 
 Nice catch! It might be a typo. Thanks for fixing that.
 
 > dc0: <Intel 21143 10/100BaseTX> port 0x5000-0x507f mem 0xf4300000-0xf43003ff irq 19 at device 4.0 on pci5
 > dc0: Checking for multiport: dc_eaddr0 1ed10000, dc_eaddr1 154a
 > miibus1: <MII bus> on dc0
 > nsphy0: <DP83840 10/100 media interface> PHY 1 on miibus1
 > nsphy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
 > dc0: Ethernet address: 00:00:d1:1e:4a:15
 > dc0: [ITHREAD]
 > dc1: <Intel 21143 10/100BaseTX> port 0x5080-0x50ff mem 0xf4300400-0xf43007ff irq 19 at device 8.0 on pci5
 > dc1: No checksum found in SROM
 > dc1: Unknown or invalid SROM format
 > dc1: Checking for multiport: dc_eaddr0 ffffffff, dc_eaddr1 ffff
 > dc1: Use station address of dc0 as basemiibus2: <MII bus> on dc1
 > ukphy0: <Generic IEEE 802.3u media interface> PHY 31 on miibus2
 > ukphy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 100baseT4
 > dc1: Ethernet address: 00:00:d1:1e:4a:16
 
 It seems it worked. :-)
 
 > dc1: [ITHREAD]
 > dc0: link state changed to DOWN
 > dc1: link state changed to DOWN
 > dc0: link state changed to UP
 > dc0: link state changed to DOWN
 > dc0: link state changed to UP
 > dc0: link state changed to DOWN
 > 
 > Notice how the link state changes. When I connect a cable to dc0 then link state changes to UP and then to DOWN, when I connect a cable to dc1 then link state does not changes and stays DOWN.
 > 
 > 
 
 This could be difference issue. It seems dc(4) reinitialize
 controller whenever IP addresses are added/removed(e.g. DHCP or
 alias etc). And I guess you didn't configure dc1, right?
 I'll see what can be done in dc(4) for this issue but it looks
 hard due to too many variants of dc(4) controllers.

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/79262: commit references a PR
Date: Thu, 14 Oct 2010 17:22:44 +0000 (UTC)

 Author: yongari
 Date: Thu Oct 14 17:22:38 2010
 New Revision: 213841
 URL: http://svn.freebsd.org/changeset/base/213841
 
 Log:
   It seems some multi-port dc(4) controllers shares SROM of the first
   port such that reading station address from second port always
   returned 0xFF:0xFF:0xFF:0xFF:0xFF:0xFF Unfortunately it seems there
   is no easy way to know whether SROM is shared or not. Workaround
   the issue by traversing dc(4) device list and see whether we're
   using second port and use station address of controller 0 as base
   station address of second port.
   
   PR:		kern/79262
   MFC after:	2 weeks
 
 Modified:
   head/sys/dev/dc/if_dc.c
   head/sys/dev/dc/if_dcreg.h
 
 Modified: head/sys/dev/dc/if_dc.c
 ==============================================================================
 --- head/sys/dev/dc/if_dc.c	Thu Oct 14 16:44:44 2010	(r213840)
 +++ head/sys/dev/dc/if_dc.c	Thu Oct 14 17:22:38 2010	(r213841)
 @@ -293,6 +293,7 @@ static void dc_decode_leaf_sia(struct dc
  static void dc_decode_leaf_mii(struct dc_softc *, struct dc_eblock_mii *);
  static void dc_decode_leaf_sym(struct dc_softc *, struct dc_eblock_sym *);
  static void dc_apply_fixup(struct dc_softc *, int);
 +static int dc_check_multiport(struct dc_softc *);
  
  #ifdef DC_USEIOSPACE
  #define DC_RES			SYS_RES_IOPORT
 @@ -2088,6 +2089,20 @@ dc_attach(device_t dev)
  		break;
  	}
  
 +	bcopy(eaddr, sc->dc_eaddr, sizeof(eaddr));
 +	/*
 +	 * If we still have invalid station address, see whether we can
 +	 * find station address for chip 0.  Some multi-port controllers
 +	 * just store station address for chip 0 if they have a shared
 +	 * SROM.
 +	 */
 +	if ((sc->dc_eaddr[0] == 0 && (sc->dc_eaddr[1] & ~0xffff) == 0) ||
 +	    (sc->dc_eaddr[0] == 0xffffffff &&
 +	    (sc->dc_eaddr[1] & 0xffff) == 0xffff)) {
 +		if (dc_check_multiport(sc) == 0)
 +			bcopy(sc->dc_eaddr, eaddr, sizeof(eaddr));
 +	}
 +
  	/* Allocate a busdma tag and DMA safe memory for TX/RX descriptors. */
  	error = bus_dma_tag_create(bus_get_dma_tag(dev), PAGE_SIZE, 0,
  	    BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL,
 @@ -3808,3 +3823,34 @@ dc_shutdown(device_t dev)
  
  	return (0);
  }
 +
 +static int
 +dc_check_multiport(struct dc_softc *sc)
 +{
 +	struct dc_softc *dsc;
 +	devclass_t dc;
 +	device_t child;
 +	uint8_t *eaddr;
 +	int unit;
 +
 +	dc = devclass_find("dc");
 +	for (unit = 0; unit < devclass_get_maxunit(dc); unit++) {
 +		child = devclass_get_device(dc, unit);
 +		if (child == NULL)
 +			continue;
 +		if (child == sc->dc_dev)
 +			continue;
 +		if (device_get_parent(child) != device_get_parent(sc->dc_dev))
 +			continue;
 +		if (unit > device_get_unit(sc->dc_dev))
 +			continue;
 +		dsc = device_get_softc(child);
 +		device_printf(sc->dc_dev, "Using station address of %s as base",
 +		    device_get_nameunit(child));
 +		bcopy(dsc->dc_eaddr, sc->dc_eaddr, ETHER_ADDR_LEN);
 +		eaddr = (uint8_t *)sc->dc_eaddr;
 +		eaddr[5]++;
 +		return (0);
 +	}
 +	return (ENOENT);
 +}
 
 Modified: head/sys/dev/dc/if_dcreg.h
 ==============================================================================
 --- head/sys/dev/dc/if_dcreg.h	Thu Oct 14 16:44:44 2010	(r213840)
 +++ head/sys/dev/dc/if_dcreg.h	Thu Oct 14 17:22:38 2010	(r213841)
 @@ -745,6 +745,7 @@ struct dc_softc {
  	int			dc_if_media;
  	u_int32_t		dc_flags;
  	u_int32_t		dc_txthresh;
 +	u_int32_t		dc_eaddr[2];
  	u_int8_t		*dc_srom;
  	struct dc_mediainfo	*dc_mi;
  	struct dc_list_data	*dc_ldata;
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: feedback->patched 
State-Changed-By: yongari 
State-Changed-When: Thu Oct 14 18:52:26 UTC 2010 
State-Changed-Why:  
Patch committed to HEAD, will MFC after 2 weeks. 
Thanks a lot for testing and detailed bug report. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=79262 

From: Pyun YongHyeon <pyunyh@gmail.com>
To: Liudas Bak??ys <liudasb@centras.lt>
Cc: bug-followup@FreeBSD.org
Subject: Re: Re: Re: Re: kern/79262: [dc] Adaptec ANA-6922 not fully supported
Date: Thu, 14 Oct 2010 12:32:14 -0700

 --ikeVEW9yuYc//A+q
 Content-Type: text/plain; charset=utf-8
 Content-Disposition: inline
 Content-Transfer-Encoding: 8bit
 
 On Mon, Oct 11, 2010 at 11:31:47AM -0700, Pyun YongHyeon wrote:
 > On Mon, Oct 11, 2010 at 08:45:38PM +0300, Liudas Bak??ys wrote:
 > > 
 > > I have loaded if_dc as kernel module so no point to attach whole dmesg output. Here is the dmesg output when I loaded if_dc with patch3.
 > > 
 > > dc0: <Intel 21143 10/100BaseTX> port 0x5000-0x507f mem 0xf4300000-0xf43003ff irq 19 at device 4.0 on pci5
 > > miibus1: <MII bus> on dc0
 > > nsphy0: <DP83840 10/100 media interface> PHY 1 on miibus1
 > > nsphy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
 > > dc0: Ethernet address: 00:00:d1:1e:4a:15
 > > dc0: [ITHREAD]
 > > dc1: <Intel 21143 10/100BaseTX> port 0x5080-0x50ff mem 0xf4300400-0xf43007ff irq 19 at device 8.0 on pci5
 > > dc1: No checksum found in SROM
 > > dc1: Unknown or invalid SROM format
 > > miibus2: <MII bus> on dc1
 > > ukphy0: <Generic IEEE 802.3u media interface> PHY 31 on miibus2
 > > ukphy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 100baseT4
 > > dc1: Ethernet address: ff:ff:ff:ff:ff:ff
 > > dc1: [ITHREAD]
 > > dc0: link state changed to DOWN
 > > dc1: link state changed to DOWN
 > > 
 > > In my case, following condition is not true and function dc_check_multiport not executed.
 > > 
 > >         if ((sc->dc_eaddr[0] == 0 && (sc->dc_eaddr[1] & ~0xffff) == 0) || 
 > >             (sc->dc_eaddr[0] == 0xffffffff &&
 > >             (sc->dc_eaddr[1] & ~0xffff) == 0xffff)) {
 > >                 if (dc_check_multiport(sc) == 0) 
 > >                         bcopy(sc->dc_eaddr, eaddr, sizeof(eaddr));
 > >         }
 > > 
 > > Here are dc_eaddr values when loading dc0 and dc1:
 > > 
 > > dc0:
 > > dc_eaddr[0] = 1ed10000
 > > dc_eaddr[1] = 154a
 > > 
 > > dc1:
 > > dc_eaddr[0] = ffffffff
 > > dc_eaddr[1] = ffff
 > > 
 > > I don’t understand following part of condition (sc->dc_eaddr[1] & ~0xffff) == 0xffff, but I changed it to see how dc_if works when dc_check_multiport gets executed. So I changed it into (sc->dc_eaddr[1] & 0xffff) == 0xffff (without not). Here is the output: 
 > > 
 > 
 > Nice catch! It might be a typo. Thanks for fixing that.
 > 
 > > dc0: <Intel 21143 10/100BaseTX> port 0x5000-0x507f mem 0xf4300000-0xf43003ff irq 19 at device 4.0 on pci5
 > > dc0: Checking for multiport: dc_eaddr0 1ed10000, dc_eaddr1 154a
 > > miibus1: <MII bus> on dc0
 > > nsphy0: <DP83840 10/100 media interface> PHY 1 on miibus1
 > > nsphy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
 > > dc0: Ethernet address: 00:00:d1:1e:4a:15
 > > dc0: [ITHREAD]
 > > dc1: <Intel 21143 10/100BaseTX> port 0x5080-0x50ff mem 0xf4300400-0xf43007ff irq 19 at device 8.0 on pci5
 > > dc1: No checksum found in SROM
 > > dc1: Unknown or invalid SROM format
 > > dc1: Checking for multiport: dc_eaddr0 ffffffff, dc_eaddr1 ffff
 > > dc1: Use station address of dc0 as basemiibus2: <MII bus> on dc1
 > > ukphy0: <Generic IEEE 802.3u media interface> PHY 31 on miibus2
 > > ukphy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 100baseT4
 > > dc1: Ethernet address: 00:00:d1:1e:4a:16
 > 
 > It seems it worked. :-)
 > 
 > > dc1: [ITHREAD]
 > > dc0: link state changed to DOWN
 > > dc1: link state changed to DOWN
 > > dc0: link state changed to UP
 > > dc0: link state changed to DOWN
 > > dc0: link state changed to UP
 > > dc0: link state changed to DOWN
 > > 
 > > Notice how the link state changes. When I connect a cable to dc0 then link state changes to UP and then to DOWN, when I connect a cable to dc1 then link state does not changes and stays DOWN.
 > > 
 > > 
 > 
 > This could be difference issue. It seems dc(4) reinitialize
 > controller whenever IP addresses are added/removed(e.g. DHCP or
 > alias etc). And I guess you didn't configure dc1, right?
 > I'll see what can be done in dc(4) for this issue but it looks
 > hard due to too many variants of dc(4) controllers.
 
 After reading this PR again, I noticed your PHY was picked up by
 ukphy(4) which does not look right to me. Would you try attached
 patch again? The patch generated against HEAD.
 
 --ikeVEW9yuYc//A+q
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: attachment; filename="dc.eaddr.patch5"
 
 Index: sys/dev/dc/if_dc.c
 ===================================================================
 --- sys/dev/dc/if_dc.c	(revision 213841)
 +++ sys/dev/dc/if_dc.c	(working copy)
 @@ -1820,6 +1820,7 @@
  	u_int32_t command;
  	struct dc_softc *sc;
  	struct ifnet *ifp;
 +	struct dc_mediainfo *m;
  	u_int32_t reg, revision;
  	int error = 0, rid, mac_offset;
  	int i;
 @@ -2099,8 +2100,19 @@
  	if ((sc->dc_eaddr[0] == 0 && (sc->dc_eaddr[1] & ~0xffff) == 0) ||
  	    (sc->dc_eaddr[0] == 0xffffffff &&
  	    (sc->dc_eaddr[1] & 0xffff) == 0xffff)) {
 -		if (dc_check_multiport(sc) == 0)
 +		if (dc_check_multiport(sc) == 0) {
  			bcopy(sc->dc_eaddr, eaddr, sizeof(eaddr));
 +			/* Extract media information. */
 +			if (DC_IS_INTEL(sc)) {
 +				while (sc->dc_mi != NULL) {
 +					m = sc->dc_mi->dc_next;
 +					free(sc->dc_mi, M_DEVBUF);
 +					sc->dc_mi = m;
 +				}
 +				sc->dc_mi = NULL;
 +				dc_parse_21143_srom(sc);
 +			}
 +		}
  	}
  
  	/* Allocate a busdma tag and DMA safe memory for TX/RX descriptors. */
 @@ -3850,6 +3862,9 @@
  		bcopy(dsc->dc_eaddr, sc->dc_eaddr, ETHER_ADDR_LEN);
  		eaddr = (uint8_t *)sc->dc_eaddr;
  		eaddr[5]++;
 +		/* Prepare SROM to parse again. */
 +		if (DC_IS_INTEL(sc) && sc->dc_srom != NULL)
 +			bcopy(dsc->dc_srom, sc->dc_srom, 2 << sc->dc_romwidth);
  		return (0);
  	}
  	return (ENOENT);
 
 --ikeVEW9yuYc//A+q--
State-Changed-From-To: patched->suspended 
State-Changed-By: yongari 
State-Changed-When: Mon Nov 22 00:54:58 UTC 2010 
State-Changed-Why:  
r213841 addressed invalid station address issue on dual-port dc(4) 
controllers but it seems that's not enough to make it work on 
recent FreeBSD releases.  Due to unknown reasons dc(4) did not work 
on recent releases which used to work without problems on 
4.11-RELEASE. This kind of issue is hard to fix with traditional 
trial and errors/feedback method. Suspend it until I have access to 
the hardware on my box. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=79262 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/79262: commit references a PR
Date: Fri, 18 Feb 2011 02:14:59 +0000 (UTC)

 Author: yongari
 Date: Fri Feb 18 02:14:53 2011
 New Revision: 218787
 URL: http://svn.freebsd.org/changeset/base/218787
 
 Log:
   When driver have to use base softc due to lack of SROM on second
   port, copy SROM information from base softc as well and run SROM
   parser again.  This change is necessary for some dual port
   controllers to make dc(4) correctly detect PHY media based on first
   port configuration table.
   While I'm here add a check for validity of the base softc before
   duplicating SROM contents from base softc. If driver failed to
   attach to the first port it can access invalid area.
   
   PR:		kern/79262
   Reviewed by:	marius
 
 Modified:
   head/sys/dev/dc/if_dc.c
 
 Modified: head/sys/dev/dc/if_dc.c
 ==============================================================================
 --- head/sys/dev/dc/if_dc.c	Fri Feb 18 01:56:25 2011	(r218786)
 +++ head/sys/dev/dc/if_dc.c	Fri Feb 18 02:14:53 2011	(r218787)
 @@ -1815,6 +1815,7 @@ dc_attach(device_t dev)
  	u_int32_t command;
  	struct dc_softc *sc;
  	struct ifnet *ifp;
 +	struct dc_mediainfo *m;
  	u_int32_t reg, revision;
  	int error, i, mac_offset, phy, rid, tmp;
  	u_int8_t *mac;
 @@ -2108,8 +2109,24 @@ dc_attach(device_t dev)
  	if ((sc->dc_eaddr[0] == 0 && (sc->dc_eaddr[1] & ~0xffff) == 0) ||
  	    (sc->dc_eaddr[0] == 0xffffffff &&
  	    (sc->dc_eaddr[1] & 0xffff) == 0xffff)) {
 -		if (dc_check_multiport(sc) == 0)
 +		error = dc_check_multiport(sc);
 +		if (error == 0) {
  			bcopy(sc->dc_eaddr, eaddr, sizeof(eaddr));
 +			/* Extract media information. */
 +			if (DC_IS_INTEL(sc) && sc->dc_srom != NULL) {
 +				while (sc->dc_mi != NULL) {
 +					m = sc->dc_mi->dc_next;
 +					free(sc->dc_mi, M_DEVBUF);
 +					sc->dc_mi = m;
 +				}
 +				error = dc_parse_21143_srom(sc);
 +				if (error != 0)
 +					goto fail;
 +			}
 +		} else if (error == ENOMEM)
 +			goto fail;
 +		else
 +			error = 0;
  	}
  
  	/* Allocate a busdma tag and DMA safe memory for TX/RX descriptors. */
 @@ -3875,12 +3892,30 @@ dc_check_multiport(struct dc_softc *sc)
  			continue;
  		if (unit > device_get_unit(sc->dc_dev))
  			continue;
 +		if (device_is_attached(child) == 0)
 +			continue;
  		dsc = device_get_softc(child);
 -		device_printf(sc->dc_dev, "Using station address of %s as base",
 +		device_printf(sc->dc_dev,
 +		    "Using station address of %s as base\n",
  		    device_get_nameunit(child));
  		bcopy(dsc->dc_eaddr, sc->dc_eaddr, ETHER_ADDR_LEN);
  		eaddr = (uint8_t *)sc->dc_eaddr;
  		eaddr[5]++;
 +		/* Prepare SROM to parse again. */
 +		if (DC_IS_INTEL(sc) && dsc->dc_srom != NULL &&
 +		    sc->dc_romwidth != 0) {
 +			free(sc->dc_srom, M_DEVBUF);
 +			sc->dc_romwidth = dsc->dc_romwidth;
 +			sc->dc_srom = malloc(DC_ROM_SIZE(sc->dc_romwidth),
 +			    M_DEVBUF, M_NOWAIT);
 +			if (sc->dc_srom == NULL) {
 +				device_printf(sc->dc_dev,
 +				    "Could not allocate SROM buffer\n");
 +				return (ENOMEM);
 +			}
 +			bcopy(dsc->dc_srom, sc->dc_srom,
 +			    DC_ROM_SIZE(sc->dc_romwidth));
 +		}
  		return (0);
  	}
  	return (ENOENT);
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/79262: commit references a PR
Date: Fri, 18 Feb 2011 02:58:17 +0000 (UTC)

 Author: yongari
 Date: Fri Feb 18 02:58:09 2011
 New Revision: 218788
 URL: http://svn.freebsd.org/changeset/base/218788
 
 Log:
   Apply special PHY initialization code for 21143 controllers before
   any other media configuration. Otherwise some 21143 controller
   cannot establish a link. While I'm here remove the PHY
   initialization code in dc_setcfg(). Since dc_setcfg() is called
   whenever link state is changed, having the PHY initialization code
   in dc_setcfg() resulted in continuous link flips.
   After driver resets SIA, use default SIA transmit/receive
   configuration instead of disabling autosense/autonegotiation.
   Otherwise, controller fails to establish a link as well as losing
   auto-negotiation capability. For manual media configuration, always
   configure 21143 controller with specified media to ensure media
   change. This change makes ANA-6922 establish link with/without
   auto-negotiation.
   
   While I'm here be more strict on link UP/DOWN detection logic.
   
   Many thanks to marius who fixed several bugs in initial patch and
   even tested the patch on a couple of dc(4) controllers.
   
   PR:		kern/79262
   Reviewed by:	marius
   Tested by:	marius
 
 Modified:
   head/sys/dev/dc/if_dc.c
 
 Modified: head/sys/dev/dc/if_dc.c
 ==============================================================================
 --- head/sys/dev/dc/if_dc.c	Fri Feb 18 02:14:53 2011	(r218787)
 +++ head/sys/dev/dc/if_dc.c	Fri Feb 18 02:58:09 2011	(r218788)
 @@ -944,23 +944,45 @@ static void
  dc_miibus_statchg(device_t dev)
  {
  	struct dc_softc *sc;
 +	struct ifnet *ifp;
  	struct mii_data *mii;
  	struct ifmedia *ifm;
  
  	sc = device_get_softc(dev);
 -	if (DC_IS_ADMTEK(sc))
 -		return;
  
  	mii = device_get_softc(sc->dc_miibus);
 +	ifp = sc->dc_ifp;
 +	if (mii == NULL || ifp == NULL ||
 +	    (ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
 +		return;
 +
  	ifm = &mii->mii_media;
  	if (DC_IS_DAVICOM(sc) &&
  	    IFM_SUBTYPE(ifm->ifm_media) == IFM_HPNA_1) {
  		dc_setcfg(sc, ifm->ifm_media);
  		sc->dc_if_media = ifm->ifm_media;
 -	} else {
 -		dc_setcfg(sc, mii->mii_media_active);
 -		sc->dc_if_media = mii->mii_media_active;
 +		return;
 +	}
 +
 +	sc->dc_link = 0;
 +	if ((mii->mii_media_status & (IFM_ACTIVE | IFM_AVALID)) ==
 +	    (IFM_ACTIVE | IFM_AVALID)) {
 +		switch (IFM_SUBTYPE(mii->mii_media_active)) {
 +		case IFM_10_T:
 +		case IFM_100_TX:
 +			sc->dc_link = 1;
 +			break;
 +		default:
 +			break;
 +		}
  	}
 +	if (sc->dc_link == 0)
 +		return;
 +
 +	sc->dc_if_media = mii->mii_media_active;
 +	if (DC_IS_ADMTEK(sc))
 +		return;
 +	dc_setcfg(sc, mii->mii_media_active);
  }
  
  /*
 @@ -1404,8 +1426,6 @@ dc_setcfg(struct dc_softc *sc, int media
  			if (!DC_IS_DAVICOM(sc))
  				DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_PORTSEL);
  			DC_CLRBIT(sc, DC_10BTCTRL, 0xFFFF);
 -			if (DC_IS_INTEL(sc))
 -				dc_apply_fixup(sc, IFM_AUTO);
  		} else {
  			if (DC_IS_PNIC(sc)) {
  				DC_PN_GPIO_SETBIT(sc, DC_PN_GPIO_SPEEDSEL);
 @@ -1415,10 +1435,6 @@ dc_setcfg(struct dc_softc *sc, int media
  			DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_PORTSEL);
  			DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_PCS);
  			DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_SCRAMBLER);
 -			if (DC_IS_INTEL(sc))
 -				dc_apply_fixup(sc,
 -				    (media & IFM_GMASK) == IFM_FDX ?
 -				    IFM_100_TX | IFM_FDX : IFM_100_TX);
  		}
  	}
  
 @@ -1442,8 +1458,6 @@ dc_setcfg(struct dc_softc *sc, int media
  			if (!DC_IS_DAVICOM(sc))
  				DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_PORTSEL);
  			DC_CLRBIT(sc, DC_10BTCTRL, 0xFFFF);
 -			if (DC_IS_INTEL(sc))
 -				dc_apply_fixup(sc, IFM_AUTO);
  		} else {
  			if (DC_IS_PNIC(sc)) {
  				DC_PN_GPIO_CLRBIT(sc, DC_PN_GPIO_SPEEDSEL);
 @@ -1463,9 +1477,6 @@ dc_setcfg(struct dc_softc *sc, int media
  				DC_SETBIT(sc, DC_SIARESET, DC_SIA_RESET);
  				DC_CLRBIT(sc, DC_10BTCTRL,
  				    DC_TCTL_AUTONEGENBL);
 -				dc_apply_fixup(sc,
 -				    (media & IFM_GMASK) == IFM_FDX ?
 -				    IFM_10_T | IFM_FDX : IFM_10_T);
  				DELAY(20000);
  			}
  		}
 @@ -1537,7 +1548,7 @@ dc_reset(struct dc_softc *sc)
  	 */
  	if (DC_IS_INTEL(sc)) {
  		DC_SETBIT(sc, DC_SIARESET, DC_SIA_RESET);
 -		CSR_WRITE_4(sc, DC_10BTCTRL, 0);
 +		CSR_WRITE_4(sc, DC_10BTCTRL, 0xFFFFFFFF);
  		CSR_WRITE_4(sc, DC_WATCHDOG, 0);
  	}
  }
 @@ -2963,11 +2974,8 @@ dc_tick(void *xsc)
  			 */
  			if ((DC_HAS_BROKEN_RXSTATE(sc) || (CSR_READ_4(sc,
  			    DC_ISR) & DC_ISR_RX_STATE) == DC_RXSTATE_WAIT) &&
 -			    sc->dc_cdata.dc_tx_cnt == 0) {
 +			    sc->dc_cdata.dc_tx_cnt == 0)
  				mii_tick(mii);
 -				if (!(mii->mii_media_status & IFM_ACTIVE))
 -					sc->dc_link = 0;
 -			}
  		}
  	} else
  		mii_tick(mii);
 @@ -2991,12 +2999,8 @@ dc_tick(void *xsc)
  	 * that time, packets will stay in the send queue, and once the
  	 * link comes up, they will be flushed out to the wire.
  	 */
 -	if (!sc->dc_link && mii->mii_media_status & IFM_ACTIVE &&
 -	    IFM_SUBTYPE(mii->mii_media_active) != IFM_NONE) {
 -		sc->dc_link++;
 -		if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
 -			dc_start_locked(ifp);
 -	}
 +	if (sc->dc_link != 0 && !IFQ_DRV_IS_EMPTY(&ifp->if_snd))
 +		dc_start_locked(ifp);
  
  	if (sc->dc_flags & DC_21143_NWAY && !sc->dc_link)
  		callout_reset(&sc->dc_stat_ch, hz/10, dc_tick, sc);
 @@ -3421,6 +3425,7 @@ dc_init_locked(struct dc_softc *sc)
  {
  	struct ifnet *ifp = sc->dc_ifp;
  	struct mii_data *mii;
 +	struct ifmedia *ifm;
  
  	DC_LOCK_ASSERT(sc);
  
 @@ -3431,6 +3436,10 @@ dc_init_locked(struct dc_softc *sc)
  	 */
  	dc_stop(sc);
  	dc_reset(sc);
 +	if (DC_IS_INTEL(sc)) {
 +		ifm = &mii->mii_media;
 +		dc_apply_fixup(sc, ifm->ifm_media);
 +	}
  
  	/*
  	 * Set cache alignment and burst length.
 @@ -3574,12 +3583,12 @@ dc_init_locked(struct dc_softc *sc)
  	DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_RX_ON);
  	CSR_WRITE_4(sc, DC_RXSTART, 0xFFFFFFFF);
  
 -	mii_mediachg(mii);
 -	dc_setcfg(sc, sc->dc_if_media);
 -
  	ifp->if_drv_flags |= IFF_DRV_RUNNING;
  	ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
  
 +	mii_mediachg(mii);
 +	dc_setcfg(sc, sc->dc_if_media);
 +
  	/* Don't start the ticker if this is a homePNA link. */
  	if (IFM_SUBTYPE(mii->mii_media.ifm_media) == IFM_HPNA_1)
  		sc->dc_link = 1;
 @@ -3610,7 +3619,9 @@ dc_ifmedia_upd(struct ifnet *ifp)
  	mii_mediachg(mii);
  	ifm = &mii->mii_media;
  
 -	if (DC_IS_DAVICOM(sc) &&
 +	if (DC_IS_INTEL(sc))
 +		dc_setcfg(sc, ifm->ifm_media);
 +	else if (DC_IS_DAVICOM(sc) &&
  	    IFM_SUBTYPE(ifm->ifm_media) == IFM_HPNA_1)
  		dc_setcfg(sc, ifm->ifm_media);
  	else
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: suspended->patched 
State-Changed-By: yongari 
State-Changed-When: Fri Feb 18 03:17:13 UTC 2011 
State-Changed-Why:  
Fix committed to HEAD. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=79262 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/79262: commit references a PR
Date: Sun, 27 Mar 2011 22:21:07 +0000 (UTC)

 Author: yongari
 Date: Sun Mar 27 22:20:44 2011
 New Revision: 220066
 URL: http://svn.freebsd.org/changeset/base/220066
 
 Log:
   MFC r213841,218787-218788:
   r213841:
     It seems some multi-port dc(4) controllers shares SROM of the first
     port such that reading station address from second port always
     returned 0xFF:0xFF:0xFF:0xFF:0xFF:0xFF Unfortunately it seems there
     is no easy way to know whether SROM is shared or not. Workaround
     the issue by traversing dc(4) device list and see whether we're
     using second port and use station address of controller 0 as base
     station address of second port.
   
     PR:		kern/79262
   
   r218787:
     When driver have to use base softc due to lack of SROM on second
     port, copy SROM information from base softc as well and run SROM
     parser again.  This change is necessary for some dual port
     controllers to make dc(4) correctly detect PHY media based on first
     port configuration table.
     While I'm here add a check for validity of the base softc before
     duplicating SROM contents from base softc. If driver failed to
     attach to the first port it can access invalid area.
   
     PR:		kern/79262
     Reviewed by:	marius
   
   r218788:
     Apply special PHY initialization code for 21143 controllers before
     any other media configuration. Otherwise some 21143 controller
     cannot establish a link. While I'm here remove the PHY
     initialization code in dc_setcfg(). Since dc_setcfg() is called
     whenever link state is changed, having the PHY initialization code
     in dc_setcfg() resulted in continuous link flips.
     After driver resets SIA, use default SIA transmit/receive
     configuration instead of disabling autosense/autonegotiation.
     Otherwise, controller fails to establish a link as well as losing
     auto-negotiation capability. For manual media configuration, always
     configure 21143 controller with specified media to ensure media
     change. This change makes ANA-6922 establish link with/without
     auto-negotiation.
   
     While I'm here be more strict on link UP/DOWN detection logic.
   
     Many thanks to marius who fixed several bugs in initial patch and
     even tested the patch on a couple of dc(4) controllers.
   
     PR:		kern/79262
     Reviewed by:	marius
     Tested by:	marius
 
 Modified:
   stable/8/sys/dev/dc/if_dc.c
   stable/8/sys/dev/dc/if_dcreg.h
 Directory Properties:
   stable/8/sys/   (props changed)
   stable/8/sys/amd64/include/xen/   (props changed)
   stable/8/sys/cddl/contrib/opensolaris/   (props changed)
   stable/8/sys/contrib/dev/acpica/   (props changed)
   stable/8/sys/contrib/pf/   (props changed)
 
 Modified: stable/8/sys/dev/dc/if_dc.c
 ==============================================================================
 --- stable/8/sys/dev/dc/if_dc.c	Sun Mar 27 22:14:14 2011	(r220065)
 +++ stable/8/sys/dev/dc/if_dc.c	Sun Mar 27 22:20:44 2011	(r220066)
 @@ -293,6 +293,7 @@ static int dc_decode_leaf_sia(struct dc_
  static int dc_decode_leaf_mii(struct dc_softc *, struct dc_eblock_mii *);
  static int dc_decode_leaf_sym(struct dc_softc *, struct dc_eblock_sym *);
  static void dc_apply_fixup(struct dc_softc *, int);
 +static int dc_check_multiport(struct dc_softc *);
  
  #ifdef DC_USEIOSPACE
  #define DC_RES			SYS_RES_IOPORT
 @@ -943,23 +944,45 @@ static void
  dc_miibus_statchg(device_t dev)
  {
  	struct dc_softc *sc;
 +	struct ifnet *ifp;
  	struct mii_data *mii;
  	struct ifmedia *ifm;
  
  	sc = device_get_softc(dev);
 -	if (DC_IS_ADMTEK(sc))
 -		return;
  
  	mii = device_get_softc(sc->dc_miibus);
 +	ifp = sc->dc_ifp;
 +	if (mii == NULL || ifp == NULL ||
 +	    (ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
 +		return;
 +
  	ifm = &mii->mii_media;
  	if (DC_IS_DAVICOM(sc) &&
  	    IFM_SUBTYPE(ifm->ifm_media) == IFM_HPNA_1) {
  		dc_setcfg(sc, ifm->ifm_media);
  		sc->dc_if_media = ifm->ifm_media;
 -	} else {
 -		dc_setcfg(sc, mii->mii_media_active);
 -		sc->dc_if_media = mii->mii_media_active;
 +		return;
  	}
 +
 +	sc->dc_link = 0;
 +	if ((mii->mii_media_status & (IFM_ACTIVE | IFM_AVALID)) ==
 +	    (IFM_ACTIVE | IFM_AVALID)) {
 +		switch (IFM_SUBTYPE(mii->mii_media_active)) {
 +		case IFM_10_T:
 +		case IFM_100_TX:
 +			sc->dc_link = 1;
 +			break;
 +		default:
 +			break;
 +		}
 +	}
 +	if (sc->dc_link == 0)
 +		return;
 +
 +	sc->dc_if_media = mii->mii_media_active;
 +	if (DC_IS_ADMTEK(sc))
 +		return;
 +	dc_setcfg(sc, mii->mii_media_active);
  }
  
  /*
 @@ -1403,8 +1426,6 @@ dc_setcfg(struct dc_softc *sc, int media
  			if (!DC_IS_DAVICOM(sc))
  				DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_PORTSEL);
  			DC_CLRBIT(sc, DC_10BTCTRL, 0xFFFF);
 -			if (DC_IS_INTEL(sc))
 -				dc_apply_fixup(sc, IFM_AUTO);
  		} else {
  			if (DC_IS_PNIC(sc)) {
  				DC_PN_GPIO_SETBIT(sc, DC_PN_GPIO_SPEEDSEL);
 @@ -1414,10 +1435,6 @@ dc_setcfg(struct dc_softc *sc, int media
  			DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_PORTSEL);
  			DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_PCS);
  			DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_SCRAMBLER);
 -			if (DC_IS_INTEL(sc))
 -				dc_apply_fixup(sc,
 -				    (media & IFM_GMASK) == IFM_FDX ?
 -				    IFM_100_TX | IFM_FDX : IFM_100_TX);
  		}
  	}
  
 @@ -1441,8 +1458,6 @@ dc_setcfg(struct dc_softc *sc, int media
  			if (!DC_IS_DAVICOM(sc))
  				DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_PORTSEL);
  			DC_CLRBIT(sc, DC_10BTCTRL, 0xFFFF);
 -			if (DC_IS_INTEL(sc))
 -				dc_apply_fixup(sc, IFM_AUTO);
  		} else {
  			if (DC_IS_PNIC(sc)) {
  				DC_PN_GPIO_CLRBIT(sc, DC_PN_GPIO_SPEEDSEL);
 @@ -1462,9 +1477,6 @@ dc_setcfg(struct dc_softc *sc, int media
  				DC_SETBIT(sc, DC_SIARESET, DC_SIA_RESET);
  				DC_CLRBIT(sc, DC_10BTCTRL,
  				    DC_TCTL_AUTONEGENBL);
 -				dc_apply_fixup(sc,
 -				    (media & IFM_GMASK) == IFM_FDX ?
 -				    IFM_10_T | IFM_FDX : IFM_10_T);
  				DELAY(20000);
  			}
  		}
 @@ -1536,7 +1548,7 @@ dc_reset(struct dc_softc *sc)
  	 */
  	if (DC_IS_INTEL(sc)) {
  		DC_SETBIT(sc, DC_SIARESET, DC_SIA_RESET);
 -		CSR_WRITE_4(sc, DC_10BTCTRL, 0);
 +		CSR_WRITE_4(sc, DC_10BTCTRL, 0xFFFFFFFF);
  		CSR_WRITE_4(sc, DC_WATCHDOG, 0);
  	}
  }
 @@ -1814,6 +1826,7 @@ dc_attach(device_t dev)
  	u_int32_t command;
  	struct dc_softc *sc;
  	struct ifnet *ifp;
 +	struct dc_mediainfo *m;
  	u_int32_t reg, revision;
  	int error, i, mac_offset, phy, rid, tmp;
  	u_int8_t *mac;
 @@ -2097,6 +2110,36 @@ dc_attach(device_t dev)
  		break;
  	}
  
 +	bcopy(eaddr, sc->dc_eaddr, sizeof(eaddr));
 +	/*
 +	 * If we still have invalid station address, see whether we can
 +	 * find station address for chip 0.  Some multi-port controllers
 +	 * just store station address for chip 0 if they have a shared
 +	 * SROM.
 +	 */
 +	if ((sc->dc_eaddr[0] == 0 && (sc->dc_eaddr[1] & ~0xffff) == 0) ||
 +	    (sc->dc_eaddr[0] == 0xffffffff &&
 +	    (sc->dc_eaddr[1] & 0xffff) == 0xffff)) {
 +		error = dc_check_multiport(sc);
 +		if (error == 0) {
 +			bcopy(sc->dc_eaddr, eaddr, sizeof(eaddr));
 +			/* Extract media information. */
 +			if (DC_IS_INTEL(sc) && sc->dc_srom != NULL) {
 +				while (sc->dc_mi != NULL) {
 +					m = sc->dc_mi->dc_next;
 +					free(sc->dc_mi, M_DEVBUF);
 +					sc->dc_mi = m;
 +				}
 +				error = dc_parse_21143_srom(sc);
 +				if (error != 0)
 +					goto fail;
 +			}
 +		} else if (error == ENOMEM)
 +			goto fail;
 +		else
 +			error = 0;
 +	}
 +
  	/* Allocate a busdma tag and DMA safe memory for TX/RX descriptors. */
  	error = bus_dma_tag_create(bus_get_dma_tag(dev), PAGE_SIZE, 0,
  	    BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL,
 @@ -2931,11 +2974,8 @@ dc_tick(void *xsc)
  			 */
  			if ((DC_HAS_BROKEN_RXSTATE(sc) || (CSR_READ_4(sc,
  			    DC_ISR) & DC_ISR_RX_STATE) == DC_RXSTATE_WAIT) &&
 -			    sc->dc_cdata.dc_tx_cnt == 0) {
 +			    sc->dc_cdata.dc_tx_cnt == 0)
  				mii_tick(mii);
 -				if (!(mii->mii_media_status & IFM_ACTIVE))
 -					sc->dc_link = 0;
 -			}
  		}
  	} else
  		mii_tick(mii);
 @@ -2959,12 +2999,8 @@ dc_tick(void *xsc)
  	 * that time, packets will stay in the send queue, and once the
  	 * link comes up, they will be flushed out to the wire.
  	 */
 -	if (!sc->dc_link && mii->mii_media_status & IFM_ACTIVE &&
 -	    IFM_SUBTYPE(mii->mii_media_active) != IFM_NONE) {
 -		sc->dc_link++;
 -		if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
 -			dc_start_locked(ifp);
 -	}
 +	if (sc->dc_link != 0 && !IFQ_DRV_IS_EMPTY(&ifp->if_snd))
 +		dc_start_locked(ifp);
  
  	if (sc->dc_flags & DC_21143_NWAY && !sc->dc_link)
  		callout_reset(&sc->dc_stat_ch, hz/10, dc_tick, sc);
 @@ -3389,6 +3425,7 @@ dc_init_locked(struct dc_softc *sc)
  {
  	struct ifnet *ifp = sc->dc_ifp;
  	struct mii_data *mii;
 +	struct ifmedia *ifm;
  
  	DC_LOCK_ASSERT(sc);
  
 @@ -3399,6 +3436,10 @@ dc_init_locked(struct dc_softc *sc)
  	 */
  	dc_stop(sc);
  	dc_reset(sc);
 +	if (DC_IS_INTEL(sc)) {
 +		ifm = &mii->mii_media;
 +		dc_apply_fixup(sc, ifm->ifm_media);
 +	}
  
  	/*
  	 * Set cache alignment and burst length.
 @@ -3542,12 +3583,12 @@ dc_init_locked(struct dc_softc *sc)
  	DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_RX_ON);
  	CSR_WRITE_4(sc, DC_RXSTART, 0xFFFFFFFF);
  
 -	mii_mediachg(mii);
 -	dc_setcfg(sc, sc->dc_if_media);
 -
  	ifp->if_drv_flags |= IFF_DRV_RUNNING;
  	ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
  
 +	mii_mediachg(mii);
 +	dc_setcfg(sc, sc->dc_if_media);
 +
  	/* Don't start the ticker if this is a homePNA link. */
  	if (IFM_SUBTYPE(mii->mii_media.ifm_media) == IFM_HPNA_1)
  		sc->dc_link = 1;
 @@ -3578,7 +3619,9 @@ dc_ifmedia_upd(struct ifnet *ifp)
  	mii_mediachg(mii);
  	ifm = &mii->mii_media;
  
 -	if (DC_IS_DAVICOM(sc) &&
 +	if (DC_IS_INTEL(sc))
 +		dc_setcfg(sc, ifm->ifm_media);
 +	else if (DC_IS_DAVICOM(sc) &&
  	    IFM_SUBTYPE(ifm->ifm_media) == IFM_HPNA_1)
  		dc_setcfg(sc, ifm->ifm_media);
  	else
 @@ -3839,3 +3882,52 @@ dc_shutdown(device_t dev)
  
  	return (0);
  }
 +
 +static int
 +dc_check_multiport(struct dc_softc *sc)
 +{
 +	struct dc_softc *dsc;
 +	devclass_t dc;
 +	device_t child;
 +	uint8_t *eaddr;
 +	int unit;
 +
 +	dc = devclass_find("dc");
 +	for (unit = 0; unit < devclass_get_maxunit(dc); unit++) {
 +		child = devclass_get_device(dc, unit);
 +		if (child == NULL)
 +			continue;
 +		if (child == sc->dc_dev)
 +			continue;
 +		if (device_get_parent(child) != device_get_parent(sc->dc_dev))
 +			continue;
 +		if (unit > device_get_unit(sc->dc_dev))
 +			continue;
 +		if (device_is_attached(child) == 0)
 +			continue;
 +		dsc = device_get_softc(child);
 +		device_printf(sc->dc_dev,
 +		    "Using station address of %s as base\n",
 +		    device_get_nameunit(child));
 +		bcopy(dsc->dc_eaddr, sc->dc_eaddr, ETHER_ADDR_LEN);
 +		eaddr = (uint8_t *)sc->dc_eaddr;
 +		eaddr[5]++;
 +		/* Prepare SROM to parse again. */
 +		if (DC_IS_INTEL(sc) && dsc->dc_srom != NULL &&
 +		    sc->dc_romwidth != 0) {
 +			free(sc->dc_srom, M_DEVBUF);
 +			sc->dc_romwidth = dsc->dc_romwidth;
 +			sc->dc_srom = malloc(DC_ROM_SIZE(sc->dc_romwidth),
 +			    M_DEVBUF, M_NOWAIT);
 +			if (sc->dc_srom == NULL) {
 +				device_printf(sc->dc_dev,
 +				    "Could not allocate SROM buffer\n");
 +				return (ENOMEM);
 +			}
 +			bcopy(dsc->dc_srom, sc->dc_srom,
 +			    DC_ROM_SIZE(sc->dc_romwidth));
 +		}
 +		return (0);
 +	}
 +	return (ENOENT);
 +}
 
 Modified: stable/8/sys/dev/dc/if_dcreg.h
 ==============================================================================
 --- stable/8/sys/dev/dc/if_dcreg.h	Sun Mar 27 22:14:14 2011	(r220065)
 +++ stable/8/sys/dev/dc/if_dcreg.h	Sun Mar 27 22:20:44 2011	(r220066)
 @@ -745,6 +745,7 @@ struct dc_softc {
  	int			dc_if_media;
  	u_int32_t		dc_flags;
  	u_int32_t		dc_txthresh;
 +	u_int32_t		dc_eaddr[2];
  	u_int8_t		*dc_srom;
  	struct dc_mediainfo	*dc_mi;
  	struct dc_list_data	*dc_ldata;
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/79262: commit references a PR
Date: Sun, 27 Mar 2011 22:21:08 +0000 (UTC)

 Author: yongari
 Date: Sun Mar 27 22:20:44 2011
 New Revision: 220066
 URL: http://svn.freebsd.org/changeset/base/220066
 
 Log:
   MFC r213841,218787-218788:
   r213841:
     It seems some multi-port dc(4) controllers shares SROM of the first
     port such that reading station address from second port always
     returned 0xFF:0xFF:0xFF:0xFF:0xFF:0xFF Unfortunately it seems there
     is no easy way to know whether SROM is shared or not. Workaround
     the issue by traversing dc(4) device list and see whether we're
     using second port and use station address of controller 0 as base
     station address of second port.
   
     PR:		kern/79262
   
   r218787:
     When driver have to use base softc due to lack of SROM on second
     port, copy SROM information from base softc as well and run SROM
     parser again.  This change is necessary for some dual port
     controllers to make dc(4) correctly detect PHY media based on first
     port configuration table.
     While I'm here add a check for validity of the base softc before
     duplicating SROM contents from base softc. If driver failed to
     attach to the first port it can access invalid area.
   
     PR:		kern/79262
     Reviewed by:	marius
   
   r218788:
     Apply special PHY initialization code for 21143 controllers before
     any other media configuration. Otherwise some 21143 controller
     cannot establish a link. While I'm here remove the PHY
     initialization code in dc_setcfg(). Since dc_setcfg() is called
     whenever link state is changed, having the PHY initialization code
     in dc_setcfg() resulted in continuous link flips.
     After driver resets SIA, use default SIA transmit/receive
     configuration instead of disabling autosense/autonegotiation.
     Otherwise, controller fails to establish a link as well as losing
     auto-negotiation capability. For manual media configuration, always
     configure 21143 controller with specified media to ensure media
     change. This change makes ANA-6922 establish link with/without
     auto-negotiation.
   
     While I'm here be more strict on link UP/DOWN detection logic.
   
     Many thanks to marius who fixed several bugs in initial patch and
     even tested the patch on a couple of dc(4) controllers.
   
     PR:		kern/79262
     Reviewed by:	marius
     Tested by:	marius
 
 Modified:
   stable/8/sys/dev/dc/if_dc.c
   stable/8/sys/dev/dc/if_dcreg.h
 Directory Properties:
   stable/8/sys/   (props changed)
   stable/8/sys/amd64/include/xen/   (props changed)
   stable/8/sys/cddl/contrib/opensolaris/   (props changed)
   stable/8/sys/contrib/dev/acpica/   (props changed)
   stable/8/sys/contrib/pf/   (props changed)
 
 Modified: stable/8/sys/dev/dc/if_dc.c
 ==============================================================================
 --- stable/8/sys/dev/dc/if_dc.c	Sun Mar 27 22:14:14 2011	(r220065)
 +++ stable/8/sys/dev/dc/if_dc.c	Sun Mar 27 22:20:44 2011	(r220066)
 @@ -293,6 +293,7 @@ static int dc_decode_leaf_sia(struct dc_
  static int dc_decode_leaf_mii(struct dc_softc *, struct dc_eblock_mii *);
  static int dc_decode_leaf_sym(struct dc_softc *, struct dc_eblock_sym *);
  static void dc_apply_fixup(struct dc_softc *, int);
 +static int dc_check_multiport(struct dc_softc *);
  
  #ifdef DC_USEIOSPACE
  #define DC_RES			SYS_RES_IOPORT
 @@ -943,23 +944,45 @@ static void
  dc_miibus_statchg(device_t dev)
  {
  	struct dc_softc *sc;
 +	struct ifnet *ifp;
  	struct mii_data *mii;
  	struct ifmedia *ifm;
  
  	sc = device_get_softc(dev);
 -	if (DC_IS_ADMTEK(sc))
 -		return;
  
  	mii = device_get_softc(sc->dc_miibus);
 +	ifp = sc->dc_ifp;
 +	if (mii == NULL || ifp == NULL ||
 +	    (ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
 +		return;
 +
  	ifm = &mii->mii_media;
  	if (DC_IS_DAVICOM(sc) &&
  	    IFM_SUBTYPE(ifm->ifm_media) == IFM_HPNA_1) {
  		dc_setcfg(sc, ifm->ifm_media);
  		sc->dc_if_media = ifm->ifm_media;
 -	} else {
 -		dc_setcfg(sc, mii->mii_media_active);
 -		sc->dc_if_media = mii->mii_media_active;
 +		return;
  	}
 +
 +	sc->dc_link = 0;
 +	if ((mii->mii_media_status & (IFM_ACTIVE | IFM_AVALID)) ==
 +	    (IFM_ACTIVE | IFM_AVALID)) {
 +		switch (IFM_SUBTYPE(mii->mii_media_active)) {
 +		case IFM_10_T:
 +		case IFM_100_TX:
 +			sc->dc_link = 1;
 +			break;
 +		default:
 +			break;
 +		}
 +	}
 +	if (sc->dc_link == 0)
 +		return;
 +
 +	sc->dc_if_media = mii->mii_media_active;
 +	if (DC_IS_ADMTEK(sc))
 +		return;
 +	dc_setcfg(sc, mii->mii_media_active);
  }
  
  /*
 @@ -1403,8 +1426,6 @@ dc_setcfg(struct dc_softc *sc, int media
  			if (!DC_IS_DAVICOM(sc))
  				DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_PORTSEL);
  			DC_CLRBIT(sc, DC_10BTCTRL, 0xFFFF);
 -			if (DC_IS_INTEL(sc))
 -				dc_apply_fixup(sc, IFM_AUTO);
  		} else {
  			if (DC_IS_PNIC(sc)) {
  				DC_PN_GPIO_SETBIT(sc, DC_PN_GPIO_SPEEDSEL);
 @@ -1414,10 +1435,6 @@ dc_setcfg(struct dc_softc *sc, int media
  			DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_PORTSEL);
  			DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_PCS);
  			DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_SCRAMBLER);
 -			if (DC_IS_INTEL(sc))
 -				dc_apply_fixup(sc,
 -				    (media & IFM_GMASK) == IFM_FDX ?
 -				    IFM_100_TX | IFM_FDX : IFM_100_TX);
  		}
  	}
  
 @@ -1441,8 +1458,6 @@ dc_setcfg(struct dc_softc *sc, int media
  			if (!DC_IS_DAVICOM(sc))
  				DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_PORTSEL);
  			DC_CLRBIT(sc, DC_10BTCTRL, 0xFFFF);
 -			if (DC_IS_INTEL(sc))
 -				dc_apply_fixup(sc, IFM_AUTO);
  		} else {
  			if (DC_IS_PNIC(sc)) {
  				DC_PN_GPIO_CLRBIT(sc, DC_PN_GPIO_SPEEDSEL);
 @@ -1462,9 +1477,6 @@ dc_setcfg(struct dc_softc *sc, int media
  				DC_SETBIT(sc, DC_SIARESET, DC_SIA_RESET);
  				DC_CLRBIT(sc, DC_10BTCTRL,
  				    DC_TCTL_AUTONEGENBL);
 -				dc_apply_fixup(sc,
 -				    (media & IFM_GMASK) == IFM_FDX ?
 -				    IFM_10_T | IFM_FDX : IFM_10_T);
  				DELAY(20000);
  			}
  		}
 @@ -1536,7 +1548,7 @@ dc_reset(struct dc_softc *sc)
  	 */
  	if (DC_IS_INTEL(sc)) {
  		DC_SETBIT(sc, DC_SIARESET, DC_SIA_RESET);
 -		CSR_WRITE_4(sc, DC_10BTCTRL, 0);
 +		CSR_WRITE_4(sc, DC_10BTCTRL, 0xFFFFFFFF);
  		CSR_WRITE_4(sc, DC_WATCHDOG, 0);
  	}
  }
 @@ -1814,6 +1826,7 @@ dc_attach(device_t dev)
  	u_int32_t command;
  	struct dc_softc *sc;
  	struct ifnet *ifp;
 +	struct dc_mediainfo *m;
  	u_int32_t reg, revision;
  	int error, i, mac_offset, phy, rid, tmp;
  	u_int8_t *mac;
 @@ -2097,6 +2110,36 @@ dc_attach(device_t dev)
  		break;
  	}
  
 +	bcopy(eaddr, sc->dc_eaddr, sizeof(eaddr));
 +	/*
 +	 * If we still have invalid station address, see whether we can
 +	 * find station address for chip 0.  Some multi-port controllers
 +	 * just store station address for chip 0 if they have a shared
 +	 * SROM.
 +	 */
 +	if ((sc->dc_eaddr[0] == 0 && (sc->dc_eaddr[1] & ~0xffff) == 0) ||
 +	    (sc->dc_eaddr[0] == 0xffffffff &&
 +	    (sc->dc_eaddr[1] & 0xffff) == 0xffff)) {
 +		error = dc_check_multiport(sc);
 +		if (error == 0) {
 +			bcopy(sc->dc_eaddr, eaddr, sizeof(eaddr));
 +			/* Extract media information. */
 +			if (DC_IS_INTEL(sc) && sc->dc_srom != NULL) {
 +				while (sc->dc_mi != NULL) {
 +					m = sc->dc_mi->dc_next;
 +					free(sc->dc_mi, M_DEVBUF);
 +					sc->dc_mi = m;
 +				}
 +				error = dc_parse_21143_srom(sc);
 +				if (error != 0)
 +					goto fail;
 +			}
 +		} else if (error == ENOMEM)
 +			goto fail;
 +		else
 +			error = 0;
 +	}
 +
  	/* Allocate a busdma tag and DMA safe memory for TX/RX descriptors. */
  	error = bus_dma_tag_create(bus_get_dma_tag(dev), PAGE_SIZE, 0,
  	    BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL,
 @@ -2931,11 +2974,8 @@ dc_tick(void *xsc)
  			 */
  			if ((DC_HAS_BROKEN_RXSTATE(sc) || (CSR_READ_4(sc,
  			    DC_ISR) & DC_ISR_RX_STATE) == DC_RXSTATE_WAIT) &&
 -			    sc->dc_cdata.dc_tx_cnt == 0) {
 +			    sc->dc_cdata.dc_tx_cnt == 0)
  				mii_tick(mii);
 -				if (!(mii->mii_media_status & IFM_ACTIVE))
 -					sc->dc_link = 0;
 -			}
  		}
  	} else
  		mii_tick(mii);
 @@ -2959,12 +2999,8 @@ dc_tick(void *xsc)
  	 * that time, packets will stay in the send queue, and once the
  	 * link comes up, they will be flushed out to the wire.
  	 */
 -	if (!sc->dc_link && mii->mii_media_status & IFM_ACTIVE &&
 -	    IFM_SUBTYPE(mii->mii_media_active) != IFM_NONE) {
 -		sc->dc_link++;
 -		if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
 -			dc_start_locked(ifp);
 -	}
 +	if (sc->dc_link != 0 && !IFQ_DRV_IS_EMPTY(&ifp->if_snd))
 +		dc_start_locked(ifp);
  
  	if (sc->dc_flags & DC_21143_NWAY && !sc->dc_link)
  		callout_reset(&sc->dc_stat_ch, hz/10, dc_tick, sc);
 @@ -3389,6 +3425,7 @@ dc_init_locked(struct dc_softc *sc)
  {
  	struct ifnet *ifp = sc->dc_ifp;
  	struct mii_data *mii;
 +	struct ifmedia *ifm;
  
  	DC_LOCK_ASSERT(sc);
  
 @@ -3399,6 +3436,10 @@ dc_init_locked(struct dc_softc *sc)
  	 */
  	dc_stop(sc);
  	dc_reset(sc);
 +	if (DC_IS_INTEL(sc)) {
 +		ifm = &mii->mii_media;
 +		dc_apply_fixup(sc, ifm->ifm_media);
 +	}
  
  	/*
  	 * Set cache alignment and burst length.
 @@ -3542,12 +3583,12 @@ dc_init_locked(struct dc_softc *sc)
  	DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_RX_ON);
  	CSR_WRITE_4(sc, DC_RXSTART, 0xFFFFFFFF);
  
 -	mii_mediachg(mii);
 -	dc_setcfg(sc, sc->dc_if_media);
 -
  	ifp->if_drv_flags |= IFF_DRV_RUNNING;
  	ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
  
 +	mii_mediachg(mii);
 +	dc_setcfg(sc, sc->dc_if_media);
 +
  	/* Don't start the ticker if this is a homePNA link. */
  	if (IFM_SUBTYPE(mii->mii_media.ifm_media) == IFM_HPNA_1)
  		sc->dc_link = 1;
 @@ -3578,7 +3619,9 @@ dc_ifmedia_upd(struct ifnet *ifp)
  	mii_mediachg(mii);
  	ifm = &mii->mii_media;
  
 -	if (DC_IS_DAVICOM(sc) &&
 +	if (DC_IS_INTEL(sc))
 +		dc_setcfg(sc, ifm->ifm_media);
 +	else if (DC_IS_DAVICOM(sc) &&
  	    IFM_SUBTYPE(ifm->ifm_media) == IFM_HPNA_1)
  		dc_setcfg(sc, ifm->ifm_media);
  	else
 @@ -3839,3 +3882,52 @@ dc_shutdown(device_t dev)
  
  	return (0);
  }
 +
 +static int
 +dc_check_multiport(struct dc_softc *sc)
 +{
 +	struct dc_softc *dsc;
 +	devclass_t dc;
 +	device_t child;
 +	uint8_t *eaddr;
 +	int unit;
 +
 +	dc = devclass_find("dc");
 +	for (unit = 0; unit < devclass_get_maxunit(dc); unit++) {
 +		child = devclass_get_device(dc, unit);
 +		if (child == NULL)
 +			continue;
 +		if (child == sc->dc_dev)
 +			continue;
 +		if (device_get_parent(child) != device_get_parent(sc->dc_dev))
 +			continue;
 +		if (unit > device_get_unit(sc->dc_dev))
 +			continue;
 +		if (device_is_attached(child) == 0)
 +			continue;
 +		dsc = device_get_softc(child);
 +		device_printf(sc->dc_dev,
 +		    "Using station address of %s as base\n",
 +		    device_get_nameunit(child));
 +		bcopy(dsc->dc_eaddr, sc->dc_eaddr, ETHER_ADDR_LEN);
 +		eaddr = (uint8_t *)sc->dc_eaddr;
 +		eaddr[5]++;
 +		/* Prepare SROM to parse again. */
 +		if (DC_IS_INTEL(sc) && dsc->dc_srom != NULL &&
 +		    sc->dc_romwidth != 0) {
 +			free(sc->dc_srom, M_DEVBUF);
 +			sc->dc_romwidth = dsc->dc_romwidth;
 +			sc->dc_srom = malloc(DC_ROM_SIZE(sc->dc_romwidth),
 +			    M_DEVBUF, M_NOWAIT);
 +			if (sc->dc_srom == NULL) {
 +				device_printf(sc->dc_dev,
 +				    "Could not allocate SROM buffer\n");
 +				return (ENOMEM);
 +			}
 +			bcopy(dsc->dc_srom, sc->dc_srom,
 +			    DC_ROM_SIZE(sc->dc_romwidth));
 +		}
 +		return (0);
 +	}
 +	return (ENOENT);
 +}
 
 Modified: stable/8/sys/dev/dc/if_dcreg.h
 ==============================================================================
 --- stable/8/sys/dev/dc/if_dcreg.h	Sun Mar 27 22:14:14 2011	(r220065)
 +++ stable/8/sys/dev/dc/if_dcreg.h	Sun Mar 27 22:20:44 2011	(r220066)
 @@ -745,6 +745,7 @@ struct dc_softc {
  	int			dc_if_media;
  	u_int32_t		dc_flags;
  	u_int32_t		dc_txthresh;
 +	u_int32_t		dc_eaddr[2];
  	u_int8_t		*dc_srom;
  	struct dc_mediainfo	*dc_mi;
  	struct dc_list_data	*dc_ldata;
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/79262: commit references a PR
Date: Sun, 27 Mar 2011 22:21:08 +0000 (UTC)

 Author: yongari
 Date: Sun Mar 27 22:20:44 2011
 New Revision: 220066
 URL: http://svn.freebsd.org/changeset/base/220066
 
 Log:
   MFC r213841,218787-218788:
   r213841:
     It seems some multi-port dc(4) controllers shares SROM of the first
     port such that reading station address from second port always
     returned 0xFF:0xFF:0xFF:0xFF:0xFF:0xFF Unfortunately it seems there
     is no easy way to know whether SROM is shared or not. Workaround
     the issue by traversing dc(4) device list and see whether we're
     using second port and use station address of controller 0 as base
     station address of second port.
   
     PR:		kern/79262
   
   r218787:
     When driver have to use base softc due to lack of SROM on second
     port, copy SROM information from base softc as well and run SROM
     parser again.  This change is necessary for some dual port
     controllers to make dc(4) correctly detect PHY media based on first
     port configuration table.
     While I'm here add a check for validity of the base softc before
     duplicating SROM contents from base softc. If driver failed to
     attach to the first port it can access invalid area.
   
     PR:		kern/79262
     Reviewed by:	marius
   
   r218788:
     Apply special PHY initialization code for 21143 controllers before
     any other media configuration. Otherwise some 21143 controller
     cannot establish a link. While I'm here remove the PHY
     initialization code in dc_setcfg(). Since dc_setcfg() is called
     whenever link state is changed, having the PHY initialization code
     in dc_setcfg() resulted in continuous link flips.
     After driver resets SIA, use default SIA transmit/receive
     configuration instead of disabling autosense/autonegotiation.
     Otherwise, controller fails to establish a link as well as losing
     auto-negotiation capability. For manual media configuration, always
     configure 21143 controller with specified media to ensure media
     change. This change makes ANA-6922 establish link with/without
     auto-negotiation.
   
     While I'm here be more strict on link UP/DOWN detection logic.
   
     Many thanks to marius who fixed several bugs in initial patch and
     even tested the patch on a couple of dc(4) controllers.
   
     PR:		kern/79262
     Reviewed by:	marius
     Tested by:	marius
 
 Modified:
   stable/8/sys/dev/dc/if_dc.c
   stable/8/sys/dev/dc/if_dcreg.h
 Directory Properties:
   stable/8/sys/   (props changed)
   stable/8/sys/amd64/include/xen/   (props changed)
   stable/8/sys/cddl/contrib/opensolaris/   (props changed)
   stable/8/sys/contrib/dev/acpica/   (props changed)
   stable/8/sys/contrib/pf/   (props changed)
 
 Modified: stable/8/sys/dev/dc/if_dc.c
 ==============================================================================
 --- stable/8/sys/dev/dc/if_dc.c	Sun Mar 27 22:14:14 2011	(r220065)
 +++ stable/8/sys/dev/dc/if_dc.c	Sun Mar 27 22:20:44 2011	(r220066)
 @@ -293,6 +293,7 @@ static int dc_decode_leaf_sia(struct dc_
  static int dc_decode_leaf_mii(struct dc_softc *, struct dc_eblock_mii *);
  static int dc_decode_leaf_sym(struct dc_softc *, struct dc_eblock_sym *);
  static void dc_apply_fixup(struct dc_softc *, int);
 +static int dc_check_multiport(struct dc_softc *);
  
  #ifdef DC_USEIOSPACE
  #define DC_RES			SYS_RES_IOPORT
 @@ -943,23 +944,45 @@ static void
  dc_miibus_statchg(device_t dev)
  {
  	struct dc_softc *sc;
 +	struct ifnet *ifp;
  	struct mii_data *mii;
  	struct ifmedia *ifm;
  
  	sc = device_get_softc(dev);
 -	if (DC_IS_ADMTEK(sc))
 -		return;
  
  	mii = device_get_softc(sc->dc_miibus);
 +	ifp = sc->dc_ifp;
 +	if (mii == NULL || ifp == NULL ||
 +	    (ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
 +		return;
 +
  	ifm = &mii->mii_media;
  	if (DC_IS_DAVICOM(sc) &&
  	    IFM_SUBTYPE(ifm->ifm_media) == IFM_HPNA_1) {
  		dc_setcfg(sc, ifm->ifm_media);
  		sc->dc_if_media = ifm->ifm_media;
 -	} else {
 -		dc_setcfg(sc, mii->mii_media_active);
 -		sc->dc_if_media = mii->mii_media_active;
 +		return;
  	}
 +
 +	sc->dc_link = 0;
 +	if ((mii->mii_media_status & (IFM_ACTIVE | IFM_AVALID)) ==
 +	    (IFM_ACTIVE | IFM_AVALID)) {
 +		switch (IFM_SUBTYPE(mii->mii_media_active)) {
 +		case IFM_10_T:
 +		case IFM_100_TX:
 +			sc->dc_link = 1;
 +			break;
 +		default:
 +			break;
 +		}
 +	}
 +	if (sc->dc_link == 0)
 +		return;
 +
 +	sc->dc_if_media = mii->mii_media_active;
 +	if (DC_IS_ADMTEK(sc))
 +		return;
 +	dc_setcfg(sc, mii->mii_media_active);
  }
  
  /*
 @@ -1403,8 +1426,6 @@ dc_setcfg(struct dc_softc *sc, int media
  			if (!DC_IS_DAVICOM(sc))
  				DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_PORTSEL);
  			DC_CLRBIT(sc, DC_10BTCTRL, 0xFFFF);
 -			if (DC_IS_INTEL(sc))
 -				dc_apply_fixup(sc, IFM_AUTO);
  		} else {
  			if (DC_IS_PNIC(sc)) {
  				DC_PN_GPIO_SETBIT(sc, DC_PN_GPIO_SPEEDSEL);
 @@ -1414,10 +1435,6 @@ dc_setcfg(struct dc_softc *sc, int media
  			DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_PORTSEL);
  			DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_PCS);
  			DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_SCRAMBLER);
 -			if (DC_IS_INTEL(sc))
 -				dc_apply_fixup(sc,
 -				    (media & IFM_GMASK) == IFM_FDX ?
 -				    IFM_100_TX | IFM_FDX : IFM_100_TX);
  		}
  	}
  
 @@ -1441,8 +1458,6 @@ dc_setcfg(struct dc_softc *sc, int media
  			if (!DC_IS_DAVICOM(sc))
  				DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_PORTSEL);
  			DC_CLRBIT(sc, DC_10BTCTRL, 0xFFFF);
 -			if (DC_IS_INTEL(sc))
 -				dc_apply_fixup(sc, IFM_AUTO);
  		} else {
  			if (DC_IS_PNIC(sc)) {
  				DC_PN_GPIO_CLRBIT(sc, DC_PN_GPIO_SPEEDSEL);
 @@ -1462,9 +1477,6 @@ dc_setcfg(struct dc_softc *sc, int media
  				DC_SETBIT(sc, DC_SIARESET, DC_SIA_RESET);
  				DC_CLRBIT(sc, DC_10BTCTRL,
  				    DC_TCTL_AUTONEGENBL);
 -				dc_apply_fixup(sc,
 -				    (media & IFM_GMASK) == IFM_FDX ?
 -				    IFM_10_T | IFM_FDX : IFM_10_T);
  				DELAY(20000);
  			}
  		}
 @@ -1536,7 +1548,7 @@ dc_reset(struct dc_softc *sc)
  	 */
  	if (DC_IS_INTEL(sc)) {
  		DC_SETBIT(sc, DC_SIARESET, DC_SIA_RESET);
 -		CSR_WRITE_4(sc, DC_10BTCTRL, 0);
 +		CSR_WRITE_4(sc, DC_10BTCTRL, 0xFFFFFFFF);
  		CSR_WRITE_4(sc, DC_WATCHDOG, 0);
  	}
  }
 @@ -1814,6 +1826,7 @@ dc_attach(device_t dev)
  	u_int32_t command;
  	struct dc_softc *sc;
  	struct ifnet *ifp;
 +	struct dc_mediainfo *m;
  	u_int32_t reg, revision;
  	int error, i, mac_offset, phy, rid, tmp;
  	u_int8_t *mac;
 @@ -2097,6 +2110,36 @@ dc_attach(device_t dev)
  		break;
  	}
  
 +	bcopy(eaddr, sc->dc_eaddr, sizeof(eaddr));
 +	/*
 +	 * If we still have invalid station address, see whether we can
 +	 * find station address for chip 0.  Some multi-port controllers
 +	 * just store station address for chip 0 if they have a shared
 +	 * SROM.
 +	 */
 +	if ((sc->dc_eaddr[0] == 0 && (sc->dc_eaddr[1] & ~0xffff) == 0) ||
 +	    (sc->dc_eaddr[0] == 0xffffffff &&
 +	    (sc->dc_eaddr[1] & 0xffff) == 0xffff)) {
 +		error = dc_check_multiport(sc);
 +		if (error == 0) {
 +			bcopy(sc->dc_eaddr, eaddr, sizeof(eaddr));
 +			/* Extract media information. */
 +			if (DC_IS_INTEL(sc) && sc->dc_srom != NULL) {
 +				while (sc->dc_mi != NULL) {
 +					m = sc->dc_mi->dc_next;
 +					free(sc->dc_mi, M_DEVBUF);
 +					sc->dc_mi = m;
 +				}
 +				error = dc_parse_21143_srom(sc);
 +				if (error != 0)
 +					goto fail;
 +			}
 +		} else if (error == ENOMEM)
 +			goto fail;
 +		else
 +			error = 0;
 +	}
 +
  	/* Allocate a busdma tag and DMA safe memory for TX/RX descriptors. */
  	error = bus_dma_tag_create(bus_get_dma_tag(dev), PAGE_SIZE, 0,
  	    BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL,
 @@ -2931,11 +2974,8 @@ dc_tick(void *xsc)
  			 */
  			if ((DC_HAS_BROKEN_RXSTATE(sc) || (CSR_READ_4(sc,
  			    DC_ISR) & DC_ISR_RX_STATE) == DC_RXSTATE_WAIT) &&
 -			    sc->dc_cdata.dc_tx_cnt == 0) {
 +			    sc->dc_cdata.dc_tx_cnt == 0)
  				mii_tick(mii);
 -				if (!(mii->mii_media_status & IFM_ACTIVE))
 -					sc->dc_link = 0;
 -			}
  		}
  	} else
  		mii_tick(mii);
 @@ -2959,12 +2999,8 @@ dc_tick(void *xsc)
  	 * that time, packets will stay in the send queue, and once the
  	 * link comes up, they will be flushed out to the wire.
  	 */
 -	if (!sc->dc_link && mii->mii_media_status & IFM_ACTIVE &&
 -	    IFM_SUBTYPE(mii->mii_media_active) != IFM_NONE) {
 -		sc->dc_link++;
 -		if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
 -			dc_start_locked(ifp);
 -	}
 +	if (sc->dc_link != 0 && !IFQ_DRV_IS_EMPTY(&ifp->if_snd))
 +		dc_start_locked(ifp);
  
  	if (sc->dc_flags & DC_21143_NWAY && !sc->dc_link)
  		callout_reset(&sc->dc_stat_ch, hz/10, dc_tick, sc);
 @@ -3389,6 +3425,7 @@ dc_init_locked(struct dc_softc *sc)
  {
  	struct ifnet *ifp = sc->dc_ifp;
  	struct mii_data *mii;
 +	struct ifmedia *ifm;
  
  	DC_LOCK_ASSERT(sc);
  
 @@ -3399,6 +3436,10 @@ dc_init_locked(struct dc_softc *sc)
  	 */
  	dc_stop(sc);
  	dc_reset(sc);
 +	if (DC_IS_INTEL(sc)) {
 +		ifm = &mii->mii_media;
 +		dc_apply_fixup(sc, ifm->ifm_media);
 +	}
  
  	/*
  	 * Set cache alignment and burst length.
 @@ -3542,12 +3583,12 @@ dc_init_locked(struct dc_softc *sc)
  	DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_RX_ON);
  	CSR_WRITE_4(sc, DC_RXSTART, 0xFFFFFFFF);
  
 -	mii_mediachg(mii);
 -	dc_setcfg(sc, sc->dc_if_media);
 -
  	ifp->if_drv_flags |= IFF_DRV_RUNNING;
  	ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
  
 +	mii_mediachg(mii);
 +	dc_setcfg(sc, sc->dc_if_media);
 +
  	/* Don't start the ticker if this is a homePNA link. */
  	if (IFM_SUBTYPE(mii->mii_media.ifm_media) == IFM_HPNA_1)
  		sc->dc_link = 1;
 @@ -3578,7 +3619,9 @@ dc_ifmedia_upd(struct ifnet *ifp)
  	mii_mediachg(mii);
  	ifm = &mii->mii_media;
  
 -	if (DC_IS_DAVICOM(sc) &&
 +	if (DC_IS_INTEL(sc))
 +		dc_setcfg(sc, ifm->ifm_media);
 +	else if (DC_IS_DAVICOM(sc) &&
  	    IFM_SUBTYPE(ifm->ifm_media) == IFM_HPNA_1)
  		dc_setcfg(sc, ifm->ifm_media);
  	else
 @@ -3839,3 +3882,52 @@ dc_shutdown(device_t dev)
  
  	return (0);
  }
 +
 +static int
 +dc_check_multiport(struct dc_softc *sc)
 +{
 +	struct dc_softc *dsc;
 +	devclass_t dc;
 +	device_t child;
 +	uint8_t *eaddr;
 +	int unit;
 +
 +	dc = devclass_find("dc");
 +	for (unit = 0; unit < devclass_get_maxunit(dc); unit++) {
 +		child = devclass_get_device(dc, unit);
 +		if (child == NULL)
 +			continue;
 +		if (child == sc->dc_dev)
 +			continue;
 +		if (device_get_parent(child) != device_get_parent(sc->dc_dev))
 +			continue;
 +		if (unit > device_get_unit(sc->dc_dev))
 +			continue;
 +		if (device_is_attached(child) == 0)
 +			continue;
 +		dsc = device_get_softc(child);
 +		device_printf(sc->dc_dev,
 +		    "Using station address of %s as base\n",
 +		    device_get_nameunit(child));
 +		bcopy(dsc->dc_eaddr, sc->dc_eaddr, ETHER_ADDR_LEN);
 +		eaddr = (uint8_t *)sc->dc_eaddr;
 +		eaddr[5]++;
 +		/* Prepare SROM to parse again. */
 +		if (DC_IS_INTEL(sc) && dsc->dc_srom != NULL &&
 +		    sc->dc_romwidth != 0) {
 +			free(sc->dc_srom, M_DEVBUF);
 +			sc->dc_romwidth = dsc->dc_romwidth;
 +			sc->dc_srom = malloc(DC_ROM_SIZE(sc->dc_romwidth),
 +			    M_DEVBUF, M_NOWAIT);
 +			if (sc->dc_srom == NULL) {
 +				device_printf(sc->dc_dev,
 +				    "Could not allocate SROM buffer\n");
 +				return (ENOMEM);
 +			}
 +			bcopy(dsc->dc_srom, sc->dc_srom,
 +			    DC_ROM_SIZE(sc->dc_romwidth));
 +		}
 +		return (0);
 +	}
 +	return (ENOENT);
 +}
 
 Modified: stable/8/sys/dev/dc/if_dcreg.h
 ==============================================================================
 --- stable/8/sys/dev/dc/if_dcreg.h	Sun Mar 27 22:14:14 2011	(r220065)
 +++ stable/8/sys/dev/dc/if_dcreg.h	Sun Mar 27 22:20:44 2011	(r220066)
 @@ -745,6 +745,7 @@ struct dc_softc {
  	int			dc_if_media;
  	u_int32_t		dc_flags;
  	u_int32_t		dc_txthresh;
 +	u_int32_t		dc_eaddr[2];
  	u_int8_t		*dc_srom;
  	struct dc_mediainfo	*dc_mi;
  	struct dc_list_data	*dc_ldata;
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/79262: commit references a PR
Date: Sun, 27 Mar 2011 22:22:08 +0000 (UTC)

 Author: yongari
 Date: Sun Mar 27 22:21:52 2011
 New Revision: 220067
 URL: http://svn.freebsd.org/changeset/base/220067
 
 Log:
   MFC r213841,218787-218788:
   r213841:
     It seems some multi-port dc(4) controllers shares SROM of the first
     port such that reading station address from second port always
     returned 0xFF:0xFF:0xFF:0xFF:0xFF:0xFF Unfortunately it seems there
     is no easy way to know whether SROM is shared or not. Workaround
     the issue by traversing dc(4) device list and see whether we're
     using second port and use station address of controller 0 as base
     station address of second port.
   
     PR:		kern/79262
   
   r218787:
     When driver have to use base softc due to lack of SROM on second
     port, copy SROM information from base softc as well and run SROM
     parser again.  This change is necessary for some dual port
     controllers to make dc(4) correctly detect PHY media based on first
     port configuration table.
     While I'm here add a check for validity of the base softc before
     duplicating SROM contents from base softc. If driver failed to
     attach to the first port it can access invalid area.
   
     PR:		kern/79262
     Reviewed by:	marius
   
   r218788:
     Apply special PHY initialization code for 21143 controllers before
     any other media configuration. Otherwise some 21143 controller
     cannot establish a link. While I'm here remove the PHY
     initialization code in dc_setcfg(). Since dc_setcfg() is called
     whenever link state is changed, having the PHY initialization code
     in dc_setcfg() resulted in continuous link flips.
     After driver resets SIA, use default SIA transmit/receive
     configuration instead of disabling autosense/autonegotiation.
     Otherwise, controller fails to establish a link as well as losing
     auto-negotiation capability. For manual media configuration, always
     configure 21143 controller with specified media to ensure media
     change. This change makes ANA-6922 establish link with/without
     auto-negotiation.
   
     While I'm here be more strict on link UP/DOWN detection logic.
   
     Many thanks to marius who fixed several bugs in initial patch and
     even tested the patch on a couple of dc(4) controllers.
   
     PR:		kern/79262
     Reviewed by:	marius
     Tested by:	marius
 
 Modified:
   stable/7/sys/dev/dc/if_dc.c
   stable/7/sys/dev/dc/if_dcreg.h
 Directory Properties:
   stable/7/sys/   (props changed)
   stable/7/sys/cddl/contrib/opensolaris/   (props changed)
   stable/7/sys/contrib/dev/acpica/   (props changed)
   stable/7/sys/contrib/pf/   (props changed)
 
 Modified: stable/7/sys/dev/dc/if_dc.c
 ==============================================================================
 --- stable/7/sys/dev/dc/if_dc.c	Sun Mar 27 22:20:44 2011	(r220066)
 +++ stable/7/sys/dev/dc/if_dc.c	Sun Mar 27 22:21:52 2011	(r220067)
 @@ -293,6 +293,7 @@ static int dc_decode_leaf_sia(struct dc_
  static int dc_decode_leaf_mii(struct dc_softc *, struct dc_eblock_mii *);
  static int dc_decode_leaf_sym(struct dc_softc *, struct dc_eblock_sym *);
  static void dc_apply_fixup(struct dc_softc *, int);
 +static int dc_check_multiport(struct dc_softc *);
  
  #ifdef DC_USEIOSPACE
  #define DC_RES			SYS_RES_IOPORT
 @@ -944,23 +945,45 @@ static void
  dc_miibus_statchg(device_t dev)
  {
  	struct dc_softc *sc;
 +	struct ifnet *ifp;
  	struct mii_data *mii;
  	struct ifmedia *ifm;
  
  	sc = device_get_softc(dev);
 -	if (DC_IS_ADMTEK(sc))
 -		return;
  
  	mii = device_get_softc(sc->dc_miibus);
 +	ifp = sc->dc_ifp;
 +	if (mii == NULL || ifp == NULL ||
 +	    (ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
 +		return;
 +
  	ifm = &mii->mii_media;
  	if (DC_IS_DAVICOM(sc) &&
  	    IFM_SUBTYPE(ifm->ifm_media) == IFM_HPNA_1) {
  		dc_setcfg(sc, ifm->ifm_media);
  		sc->dc_if_media = ifm->ifm_media;
 -	} else {
 -		dc_setcfg(sc, mii->mii_media_active);
 -		sc->dc_if_media = mii->mii_media_active;
 +		return;
  	}
 +
 +	sc->dc_link = 0;
 +	if ((mii->mii_media_status & (IFM_ACTIVE | IFM_AVALID)) ==
 +	    (IFM_ACTIVE | IFM_AVALID)) {
 +		switch (IFM_SUBTYPE(mii->mii_media_active)) {
 +		case IFM_10_T:
 +		case IFM_100_TX:
 +			sc->dc_link = 1;
 +			break;
 +		default:
 +			break;
 +		}
 +	}
 +	if (sc->dc_link == 0)
 +		return;
 +
 +	sc->dc_if_media = mii->mii_media_active;
 +	if (DC_IS_ADMTEK(sc))
 +		return;
 +	dc_setcfg(sc, mii->mii_media_active);
  }
  
  /*
 @@ -1404,8 +1427,6 @@ dc_setcfg(struct dc_softc *sc, int media
  			if (!DC_IS_DAVICOM(sc))
  				DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_PORTSEL);
  			DC_CLRBIT(sc, DC_10BTCTRL, 0xFFFF);
 -			if (DC_IS_INTEL(sc))
 -				dc_apply_fixup(sc, IFM_AUTO);
  		} else {
  			if (DC_IS_PNIC(sc)) {
  				DC_PN_GPIO_SETBIT(sc, DC_PN_GPIO_SPEEDSEL);
 @@ -1415,10 +1436,6 @@ dc_setcfg(struct dc_softc *sc, int media
  			DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_PORTSEL);
  			DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_PCS);
  			DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_SCRAMBLER);
 -			if (DC_IS_INTEL(sc))
 -				dc_apply_fixup(sc,
 -				    (media & IFM_GMASK) == IFM_FDX ?
 -				    IFM_100_TX | IFM_FDX : IFM_100_TX);
  		}
  	}
  
 @@ -1442,8 +1459,6 @@ dc_setcfg(struct dc_softc *sc, int media
  			if (!DC_IS_DAVICOM(sc))
  				DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_PORTSEL);
  			DC_CLRBIT(sc, DC_10BTCTRL, 0xFFFF);
 -			if (DC_IS_INTEL(sc))
 -				dc_apply_fixup(sc, IFM_AUTO);
  		} else {
  			if (DC_IS_PNIC(sc)) {
  				DC_PN_GPIO_CLRBIT(sc, DC_PN_GPIO_SPEEDSEL);
 @@ -1463,9 +1478,6 @@ dc_setcfg(struct dc_softc *sc, int media
  				DC_SETBIT(sc, DC_SIARESET, DC_SIA_RESET);
  				DC_CLRBIT(sc, DC_10BTCTRL,
  				    DC_TCTL_AUTONEGENBL);
 -				dc_apply_fixup(sc,
 -				    (media & IFM_GMASK) == IFM_FDX ?
 -				    IFM_10_T | IFM_FDX : IFM_10_T);
  				DELAY(20000);
  			}
  		}
 @@ -1537,7 +1549,7 @@ dc_reset(struct dc_softc *sc)
  	 */
  	if (DC_IS_INTEL(sc)) {
  		DC_SETBIT(sc, DC_SIARESET, DC_SIA_RESET);
 -		CSR_WRITE_4(sc, DC_10BTCTRL, 0);
 +		CSR_WRITE_4(sc, DC_10BTCTRL, 0xFFFFFFFF);
  		CSR_WRITE_4(sc, DC_WATCHDOG, 0);
  	}
  }
 @@ -1815,6 +1827,7 @@ dc_attach(device_t dev)
  	u_int32_t command;
  	struct dc_softc *sc;
  	struct ifnet *ifp;
 +	struct dc_mediainfo *m;
  	u_int32_t reg, revision;
  	int error, i, mac_offset, phy, rid, tmp;
  	u_int8_t *mac;
 @@ -2098,6 +2111,36 @@ dc_attach(device_t dev)
  		break;
  	}
  
 +	bcopy(eaddr, sc->dc_eaddr, sizeof(eaddr));
 +	/*
 +	 * If we still have invalid station address, see whether we can
 +	 * find station address for chip 0.  Some multi-port controllers
 +	 * just store station address for chip 0 if they have a shared
 +	 * SROM.
 +	 */
 +	if ((sc->dc_eaddr[0] == 0 && (sc->dc_eaddr[1] & ~0xffff) == 0) ||
 +	    (sc->dc_eaddr[0] == 0xffffffff &&
 +	    (sc->dc_eaddr[1] & 0xffff) == 0xffff)) {
 +		error = dc_check_multiport(sc);
 +		if (error == 0) {
 +			bcopy(sc->dc_eaddr, eaddr, sizeof(eaddr));
 +			/* Extract media information. */
 +			if (DC_IS_INTEL(sc) && sc->dc_srom != NULL) {
 +				while (sc->dc_mi != NULL) {
 +					m = sc->dc_mi->dc_next;
 +					free(sc->dc_mi, M_DEVBUF);
 +					sc->dc_mi = m;
 +				}
 +				error = dc_parse_21143_srom(sc);
 +				if (error != 0)
 +					goto fail;
 +			}
 +		} else if (error == ENOMEM)
 +			goto fail;
 +		else
 +			error = 0;
 +	}
 +
  	/* Allocate a busdma tag and DMA safe memory for TX/RX descriptors. */
  	error = bus_dma_tag_create(bus_get_dma_tag(dev), PAGE_SIZE, 0,
  	    BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL,
 @@ -2928,11 +2971,8 @@ dc_tick(void *xsc)
  			 */
  			if ((DC_HAS_BROKEN_RXSTATE(sc) || (CSR_READ_4(sc,
  			    DC_ISR) & DC_ISR_RX_STATE) == DC_RXSTATE_WAIT) &&
 -			    sc->dc_cdata.dc_tx_cnt == 0) {
 +			    sc->dc_cdata.dc_tx_cnt == 0)
  				mii_tick(mii);
 -				if (!(mii->mii_media_status & IFM_ACTIVE))
 -					sc->dc_link = 0;
 -			}
  		}
  	} else
  		mii_tick(mii);
 @@ -2956,12 +2996,8 @@ dc_tick(void *xsc)
  	 * that time, packets will stay in the send queue, and once the
  	 * link comes up, they will be flushed out to the wire.
  	 */
 -	if (!sc->dc_link && mii->mii_media_status & IFM_ACTIVE &&
 -	    IFM_SUBTYPE(mii->mii_media_active) != IFM_NONE) {
 -		sc->dc_link++;
 -		if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
 -			dc_start_locked(ifp);
 -	}
 +	if (sc->dc_link != 0 && !IFQ_DRV_IS_EMPTY(&ifp->if_snd))
 +		dc_start_locked(ifp);
  
  	if (sc->dc_flags & DC_21143_NWAY && !sc->dc_link)
  		callout_reset(&sc->dc_stat_ch, hz/10, dc_tick, sc);
 @@ -3384,6 +3420,7 @@ dc_init_locked(struct dc_softc *sc)
  {
  	struct ifnet *ifp = sc->dc_ifp;
  	struct mii_data *mii;
 +	struct ifmedia *ifm;
  
  	DC_LOCK_ASSERT(sc);
  
 @@ -3394,6 +3431,10 @@ dc_init_locked(struct dc_softc *sc)
  	 */
  	dc_stop(sc);
  	dc_reset(sc);
 +	if (DC_IS_INTEL(sc)) {
 +		ifm = &mii->mii_media;
 +		dc_apply_fixup(sc, ifm->ifm_media);
 +	}
  
  	/*
  	 * Set cache alignment and burst length.
 @@ -3537,12 +3578,12 @@ dc_init_locked(struct dc_softc *sc)
  	DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_RX_ON);
  	CSR_WRITE_4(sc, DC_RXSTART, 0xFFFFFFFF);
  
 -	mii_mediachg(mii);
 -	dc_setcfg(sc, sc->dc_if_media);
 -
  	ifp->if_drv_flags |= IFF_DRV_RUNNING;
  	ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
  
 +	mii_mediachg(mii);
 +	dc_setcfg(sc, sc->dc_if_media);
 +
  	/* Don't start the ticker if this is a homePNA link. */
  	if (IFM_SUBTYPE(mii->mii_media.ifm_media) == IFM_HPNA_1)
  		sc->dc_link = 1;
 @@ -3573,7 +3614,9 @@ dc_ifmedia_upd(struct ifnet *ifp)
  	mii_mediachg(mii);
  	ifm = &mii->mii_media;
  
 -	if (DC_IS_DAVICOM(sc) &&
 +	if (DC_IS_INTEL(sc))
 +		dc_setcfg(sc, ifm->ifm_media);
 +	else if (DC_IS_DAVICOM(sc) &&
  	    IFM_SUBTYPE(ifm->ifm_media) == IFM_HPNA_1)
  		dc_setcfg(sc, ifm->ifm_media);
  	else
 @@ -3834,3 +3877,52 @@ dc_shutdown(device_t dev)
  
  	return (0);
  }
 +
 +static int
 +dc_check_multiport(struct dc_softc *sc)
 +{
 +	struct dc_softc *dsc;
 +	devclass_t dc;
 +	device_t child;
 +	uint8_t *eaddr;
 +	int unit;
 +
 +	dc = devclass_find("dc");
 +	for (unit = 0; unit < devclass_get_maxunit(dc); unit++) {
 +		child = devclass_get_device(dc, unit);
 +		if (child == NULL)
 +			continue;
 +		if (child == sc->dc_dev)
 +			continue;
 +		if (device_get_parent(child) != device_get_parent(sc->dc_dev))
 +			continue;
 +		if (unit > device_get_unit(sc->dc_dev))
 +			continue;
 +		if (device_is_attached(child) == 0)
 +			continue;
 +		dsc = device_get_softc(child);
 +		device_printf(sc->dc_dev,
 +		    "Using station address of %s as base\n",
 +		    device_get_nameunit(child));
 +		bcopy(dsc->dc_eaddr, sc->dc_eaddr, ETHER_ADDR_LEN);
 +		eaddr = (uint8_t *)sc->dc_eaddr;
 +		eaddr[5]++;
 +		/* Prepare SROM to parse again. */
 +		if (DC_IS_INTEL(sc) && dsc->dc_srom != NULL &&
 +		    sc->dc_romwidth != 0) {
 +			free(sc->dc_srom, M_DEVBUF);
 +			sc->dc_romwidth = dsc->dc_romwidth;
 +			sc->dc_srom = malloc(DC_ROM_SIZE(sc->dc_romwidth),
 +			    M_DEVBUF, M_NOWAIT);
 +			if (sc->dc_srom == NULL) {
 +				device_printf(sc->dc_dev,
 +				    "Could not allocate SROM buffer\n");
 +				return (ENOMEM);
 +			}
 +			bcopy(dsc->dc_srom, sc->dc_srom,
 +			    DC_ROM_SIZE(sc->dc_romwidth));
 +		}
 +		return (0);
 +	}
 +	return (ENOENT);
 +}
 
 Modified: stable/7/sys/dev/dc/if_dcreg.h
 ==============================================================================
 --- stable/7/sys/dev/dc/if_dcreg.h	Sun Mar 27 22:20:44 2011	(r220066)
 +++ stable/7/sys/dev/dc/if_dcreg.h	Sun Mar 27 22:21:52 2011	(r220067)
 @@ -745,6 +745,7 @@ struct dc_softc {
  	int			dc_if_media;
  	u_int32_t		dc_flags;
  	u_int32_t		dc_txthresh;
 +	u_int32_t		dc_eaddr[2];
  	u_int8_t		*dc_srom;
  	struct dc_mediainfo	*dc_mi;
  	struct dc_list_data	*dc_ldata;
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/79262: commit references a PR
Date: Sun, 27 Mar 2011 22:22:08 +0000 (UTC)

 Author: yongari
 Date: Sun Mar 27 22:21:52 2011
 New Revision: 220067
 URL: http://svn.freebsd.org/changeset/base/220067
 
 Log:
   MFC r213841,218787-218788:
   r213841:
     It seems some multi-port dc(4) controllers shares SROM of the first
     port such that reading station address from second port always
     returned 0xFF:0xFF:0xFF:0xFF:0xFF:0xFF Unfortunately it seems there
     is no easy way to know whether SROM is shared or not. Workaround
     the issue by traversing dc(4) device list and see whether we're
     using second port and use station address of controller 0 as base
     station address of second port.
   
     PR:		kern/79262
   
   r218787:
     When driver have to use base softc due to lack of SROM on second
     port, copy SROM information from base softc as well and run SROM
     parser again.  This change is necessary for some dual port
     controllers to make dc(4) correctly detect PHY media based on first
     port configuration table.
     While I'm here add a check for validity of the base softc before
     duplicating SROM contents from base softc. If driver failed to
     attach to the first port it can access invalid area.
   
     PR:		kern/79262
     Reviewed by:	marius
   
   r218788:
     Apply special PHY initialization code for 21143 controllers before
     any other media configuration. Otherwise some 21143 controller
     cannot establish a link. While I'm here remove the PHY
     initialization code in dc_setcfg(). Since dc_setcfg() is called
     whenever link state is changed, having the PHY initialization code
     in dc_setcfg() resulted in continuous link flips.
     After driver resets SIA, use default SIA transmit/receive
     configuration instead of disabling autosense/autonegotiation.
     Otherwise, controller fails to establish a link as well as losing
     auto-negotiation capability. For manual media configuration, always
     configure 21143 controller with specified media to ensure media
     change. This change makes ANA-6922 establish link with/without
     auto-negotiation.
   
     While I'm here be more strict on link UP/DOWN detection logic.
   
     Many thanks to marius who fixed several bugs in initial patch and
     even tested the patch on a couple of dc(4) controllers.
   
     PR:		kern/79262
     Reviewed by:	marius
     Tested by:	marius
 
 Modified:
   stable/7/sys/dev/dc/if_dc.c
   stable/7/sys/dev/dc/if_dcreg.h
 Directory Properties:
   stable/7/sys/   (props changed)
   stable/7/sys/cddl/contrib/opensolaris/   (props changed)
   stable/7/sys/contrib/dev/acpica/   (props changed)
   stable/7/sys/contrib/pf/   (props changed)
 
 Modified: stable/7/sys/dev/dc/if_dc.c
 ==============================================================================
 --- stable/7/sys/dev/dc/if_dc.c	Sun Mar 27 22:20:44 2011	(r220066)
 +++ stable/7/sys/dev/dc/if_dc.c	Sun Mar 27 22:21:52 2011	(r220067)
 @@ -293,6 +293,7 @@ static int dc_decode_leaf_sia(struct dc_
  static int dc_decode_leaf_mii(struct dc_softc *, struct dc_eblock_mii *);
  static int dc_decode_leaf_sym(struct dc_softc *, struct dc_eblock_sym *);
  static void dc_apply_fixup(struct dc_softc *, int);
 +static int dc_check_multiport(struct dc_softc *);
  
  #ifdef DC_USEIOSPACE
  #define DC_RES			SYS_RES_IOPORT
 @@ -944,23 +945,45 @@ static void
  dc_miibus_statchg(device_t dev)
  {
  	struct dc_softc *sc;
 +	struct ifnet *ifp;
  	struct mii_data *mii;
  	struct ifmedia *ifm;
  
  	sc = device_get_softc(dev);
 -	if (DC_IS_ADMTEK(sc))
 -		return;
  
  	mii = device_get_softc(sc->dc_miibus);
 +	ifp = sc->dc_ifp;
 +	if (mii == NULL || ifp == NULL ||
 +	    (ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
 +		return;
 +
  	ifm = &mii->mii_media;
  	if (DC_IS_DAVICOM(sc) &&
  	    IFM_SUBTYPE(ifm->ifm_media) == IFM_HPNA_1) {
  		dc_setcfg(sc, ifm->ifm_media);
  		sc->dc_if_media = ifm->ifm_media;
 -	} else {
 -		dc_setcfg(sc, mii->mii_media_active);
 -		sc->dc_if_media = mii->mii_media_active;
 +		return;
  	}
 +
 +	sc->dc_link = 0;
 +	if ((mii->mii_media_status & (IFM_ACTIVE | IFM_AVALID)) ==
 +	    (IFM_ACTIVE | IFM_AVALID)) {
 +		switch (IFM_SUBTYPE(mii->mii_media_active)) {
 +		case IFM_10_T:
 +		case IFM_100_TX:
 +			sc->dc_link = 1;
 +			break;
 +		default:
 +			break;
 +		}
 +	}
 +	if (sc->dc_link == 0)
 +		return;
 +
 +	sc->dc_if_media = mii->mii_media_active;
 +	if (DC_IS_ADMTEK(sc))
 +		return;
 +	dc_setcfg(sc, mii->mii_media_active);
  }
  
  /*
 @@ -1404,8 +1427,6 @@ dc_setcfg(struct dc_softc *sc, int media
  			if (!DC_IS_DAVICOM(sc))
  				DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_PORTSEL);
  			DC_CLRBIT(sc, DC_10BTCTRL, 0xFFFF);
 -			if (DC_IS_INTEL(sc))
 -				dc_apply_fixup(sc, IFM_AUTO);
  		} else {
  			if (DC_IS_PNIC(sc)) {
  				DC_PN_GPIO_SETBIT(sc, DC_PN_GPIO_SPEEDSEL);
 @@ -1415,10 +1436,6 @@ dc_setcfg(struct dc_softc *sc, int media
  			DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_PORTSEL);
  			DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_PCS);
  			DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_SCRAMBLER);
 -			if (DC_IS_INTEL(sc))
 -				dc_apply_fixup(sc,
 -				    (media & IFM_GMASK) == IFM_FDX ?
 -				    IFM_100_TX | IFM_FDX : IFM_100_TX);
  		}
  	}
  
 @@ -1442,8 +1459,6 @@ dc_setcfg(struct dc_softc *sc, int media
  			if (!DC_IS_DAVICOM(sc))
  				DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_PORTSEL);
  			DC_CLRBIT(sc, DC_10BTCTRL, 0xFFFF);
 -			if (DC_IS_INTEL(sc))
 -				dc_apply_fixup(sc, IFM_AUTO);
  		} else {
  			if (DC_IS_PNIC(sc)) {
  				DC_PN_GPIO_CLRBIT(sc, DC_PN_GPIO_SPEEDSEL);
 @@ -1463,9 +1478,6 @@ dc_setcfg(struct dc_softc *sc, int media
  				DC_SETBIT(sc, DC_SIARESET, DC_SIA_RESET);
  				DC_CLRBIT(sc, DC_10BTCTRL,
  				    DC_TCTL_AUTONEGENBL);
 -				dc_apply_fixup(sc,
 -				    (media & IFM_GMASK) == IFM_FDX ?
 -				    IFM_10_T | IFM_FDX : IFM_10_T);
  				DELAY(20000);
  			}
  		}
 @@ -1537,7 +1549,7 @@ dc_reset(struct dc_softc *sc)
  	 */
  	if (DC_IS_INTEL(sc)) {
  		DC_SETBIT(sc, DC_SIARESET, DC_SIA_RESET);
 -		CSR_WRITE_4(sc, DC_10BTCTRL, 0);
 +		CSR_WRITE_4(sc, DC_10BTCTRL, 0xFFFFFFFF);
  		CSR_WRITE_4(sc, DC_WATCHDOG, 0);
  	}
  }
 @@ -1815,6 +1827,7 @@ dc_attach(device_t dev)
  	u_int32_t command;
  	struct dc_softc *sc;
  	struct ifnet *ifp;
 +	struct dc_mediainfo *m;
  	u_int32_t reg, revision;
  	int error, i, mac_offset, phy, rid, tmp;
  	u_int8_t *mac;
 @@ -2098,6 +2111,36 @@ dc_attach(device_t dev)
  		break;
  	}
  
 +	bcopy(eaddr, sc->dc_eaddr, sizeof(eaddr));
 +	/*
 +	 * If we still have invalid station address, see whether we can
 +	 * find station address for chip 0.  Some multi-port controllers
 +	 * just store station address for chip 0 if they have a shared
 +	 * SROM.
 +	 */
 +	if ((sc->dc_eaddr[0] == 0 && (sc->dc_eaddr[1] & ~0xffff) == 0) ||
 +	    (sc->dc_eaddr[0] == 0xffffffff &&
 +	    (sc->dc_eaddr[1] & 0xffff) == 0xffff)) {
 +		error = dc_check_multiport(sc);
 +		if (error == 0) {
 +			bcopy(sc->dc_eaddr, eaddr, sizeof(eaddr));
 +			/* Extract media information. */
 +			if (DC_IS_INTEL(sc) && sc->dc_srom != NULL) {
 +				while (sc->dc_mi != NULL) {
 +					m = sc->dc_mi->dc_next;
 +					free(sc->dc_mi, M_DEVBUF);
 +					sc->dc_mi = m;
 +				}
 +				error = dc_parse_21143_srom(sc);
 +				if (error != 0)
 +					goto fail;
 +			}
 +		} else if (error == ENOMEM)
 +			goto fail;
 +		else
 +			error = 0;
 +	}
 +
  	/* Allocate a busdma tag and DMA safe memory for TX/RX descriptors. */
  	error = bus_dma_tag_create(bus_get_dma_tag(dev), PAGE_SIZE, 0,
  	    BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL,
 @@ -2928,11 +2971,8 @@ dc_tick(void *xsc)
  			 */
  			if ((DC_HAS_BROKEN_RXSTATE(sc) || (CSR_READ_4(sc,
  			    DC_ISR) & DC_ISR_RX_STATE) == DC_RXSTATE_WAIT) &&
 -			    sc->dc_cdata.dc_tx_cnt == 0) {
 +			    sc->dc_cdata.dc_tx_cnt == 0)
  				mii_tick(mii);
 -				if (!(mii->mii_media_status & IFM_ACTIVE))
 -					sc->dc_link = 0;
 -			}
  		}
  	} else
  		mii_tick(mii);
 @@ -2956,12 +2996,8 @@ dc_tick(void *xsc)
  	 * that time, packets will stay in the send queue, and once the
  	 * link comes up, they will be flushed out to the wire.
  	 */
 -	if (!sc->dc_link && mii->mii_media_status & IFM_ACTIVE &&
 -	    IFM_SUBTYPE(mii->mii_media_active) != IFM_NONE) {
 -		sc->dc_link++;
 -		if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
 -			dc_start_locked(ifp);
 -	}
 +	if (sc->dc_link != 0 && !IFQ_DRV_IS_EMPTY(&ifp->if_snd))
 +		dc_start_locked(ifp);
  
  	if (sc->dc_flags & DC_21143_NWAY && !sc->dc_link)
  		callout_reset(&sc->dc_stat_ch, hz/10, dc_tick, sc);
 @@ -3384,6 +3420,7 @@ dc_init_locked(struct dc_softc *sc)
  {
  	struct ifnet *ifp = sc->dc_ifp;
  	struct mii_data *mii;
 +	struct ifmedia *ifm;
  
  	DC_LOCK_ASSERT(sc);
  
 @@ -3394,6 +3431,10 @@ dc_init_locked(struct dc_softc *sc)
  	 */
  	dc_stop(sc);
  	dc_reset(sc);
 +	if (DC_IS_INTEL(sc)) {
 +		ifm = &mii->mii_media;
 +		dc_apply_fixup(sc, ifm->ifm_media);
 +	}
  
  	/*
  	 * Set cache alignment and burst length.
 @@ -3537,12 +3578,12 @@ dc_init_locked(struct dc_softc *sc)
  	DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_RX_ON);
  	CSR_WRITE_4(sc, DC_RXSTART, 0xFFFFFFFF);
  
 -	mii_mediachg(mii);
 -	dc_setcfg(sc, sc->dc_if_media);
 -
  	ifp->if_drv_flags |= IFF_DRV_RUNNING;
  	ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
  
 +	mii_mediachg(mii);
 +	dc_setcfg(sc, sc->dc_if_media);
 +
  	/* Don't start the ticker if this is a homePNA link. */
  	if (IFM_SUBTYPE(mii->mii_media.ifm_media) == IFM_HPNA_1)
  		sc->dc_link = 1;
 @@ -3573,7 +3614,9 @@ dc_ifmedia_upd(struct ifnet *ifp)
  	mii_mediachg(mii);
  	ifm = &mii->mii_media;
  
 -	if (DC_IS_DAVICOM(sc) &&
 +	if (DC_IS_INTEL(sc))
 +		dc_setcfg(sc, ifm->ifm_media);
 +	else if (DC_IS_DAVICOM(sc) &&
  	    IFM_SUBTYPE(ifm->ifm_media) == IFM_HPNA_1)
  		dc_setcfg(sc, ifm->ifm_media);
  	else
 @@ -3834,3 +3877,52 @@ dc_shutdown(device_t dev)
  
  	return (0);
  }
 +
 +static int
 +dc_check_multiport(struct dc_softc *sc)
 +{
 +	struct dc_softc *dsc;
 +	devclass_t dc;
 +	device_t child;
 +	uint8_t *eaddr;
 +	int unit;
 +
 +	dc = devclass_find("dc");
 +	for (unit = 0; unit < devclass_get_maxunit(dc); unit++) {
 +		child = devclass_get_device(dc, unit);
 +		if (child == NULL)
 +			continue;
 +		if (child == sc->dc_dev)
 +			continue;
 +		if (device_get_parent(child) != device_get_parent(sc->dc_dev))
 +			continue;
 +		if (unit > device_get_unit(sc->dc_dev))
 +			continue;
 +		if (device_is_attached(child) == 0)
 +			continue;
 +		dsc = device_get_softc(child);
 +		device_printf(sc->dc_dev,
 +		    "Using station address of %s as base\n",
 +		    device_get_nameunit(child));
 +		bcopy(dsc->dc_eaddr, sc->dc_eaddr, ETHER_ADDR_LEN);
 +		eaddr = (uint8_t *)sc->dc_eaddr;
 +		eaddr[5]++;
 +		/* Prepare SROM to parse again. */
 +		if (DC_IS_INTEL(sc) && dsc->dc_srom != NULL &&
 +		    sc->dc_romwidth != 0) {
 +			free(sc->dc_srom, M_DEVBUF);
 +			sc->dc_romwidth = dsc->dc_romwidth;
 +			sc->dc_srom = malloc(DC_ROM_SIZE(sc->dc_romwidth),
 +			    M_DEVBUF, M_NOWAIT);
 +			if (sc->dc_srom == NULL) {
 +				device_printf(sc->dc_dev,
 +				    "Could not allocate SROM buffer\n");
 +				return (ENOMEM);
 +			}
 +			bcopy(dsc->dc_srom, sc->dc_srom,
 +			    DC_ROM_SIZE(sc->dc_romwidth));
 +		}
 +		return (0);
 +	}
 +	return (ENOENT);
 +}
 
 Modified: stable/7/sys/dev/dc/if_dcreg.h
 ==============================================================================
 --- stable/7/sys/dev/dc/if_dcreg.h	Sun Mar 27 22:20:44 2011	(r220066)
 +++ stable/7/sys/dev/dc/if_dcreg.h	Sun Mar 27 22:21:52 2011	(r220067)
 @@ -745,6 +745,7 @@ struct dc_softc {
  	int			dc_if_media;
  	u_int32_t		dc_flags;
  	u_int32_t		dc_txthresh;
 +	u_int32_t		dc_eaddr[2];
  	u_int8_t		*dc_srom;
  	struct dc_mediainfo	*dc_mi;
  	struct dc_list_data	*dc_ldata;
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/79262: commit references a PR
Date: Sun, 27 Mar 2011 22:22:09 +0000 (UTC)

 Author: yongari
 Date: Sun Mar 27 22:21:52 2011
 New Revision: 220067
 URL: http://svn.freebsd.org/changeset/base/220067
 
 Log:
   MFC r213841,218787-218788:
   r213841:
     It seems some multi-port dc(4) controllers shares SROM of the first
     port such that reading station address from second port always
     returned 0xFF:0xFF:0xFF:0xFF:0xFF:0xFF Unfortunately it seems there
     is no easy way to know whether SROM is shared or not. Workaround
     the issue by traversing dc(4) device list and see whether we're
     using second port and use station address of controller 0 as base
     station address of second port.
   
     PR:		kern/79262
   
   r218787:
     When driver have to use base softc due to lack of SROM on second
     port, copy SROM information from base softc as well and run SROM
     parser again.  This change is necessary for some dual port
     controllers to make dc(4) correctly detect PHY media based on first
     port configuration table.
     While I'm here add a check for validity of the base softc before
     duplicating SROM contents from base softc. If driver failed to
     attach to the first port it can access invalid area.
   
     PR:		kern/79262
     Reviewed by:	marius
   
   r218788:
     Apply special PHY initialization code for 21143 controllers before
     any other media configuration. Otherwise some 21143 controller
     cannot establish a link. While I'm here remove the PHY
     initialization code in dc_setcfg(). Since dc_setcfg() is called
     whenever link state is changed, having the PHY initialization code
     in dc_setcfg() resulted in continuous link flips.
     After driver resets SIA, use default SIA transmit/receive
     configuration instead of disabling autosense/autonegotiation.
     Otherwise, controller fails to establish a link as well as losing
     auto-negotiation capability. For manual media configuration, always
     configure 21143 controller with specified media to ensure media
     change. This change makes ANA-6922 establish link with/without
     auto-negotiation.
   
     While I'm here be more strict on link UP/DOWN detection logic.
   
     Many thanks to marius who fixed several bugs in initial patch and
     even tested the patch on a couple of dc(4) controllers.
   
     PR:		kern/79262
     Reviewed by:	marius
     Tested by:	marius
 
 Modified:
   stable/7/sys/dev/dc/if_dc.c
   stable/7/sys/dev/dc/if_dcreg.h
 Directory Properties:
   stable/7/sys/   (props changed)
   stable/7/sys/cddl/contrib/opensolaris/   (props changed)
   stable/7/sys/contrib/dev/acpica/   (props changed)
   stable/7/sys/contrib/pf/   (props changed)
 
 Modified: stable/7/sys/dev/dc/if_dc.c
 ==============================================================================
 --- stable/7/sys/dev/dc/if_dc.c	Sun Mar 27 22:20:44 2011	(r220066)
 +++ stable/7/sys/dev/dc/if_dc.c	Sun Mar 27 22:21:52 2011	(r220067)
 @@ -293,6 +293,7 @@ static int dc_decode_leaf_sia(struct dc_
  static int dc_decode_leaf_mii(struct dc_softc *, struct dc_eblock_mii *);
  static int dc_decode_leaf_sym(struct dc_softc *, struct dc_eblock_sym *);
  static void dc_apply_fixup(struct dc_softc *, int);
 +static int dc_check_multiport(struct dc_softc *);
  
  #ifdef DC_USEIOSPACE
  #define DC_RES			SYS_RES_IOPORT
 @@ -944,23 +945,45 @@ static void
  dc_miibus_statchg(device_t dev)
  {
  	struct dc_softc *sc;
 +	struct ifnet *ifp;
  	struct mii_data *mii;
  	struct ifmedia *ifm;
  
  	sc = device_get_softc(dev);
 -	if (DC_IS_ADMTEK(sc))
 -		return;
  
  	mii = device_get_softc(sc->dc_miibus);
 +	ifp = sc->dc_ifp;
 +	if (mii == NULL || ifp == NULL ||
 +	    (ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
 +		return;
 +
  	ifm = &mii->mii_media;
  	if (DC_IS_DAVICOM(sc) &&
  	    IFM_SUBTYPE(ifm->ifm_media) == IFM_HPNA_1) {
  		dc_setcfg(sc, ifm->ifm_media);
  		sc->dc_if_media = ifm->ifm_media;
 -	} else {
 -		dc_setcfg(sc, mii->mii_media_active);
 -		sc->dc_if_media = mii->mii_media_active;
 +		return;
  	}
 +
 +	sc->dc_link = 0;
 +	if ((mii->mii_media_status & (IFM_ACTIVE | IFM_AVALID)) ==
 +	    (IFM_ACTIVE | IFM_AVALID)) {
 +		switch (IFM_SUBTYPE(mii->mii_media_active)) {
 +		case IFM_10_T:
 +		case IFM_100_TX:
 +			sc->dc_link = 1;
 +			break;
 +		default:
 +			break;
 +		}
 +	}
 +	if (sc->dc_link == 0)
 +		return;
 +
 +	sc->dc_if_media = mii->mii_media_active;
 +	if (DC_IS_ADMTEK(sc))
 +		return;
 +	dc_setcfg(sc, mii->mii_media_active);
  }
  
  /*
 @@ -1404,8 +1427,6 @@ dc_setcfg(struct dc_softc *sc, int media
  			if (!DC_IS_DAVICOM(sc))
  				DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_PORTSEL);
  			DC_CLRBIT(sc, DC_10BTCTRL, 0xFFFF);
 -			if (DC_IS_INTEL(sc))
 -				dc_apply_fixup(sc, IFM_AUTO);
  		} else {
  			if (DC_IS_PNIC(sc)) {
  				DC_PN_GPIO_SETBIT(sc, DC_PN_GPIO_SPEEDSEL);
 @@ -1415,10 +1436,6 @@ dc_setcfg(struct dc_softc *sc, int media
  			DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_PORTSEL);
  			DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_PCS);
  			DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_SCRAMBLER);
 -			if (DC_IS_INTEL(sc))
 -				dc_apply_fixup(sc,
 -				    (media & IFM_GMASK) == IFM_FDX ?
 -				    IFM_100_TX | IFM_FDX : IFM_100_TX);
  		}
  	}
  
 @@ -1442,8 +1459,6 @@ dc_setcfg(struct dc_softc *sc, int media
  			if (!DC_IS_DAVICOM(sc))
  				DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_PORTSEL);
  			DC_CLRBIT(sc, DC_10BTCTRL, 0xFFFF);
 -			if (DC_IS_INTEL(sc))
 -				dc_apply_fixup(sc, IFM_AUTO);
  		} else {
  			if (DC_IS_PNIC(sc)) {
  				DC_PN_GPIO_CLRBIT(sc, DC_PN_GPIO_SPEEDSEL);
 @@ -1463,9 +1478,6 @@ dc_setcfg(struct dc_softc *sc, int media
  				DC_SETBIT(sc, DC_SIARESET, DC_SIA_RESET);
  				DC_CLRBIT(sc, DC_10BTCTRL,
  				    DC_TCTL_AUTONEGENBL);
 -				dc_apply_fixup(sc,
 -				    (media & IFM_GMASK) == IFM_FDX ?
 -				    IFM_10_T | IFM_FDX : IFM_10_T);
  				DELAY(20000);
  			}
  		}
 @@ -1537,7 +1549,7 @@ dc_reset(struct dc_softc *sc)
  	 */
  	if (DC_IS_INTEL(sc)) {
  		DC_SETBIT(sc, DC_SIARESET, DC_SIA_RESET);
 -		CSR_WRITE_4(sc, DC_10BTCTRL, 0);
 +		CSR_WRITE_4(sc, DC_10BTCTRL, 0xFFFFFFFF);
  		CSR_WRITE_4(sc, DC_WATCHDOG, 0);
  	}
  }
 @@ -1815,6 +1827,7 @@ dc_attach(device_t dev)
  	u_int32_t command;
  	struct dc_softc *sc;
  	struct ifnet *ifp;
 +	struct dc_mediainfo *m;
  	u_int32_t reg, revision;
  	int error, i, mac_offset, phy, rid, tmp;
  	u_int8_t *mac;
 @@ -2098,6 +2111,36 @@ dc_attach(device_t dev)
  		break;
  	}
  
 +	bcopy(eaddr, sc->dc_eaddr, sizeof(eaddr));
 +	/*
 +	 * If we still have invalid station address, see whether we can
 +	 * find station address for chip 0.  Some multi-port controllers
 +	 * just store station address for chip 0 if they have a shared
 +	 * SROM.
 +	 */
 +	if ((sc->dc_eaddr[0] == 0 && (sc->dc_eaddr[1] & ~0xffff) == 0) ||
 +	    (sc->dc_eaddr[0] == 0xffffffff &&
 +	    (sc->dc_eaddr[1] & 0xffff) == 0xffff)) {
 +		error = dc_check_multiport(sc);
 +		if (error == 0) {
 +			bcopy(sc->dc_eaddr, eaddr, sizeof(eaddr));
 +			/* Extract media information. */
 +			if (DC_IS_INTEL(sc) && sc->dc_srom != NULL) {
 +				while (sc->dc_mi != NULL) {
 +					m = sc->dc_mi->dc_next;
 +					free(sc->dc_mi, M_DEVBUF);
 +					sc->dc_mi = m;
 +				}
 +				error = dc_parse_21143_srom(sc);
 +				if (error != 0)
 +					goto fail;
 +			}
 +		} else if (error == ENOMEM)
 +			goto fail;
 +		else
 +			error = 0;
 +	}
 +
  	/* Allocate a busdma tag and DMA safe memory for TX/RX descriptors. */
  	error = bus_dma_tag_create(bus_get_dma_tag(dev), PAGE_SIZE, 0,
  	    BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL,
 @@ -2928,11 +2971,8 @@ dc_tick(void *xsc)
  			 */
  			if ((DC_HAS_BROKEN_RXSTATE(sc) || (CSR_READ_4(sc,
  			    DC_ISR) & DC_ISR_RX_STATE) == DC_RXSTATE_WAIT) &&
 -			    sc->dc_cdata.dc_tx_cnt == 0) {
 +			    sc->dc_cdata.dc_tx_cnt == 0)
  				mii_tick(mii);
 -				if (!(mii->mii_media_status & IFM_ACTIVE))
 -					sc->dc_link = 0;
 -			}
  		}
  	} else
  		mii_tick(mii);
 @@ -2956,12 +2996,8 @@ dc_tick(void *xsc)
  	 * that time, packets will stay in the send queue, and once the
  	 * link comes up, they will be flushed out to the wire.
  	 */
 -	if (!sc->dc_link && mii->mii_media_status & IFM_ACTIVE &&
 -	    IFM_SUBTYPE(mii->mii_media_active) != IFM_NONE) {
 -		sc->dc_link++;
 -		if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
 -			dc_start_locked(ifp);
 -	}
 +	if (sc->dc_link != 0 && !IFQ_DRV_IS_EMPTY(&ifp->if_snd))
 +		dc_start_locked(ifp);
  
  	if (sc->dc_flags & DC_21143_NWAY && !sc->dc_link)
  		callout_reset(&sc->dc_stat_ch, hz/10, dc_tick, sc);
 @@ -3384,6 +3420,7 @@ dc_init_locked(struct dc_softc *sc)
  {
  	struct ifnet *ifp = sc->dc_ifp;
  	struct mii_data *mii;
 +	struct ifmedia *ifm;
  
  	DC_LOCK_ASSERT(sc);
  
 @@ -3394,6 +3431,10 @@ dc_init_locked(struct dc_softc *sc)
  	 */
  	dc_stop(sc);
  	dc_reset(sc);
 +	if (DC_IS_INTEL(sc)) {
 +		ifm = &mii->mii_media;
 +		dc_apply_fixup(sc, ifm->ifm_media);
 +	}
  
  	/*
  	 * Set cache alignment and burst length.
 @@ -3537,12 +3578,12 @@ dc_init_locked(struct dc_softc *sc)
  	DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_RX_ON);
  	CSR_WRITE_4(sc, DC_RXSTART, 0xFFFFFFFF);
  
 -	mii_mediachg(mii);
 -	dc_setcfg(sc, sc->dc_if_media);
 -
  	ifp->if_drv_flags |= IFF_DRV_RUNNING;
  	ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
  
 +	mii_mediachg(mii);
 +	dc_setcfg(sc, sc->dc_if_media);
 +
  	/* Don't start the ticker if this is a homePNA link. */
  	if (IFM_SUBTYPE(mii->mii_media.ifm_media) == IFM_HPNA_1)
  		sc->dc_link = 1;
 @@ -3573,7 +3614,9 @@ dc_ifmedia_upd(struct ifnet *ifp)
  	mii_mediachg(mii);
  	ifm = &mii->mii_media;
  
 -	if (DC_IS_DAVICOM(sc) &&
 +	if (DC_IS_INTEL(sc))
 +		dc_setcfg(sc, ifm->ifm_media);
 +	else if (DC_IS_DAVICOM(sc) &&
  	    IFM_SUBTYPE(ifm->ifm_media) == IFM_HPNA_1)
  		dc_setcfg(sc, ifm->ifm_media);
  	else
 @@ -3834,3 +3877,52 @@ dc_shutdown(device_t dev)
  
  	return (0);
  }
 +
 +static int
 +dc_check_multiport(struct dc_softc *sc)
 +{
 +	struct dc_softc *dsc;
 +	devclass_t dc;
 +	device_t child;
 +	uint8_t *eaddr;
 +	int unit;
 +
 +	dc = devclass_find("dc");
 +	for (unit = 0; unit < devclass_get_maxunit(dc); unit++) {
 +		child = devclass_get_device(dc, unit);
 +		if (child == NULL)
 +			continue;
 +		if (child == sc->dc_dev)
 +			continue;
 +		if (device_get_parent(child) != device_get_parent(sc->dc_dev))
 +			continue;
 +		if (unit > device_get_unit(sc->dc_dev))
 +			continue;
 +		if (device_is_attached(child) == 0)
 +			continue;
 +		dsc = device_get_softc(child);
 +		device_printf(sc->dc_dev,
 +		    "Using station address of %s as base\n",
 +		    device_get_nameunit(child));
 +		bcopy(dsc->dc_eaddr, sc->dc_eaddr, ETHER_ADDR_LEN);
 +		eaddr = (uint8_t *)sc->dc_eaddr;
 +		eaddr[5]++;
 +		/* Prepare SROM to parse again. */
 +		if (DC_IS_INTEL(sc) && dsc->dc_srom != NULL &&
 +		    sc->dc_romwidth != 0) {
 +			free(sc->dc_srom, M_DEVBUF);
 +			sc->dc_romwidth = dsc->dc_romwidth;
 +			sc->dc_srom = malloc(DC_ROM_SIZE(sc->dc_romwidth),
 +			    M_DEVBUF, M_NOWAIT);
 +			if (sc->dc_srom == NULL) {
 +				device_printf(sc->dc_dev,
 +				    "Could not allocate SROM buffer\n");
 +				return (ENOMEM);
 +			}
 +			bcopy(dsc->dc_srom, sc->dc_srom,
 +			    DC_ROM_SIZE(sc->dc_romwidth));
 +		}
 +		return (0);
 +	}
 +	return (ENOENT);
 +}
 
 Modified: stable/7/sys/dev/dc/if_dcreg.h
 ==============================================================================
 --- stable/7/sys/dev/dc/if_dcreg.h	Sun Mar 27 22:20:44 2011	(r220066)
 +++ stable/7/sys/dev/dc/if_dcreg.h	Sun Mar 27 22:21:52 2011	(r220067)
 @@ -745,6 +745,7 @@ struct dc_softc {
  	int			dc_if_media;
  	u_int32_t		dc_flags;
  	u_int32_t		dc_txthresh;
 +	u_int32_t		dc_eaddr[2];
  	u_int8_t		*dc_srom;
  	struct dc_mediainfo	*dc_mi;
  	struct dc_list_data	*dc_ldata;
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: patched->closed 
State-Changed-By: yongari 
State-Changed-When: Mon Mar 28 00:35:37 UTC 2011 
State-Changed-Why:  
Fixes for the issue were megered to both stable/8 and stable/7. 
Thanks for reporting. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=79262 
>Unformatted:
