Bug 144867 - [panic] trap: memory address not aligned booting Sunfire 280R
Summary: [panic] trap: memory address not aligned booting Sunfire 280R
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: sparc64 (show other bugs)
Version: 9.0-CURRENT
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-sparc64 (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-03-19 03:00 UTC by Robert Farmer
Modified: 2010-05-14 21:00 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Farmer 2010-03-19 03:00:15 UTC
I'm trying to boot the install DVD for the 201002 snapshot of current
on a Sunfire 280R and get the following panic at boot:

Booting [/boot/kernel/kernel]...               
jumping to kernel entry at 0xc0088000.
GDB: no debug ports present
KDB: debugger backends: ddb
KDB: current backend: ddb
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 9.0-CURRENT-201002 #0: Sat Feb 13 04:56:40 UTC 2010
    root@heller.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC sparc64
WARNING: WITNESS option enabled, expect reduced performance.
real memory  = 8589934592 (8192 MB)
avail memory = 8377434112 (7989 MB)
cpu0: Sun Microsystems UltraSparc-III+ Processor (1200.00 MHz CPU)
cpu1: Sun Microsystems UltraSparc-III+ Processor (1200.00 MHz CPU)
FreeBSD/SMP: Multiprocessor System Detected: 2 CPUs
ispfw: registered firmware <isp_1000>
ispfw: registered firmware <isp_1040>
ispfw: registered firmware <isp_1040_it>
ispfw: registered firmware <isp_1080>
ispfw: registered firmware <isp_1080_it>
ispfw: registered firmware <isp_12160>
ispfw: registered firmware <isp_12160_it>
ispfw: registered firmware <isp_2100>
ispfw: registered firmware <isp_2200>
ispfw: registered firmware <isp_2300>
ispfw: registered firmware <isp_2322>
ispfw: registered firmware <isp_2400>
ispfw: registered firmware <isp_2400_multi>
ispfw: registered firmware <isp_2500>
ispfw: registered firmware <isp_2500_multi>
kbd0 at kbdmux0
nexus0: <Open Firmware Nexus device>
nexus0: <memory-controller> mem 0x40000400000-0x40000400047 type memory-controller (no driver attached)
nexus0: <memory-controller> mem 0x40000c00000-0x40000c00047 type memory-controller (no driver attached)
pcib0: <Sun Host-PCI bridge> mem 0x40004700000-0x40004717fff,0x40004410000-0x4000441004f,0x7ffee000000-0x7ffee0000ff irq 563,560,561,564,550 on nexus0
pcib0: Schizo, version 7, IGN 0x8, bus B, 33MHz
pcib0: DVMA map: 0xc0000000 to 0xffffffff 131072 entries, streaming buffer
pcib0: [FILTER]
pcib0: [FILTER]
pcib0: [FILTER]
pcib0: [FILTER]
pcib0: [FILTER]
pci0: <OFW PCI bus> on pcib0
ebus0: <PCI-EBus3 bridge> mem 0x7d000000-0x7dffffff,0x7e000000-0x7e7fffff at device 5.0 on pci0
ebus0: <flashprom> addr 0-0x1fffff (no driver attached)
ebus0: <i2c> addr 0x10000002e-0x10000002f,0x10000002d irq 35 (no driver attached)
ebus0: <bbc> addr 0x100000000-0x1000fffff (no driver attached)
ebus0: <power> addr 0x10030002e-0x10030002f,0x100300600-0x100300607 (no driver attached)
ebus0: <i2c> addr 0x100000030-0x100000031 irq 35 (no driver attached)
ebus0: <beep> addr 0x100000032-0x100000037 (no driver attached)
rtc0: <Real-Time Clock> addr 0x100300070-0x100300071 irq 36 on ebus0
ebus0: <gpio> addr 0x100300600-0x100300607 (no driver attached)
ebus0: <pmc> addr 0x100300700-0x100300701 (no driver attached)
ebus0: <parallel> addr 0x100300278-0x100300287,0x10030002e-0x10030002f,0x100700000-0x10070000f irq 28 (no driver attached)
uart0: <16550 or compatible> addr 0x1003062f8-0x1003062ff irq 46 on ebus0
uart0: [FILTER]
uart1: <16550 or compatible> addr 0x1003083f8-0x1003083ff irq 45 on ebus0
uart1: [FILTER]
scc0: <Siemens SAB 82532 dual channel SCC> addr 0x100400000-0x10040007f irq 34 on ebus0
scc0: [FILTER]
uart2: <SAB 82532 v3.2, channel A> on scc0
uart2: [FILTER]
uart2: CTS oflow
uart2: console (9600,n,8,1)
uart3: <SAB 82532 v3.2, channel B> on scc0
uart3: [FILTER]
uart3: CTS oflow
gem0: <Sun ERI 10/100 Ethernet> mem 0x100000-0x11ffff at device 5.1 on pci0
miibus0: <MII bus> on gem0
ukphy0: <Generic IEEE 802.3u media interface> PHY 1 on miibus0
ukphy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
gem0: 2kB RX FIFO, 2kB TX FIFO
gem0: Ethernet address: 00:03:ba:3a:0f:f2
gem0: [ITHREAD]
ohci0: <Sun PCIO-2 USB controller> mem 0x1000000-0x1007fff at device 5.3 on pci0
ohci0: [ITHREAD]
usbus0: <Sun PCIO-2 USB controller> on ohci0
sym0: <875> port 0x300-0x3ff mem 0x124000-0x1240ff,0x126000-0x126fff at device 6.0 on pci0
sym0: No NVRAM, ID 7, Fast-20, SE, parity checking
sym0: [ITHREAD]
sym1: <875> port 0x400-0x4ff mem 0x128000-0x1280ff,0x12a000-0x12afff at device 6.1 on pci0
sym1: No NVRAM, ID 7, Fast-20, SE, parity checking
sym1: [ITHREAD]
cas0: <Sun Cassini+ Gigabit Ethernet> mem 0x200000-0x3fffff at device 2.0 on pci0
panic: trap: memory address not aligned
cpuid = 0
KDB: enter: panic
[ thread pid 0 tid 100000 ]
Stopped at      kdb_enter+0x80: ta              %xcc, 1
db> bt
Tracing pid 0 tid 100000 td 0xc0a40730
panic() at panic+0x20c
trap() at trap+0x570
-- memory address not aligned sfar=0x7fe00200001 sfsr=0x1d007d %o7=0xc0175864 --
cas_pci_attach() at cas_pci_attach+0xc80
device_attach() at device_attach+0x4a4
device_probe_and_attach() at device_probe_and_attach+0x64
bus_generic_attach() at bus_generic_attach+0x10
ofw_pcibus_attach() at ofw_pcibus_attach+0x934
device_attach() at device_attach+0x4a4
device_probe_and_attach() at device_probe_and_attach+0x64
bus_generic_attach() at bus_generic_attach+0x10
schizo_attach() at schizo_attach+0x146c
device_attach() at device_attach+0x4a4
device_probe_and_attach() at device_probe_and_attach+0x64
bus_generic_new_pass() at bus_generic_new_pass+0x11c
bus_generic_new_pass() at bus_generic_new_pass+0x104
bus_set_pass() at bus_set_pass+0xf8
root_bus_configure() at root_bus_configure+0x8
configure() at configure+0x4
mi_startup() at mi_startup+0x18c
btext() at btext+0x30
db>

How-To-Repeat: Try to boot FreeBSD on Sunfire 280R
Comment 1 marius 2010-03-19 22:06:58 UTC
On Fri, Mar 19, 2010 at 02:51:52AM +0000, Rob Farmer wrote:
> db> bt
> Tracing pid 0 tid 100000 td 0xc0a40730
> panic() at panic+0x20c
> trap() at trap+0x570
> -- memory address not aligned sfar=0x7fe00200001 sfsr=0x1d007d %o7=0xc0175864 --
> cas_pci_attach() at cas_pci_attach+0xc80

Hrm, this doesn't make a whole lot of sense:
(gdb) l *0xc0175864
0xc0175864 is in cas_pci_attach (/usr/src/sys/dev/cas/if_cas.c:356).
351                     switch (sc->sc_variant) {
352                     default:
353                             sc->sc_phyad = -1;
354                             break;
355                     }
356                     error = mii_phy_probe(sc->sc_dev, &sc->sc_miibus,
357                         cas_mediachange, cas_mediastatus);
358             }
359
360             /*

Except maybe that this is triggered by the bus_space_write_4() above
that, which is cas_pci_attach+0xc80, and somehow delayed. Is this the
MMF (multimode fibre) model of the GigaSwift Ethernet 1.0 card perhaps?
Can you boot with that card removed?

Marius
Comment 2 Robert Farmer 2010-03-19 23:55:02 UTC
On Fri, Mar 19, 2010 at 3:06 PM, Marius Strobl
<marius@alchemy.franken.de> wrote:
> On Fri, Mar 19, 2010 at 02:51:52AM +0000, Rob Farmer wrote:
>> db> bt
>> Tracing pid 0 tid 100000 td 0xc0a40730
>> panic() at panic+0x20c
>> trap() at trap+0x570
>> -- memory address not aligned sfar=3D0x7fe00200001 sfsr=3D0x1d007d %o7=
=3D0xc0175864 --
>> cas_pci_attach() at cas_pci_attach+0xc80
>
> Hrm, this doesn't make a whole lot of sense:
> (gdb) l *0xc0175864
> 0xc0175864 is in cas_pci_attach (/usr/src/sys/dev/cas/if_cas.c:356).
> 351 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 switch (sc->sc_variant) {
> 352 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 default:
> 353 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 sc->sc_phyad =
=3D -1;
> 354 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 break;
> 355 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 }
> 356 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 error =3D mii_phy_probe(sc->s=
c_dev, &sc->sc_miibus,
> 357 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 cas_mediachange, cas_=
mediastatus);
> 358 =A0 =A0 =A0 =A0 =A0 =A0 }
> 359
> 360 =A0 =A0 =A0 =A0 =A0 =A0 /*
>
> Except maybe that this is triggered by the bus_space_write_4() above
> that, which is cas_pci_attach+0xc80, and somehow delayed. Is this the
> MMF (multimode fibre) model of the GigaSwift Ethernet 1.0 card perhaps?
> Can you boot with that card removed?

Hi, thanks for the quick response.

Yes, its the MMF card. There are two of them, actually. I don't need
them in my environment so I took them out and it booted from the cd.
However, I did a standard install in sysinstall and now I get a new
panic trying to boot from the hard drive:

GDB: no debug ports present
KDB: debugger backends: ddb
KDB: current backend: ddb
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 9.0-CURRENT-201002 #0: Sat Feb 13 04:56:40 UTC 2010
    root@heller.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC sparc64
WARNING: WITNESS option enabled, expect reduced performance.
real memory  =3D 8589934592 (8192 MB)
avail memory =3D 8381644800 (7993 MB)
cpu0: Sun Microsystems UltraSparc-III+ Processor (1200.00 MHz CPU)
cpu1: Sun Microsystems UltraSparc-III+ Processor (1200.00 MHz CPU)
FreeBSD/SMP: Multiprocessor System Detected: 2 CPUs
ispfw: registered firmware <isp_1000>
ispfw: registered firmware <isp_1040>
ispfw: registered firmware <isp_1040_it>
ispfw: registered firmware <isp_1080>
ispfw: registered firmware <isp_1080_it>
ispfw: registered firmware <isp_12160>
ispfw: registered firmware <isp_12160_it>
ispfw: registered firmware <isp_2100>
ispfw: registered firmware <isp_2200>
ispfw: registered firmware <isp_2300>
ispfw: registered firmware <isp_2322>
ispfw: registered firmware <isp_2400>
ispfw: registered firmware <isp_2400_multi>
ispfw: registered firmware <isp_2500>
ispfw: registered firmware <isp_2500_multi>
kbd0 at kbdmux0
nexus0: <Open Firmware Nexus device>
nexus0: <memory-controller> mem 0x40000400000-0x40000400047 type
memory-controller (no driver attached)
nexus0: <memory-controller> mem 0x40000c00000-0x40000c00047 type
memory-controller (no driver attached)
pcib0: <Sun Host-PCI bridge> mem
0x40004700000-0x40004717fff,0x40004410000-0x4000441004f,0x7ffee000000-0x7ff=
ee0000ff
irq 563,560,561,564,550 on nexus0
pcib0: Schizo, version 7, IGN 0x8, bus B, 33MHz
pcib0: DVMA map: 0xc0000000 to 0xffffffff 131072 entries, streaming buffer
pcib0: [FILTER]
pcib0: [FILTER]
pcib0: [FILTER]
pcib0: [FILTER]
pcib0: [FILTER]
pci0: <OFW PCI bus> on pcib0
ebus0: <PCI-EBus3 bridge> mem
0x7d000000-0x7dffffff,0x7e000000-0x7e7fffff at device 5.0 on pci0
ebus0: <flashprom> addr 0-0x1fffff (no driver attached)
ebus0: <i2c> addr 0x10000002e-0x10000002f,0x10000002d irq 35 (no
driver attached)
ebus0: <bbc> addr 0x100000000-0x1000fffff (no driver attached)
ebus0: <power> addr 0x10030002e-0x10030002f,0x100300600-0x100300607
(no driver attached)
ebus0: <i2c> addr 0x100000030-0x100000031 irq 35 (no driver attached)
ebus0: <beep> addr 0x100000032-0x100000037 (no driver attached)
rtc0: <Real-Time Clock> addr 0x100300070-0x100300071 irq 36 on ebus0
ebus0: <gpio> addr 0x100300600-0x100300607 (no driver attached)
ebus0: <pmc> addr 0x100300700-0x100300701 (no driver attached)
ebus0: <parallel> addr
0x100300278-0x100300287,0x10030002e-0x10030002f,0x100700000-0x10070000f
irq 28 (no driver attached)
uart0: <16550 or compatible> addr 0x1003062f8-0x1003062ff irq 46 on ebus0
uart0: [FILTER]
uart1: <16550 or compatible> addr 0x1003083f8-0x1003083ff irq 45 on ebus0
uart1: [FILTER]
scc0: <Siemens SAB 82532 dual channel SCC> addr
0x100400000-0x10040007f irq 34 on ebus0
scc0: [FILTER]
uart2: <SAB 82532 v3.2, channel A> on scc0
uart2: [FILTER]
uart2: CTS oflow
uart2: console (9600,n,8,1)
uart3: <SAB 82532 v3.2, channel B> on scc0
uart3: [FILTER]
uart3: CTS oflow
gem0: <Sun ERI 10/100 Ethernet> mem 0x100000-0x11ffff at device 5.1 on pci0
miibus0: <MII bus> on gem0
ukphy0: <Generic IEEE 802.3u media interface> PHY 1 on miibus0
ukphy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
gem0: 2kB RX FIFO, 2kB TX FIFO
gem0: Ethernet address: 00:03:ba:3a:0f:f2
gem0: [ITHREAD]
ohci0: <Sun PCIO-2 USB controller> mem 0x1000000-0x1007fff at device 5.3 on=
 pci0
ohci0: [ITHREAD]
usbus0: <Sun PCIO-2 USB controller> on ohci0
sym0: <875> port 0x300-0x3ff mem 0x124000-0x1240ff,0x126000-0x126fff
at device 6.0 on pci0
sym0: No NVRAM, ID 7, Fast-20, SE, parity checking
sym0: [ITHREAD]
sym1: <875> port 0x400-0x4ff mem 0x128000-0x1280ff,0x12a000-0x12afff
at device 6.1 on pci0
sym1: No NVRAM, ID 7, Fast-20, SE, parity checking
sym1: [ITHREAD]
pcib1: <Sun Host-PCI bridge> mem
0x40004600000-0x40004617fff,0x40004410000-0x4000441004f,0x7ffec000000-0x7ff=
ec0000ff
irq 562,560,561,564 on nexus0
pcib1: Schizo, version 7, IGN 0x8, bus A, 66MHz
Timecounter "pcib1" frequency 150000000 Hz quality 100
pcib1: DVMA map: 0xc0000000 to 0xffffffff 131072 entries, streaming buffer
panic: pcib: PCI bus A error AFAR 0x1000c0 AFSR 0x320000000 PCI CSR
0x60002010f003f IOMMU 0x70003 STATUS 0x2a0
cpuid =3D 0
KDB: enter: panic
[ thread pid 0 tid 100000 ]
Stopped at      kdb_enter+0x80: ta              %xcc, 1
db> bt
Tracing pid 0 tid 100000 td 0xc0a40730
panic() at panic+0x20c
schizo_pci_bus() at schizo_pci_bus+0x1b8
intr_event_handle() at intr_event_handle+0x5c
intr_execute_handlers() at intr_execute_handlers+0x8
intr_fast() at intr_fast+0x68
-- interrupt level=3D0xd pil=3D0 %o7=3D0xc041be8c --
strlen() at strlen
vprintf() at vprintf+0x7c
printf() at printf+0x20
device_print_prettyname() at device_print_prettyname+0x60
device_printf() at device_printf+0x14
bus_setup_intr() at bus_setup_intr+0x12c
schizo_set_intr() at schizo_set_intr+0xd4
schizo_attach() at schizo_attach+0xff4
device_attach() at device_attach+0x4a4
device_probe_and_attach() at device_probe_and_attach+0x64
bus_generic_new_pass() at bus_generic_new_pass+0x11c
bus_generic_new_pass() at bus_generic_new_pass+0x104
bus_set_pass() at bus_set_pass+0xf8
root_bus_configure() at root_bus_configure+0x8
configure() at configure+0x4
mi_startup() at mi_startup+0x18c
btext() at btext+0x30
db>

--=20
Rob Farmer

>
> Marius
>
>
Comment 3 marius 2010-03-20 20:43:18 UTC
On Fri, Mar 19, 2010 at 04:55:02PM -0700, Rob Farmer wrote:
> 
> Yes, its the MMF card. There are two of them, actually. I don't need
> them in my environment so I took them out and it booted from the cd.

Ok, let's check that again once you got the machine running without
them.

> However, I did a standard install in sysinstall and now I get a new
> panic trying to boot from the hard drive:
> 
> pcib1: <Sun Host-PCI bridge> mem
> 0x40004600000-0x40004617fff,0x40004410000-0x4000441004f,0x7ffec000000-0x7ffec0000ff
> irq 562,560,561,564 on nexus0
> pcib1: Schizo, version 7, IGN 0x8, bus A, 66MHz
> Timecounter "pcib1" frequency 150000000 Hz quality 100
> pcib1: DVMA map: 0xc0000000 to 0xffffffff 131072 entries, streaming buffer
> panic: pcib: PCI bus A error AFAR 0x1000c0 AFSR 0x320000000 PCI CSR
> 0x60002010f003f IOMMU 0x70003 STATUS 0x2a0

Please give the following snapshot a try:
http://people.freebsd.org/~marius/FreeBSD-9.0-20100320-SNAP-sparc64-disc1.iso.gz
That one includes r205254, which works around a quirk of version 7
Schizo seen when booting V890 from disk. You appear to be hitting
the same issue.

Marius
Comment 4 Robert Farmer 2010-03-25 18:07:30 UTC
On Sat, Mar 20, 2010 at 1:43 PM, Marius Strobl
<marius@alchemy.franken.de> wrote:
> On Fri, Mar 19, 2010 at 04:55:02PM -0700, Rob Farmer wrote:
>>
>> Yes, its the MMF card. There are two of them, actually. I don't need
>> them in my environment so I took them out and it booted from the cd.
>
> Ok, let's check that again once you got the machine running without
> them.
>
>> However, I did a standard install in sysinstall and now I get a new
>> panic trying to boot from the hard drive:
>>
>> pcib1: <Sun Host-PCI bridge> mem
>> 0x40004600000-0x40004617fff,0x40004410000-0x4000441004f,0x7ffec000000-0x7ffec0000ff
>> irq 562,560,561,564 on nexus0
>> pcib1: Schizo, version 7, IGN 0x8, bus A, 66MHz
>> Timecounter "pcib1" frequency 150000000 Hz quality 100
>> pcib1: DVMA map: 0xc0000000 to 0xffffffff 131072 entries, streaming buffer
>> panic: pcib: PCI bus A error AFAR 0x1000c0 AFSR 0x320000000 PCI CSR
>> 0x60002010f003f IOMMU 0x70003 STATUS 0x2a0
>
> Please give the following snapshot a try:
> http://people.freebsd.org/~marius/FreeBSD-9.0-20100320-SNAP-sparc64-disc1.iso.gz
> That one includes r205254, which works around a quirk of version 7
> Schizo seen when booting V890 from disk. You appear to be hitting
> the same issue.

That snapshot works great without the MMF cards. I don't need them so
I will just leave them out, but if you are interested in working on
them I can test patches.

-- 
Rob Farmer

>
> Marius
>
>
Comment 5 marius 2010-03-25 23:27:38 UTC
On Thu, Mar 25, 2010 at 11:07:30AM -0700, Rob Farmer wrote:
> On Sat, Mar 20, 2010 at 1:43 PM, Marius Strobl
> >>
> >> pcib1: <Sun Host-PCI bridge> mem
> >> 0x40004600000-0x40004617fff,0x40004410000-0x4000441004f,0x7ffec000000-0x7ffec0000ff
> >> irq 562,560,561,564 on nexus0
> >> pcib1: Schizo, version 7, IGN 0x8, bus A, 66MHz
> >> Timecounter "pcib1" frequency 150000000 Hz quality 100
> >> pcib1: DVMA map: 0xc0000000 to 0xffffffff 131072 entries, streaming buffer
> >> panic: pcib: PCI bus A error AFAR 0x1000c0 AFSR 0x320000000 PCI CSR
> >> 0x60002010f003f IOMMU 0x70003 STATUS 0x2a0
> >
> > Please give the following snapshot a try:
> > http://people.freebsd.org/~marius/FreeBSD-9.0-20100320-SNAP-sparc64-disc1.iso.gz
> > That one includes r205254, which works around a quirk of version 7
> > Schizo seen when booting V890 from disk. You appear to be hitting
> > the same issue.
> 
> That snapshot works great without the MMF cards.

Thanks for testing.

> I don't need them so
> I will just leave them out, but if you are interested in working on
> them I can test patches.

Please give the following quick hack a try:
http://people.freebsd.org/~marius/cas_mmf.diff

Marius
Comment 6 Robert Farmer 2010-03-29 22:51:45 UTC
On Thu, Mar 25, 2010 at 4:27 PM, Marius Strobl
<marius@alchemy.franken.de> wrote:
> On Thu, Mar 25, 2010 at 11:07:30AM -0700, Rob Farmer wrote:
>> On Sat, Mar 20, 2010 at 1:43 PM, Marius Strobl
>> >>
>> >> pcib1: <Sun Host-PCI bridge> mem
>> >> 0x40004600000-0x40004617fff,0x40004410000-0x4000441004f,0x7ffec000000-0x7ffec0000ff
>> >> irq 562,560,561,564 on nexus0
>> >> pcib1: Schizo, version 7, IGN 0x8, bus A, 66MHz
>> >> Timecounter "pcib1" frequency 150000000 Hz quality 100
>> >> pcib1: DVMA map: 0xc0000000 to 0xffffffff 131072 entries, streaming buffer
>> >> panic: pcib: PCI bus A error AFAR 0x1000c0 AFSR 0x320000000 PCI CSR
>> >> 0x60002010f003f IOMMU 0x70003 STATUS 0x2a0
>> >
>> > Please give the following snapshot a try:
>> > http://people.freebsd.org/~marius/FreeBSD-9.0-20100320-SNAP-sparc64-disc1.iso.gz
>> > That one includes r205254, which works around a quirk of version 7
>> > Schizo seen when booting V890 from disk. You appear to be hitting
>> > the same issue.
>>
>> That snapshot works great without the MMF cards.
>
> Thanks for testing.
>
>> I don't need them so
>> I will just leave them out, but if you are interested in working on
>> them I can test patches.
>
> Please give the following quick hack a try:
> http://people.freebsd.org/~marius/cas_mmf.diff

Sorry, no luck - it still panics:

jumping to kernel entry at 0xc0088000.
GDB: no debug ports present
KDB: debugger backends: ddb
KDB: current backend: ddb
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 9.0-CURRENT #0: Thu Mar 25 20:26:26 PDT 2010
    rfarmer@sunfire.predatorlabs.net:/usr/obj/usr/src/sys/GENERIC sparc64
WARNING: WITNESS option enabled, expect reduced performance.
real memory  = 8589934592 (8192 MB)
avail memory = 8381587456 (7993 MB)
cpu0: Sun Microsystems UltraSparc-III+ Processor (1200.00 MHz CPU)
cpu1: Sun Microsystems UltraSparc-III+ Processor (1200.00 MHz CPU)
FreeBSD/SMP: Multiprocessor System Detected: 2 CPUs
kbd0 at kbdmux0
nexus0: <Open Firmware Nexus device>
nexus0: <memory-controller> mem 0x40000400000-0x40000400047 type
memory-controller (no driver attached)
nexus0: <memory-controller> mem 0x40000c00000-0x40000c00047 type
memory-controller (no driver attached)
pcib0: <Sun Host-PCI bridge> mem
0x40004700000-0x40004717fff,0x40004410000-0x4000441004f,0x7ffee000000-0x7ffee0000ff
irq 563,560,561,564,550 on nexus0
pcib0: Schizo, version 7, IGN 0x8, bus B, 33MHz
pcib0: DVMA map: 0xc0000000 to 0xffffffff 131072 entries, streaming buffer
pcib0: [FILTER]
pcib0: [FILTER]
pcib0: [FILTER]
pcib0: [FILTER]
pcib0: [FILTER]
pci0: <OFW PCI bus> on pcib0
ebus0: <PCI-EBus3 bridge> mem
0x7d000000-0x7dffffff,0x7e000000-0x7e7fffff at device 5.0 on pci0
ebus0: <flashprom> addr 0-0x1fffff (no driver attached)
ebus0: <i2c> addr 0x10000002e-0x10000002f,0x10000002d irq 35 (no
driver attached)
ebus0: <bbc> addr 0x100000000-0x1000fffff (no driver attached)
ebus0: <power> addr 0x10030002e-0x10030002f,0x100300600-0x100300607
(no driver attached)
ebus0: <i2c> addr 0x100000030-0x100000031 irq 35 (no driver attached)
ebus0: <beep> addr 0x100000032-0x100000037 (no driver attached)
rtc0: <Real-Time Clock> addr 0x100300070-0x100300071 irq 36 on ebus0
ebus0: <gpio> addr 0x100300600-0x100300607 (no driver attached)
ebus0: <pmc> addr 0x100300700-0x100300701 (no driver attached)
ebus0: <parallel> addr
0x100300278-0x100300287,0x10030002e-0x10030002f,0x100700000-0x10070000f
irq 28 (no driver attached)
uart0: <16550 or compatible> addr 0x1003062f8-0x1003062ff irq 46 on ebus0
uart0: [FILTER]
uart1: <16550 or compatible> addr 0x1003083f8-0x1003083ff irq 45 on ebus0
uart1: [FILTER]
scc0: <Siemens SAB 82532 dual channel SCC> addr
0x100400000-0x10040007f irq 34 on ebus0
scc0: [FILTER]
uart2: <SAB 82532 v3.2, channel A> on scc0
uart2: [FILTER]
uart2: CTS oflow
uart2: console (9600,n,8,1)
uart3: <SAB 82532 v3.2, channel B> on scc0
uart3: [FILTER]
uart3: CTS oflow
gem0: <Sun ERI 10/100 Ethernet> mem 0x100000-0x11ffff at device 5.1 on pci0
miibus0: <MII bus> on gem0
ukphy0: <Generic IEEE 802.3u media interface> PHY 1 on miibus0
ukphy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
gem0: 2kB RX FIFO, 2kB TX FIFO
gem0: Ethernet address: 00:03:ba:3a:0f:f2
gem0: [ITHREAD]
ohci0: <Sun PCIO-2 USB controller> mem 0x1000000-0x1007fff at device 5.3 on pci0
ohci0: [ITHREAD]
usbus0: <Sun PCIO-2 USB controller> on ohci0
sym0: <875> port 0x300-0x3ff mem 0x124000-0x1240ff,0x126000-0x126fff
at device 6.0 on pci0
sym0: No NVRAM, ID 7, Fast-20, SE, parity checking
sym0: [ITHREAD]
sym1: <875> port 0x400-0x4ff mem 0x128000-0x1280ff,0x12a000-0x12afff
at device 6.1 on pci0
sym1: No NVRAM, ID 7, Fast-20, SE, parity checking
sym1: [ITHREAD]
pcib1: <Sun Host-PCI bridge> mem
0x40004600000-0x40004617fff,0x40004410000-0x4000441004f,0x7ffec000000-0x7ffec0000ff
irq 562,560,561,564 on nexus0
pcib1: Schizo, version 7, IGN 0x8, bus A, 66MHz
Timecounter "pcib1" frequency 150000000 Hz quality 100
pcib1: DVMA map: 0xc0000000 to 0xffffffff 131072 entries, streaming buffer
pcib1: [FILTER]
pcib1: [FILTER]
pci1: <OFW PCI bus> on pcib1
isp0: <Qlogic ISP 2200 PCI FC-AL Adapter> port 0x300-0x3ff mem
0x100000-0x100fff at device 4.0 on pci1
isp0: [ITHREAD]
isp0: invalid NVRAM header
isp0: invalid NVRAM header
isp0: bad frame length (0) from NVRAM- using 1024
isp0: bad execution throttle of 0- using 16
cas0: <Sun Cassini+ Gigabit Ethernet> mem 0x200000-0x3fffff at device
1.0 on pci1
panic: trap: memory address not aligned
cpuid = 0
KDB: enter: panic
[ thread pid 0 tid 100000 ]
Stopped at      kdb_enter+0x80: ta              %xcc, 1
db> bt
Tracing pid 0 tid 100000 td 0xc0a0e330
panic() at panic+0x198
trap() at trap+0x220
-- memory address not aligned sfar=0x7fd00200001 sfsr=0x1d007d %o7=0xc016f1c8 --
cas_pci_attach() at cas_pci_attach+0xb1c
device_attach() at device_attach+0x68
bus_generic_attach() at bus_generic_attach+0x10
ofw_pcibus_attach() at ofw_pcibus_attach+0x2e4
device_attach() at device_attach+0x68
bus_generic_attach() at bus_generic_attach+0x10
schizo_attach() at schizo_attach+0xe04
device_attach() at device_attach+0x68
bus_generic_new_pass() at bus_generic_new_pass+0x130
bus_generic_new_pass() at bus_generic_new_pass+0xbc
bus_set_pass() at bus_set_pass+0xc4
configure() at configure+0x4
mi_startup() at mi_startup+0xf0
btext() at btext+0x2c
db>

--
Rob Farmer
>
> Marius
>
>
Comment 7 marius 2010-04-17 21:05:14 UTC
Could both of you please refetch the following patch and give it try?
http://people.freebsd.org/~marius/cas_mmf.diff
The MD5 hash of the new version is 0d668f21e2b3bb3c9641950bd0153e3d.

Marius
Comment 8 Robert Farmer 2010-04-18 15:37:52 UTC
On Sat, Apr 17, 2010 at 1:05 PM, Marius Strobl
<marius@alchemy.franken.de> wrote:
>
> Could both of you please refetch the following patch and give it try?
> http://people.freebsd.org/~marius/cas_mmf.diff
> The MD5 hash of the new version is 0d668f21e2b3bb3c9641950bd0153e3d.
>
> Marius
>
>

Thanks for looking into this. The patch works for my machine. Here's
the dmesg from generic:

jumping to kernel entry at 0xc0088000.
GDB: no debug ports present
KDB: debugger backends: ddb
KDB: current backend: ddb
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 9.0-CURRENT #0: Sun Apr 18 05:37:42 PDT 2010
    rfarmer@sunfire.predatorlabs.net:/usr/obj/usr/src/sys/GENERIC sparc64
WARNING: WITNESS option enabled, expect reduced performance.
real memory  = 8589934592 (8192 MB)
avail memory = 8381571072 (7993 MB)
cpu0: Sun Microsystems UltraSparc-III+ Processor (1200.00 MHz CPU)
cpu1: Sun Microsystems UltraSparc-III+ Processor (1200.00 MHz CPU)
FreeBSD/SMP: Multiprocessor System Detected: 2 CPUs
kbd0 at kbdmux0
nexus0: <Open Firmware Nexus device>
nexus0: <memory-controller> mem 0x40000400000-0x40000400047 type
memory-controller (no driver attached)
nexus0: <memory-controller> mem 0x40000c00000-0x40000c00047 type
memory-controller (no driver attached)
pcib0: <Sun Host-PCI bridge> mem
0x40004700000-0x40004717fff,0x40004410000-0x4000441004f,0x7ffee000000-0x7ffee0000ff
irq 563,560,561,564,550 on nexus0
pcib0: Schizo, version 7, IGN 0x8, bus B, 33MHz
pcib0: DVMA map: 0xc0000000 to 0xffffffff 131072 entries, streaming buffer
pcib0: [FILTER]
pcib0: [FILTER]
pcib0: [FILTER]
pcib0: [FILTER]
pcib0: [FILTER]
pci0: <OFW PCI bus> on pcib0
ebus0: <PCI-EBus3 bridge> mem
0x7d000000-0x7dffffff,0x7e000000-0x7e7fffff at device 5.0 on pci0
ebus0: <flashprom> addr 0-0x1fffff (no driver attached)
ebus0: <i2c> addr 0x10000002e-0x10000002f,0x10000002d irq 35 (no
driver attached)
ebus0: <bbc> addr 0x100000000-0x1000fffff (no driver attached)
ebus0: <power> addr 0x10030002e-0x10030002f,0x100300600-0x100300607
(no driver attached)
ebus0: <i2c> addr 0x100000030-0x100000031 irq 35 (no driver attached)
ebus0: <beep> addr 0x100000032-0x100000037 (no driver attached)
rtc0: <Real-Time Clock> addr 0x100300070-0x100300071 irq 36 on ebus0
ebus0: <gpio> addr 0x100300600-0x100300607 (no driver attached)
ebus0: <pmc> addr 0x100300700-0x100300701 (no driver attached)
ebus0: <parallel> addr
0x100300278-0x100300287,0x10030002e-0x10030002f,0x100700000-0x10070000f
irq 28 (no driver attached)
uart0: <16550 or compatible> addr 0x1003062f8-0x1003062ff irq 46 on ebus0
uart0: [FILTER]
uart1: <16550 or compatible> addr 0x1003083f8-0x1003083ff irq 45 on ebus0
uart1: [FILTER]
scc0: <Siemens SAB 82532 dual channel SCC> addr
0x100400000-0x10040007f irq 34 on ebus0
scc0: [FILTER]
uart2: <SAB 82532 v3.2, channel A> on scc0
uart2: [FILTER]
uart2: CTS oflow
uart2: console (9600,n,8,1)
uart3: <SAB 82532 v3.2, channel B> on scc0
uart3: [FILTER]
uart3: CTS oflow
gem0: <Sun ERI 10/100 Ethernet> mem 0x100000-0x11ffff at device 5.1 on pci0
miibus0: <MII bus> on gem0
ukphy0: <Generic IEEE 802.3u media interface> PHY 1 on miibus0
ukphy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
gem0: 2kB RX FIFO, 2kB TX FIFO
gem0: Ethernet address: 00:03:ba:3a:0f:f2
gem0: [ITHREAD]
ohci0: <Sun PCIO-2 USB controller> mem 0x1000000-0x1007fff at device 5.3 on pci0
ohci0: [ITHREAD]
usbus0: <Sun PCIO-2 USB controller> on ohci0
sym0: <875> port 0x300-0x3ff mem 0x124000-0x1240ff,0x126000-0x126fff
at device 6.0 on pci0
sym0: No NVRAM, ID 7, Fast-20, SE, parity checking
sym0: [ITHREAD]
sym1: <875> port 0x400-0x4ff mem 0x128000-0x1280ff,0x12a000-0x12afff
at device 6.1 on pci0
sym1: No NVRAM, ID 7, Fast-20, SE, parity checking
sym1: [ITHREAD]
cas0: <Sun Cassini+ Gigabit Ethernet> mem 0x200000-0x3fffff at device
3.0 on pci0
miibus1: <MII bus> on cas0
gentbi0: <Generic ten-bit interface> PHY 0 on miibus1
gentbi0:  1000baseSX, 1000baseSX-FDX, auto
cas0: 16kB RX FIFO, 9kB TX FIFO
cas0: Ethernet address: 00:03:ba:3a:0f:f2
cas0: [FILTER]
pcib1: <Sun Host-PCI bridge> mem
0x40004600000-0x40004617fff,0x40004410000-0x4000441004f,0x7ffec000000-0x7ffec0000ff
irq 562,560,561,564 on nexus0
pcib1: Schizo, version 7, IGN 0x8, bus A, 66MHz
Timecounter "pcib1" frequency 150000000 Hz quality 100
pcib1: DVMA map: 0xc0000000 to 0xffffffff 131072 entries, streaming buffer
pcib1: [FILTER]
pcib1: [FILTER]
pci1: <OFW PCI bus> on pcib1
isp0: <Qlogic ISP 2200 PCI FC-AL Adapter> port 0x300-0x3ff mem
0x100000-0x100fff at device 4.0 on pci1
isp0: [ITHREAD]
isp0: invalid NVRAM header
isp0: invalid NVRAM header
isp0: bad frame length (0) from NVRAM- using 1024
isp0: bad execution throttle of 0- using 16
cas1: <Sun Cassini+ Gigabit Ethernet> mem 0x200000-0x3fffff at device
1.0 on pci1
miibus2: <MII bus> on cas1
gentbi1: <Generic ten-bit interface> PHY 0 on miibus2
gentbi1:  1000baseSX, 1000baseSX-FDX, auto
cas1: 16kB RX FIFO, 9kB TX FIFO
cas1: Ethernet address: 00:03:ba:3a:0f:f2
cas1: [FILTER]
nexus0: <syscons> type unknown (no driver attached)
Timecounter "tick" frequency 1200000000 Hz quality 10
Timecounters tick every 1.000 msec
usbus0: 12Mbps Full Speed USB v1.0
(xpt0:isp0:0:-1:-1): rescan already queued
(xpt0:isp0:0:-1:-1): rescan already queued
ugen0.1: <SUN> at usbus0
uhub0: <SUN OHCI root HUB, class 9/0, rev 1.00/1.00, addr 1> on usbus0
uhub0: 4 ports with 4 removable, self powered
(probe6:sym0:0:6:0): TEST UNIT READY. CDB: 0 0 0 0 0 0
(probe6:sym0:0:6:0): CAM status: SCSI Status Error
(probe6:sym0:0:6:0): SCSI status: Check Condition
(probe6:sym0:0:6:0): SCSI sense: NOT READY asc:3a,0 (Medium not present)
SMP: AP CPU #1 Launched!
da0 at isp0 bus 0 scbus2 target 0 lun 0
WARNING: WITNESS option enabled, expect reduced performance.
da0: <FUJITSU MAP3735F SUN72G 0601> Fixed Direct Access SCSI-4 device
da0: 100.000MB/s transfers
da0: Command Queueing enabled
da0: 70007MB (143374738 512 byte sectors: 255H 63S/T 8924C)
da1 at isp0 bus 0 scbus2 target 1 lun 0
da1: <FUJITSU MAP3735F SUN72G 0601> Fixed Direct Access SCSI-4 device
da1: 100.000MB/s transfers WWNN 0x500000e0103578e0 WWPN
0x500000e0103578e1 PortID 0xe8
da1: Command Queueing enabled
da1: 70007MB (143374738 512 byte sectors: 255H 63S/T 8924C)
cd0 at sym0 bus 0 scbus0 target 6 lun 0
cd0: <TOSHIBA DVD-ROM SD-M1401 1009> 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
GEOM: da0: adding VTOC8 information.
GEOM: da1: adding VTOC8 information.
Trying to mount root from ufs:/dev/da0a

-- 
Rob Farmer
Comment 9 craig001 2010-04-18 23:46:26 UTC
On Sun, 2010-04-18 at 07:37 -0700, Rob Farmer wrote:
> On Sat, Apr 17, 2010 at 1:05 PM, Marius Strobl
> <marius@alchemy.franken.de> wrote:
> >
> > Could both of you please refetch the following patch and give it try?
> > http://people.freebsd.org/~marius/cas_mmf.diff
> > The MD5 hash of the new version is 0d668f21e2b3bb3c9641950bd0153e3d.
> >
> > Marius
> >
> >
> 
> Thanks for looking into this. The patch works for my machine. Here's
> the dmesg from generic:
> 
> jumping to kernel entry at 0xc0088000.
> GDB: no debug ports present
> KDB: debugger backends: ddb
> KDB: current backend: ddb
> 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 9.0-CURRENT #0: Sun Apr 18 05:37:42 PDT 2010
>     rfarmer@sunfire.predatorlabs.net:/usr/obj/usr/src/sys/GENERIC sparc64
> WARNING: WITNESS option enabled, expect reduced performance.
> real memory  = 8589934592 (8192 MB)
> avail memory = 8381571072 (7993 MB)
> cpu0: Sun Microsystems UltraSparc-III+ Processor (1200.00 MHz CPU)
> cpu1: Sun Microsystems UltraSparc-III+ Processor (1200.00 MHz CPU)
> FreeBSD/SMP: Multiprocessor System Detected: 2 CPUs
> kbd0 at kbdmux0
> nexus0: <Open Firmware Nexus device>
> nexus0: <memory-controller> mem 0x40000400000-0x40000400047 type
> memory-controller (no driver attached)
> nexus0: <memory-controller> mem 0x40000c00000-0x40000c00047 type
> memory-controller (no driver attached)
> pcib0: <Sun Host-PCI bridge> mem
> 0x40004700000-0x40004717fff,0x40004410000-0x4000441004f,0x7ffee000000-0x7ffee0000ff
> irq 563,560,561,564,550 on nexus0
> pcib0: Schizo, version 7, IGN 0x8, bus B, 33MHz
> pcib0: DVMA map: 0xc0000000 to 0xffffffff 131072 entries, streaming buffer
> pcib0: [FILTER]
> pcib0: [FILTER]
> pcib0: [FILTER]
> pcib0: [FILTER]
> pcib0: [FILTER]
> pci0: <OFW PCI bus> on pcib0
> ebus0: <PCI-EBus3 bridge> mem
> 0x7d000000-0x7dffffff,0x7e000000-0x7e7fffff at device 5.0 on pci0
> ebus0: <flashprom> addr 0-0x1fffff (no driver attached)
> ebus0: <i2c> addr 0x10000002e-0x10000002f,0x10000002d irq 35 (no
> driver attached)
> ebus0: <bbc> addr 0x100000000-0x1000fffff (no driver attached)
> ebus0: <power> addr 0x10030002e-0x10030002f,0x100300600-0x100300607
> (no driver attached)
> ebus0: <i2c> addr 0x100000030-0x100000031 irq 35 (no driver attached)
> ebus0: <beep> addr 0x100000032-0x100000037 (no driver attached)
> rtc0: <Real-Time Clock> addr 0x100300070-0x100300071 irq 36 on ebus0
> ebus0: <gpio> addr 0x100300600-0x100300607 (no driver attached)
> ebus0: <pmc> addr 0x100300700-0x100300701 (no driver attached)
> ebus0: <parallel> addr
> 0x100300278-0x100300287,0x10030002e-0x10030002f,0x100700000-0x10070000f
> irq 28 (no driver attached)
> uart0: <16550 or compatible> addr 0x1003062f8-0x1003062ff irq 46 on ebus0
> uart0: [FILTER]
> uart1: <16550 or compatible> addr 0x1003083f8-0x1003083ff irq 45 on ebus0
> uart1: [FILTER]
> scc0: <Siemens SAB 82532 dual channel SCC> addr
> 0x100400000-0x10040007f irq 34 on ebus0
> scc0: [FILTER]
> uart2: <SAB 82532 v3.2, channel A> on scc0
> uart2: [FILTER]
> uart2: CTS oflow
> uart2: console (9600,n,8,1)
> uart3: <SAB 82532 v3.2, channel B> on scc0
> uart3: [FILTER]
> uart3: CTS oflow
> gem0: <Sun ERI 10/100 Ethernet> mem 0x100000-0x11ffff at device 5.1 on pci0
> miibus0: <MII bus> on gem0
> ukphy0: <Generic IEEE 802.3u media interface> PHY 1 on miibus0
> ukphy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
> gem0: 2kB RX FIFO, 2kB TX FIFO
> gem0: Ethernet address: 00:03:ba:3a:0f:f2
> gem0: [ITHREAD]
> ohci0: <Sun PCIO-2 USB controller> mem 0x1000000-0x1007fff at device 5.3 on pci0
> ohci0: [ITHREAD]
> usbus0: <Sun PCIO-2 USB controller> on ohci0
> sym0: <875> port 0x300-0x3ff mem 0x124000-0x1240ff,0x126000-0x126fff
> at device 6.0 on pci0
> sym0: No NVRAM, ID 7, Fast-20, SE, parity checking
> sym0: [ITHREAD]
> sym1: <875> port 0x400-0x4ff mem 0x128000-0x1280ff,0x12a000-0x12afff
> at device 6.1 on pci0
> sym1: No NVRAM, ID 7, Fast-20, SE, parity checking
> sym1: [ITHREAD]
> cas0: <Sun Cassini+ Gigabit Ethernet> mem 0x200000-0x3fffff at device
> 3.0 on pci0
> miibus1: <MII bus> on cas0
> gentbi0: <Generic ten-bit interface> PHY 0 on miibus1
> gentbi0:  1000baseSX, 1000baseSX-FDX, auto
> cas0: 16kB RX FIFO, 9kB TX FIFO
> cas0: Ethernet address: 00:03:ba:3a:0f:f2
> cas0: [FILTER]
> pcib1: <Sun Host-PCI bridge> mem
> 0x40004600000-0x40004617fff,0x40004410000-0x4000441004f,0x7ffec000000-0x7ffec0000ff
> irq 562,560,561,564 on nexus0
> pcib1: Schizo, version 7, IGN 0x8, bus A, 66MHz
> Timecounter "pcib1" frequency 150000000 Hz quality 100
> pcib1: DVMA map: 0xc0000000 to 0xffffffff 131072 entries, streaming buffer
> pcib1: [FILTER]
> pcib1: [FILTER]
> pci1: <OFW PCI bus> on pcib1
> isp0: <Qlogic ISP 2200 PCI FC-AL Adapter> port 0x300-0x3ff mem
> 0x100000-0x100fff at device 4.0 on pci1
> isp0: [ITHREAD]
> isp0: invalid NVRAM header
> isp0: invalid NVRAM header
> isp0: bad frame length (0) from NVRAM- using 1024
> isp0: bad execution throttle of 0- using 16
> cas1: <Sun Cassini+ Gigabit Ethernet> mem 0x200000-0x3fffff at device
> 1.0 on pci1
> miibus2: <MII bus> on cas1
> gentbi1: <Generic ten-bit interface> PHY 0 on miibus2
> gentbi1:  1000baseSX, 1000baseSX-FDX, auto
> cas1: 16kB RX FIFO, 9kB TX FIFO
> cas1: Ethernet address: 00:03:ba:3a:0f:f2
> cas1: [FILTER]
> nexus0: <syscons> type unknown (no driver attached)
> Timecounter "tick" frequency 1200000000 Hz quality 10
> Timecounters tick every 1.000 msec
> usbus0: 12Mbps Full Speed USB v1.0
> (xpt0:isp0:0:-1:-1): rescan already queued
> (xpt0:isp0:0:-1:-1): rescan already queued
> ugen0.1: <SUN> at usbus0
> uhub0: <SUN OHCI root HUB, class 9/0, rev 1.00/1.00, addr 1> on usbus0
> uhub0: 4 ports with 4 removable, self powered
> (probe6:sym0:0:6:0): TEST UNIT READY. CDB: 0 0 0 0 0 0
> (probe6:sym0:0:6:0): CAM status: SCSI Status Error
> (probe6:sym0:0:6:0): SCSI status: Check Condition
> (probe6:sym0:0:6:0): SCSI sense: NOT READY asc:3a,0 (Medium not present)
> SMP: AP CPU #1 Launched!
> da0 at isp0 bus 0 scbus2 target 0 lun 0
> WARNING: WITNESS option enabled, expect reduced performance.
> da0: <FUJITSU MAP3735F SUN72G 0601> Fixed Direct Access SCSI-4 device
> da0: 100.000MB/s transfers
> da0: Command Queueing enabled
> da0: 70007MB (143374738 512 byte sectors: 255H 63S/T 8924C)
> da1 at isp0 bus 0 scbus2 target 1 lun 0
> da1: <FUJITSU MAP3735F SUN72G 0601> Fixed Direct Access SCSI-4 device
> da1: 100.000MB/s transfers WWNN 0x500000e0103578e0 WWPN
> 0x500000e0103578e1 PortID 0xe8
> da1: Command Queueing enabled
> da1: 70007MB (143374738 512 byte sectors: 255H 63S/T 8924C)
> cd0 at sym0 bus 0 scbus0 target 6 lun 0
> cd0: <TOSHIBA DVD-ROM SD-M1401 1009> 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
> GEOM: da0: adding VTOC8 information.
> GEOM: da1: adding VTOC8 information.
> Trying to mount root from ufs:/dev/da0a
> 

Confirmed working for the b1600 chassis as well :-)

brilliant, thanks a million.

Rebooting with command: boot                                          
Boot device: disk  File and args: 
 
>> FreeBSD/sparc64 boot block
   Boot path:   /pci@1f,0/ide@d/disk@0,0:a
   Boot loader: /boot/loader
Consoles: Open Firmware console  

Booting with sun4u support.

FreeBSD/sparc64 bootstrap loader, Revision 1.0
(root@araz.cse.buffalo.edu, Sat Nov 21 15:42:12 UTC 2009)
bootpath="/pci@1f,0/ide@d/disk@0,0:a"
Loading /boot/defaults/loader.conf 
/boot/kernel/kernel data=0x972848+0x75368 syms=[0x8+0xa2f90+0x8+0x95b0e]
/
Hit [Enter] to boot immediately, or any other key for command prompt.
Booting [/boot/kernel/kernel]...               
jumping to kernel entry at 0xc0088000.
Copyright (c) 1992-2009 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.0-RELEASE #1: Sun Apr 18 20:55:49 BST 2010
    root@gradfly.lerwick.hopto.org:/usr/obj/usr/src/sys/GENERIC
real memory  = 1073741824 (1024 MB)
avail memory = 1032560640 (984 MB)
cpu0: Sun Microsystems UltraSparc-IIe Processor (650.00 MHz CPU)
ispfw: registered firmware <isp_1000>
ispfw: registered firmware <isp_1040>
ispfw: registered firmware <isp_1040_it>
ispfw: registered firmware <isp_1080>
ispfw: registered firmware <isp_1080_it>
ispfw: registered firmware <isp_12160>
ispfw: registered firmware <isp_12160_it>
ispfw: registered firmware <isp_2100>
ispfw: registered firmware <isp_2200>
ispfw: registered firmware <isp_2300>
ispfw: registered firmware <isp_2322>
ispfw: registered firmware <isp_2400>
ispfw: registered firmware <isp_2400_multi>
ispfw: registered firmware <isp_2500>
ispfw: registered firmware <isp_2500_multi>
kbd0 at kbdmux0
nexus0: <Open Firmware Nexus device>
pcib0: <U2P UPA-PCI bridge> mem
0x1fe00000000-0x1fe0000ffff,0x1fe01000000-0x1fe010000ff irq
2032,2030,2031,2021 on nexus0
pcib0: Hummingbird compatible, impl 0, version 0, IGN 0x1f, bus A, 33MHz
pcib0: DVMA map: 0xc0000000 to 0xc3ffffff
pcib0: [FILTER]
pcib0: [FILTER]
pcib0: [GIANT-LOCKED]
pcib0: [ITHREAD]
pcib0: [FILTER]
pci0: <OFW PCI bus> on pcib0
isab0: <PCI-ISA bridge> at device 7.0 on pci0
isa0: <ISA bus> on isab0
pci0: <old, non-VGA display device> at device 3.0 (no driver attached)
cas0: <Sun Cassini+ Gigabit Ethernet> mem 0-0x1fffff at device 10.0 on
pci0
miibus0: <MII bus> on cas0
gentbi0: <Generic ten-bit interface> PHY 0 on miibus0
gentbi0:  1000baseSX, 1000baseSX-FDX, auto
cas0: 16kB RX FIFO, 9kB TX FIFO
cas0: Ethernet address: 00:03:ba:4c:ee:fa
cas0: [FILTER]
cas1: <Sun Cassini+ Gigabit Ethernet> mem 0x400000-0x5fffff at device
11.0 on pci0
miibus1: <MII bus> on cas1
gentbi1: <Generic ten-bit interface> PHY 0 on miibus1
gentbi1:  1000baseSX, 1000baseSX-FDX, auto
cas1: 16kB RX FIFO, 9kB TX FIFO
cas1: Ethernet address: 00:03:ba:4c:ee:fb
cas1: [FILTER]
atapci0: <AcerLabs M5229 UDMA100 controller> port
0x900-0x907,0x918-0x91b,0x910-0x917,0x908-0x90b,0x920-0x92f at device
13.0 on pci0
atapci0: [ITHREAD]
atapci0: using PIO transfers above 137GB as workaround for 48bit DMA
access bug, expect reduced performance
ata2: <ATA channel 0> on atapci0
ata2: [ITHREAD]
ata3: <ATA channel 1> on atapci0
ata3: [ITHREAD]
nexus0: <syscons> type unknown (no driver attached)
uart0: <16550 or compatible> at port 0x3f8-0x3ff irq 42 on isa0
uart0: [FILTER]
uart0: console (9600,n,8,1)
rtc0: <Real-Time Clock> at port 0x70-0x71 on isa0
Timecounter "tick" frequency 650000000 Hz quality 1000
Timecounters tick every 1.000 msec
ad0: 28615MB <TOS MK3019GAXB SUN30G FB200C> at ata2-master UDMA100
GEOM: ad0: adding VTOC8 information.
Trying to mount root from ufs:/dev/ad0a
Invalid time in real time clock.
Check and reset the date immediately!
Setting hostuuid: b144b077-4b38-11df-ba65-0003ba0b715c.
Setting hostid: 0x02c86842.
Entropy harvesting: interrupts ethernet point_to_point kickstart.
Starting file system checks:
/dev/ad0a: FILE SYSTEM CLEAN; SKIPPING CHECKS
/dev/ad0a: clean, 163323 free (307 frags, 20377 blocks, 0.1%
fragmentation)
/dev/ad0e: FILE SYSTEM CLEAN; SKIPPING CHECKS
/dev/ad0e: clean, 253997 free (37 frags, 31745 blocks, 0.0%
fragmentation)
/dev/ad0f: FILE SYSTEM CLEAN; SKIPPING CHECKS
/dev/ad0f: clean, 12743683 free (4083 frags, 1592450 blocks, 0.0%
fragmentation)
/dev/ad0d: FILE SYSTEM CLEAN; SKIPPING CHECKS
/dev/ad0d: clean, 625999 free (47 frags, 78244 blocks, 0.0%
fragmentation)
Mounting local file systems:.
/etc/rc: WARNING: $hostname is not set -- see rc.conf(5).
Starting Network: lo0.
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
        options=3<RXCSUM,TXCSUM>
        inet6 fe80::1%lo0 prefixlen 64 scopeid 0x3 
        inet6 ::1 prefixlen 128 
        inet 127.0.0.1 netmask 0xff000000 
Starting devd.
Creating and/or trimming log files.
Starting syslogd.
ELF ldconfig path: /lib /usr/lib /usr/lib/compat
Clearing /tmp (X related).
Updating motd:.
Starting cron.
Starting background file system checks in 60 seconds.

Sun Apr 18 22:25:06 UTC 2010
Apr 18 22:25:06  getty[893]: open /dev/ttyv0: No such file or directory

FreeBSD/sparc64 (Amnesiac) (ttyu0)

# ping yahoo.com
PING yahoo.com (72.30.2.43): 56 data bytes
64 bytes from 72.30.2.43: icmp_seq=0 ttl=49 time=201.886 ms
64 bytes from 72.30.2.43: icmp_seq=1 ttl=49 time=220.346 ms
Comment 10 dfilter service freebsd_committer freebsd_triage 2010-05-03 21:57:36 UTC
Author: marius
Date: Mon May  3 20:57:16 2010
New Revision: 207585
URL: http://svn.freebsd.org/changeset/base/207585

Log:
  - Don't set CAS_PCS_DATAPATH to anything except CAS_PCS_DATAPATH_SERDES
    on Cassini using the external PCS SERDES otherwise unaligned access
    traps and other strange effects happen with some machines. Don't touch
    the MIF which is unused in that case either. These changes require the
    PHY type to use to be determined via the OFW device tree or from the
    VPD in machines without the former.
  - Disable the SERDES pins of Saturn when not used in order to save power
    and ensure they are enabled otherwise.
  - In cas_attach() use the correct register offset for CAS_PCS_CONF_EN.
  - Add some bus space barriers missing in the PCS code path.
  
  These changes make the Sun GigaSwift Ethernet 1.0 MMF cards as well as
  the on-board interfaces found in Sun Fire B100s Blade Server work.
  
  PR:	144867

Modified:
  head/sys/dev/cas/if_cas.c
  head/sys/dev/cas/if_casreg.h

Modified: head/sys/dev/cas/if_cas.c
==============================================================================
--- head/sys/dev/cas/if_cas.c	Mon May  3 20:31:13 2010	(r207584)
+++ head/sys/dev/cas/if_cas.c	Mon May  3 20:57:16 2010	(r207585)
@@ -76,6 +76,7 @@ __FBSDID("$FreeBSD$");
 
 #include <machine/bus.h>
 #if defined(__powerpc__) || defined(__sparc64__)
+#include <dev/ofw/ofw_bus.h>
 #include <dev/ofw/openfirm.h>
 #include <machine/ofw_machdep.h>
 #endif
@@ -321,55 +322,82 @@ cas_attach(struct cas_softc *sc)
 		}
 	}
 
-	CAS_WRITE_4(sc, CAS_PCS_DATAPATH, CAS_PCS_DATAPATH_MII);
-
-	cas_mifinit(sc);
-
-	/*
-	 * Look for an external PHY.
-	 */
-	error = ENXIO;
-	v = CAS_READ_4(sc, CAS_MIF_CONF);
-	if ((v & CAS_MIF_CONF_MDI1) != 0) {
-		v |= CAS_MIF_CONF_PHY_SELECT;
-		CAS_WRITE_4(sc, CAS_MIF_CONF, v);
-		switch (sc->sc_variant) {
-		default:
-			sc->sc_phyad = -1;
-			break;
+	if ((sc->sc_flags & CAS_SERDES) == 0) {
+		CAS_WRITE_4(sc, CAS_PCS_DATAPATH, CAS_PCS_DATAPATH_MII);
+		CAS_BARRIER(sc, CAS_PCS_DATAPATH, 4,
+		    BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
+		cas_mifinit(sc);
+		/*
+		 * Look for an external PHY.
+		 */
+		error = ENXIO;
+		v = CAS_READ_4(sc, CAS_MIF_CONF);
+		if ((v & CAS_MIF_CONF_MDI1) != 0) {
+			v |= CAS_MIF_CONF_PHY_SELECT;
+			CAS_WRITE_4(sc, CAS_MIF_CONF, v);
+			CAS_BARRIER(sc, CAS_MIF_CONF, 4,
+			    BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
+			/* Enable/unfreeze the GMII pins of Saturn. */
+			if (sc->sc_variant == CAS_SATURN) {
+				CAS_WRITE_4(sc, CAS_SATURN_PCFG, 0);
+				CAS_BARRIER(sc, CAS_SATURN_PCFG, 4,
+				    BUS_SPACE_BARRIER_READ |
+				    BUS_SPACE_BARRIER_WRITE);
+			}
+			switch (sc->sc_variant) {
+			default:
+				sc->sc_phyad = -1;
+				break;
+			}
+			error = mii_phy_probe(sc->sc_dev, &sc->sc_miibus,
+			    cas_mediachange, cas_mediastatus);
 		}
-		error = mii_phy_probe(sc->sc_dev, &sc->sc_miibus,
-		    cas_mediachange, cas_mediastatus);
-	}
-
-	/*
-	 * Fall back on an internal PHY if no external PHY was found.
-	 */
-	if (error != 0 && (v & CAS_MIF_CONF_MDI0) != 0) {
-		v &= ~CAS_MIF_CONF_PHY_SELECT;
-		CAS_WRITE_4(sc, CAS_MIF_CONF, v);
-		switch (sc->sc_variant) {
-		default:
-			sc->sc_phyad = -1;
-			break;
+		/*
+		 * Fall back on an internal PHY if no external PHY was found.
+		 */
+		if (error != 0 && (v & CAS_MIF_CONF_MDI0) != 0) {
+			v &= ~CAS_MIF_CONF_PHY_SELECT;
+			CAS_WRITE_4(sc, CAS_MIF_CONF, v);
+			CAS_BARRIER(sc, CAS_MIF_CONF, 4,
+			    BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
+			/* Freeze the GMII pins of Saturn for saving power. */
+			if (sc->sc_variant == CAS_SATURN) {
+				CAS_WRITE_4(sc, CAS_SATURN_PCFG,
+				    CAS_SATURN_PCFG_FSI);
+				CAS_BARRIER(sc, CAS_SATURN_PCFG, 4,
+				    BUS_SPACE_BARRIER_READ |
+				    BUS_SPACE_BARRIER_WRITE);
+			}
+			switch (sc->sc_variant) {
+			default:
+				sc->sc_phyad = -1;
+				break;
+			}
+			error = mii_phy_probe(sc->sc_dev, &sc->sc_miibus,
+			    cas_mediachange, cas_mediastatus);
 		}
-		error = mii_phy_probe(sc->sc_dev, &sc->sc_miibus,
-		    cas_mediachange, cas_mediastatus);
-	}
-
-	/*
-	 * Try the external PCS SERDES if we didn't find any PHYs.
-	 */
-	if (error != 0) {
+	} else {
+		/*
+		 * Use the external PCS SERDES.
+		 */
 		CAS_WRITE_4(sc, CAS_PCS_DATAPATH, CAS_PCS_DATAPATH_SERDES);
+		CAS_BARRIER(sc, CAS_PCS_DATAPATH, 4, BUS_SPACE_BARRIER_WRITE);
+		/* Enable/unfreeze the SERDES pins of Saturn. */
+		if (sc->sc_variant == CAS_SATURN) {
+			CAS_WRITE_4(sc, CAS_SATURN_PCFG, 0);
+			CAS_BARRIER(sc, CAS_SATURN_PCFG, 4,
+			    BUS_SPACE_BARRIER_WRITE);
+		}
 		CAS_WRITE_4(sc, CAS_PCS_SERDES_CTRL, CAS_PCS_SERDES_CTRL_ESD);
-		CAS_WRITE_4(sc, CAS_PCS_CONF_EN, CAS_PCS_CONF_EN);
-		sc->sc_flags |= CAS_SERDES;
+		CAS_BARRIER(sc, CAS_PCS_SERDES_CTRL, 4,
+		    BUS_SPACE_BARRIER_WRITE);
+		CAS_WRITE_4(sc, CAS_PCS_CONF, CAS_PCS_CONF_EN);
+		CAS_BARRIER(sc, CAS_PCS_CONF, 4,
+		    BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
 		sc->sc_phyad = CAS_PHYAD_EXTERNAL;
 		error = mii_phy_probe(sc->sc_dev, &sc->sc_miibus,
 		    cas_mediachange, cas_mediastatus);
 	}
-
 	if (error != 0) {
 		device_printf(sc->sc_dev, "PHY probe failed: %d\n", error);
 		goto fail_rxmap;
@@ -956,8 +984,9 @@ cas_init_locked(struct cas_softc *sc)
 	    __func__);
 #endif
 
-	/* Re-initialize the MIF. */
-	cas_mifinit(sc);
+	if ((sc->sc_flags & CAS_SERDES) == 0)
+		/* Re-initialize the MIF. */
+		cas_mifinit(sc);
 
 	/* step 3.  Setup data structures in host memory. */
 	cas_meminit(sc);
@@ -2105,6 +2134,8 @@ cas_mifinit(struct cas_softc *sc)
 	/* Configure the MIF in frame mode. */
 	CAS_WRITE_4(sc, CAS_MIF_CONF,
 	    CAS_READ_4(sc, CAS_MIF_CONF) & ~CAS_MIF_CONF_BB_MODE);
+	CAS_BARRIER(sc, CAS_MIF_CONF, 4,
+	    BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
 }
 
 /*
@@ -2219,10 +2250,16 @@ cas_mii_writereg(device_t dev, int phy, 
 			CAS_BARRIER(sc, CAS_PCS_CONF, 4,
 			    BUS_SPACE_BARRIER_WRITE);
 			CAS_WRITE_4(sc, CAS_PCS_ANAR, val);
+			CAS_BARRIER(sc, CAS_PCS_ANAR, 4,
+			    BUS_SPACE_BARRIER_WRITE);
 			CAS_WRITE_4(sc, CAS_PCS_SERDES_CTRL,
 			    CAS_PCS_SERDES_CTRL_ESD);
+			CAS_BARRIER(sc, CAS_PCS_CONF, 4,
+			    BUS_SPACE_BARRIER_WRITE);
 			CAS_WRITE_4(sc, CAS_PCS_CONF,
 			    CAS_PCS_CONF_EN);
+			CAS_BARRIER(sc, CAS_PCS_CONF, 4,
+			    BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
 			return (0);
 		case MII_ANLPAR:
 			reg = CAS_PCS_ANLPAR;
@@ -2233,6 +2270,8 @@ cas_mii_writereg(device_t dev, int phy, 
 			return (0);
 		}
 		CAS_WRITE_4(sc, reg, val);
+		CAS_BARRIER(sc, reg, 4,
+		    BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
 		return (0);
 	}
 
@@ -2630,15 +2669,20 @@ static struct resource_spec cas_pci_res_
 	{ -1, 0 }
 };
 
+#define	CAS_LOCAL_MAC_ADDRESS	"local-mac-address"
+#define	CAS_PHY_INTERFACE	"phy-interface"
+#define	CAS_PHY_TYPE		"phy-type"
+#define	CAS_PHY_TYPE_PCS	"pcs"
+
 static int
 cas_pci_attach(device_t dev)
 {
+	char buf[sizeof(CAS_LOCAL_MAC_ADDRESS)];
 	struct cas_softc *sc;
 	int i;
 #if !(defined(__powerpc__) || defined(__sparc64__))
 	u_char enaddr[4][ETHER_ADDR_LEN];
-	char lma[sizeof("local-mac-address")];
-	int found, j;
+	u_int j, k, lma, pcs[4], phy;
 #endif
 
 	sc = device_get_softc(dev);
@@ -2679,13 +2723,20 @@ cas_pci_attach(device_t dev)
 
 #if defined(__powerpc__) || defined(__sparc64__)
 	OF_getetheraddr(dev, sc->sc_enaddr);
+	if (OF_getprop(ofw_bus_get_node(dev), CAS_PHY_INTERFACE, buf,
+	    sizeof(buf)) > 0 || OF_getprop(ofw_bus_get_node(dev),
+	    CAS_PHY_TYPE, buf, sizeof(buf)) > 0) {
+		buf[sizeof(buf) - 1] = '\0';
+		if (strcmp(buf, CAS_PHY_TYPE_PCS) == 0)
+			sc->sc_flags |= CAS_SERDES;
+	}
 #else
 	/*
-	 * Dig out VPD (vital product data) and read the MAX address.
-	 * The VPD resides in the PCI Expansion ROM (PCI FCode) and
-	 * can't be accessed via the PCI capability pointer.
-	 * SUNW,pci-ce and SUNW,pci-qge use the Enhanced VPD format
-	 * described in US Patent 7149820.
+	 * Dig out VPD (vital product data) and read the MAC address as well
+	 * as the PHY type.  The VPD resides in the PCI Expansion ROM (PCI
+	 * FCode) and can't be accessed via the PCI capability pointer.
+	 * SUNW,pci-ce and SUNW,pci-qge use the Enhanced VPD format described
+	 * in the free US Patent 7149820.
 	 */
 
 #define	PCI_ROMHDR_SIZE			0x1c
@@ -2719,7 +2770,10 @@ cas_pci_attach(device_t dev)
 #define	CAS_ROM_READ_4(sc, offs)					\
 	CAS_READ_4((sc), CAS_PCI_ROM_OFFSET + (offs))
 
-	found = 0;
+	lma = phy = 0;
+	memset(enaddr, 0, sizeof(enaddr));
+	memset(pcs, 0, sizeof(pcs));
+
 	/* Enable PCI Expansion ROM access. */
 	CAS_WRITE_4(sc, CAS_BIM_LDEV_OEN,
 	    CAS_BIM_LDEV_OEN_PAD | CAS_BIM_LDEV_OEN_PROM);
@@ -2768,23 +2822,51 @@ cas_pci_attach(device_t dev)
 			if (CAS_ROM_READ_1(sc, j + PCI_VPD_SIZE) != 'I')
 				/* no instance property */
 				continue;
-			if (CAS_ROM_READ_1(sc, j + PCI_VPD_SIZE + 3) != 'B')
-				/* no byte array */
-				continue;
-			if (CAS_ROM_READ_1(sc, j + PCI_VPD_SIZE + 4) !=
-			    ETHER_ADDR_LEN)
-				continue;
-			bus_read_region_1(sc->sc_res[CAS_RES_MEM],
-			    CAS_PCI_ROM_OFFSET + j + PCI_VPD_SIZE + 5,
-			    lma, sizeof(lma));
-			if (strcmp(lma, "local-mac-address") != 0)
-				continue;
-			bus_read_region_1(sc->sc_res[CAS_RES_MEM],
-			    CAS_PCI_ROM_OFFSET + j + PCI_VPD_SIZE + 5 +
-			    sizeof(lma), enaddr[found],
-			    sizeof(enaddr[found]));
-			if (found++ == 4)
-				break;
+			if (CAS_ROM_READ_1(sc, j + PCI_VPD_SIZE + 3) == 'B') {
+				/* byte array */
+				if (CAS_ROM_READ_1(sc,
+				    j + PCI_VPD_SIZE + 4) != ETHER_ADDR_LEN)
+					continue;
+				bus_read_region_1(sc->sc_res[CAS_RES_MEM],
+				    CAS_PCI_ROM_OFFSET + j + PCI_VPD_SIZE + 5,
+				    buf, sizeof(buf));
+				buf[sizeof(buf) - 1] = '\0';
+				if (strcmp(buf, CAS_LOCAL_MAC_ADDRESS) != 0)
+					continue;
+				bus_read_region_1(sc->sc_res[CAS_RES_MEM],
+				    CAS_PCI_ROM_OFFSET + j + PCI_VPD_SIZE +
+				    5 + sizeof(CAS_LOCAL_MAC_ADDRESS),
+				    enaddr[lma], sizeof(enaddr[lma]));
+				lma++;
+				if (lma == 4 && phy == 4)
+					break;
+			} else if (CAS_ROM_READ_1(sc, j + PCI_VPD_SIZE + 3) ==
+			   'S') {
+				/* string */
+				if (CAS_ROM_READ_1(sc,
+				    j + PCI_VPD_SIZE + 4) !=
+				    sizeof(CAS_PHY_TYPE_PCS))
+					continue;
+				bus_read_region_1(sc->sc_res[CAS_RES_MEM],
+				    CAS_PCI_ROM_OFFSET + j + PCI_VPD_SIZE + 5,
+				    buf, sizeof(buf));
+				buf[sizeof(buf) - 1] = '\0';
+				if (strcmp(buf, CAS_PHY_INTERFACE) == 0)
+					k = sizeof(CAS_PHY_INTERFACE);
+				else if (strcmp(buf, CAS_PHY_TYPE) == 0)
+					k = sizeof(CAS_PHY_TYPE);
+				else
+					continue;
+				bus_read_region_1(sc->sc_res[CAS_RES_MEM],
+				    CAS_PCI_ROM_OFFSET + j + PCI_VPD_SIZE +
+				    5 + k, buf, sizeof(buf));
+				buf[sizeof(buf) - 1] = '\0';
+				if (strcmp(buf, CAS_PHY_TYPE_PCS) == 0)
+					pcs[phy] = 1;
+				phy++;
+				if (lma == 4 && phy == 4)
+					break;
+			}
 		}
 		break;
 	default:
@@ -2795,14 +2877,24 @@ cas_pci_attach(device_t dev)
  fail_prom:
 	CAS_WRITE_4(sc, CAS_BIM_LDEV_OEN, 0);
 
-	if (found == 0) {
+	if (lma == 0) {
 		device_printf(dev, "could not determine Ethernet address\n");
 		goto fail;
 	}
 	i = 0;
-	if (found > 1 && pci_get_slot(dev) < sizeof(enaddr) / sizeof(*enaddr))
+	if (lma > 1 && pci_get_slot(dev) < sizeof(enaddr) / sizeof(*enaddr))
 		i = pci_get_slot(dev);
 	memcpy(sc->sc_enaddr, enaddr[i], ETHER_ADDR_LEN);
+
+	if (phy == 0) {
+		device_printf(dev, "could not determine PHY type\n");
+		goto fail;
+	}
+	i = 0;
+	if (phy > 1 && pci_get_slot(dev) < sizeof(pcs) / sizeof(*pcs))
+		i = pci_get_slot(dev);
+	if (pcs[i] != 0)
+		sc->sc_flags |= CAS_SERDES;
 #endif
 
 	if (cas_attach(sc) != 0) {

Modified: head/sys/dev/cas/if_casreg.h
==============================================================================
--- head/sys/dev/cas/if_casreg.h	Mon May  3 20:31:13 2010	(r207584)
+++ head/sys/dev/cas/if_casreg.h	Mon May  3 20:57:16 2010	(r207585)
@@ -68,6 +68,7 @@
 #define	CAS_STATUS4		0x105c	/* interrupt status 4 for INTD */
 #define	CAS_CLEAR_ALIAS4	0x1060	/* clear mask alias 4 for INTD */
 #define	CAS_STATUS_ALIAS4	0x1064	/* interrupt status alias 4 for INTD */
+#define	CAS_SATURN_PCFG		0x106c	/* internal MACPHY pin configuration */
 
 #define	CAS_CAW_RX_WGHT_MASK	0x00000003	/* RX DMA factor for... */
 #define	CAS_CAW_RX_WGHT_SHFT	0		/* ...weighted round robin */
@@ -171,6 +172,17 @@
 /* INTn enable bit for CAS_INTMASK[2-4] */
 #define	CAS_INTMASKN_EN		0x00000080	/* INT[B-D] enable */
 
+#define	CAS_SATURN_PCFG_TLA	0x00000001	/* PHY activity LED */
+#define	CAS_SATURN_PCFG_FLA	0x00000002	/* PHY 10MBit/sec LED */
+#define	CAS_SATURN_PCFG_CLA	0x00000004	/* PHY 100MBit/sec LED */
+#define	CAS_SATURN_PCFG_LLA	0x00000008	/* PHY 1000MBit/sec LED */
+#define	CAS_SATURN_PCFG_RLA	0x00000010	/* PHY full-duplex LED */
+#define	CAS_SATURN_PCFG_PDS	0x00000020	/* PHY debug mode */
+#define	CAS_SATURN_PCFG_MTP	0x00000080	/* test point select */
+#define	CAS_SATURN_PCFG_GMO	0x00000100	/* GMII observe */
+#define	CAS_SATURN_PCFG_FSI	0x00000200	/* freeze GMII/SERDES */
+#define	CAS_SATURN_PCFG_LAD	0x00000800	/* MAC LED control active low */
+
 /* TX DMA registers */
 #define	CAS_TX_CONF		0x2004	/* TX configuration */
 #define	CAS_TX_FIFO_WR		0x2014	/* FIFO write pointer */
_______________________________________________
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"
Comment 11 Robert Farmer 2010-05-05 18:54:49 UTC
On Sat, Apr 17, 2010 at 1:05 PM, Marius Strobl
<marius@alchemy.franken.de> wrote:
>
> Could both of you please refetch the following patch and give it try?
> http://people.freebsd.org/~marius/cas_mmf.diff
> The MD5 hash of the new version is 0d668f21e2b3bb3c9641950bd0153e3d.
>
> Marius
>
>

Is the patch you sent me the same as what was committed? I just tried
to upgrade the system today and am getting a panic again:

jumping to kernel entry at 0xc0088000.
GDB: no debug ports present
KDB: debugger backends: ddb
KDB: current backend: ddb
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 9.0-CURRENT #0: Wed May  5 08:47:13 PDT 2010
    root@:/usr/obj/usr/src/sys/GENERIC sparc64
WARNING: WITNESS option enabled, expect reduced performance.
real memory  = 8589934592 (8192 MB)
avail memory = 8381554688 (7993 MB)
cpu0: Sun Microsystems UltraSparc-III+ Processor (1200.00 MHz CPU)
cpu1: Sun Microsystems UltraSparc-III+ Processor (1200.00 MHz CPU)
FreeBSD/SMP: Multiprocessor System Detected: 2 CPUs
kbd0 at kbdmux0
nexus0: <Open Firmware Nexus device>
nexus0: <memory-controller> mem 0x40000400000-0x40000400047 type
memory-controller (no driver attached)
nexus0: <memory-controller> mem 0x40000c00000-0x40000c00047 type
memory-controller (no driver attached)
pcib0: <Sun Host-PCI bridge> mem
0x40004700000-0x40004717fff,0x40004410000-0x4000441004f,0x7ffee000000-0x7ffee0000ff
irq 563,560,561,564,550 on nexus0
pcib0: Schizo, version 7, IGN 0x8, bus B, 33MHz
pcib0: DVMA map: 0xc0000000 to 0xffffffff 131072 entries, streaming buffer
pcib0: [FILTER]
pcib0: [FILTER]
pcib0: [FILTER]
pcib0: [FILTER]
pcib0: [FILTER]
pci0: <OFW PCI bus> on pcib0
ebus0: <PCI-EBus3 bridge> mem
0x7d000000-0x7dffffff,0x7e000000-0x7e7fffff at device 5.0 on pci0
ebus0: <flashprom> addr 0-0x1fffff (no driver attached)
ebus0: <i2c> addr 0x10000002e-0x10000002f,0x10000002d irq 35 (no
driver attached)
ebus0: <bbc> addr 0x100000000-0x1000fffff (no driver attached)
ebus0: <power> addr 0x10030002e-0x10030002f,0x100300600-0x100300607
(no driver attached)
ebus0: <i2c> addr 0x100000030-0x100000031 irq 35 (no driver attached)
ebus0: <beep> addr 0x100000032-0x100000037 (no driver attached)
rtc0: <Real-Time Clock> addr 0x100300070-0x100300071 irq 36 on ebus0
ebus0: <gpio> addr 0x100300600-0x100300607 (no driver attached)
ebus0: <pmc> addr 0x100300700-0x100300701 (no driver attached)
ebus0: <parallel> addr
0x100300278-0x100300287,0x10030002e-0x10030002f,0x100700000-0x10070000f
irq 28 (no driver attached)
uart0: <16550 or compatible> addr 0x1003062f8-0x1003062ff irq 46 on ebus0
uart0: [FILTER]
uart1: <16550 or compatible> addr 0x1003083f8-0x1003083ff irq 45 on ebus0
uart1: [FILTER]
scc0: <Siemens SAB 82532 dual channel SCC> addr
0x100400000-0x10040007f irq 34 on ebus0
scc0: [FILTER]
uart2: <SAB 82532 v3.2, channel A> on scc0
uart2: [FILTER]
uart2: CTS oflow
uart2: console (9600,n,8,1)
uart3: <SAB 82532 v3.2, channel B> on scc0
uart3: [FILTER]
uart3: CTS oflow
gem0: <Sun ERI 10/100 Ethernet> mem 0x100000-0x11ffff at device 5.1 on pci0
miibus0: <MII bus> on gem0
ukphy0: <Generic IEEE 802.3u media interface> PHY 1 on miibus0
ukphy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
gem0: 2kB RX FIFO, 2kB TX FIFO
gem0: Ethernet address: 00:03:ba:3a:0f:f2
gem0: [ITHREAD]
ohci0: <Sun PCIO-2 USB controller> mem 0x1000000-0x1007fff at device 5.3 on pci0
ohci0: [ITHREAD]
usbus0: <Sun PCIO-2 USB controller> on ohci0
sym0: <875> port 0x300-0x3ff mem 0x124000-0x1240ff,0x126000-0x126fff
at device 6.0 on pci0
sym0: No NVRAM, ID 7, Fast-20, SE, parity checking
sym0: [ITHREAD]
sym1: <875> port 0x400-0x4ff mem 0x128000-0x1280ff,0x12a000-0x12afff
at device 6.1 on pci0
sym1: No NVRAM, ID 7, Fast-20, SE, parity checking
sym1: [ITHREAD]
cas0: <Sun Cassini+ Gigabit Ethernet> mem 0x200000-0x3fffff at device
3.0 on pci0
miibus1: <MII bus> on cas0
gentbi0: <Generic ten-bit interface> PHY 0 on miibus1
gentbi0:  1000baseSX, 1000baseSX-FDX, auto
cas0: 16kB RX FIFO, 9kB TX FIFO
cas0: Ethernet address: 00:03:ba:3a:0f:f2
cas0: [FILTER]
pcib1: <Sun Host-PCI bridge> mem
0x40004600000-0x40004617fff,0x40004410000-0x4000441004f,0x7ffec000000-0x7ffec0000ff
irq 562,560,561,564 on nexus0
pcib1: Schizo, version 7, IGN 0x8, bus A, 66MHz
Timecounter "pcib1" frequency 150000000 Hz quality 100
pcib1: DVMA map: 0xc0000000 to 0xffffffff 131072 entries, streaming buffer
pcib1: [FILTER]
pcib1: [FILTER]
pci1: <OFW PCI bus> on pcib1
isp0: <Qlogic ISP 2200 PCI FC-AL Adapter> port 0x300-0x3ff mem
0x100000-0x100fff at device 4.0 on pci1
isp0: [ITHREAD]
isp0: invalid NVRAM header
isp0: invalid NVRAM header
isp0: bad frame length (0) from NVRAM- using 1024
isp0: bad execution throttle of 0- using 16
cas1: <Sun Cassini+ Gigabit Ethernet> mem 0x200000-0x3fffff at device
1.0 on pci1
miibus2: <MII bus> on cas1
gentbi1: <Generic ten-bit interface> PHY 0 on miibus2
gentbi1:  1000baseSX, 1000baseSX-FDX, auto
cas1: 16kB RX FIFO, 9kB TX FIFO
cas1: Ethernet address: 00:03:ba:3a:0f:f2
cas1: [FILTER]
nexus0: <syscons> type unknown (no driver attached)
Timecounter "tick" frequency 1200000000 Hz quality 10
Timecounters tick every 1.000 msec
panic: pcib1: PCI bus A error AFAR 0x1000c0 AFSR 0x320000000 PCI CSR
0x60002010f003f IOMMU 0x70003 STATUS 0x2a0
cpuid = 0
KDB: enter: panic
[ thread pid 0 tid 100029 ]
Stopped at      kdb_enter+0x80: ta              %xcc, 1
db> bt
Tracing pid 0 tid 100029 td 0xfffff800030b2ec0
panic() at panic+0x198
schizo_pci_bus() at schizo_pci_bus+0x2c0
intr_event_handle() at intr_event_handle+0x4c
intr_execute_handlers() at intr_execute_handlers+0x8
intr_fast() at intr_fast+0x68
-- interrupt level=0xd pil=0 %o7=0xc0702c64 --
spinlock_exit() at spinlock_exit+0x28
fork_exit() at fork_exit+0x58
fork_trampoline() at fork_trampoline+0x8
db>

-- 
Rob Farmer
Comment 12 marius 2010-05-06 09:01:41 UTC
On Wed, May 05, 2010 at 10:54:49AM -0700, Rob Farmer wrote:
> On Sat, Apr 17, 2010 at 1:05 PM, Marius Strobl
> <marius@alchemy.franken.de> wrote:
> >
> > Could both of you please refetch the following patch and give it try?
> > http://people.freebsd.org/~marius/cas_mmf.diff
> > The MD5 hash of the new version is 0d668f21e2b3bb3c9641950bd0153e3d.
> >
> > Marius
> >
> >
> 
> Is the patch you sent me the same as what was committed?

Except for a change in a comment it was.

> I just tried
> to upgrade the system today and am getting a panic again:

This likely is a variation of the problem that when booting from
disk the firmware leaves us with a PCI bus error that may be
cleared from the status registers but nevertheless triggers an
error interrupt, which you already hit earlier. I've to think
some more about this.

Marius
Comment 13 marius 2010-05-09 18:28:23 UTC
On Thu, May 06, 2010 at 10:01:41AM +0200, Marius Strobl wrote:
> On Wed, May 05, 2010 at 10:54:49AM -0700, Rob Farmer wrote:
> > On Sat, Apr 17, 2010 at 1:05 PM, Marius Strobl
> > <marius@alchemy.franken.de> wrote:
> > >
> > > Could both of you please refetch the following patch and give it try?
> > > http://people.freebsd.org/~marius/cas_mmf.diff
> > > The MD5 hash of the new version is 0d668f21e2b3bb3c9641950bd0153e3d.
> > >
> > > Marius
> > >
> > >
> > 
> > Is the patch you sent me the same as what was committed?
> 
> Except for a change in a comment it was.
> 
> > I just tried
> > to upgrade the system today and am getting a panic again:
> 
> This likely is a variation of the problem that when booting from
> disk the firmware leaves us with a PCI bus error that may be
> cleared from the status registers but nevertheless triggers an
> error interrupt, which you already hit earlier. I've to think
> some more about this.
> 

Please give the following patch a try:
http://people.freebsd.org/~marius/schizo_pci_non_fatal.diff

Marius
Comment 14 Robert Farmer 2010-05-12 14:25:14 UTC
On Sun, May 9, 2010 at 10:28 AM, Marius Strobl
<marius@alchemy.franken.de> wrote:
> Please give the following patch a try:
> http://people.freebsd.org/~marius/schizo_pci_non_fatal.diff

That patch works for me.

Thanks,
-- 
Rob Farmer

>
> Marius
>
>
Comment 15 dfilter service freebsd_committer freebsd_triage 2010-05-14 20:11:51 UTC
Author: marius
Date: Fri May 14 19:11:41 2010
New Revision: 208086
URL: http://svn.freebsd.org/changeset/base/208086

Log:
  MFC: r207585
  
  - Don't set CAS_PCS_DATAPATH to anything except CAS_PCS_DATAPATH_SERDES
    on Cassini using the external PCS SERDES otherwise unaligned access
    traps and other strange effects happen with some machines. Don't touch
    the MIF which is unused in that case either. These changes require the
    PHY type to use to be determined via the OFW device tree or from the
    VPD in machines without the former.
  - Disable the SERDES pins of Saturn when not used in order to save power
    and ensure they are enabled otherwise.
  - In cas_attach() use the correct register offset for CAS_PCS_CONF_EN.
  - Add some bus space barriers missing in the PCS code path.
  
  These changes make the Sun GigaSwift Ethernet 1.0 MMF cards as well as
  the on-board interfaces found in Sun Fire B100s Blade Server work.
  
  PR:	144867

Modified:
  stable/8/sys/dev/cas/if_cas.c
  stable/8/sys/dev/cas/if_casreg.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)
  stable/8/sys/dev/xen/xenpci/   (props changed)
  stable/8/sys/geom/sched/   (props changed)

Modified: stable/8/sys/dev/cas/if_cas.c
==============================================================================
--- stable/8/sys/dev/cas/if_cas.c	Fri May 14 18:00:21 2010	(r208085)
+++ stable/8/sys/dev/cas/if_cas.c	Fri May 14 19:11:41 2010	(r208086)
@@ -76,6 +76,7 @@ __FBSDID("$FreeBSD$");
 
 #include <machine/bus.h>
 #if defined(__powerpc__) || defined(__sparc64__)
+#include <dev/ofw/ofw_bus.h>
 #include <dev/ofw/openfirm.h>
 #include <machine/ofw_machdep.h>
 #endif
@@ -321,55 +322,82 @@ cas_attach(struct cas_softc *sc)
 		}
 	}
 
-	CAS_WRITE_4(sc, CAS_PCS_DATAPATH, CAS_PCS_DATAPATH_MII);
-
-	cas_mifinit(sc);
-
-	/*
-	 * Look for an external PHY.
-	 */
-	error = ENXIO;
-	v = CAS_READ_4(sc, CAS_MIF_CONF);
-	if ((v & CAS_MIF_CONF_MDI1) != 0) {
-		v |= CAS_MIF_CONF_PHY_SELECT;
-		CAS_WRITE_4(sc, CAS_MIF_CONF, v);
-		switch (sc->sc_variant) {
-		default:
-			sc->sc_phyad = -1;
-			break;
+	if ((sc->sc_flags & CAS_SERDES) == 0) {
+		CAS_WRITE_4(sc, CAS_PCS_DATAPATH, CAS_PCS_DATAPATH_MII);
+		CAS_BARRIER(sc, CAS_PCS_DATAPATH, 4,
+		    BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
+		cas_mifinit(sc);
+		/*
+		 * Look for an external PHY.
+		 */
+		error = ENXIO;
+		v = CAS_READ_4(sc, CAS_MIF_CONF);
+		if ((v & CAS_MIF_CONF_MDI1) != 0) {
+			v |= CAS_MIF_CONF_PHY_SELECT;
+			CAS_WRITE_4(sc, CAS_MIF_CONF, v);
+			CAS_BARRIER(sc, CAS_MIF_CONF, 4,
+			    BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
+			/* Enable/unfreeze the GMII pins of Saturn. */
+			if (sc->sc_variant == CAS_SATURN) {
+				CAS_WRITE_4(sc, CAS_SATURN_PCFG, 0);
+				CAS_BARRIER(sc, CAS_SATURN_PCFG, 4,
+				    BUS_SPACE_BARRIER_READ |
+				    BUS_SPACE_BARRIER_WRITE);
+			}
+			switch (sc->sc_variant) {
+			default:
+				sc->sc_phyad = -1;
+				break;
+			}
+			error = mii_phy_probe(sc->sc_dev, &sc->sc_miibus,
+			    cas_mediachange, cas_mediastatus);
 		}
-		error = mii_phy_probe(sc->sc_dev, &sc->sc_miibus,
-		    cas_mediachange, cas_mediastatus);
-	}
-
-	/*
-	 * Fall back on an internal PHY if no external PHY was found.
-	 */
-	if (error != 0 && (v & CAS_MIF_CONF_MDI0) != 0) {
-		v &= ~CAS_MIF_CONF_PHY_SELECT;
-		CAS_WRITE_4(sc, CAS_MIF_CONF, v);
-		switch (sc->sc_variant) {
-		default:
-			sc->sc_phyad = -1;
-			break;
+		/*
+		 * Fall back on an internal PHY if no external PHY was found.
+		 */
+		if (error != 0 && (v & CAS_MIF_CONF_MDI0) != 0) {
+			v &= ~CAS_MIF_CONF_PHY_SELECT;
+			CAS_WRITE_4(sc, CAS_MIF_CONF, v);
+			CAS_BARRIER(sc, CAS_MIF_CONF, 4,
+			    BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
+			/* Freeze the GMII pins of Saturn for saving power. */
+			if (sc->sc_variant == CAS_SATURN) {
+				CAS_WRITE_4(sc, CAS_SATURN_PCFG,
+				    CAS_SATURN_PCFG_FSI);
+				CAS_BARRIER(sc, CAS_SATURN_PCFG, 4,
+				    BUS_SPACE_BARRIER_READ |
+				    BUS_SPACE_BARRIER_WRITE);
+			}
+			switch (sc->sc_variant) {
+			default:
+				sc->sc_phyad = -1;
+				break;
+			}
+			error = mii_phy_probe(sc->sc_dev, &sc->sc_miibus,
+			    cas_mediachange, cas_mediastatus);
 		}
-		error = mii_phy_probe(sc->sc_dev, &sc->sc_miibus,
-		    cas_mediachange, cas_mediastatus);
-	}
-
-	/*
-	 * Try the external PCS SERDES if we didn't find any PHYs.
-	 */
-	if (error != 0) {
+	} else {
+		/*
+		 * Use the external PCS SERDES.
+		 */
 		CAS_WRITE_4(sc, CAS_PCS_DATAPATH, CAS_PCS_DATAPATH_SERDES);
+		CAS_BARRIER(sc, CAS_PCS_DATAPATH, 4, BUS_SPACE_BARRIER_WRITE);
+		/* Enable/unfreeze the SERDES pins of Saturn. */
+		if (sc->sc_variant == CAS_SATURN) {
+			CAS_WRITE_4(sc, CAS_SATURN_PCFG, 0);
+			CAS_BARRIER(sc, CAS_SATURN_PCFG, 4,
+			    BUS_SPACE_BARRIER_WRITE);
+		}
 		CAS_WRITE_4(sc, CAS_PCS_SERDES_CTRL, CAS_PCS_SERDES_CTRL_ESD);
-		CAS_WRITE_4(sc, CAS_PCS_CONF_EN, CAS_PCS_CONF_EN);
-		sc->sc_flags |= CAS_SERDES;
+		CAS_BARRIER(sc, CAS_PCS_SERDES_CTRL, 4,
+		    BUS_SPACE_BARRIER_WRITE);
+		CAS_WRITE_4(sc, CAS_PCS_CONF, CAS_PCS_CONF_EN);
+		CAS_BARRIER(sc, CAS_PCS_CONF, 4,
+		    BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
 		sc->sc_phyad = CAS_PHYAD_EXTERNAL;
 		error = mii_phy_probe(sc->sc_dev, &sc->sc_miibus,
 		    cas_mediachange, cas_mediastatus);
 	}
-
 	if (error != 0) {
 		device_printf(sc->sc_dev, "PHY probe failed: %d\n", error);
 		goto fail_rxmap;
@@ -956,8 +984,9 @@ cas_init_locked(struct cas_softc *sc)
 	    __func__);
 #endif
 
-	/* Re-initialize the MIF. */
-	cas_mifinit(sc);
+	if ((sc->sc_flags & CAS_SERDES) == 0)
+		/* Re-initialize the MIF. */
+		cas_mifinit(sc);
 
 	/* step 3.  Setup data structures in host memory. */
 	cas_meminit(sc);
@@ -2105,6 +2134,8 @@ cas_mifinit(struct cas_softc *sc)
 	/* Configure the MIF in frame mode. */
 	CAS_WRITE_4(sc, CAS_MIF_CONF,
 	    CAS_READ_4(sc, CAS_MIF_CONF) & ~CAS_MIF_CONF_BB_MODE);
+	CAS_BARRIER(sc, CAS_MIF_CONF, 4,
+	    BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
 }
 
 /*
@@ -2219,10 +2250,16 @@ cas_mii_writereg(device_t dev, int phy, 
 			CAS_BARRIER(sc, CAS_PCS_CONF, 4,
 			    BUS_SPACE_BARRIER_WRITE);
 			CAS_WRITE_4(sc, CAS_PCS_ANAR, val);
+			CAS_BARRIER(sc, CAS_PCS_ANAR, 4,
+			    BUS_SPACE_BARRIER_WRITE);
 			CAS_WRITE_4(sc, CAS_PCS_SERDES_CTRL,
 			    CAS_PCS_SERDES_CTRL_ESD);
+			CAS_BARRIER(sc, CAS_PCS_CONF, 4,
+			    BUS_SPACE_BARRIER_WRITE);
 			CAS_WRITE_4(sc, CAS_PCS_CONF,
 			    CAS_PCS_CONF_EN);
+			CAS_BARRIER(sc, CAS_PCS_CONF, 4,
+			    BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
 			return (0);
 		case MII_ANLPAR:
 			reg = CAS_PCS_ANLPAR;
@@ -2233,6 +2270,8 @@ cas_mii_writereg(device_t dev, int phy, 
 			return (0);
 		}
 		CAS_WRITE_4(sc, reg, val);
+		CAS_BARRIER(sc, reg, 4,
+		    BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
 		return (0);
 	}
 
@@ -2630,15 +2669,20 @@ static struct resource_spec cas_pci_res_
 	{ -1, 0 }
 };
 
+#define	CAS_LOCAL_MAC_ADDRESS	"local-mac-address"
+#define	CAS_PHY_INTERFACE	"phy-interface"
+#define	CAS_PHY_TYPE		"phy-type"
+#define	CAS_PHY_TYPE_PCS	"pcs"
+
 static int
 cas_pci_attach(device_t dev)
 {
+	char buf[sizeof(CAS_LOCAL_MAC_ADDRESS)];
 	struct cas_softc *sc;
 	int i;
 #if !(defined(__powerpc__) || defined(__sparc64__))
 	u_char enaddr[4][ETHER_ADDR_LEN];
-	char lma[sizeof("local-mac-address")];
-	int found, j;
+	u_int j, k, lma, pcs[4], phy;
 #endif
 
 	sc = device_get_softc(dev);
@@ -2679,13 +2723,20 @@ cas_pci_attach(device_t dev)
 
 #if defined(__powerpc__) || defined(__sparc64__)
 	OF_getetheraddr(dev, sc->sc_enaddr);
+	if (OF_getprop(ofw_bus_get_node(dev), CAS_PHY_INTERFACE, buf,
+	    sizeof(buf)) > 0 || OF_getprop(ofw_bus_get_node(dev),
+	    CAS_PHY_TYPE, buf, sizeof(buf)) > 0) {
+		buf[sizeof(buf) - 1] = '\0';
+		if (strcmp(buf, CAS_PHY_TYPE_PCS) == 0)
+			sc->sc_flags |= CAS_SERDES;
+	}
 #else
 	/*
-	 * Dig out VPD (vital product data) and read the MAX address.
-	 * The VPD resides in the PCI Expansion ROM (PCI FCode) and
-	 * can't be accessed via the PCI capability pointer.
-	 * SUNW,pci-ce and SUNW,pci-qge use the Enhanced VPD format
-	 * described in US Patent 7149820.
+	 * Dig out VPD (vital product data) and read the MAC address as well
+	 * as the PHY type.  The VPD resides in the PCI Expansion ROM (PCI
+	 * FCode) and can't be accessed via the PCI capability pointer.
+	 * SUNW,pci-ce and SUNW,pci-qge use the Enhanced VPD format described
+	 * in the free US Patent 7149820.
 	 */
 
 #define	PCI_ROMHDR_SIZE			0x1c
@@ -2719,7 +2770,10 @@ cas_pci_attach(device_t dev)
 #define	CAS_ROM_READ_4(sc, offs)					\
 	CAS_READ_4((sc), CAS_PCI_ROM_OFFSET + (offs))
 
-	found = 0;
+	lma = phy = 0;
+	memset(enaddr, 0, sizeof(enaddr));
+	memset(pcs, 0, sizeof(pcs));
+
 	/* Enable PCI Expansion ROM access. */
 	CAS_WRITE_4(sc, CAS_BIM_LDEV_OEN,
 	    CAS_BIM_LDEV_OEN_PAD | CAS_BIM_LDEV_OEN_PROM);
@@ -2768,23 +2822,51 @@ cas_pci_attach(device_t dev)
 			if (CAS_ROM_READ_1(sc, j + PCI_VPD_SIZE) != 'I')
 				/* no instance property */
 				continue;
-			if (CAS_ROM_READ_1(sc, j + PCI_VPD_SIZE + 3) != 'B')
-				/* no byte array */
-				continue;
-			if (CAS_ROM_READ_1(sc, j + PCI_VPD_SIZE + 4) !=
-			    ETHER_ADDR_LEN)
-				continue;
-			bus_read_region_1(sc->sc_res[CAS_RES_MEM],
-			    CAS_PCI_ROM_OFFSET + j + PCI_VPD_SIZE + 5,
-			    lma, sizeof(lma));
-			if (strcmp(lma, "local-mac-address") != 0)
-				continue;
-			bus_read_region_1(sc->sc_res[CAS_RES_MEM],
-			    CAS_PCI_ROM_OFFSET + j + PCI_VPD_SIZE + 5 +
-			    sizeof(lma), enaddr[found],
-			    sizeof(enaddr[found]));
-			if (found++ == 4)
-				break;
+			if (CAS_ROM_READ_1(sc, j + PCI_VPD_SIZE + 3) == 'B') {
+				/* byte array */
+				if (CAS_ROM_READ_1(sc,
+				    j + PCI_VPD_SIZE + 4) != ETHER_ADDR_LEN)
+					continue;
+				bus_read_region_1(sc->sc_res[CAS_RES_MEM],
+				    CAS_PCI_ROM_OFFSET + j + PCI_VPD_SIZE + 5,
+				    buf, sizeof(buf));
+				buf[sizeof(buf) - 1] = '\0';
+				if (strcmp(buf, CAS_LOCAL_MAC_ADDRESS) != 0)
+					continue;
+				bus_read_region_1(sc->sc_res[CAS_RES_MEM],
+				    CAS_PCI_ROM_OFFSET + j + PCI_VPD_SIZE +
+				    5 + sizeof(CAS_LOCAL_MAC_ADDRESS),
+				    enaddr[lma], sizeof(enaddr[lma]));
+				lma++;
+				if (lma == 4 && phy == 4)
+					break;
+			} else if (CAS_ROM_READ_1(sc, j + PCI_VPD_SIZE + 3) ==
+			   'S') {
+				/* string */
+				if (CAS_ROM_READ_1(sc,
+				    j + PCI_VPD_SIZE + 4) !=
+				    sizeof(CAS_PHY_TYPE_PCS))
+					continue;
+				bus_read_region_1(sc->sc_res[CAS_RES_MEM],
+				    CAS_PCI_ROM_OFFSET + j + PCI_VPD_SIZE + 5,
+				    buf, sizeof(buf));
+				buf[sizeof(buf) - 1] = '\0';
+				if (strcmp(buf, CAS_PHY_INTERFACE) == 0)
+					k = sizeof(CAS_PHY_INTERFACE);
+				else if (strcmp(buf, CAS_PHY_TYPE) == 0)
+					k = sizeof(CAS_PHY_TYPE);
+				else
+					continue;
+				bus_read_region_1(sc->sc_res[CAS_RES_MEM],
+				    CAS_PCI_ROM_OFFSET + j + PCI_VPD_SIZE +
+				    5 + k, buf, sizeof(buf));
+				buf[sizeof(buf) - 1] = '\0';
+				if (strcmp(buf, CAS_PHY_TYPE_PCS) == 0)
+					pcs[phy] = 1;
+				phy++;
+				if (lma == 4 && phy == 4)
+					break;
+			}
 		}
 		break;
 	default:
@@ -2795,14 +2877,24 @@ cas_pci_attach(device_t dev)
  fail_prom:
 	CAS_WRITE_4(sc, CAS_BIM_LDEV_OEN, 0);
 
-	if (found == 0) {
+	if (lma == 0) {
 		device_printf(dev, "could not determine Ethernet address\n");
 		goto fail;
 	}
 	i = 0;
-	if (found > 1 && pci_get_slot(dev) < sizeof(enaddr) / sizeof(*enaddr))
+	if (lma > 1 && pci_get_slot(dev) < sizeof(enaddr) / sizeof(*enaddr))
 		i = pci_get_slot(dev);
 	memcpy(sc->sc_enaddr, enaddr[i], ETHER_ADDR_LEN);
+
+	if (phy == 0) {
+		device_printf(dev, "could not determine PHY type\n");
+		goto fail;
+	}
+	i = 0;
+	if (phy > 1 && pci_get_slot(dev) < sizeof(pcs) / sizeof(*pcs))
+		i = pci_get_slot(dev);
+	if (pcs[i] != 0)
+		sc->sc_flags |= CAS_SERDES;
 #endif
 
 	if (cas_attach(sc) != 0) {

Modified: stable/8/sys/dev/cas/if_casreg.h
==============================================================================
--- stable/8/sys/dev/cas/if_casreg.h	Fri May 14 18:00:21 2010	(r208085)
+++ stable/8/sys/dev/cas/if_casreg.h	Fri May 14 19:11:41 2010	(r208086)
@@ -68,6 +68,7 @@
 #define	CAS_STATUS4		0x105c	/* interrupt status 4 for INTD */
 #define	CAS_CLEAR_ALIAS4	0x1060	/* clear mask alias 4 for INTD */
 #define	CAS_STATUS_ALIAS4	0x1064	/* interrupt status alias 4 for INTD */
+#define	CAS_SATURN_PCFG		0x106c	/* internal MACPHY pin configuration */
 
 #define	CAS_CAW_RX_WGHT_MASK	0x00000003	/* RX DMA factor for... */
 #define	CAS_CAW_RX_WGHT_SHFT	0		/* ...weighted round robin */
@@ -171,6 +172,17 @@
 /* INTn enable bit for CAS_INTMASK[2-4] */
 #define	CAS_INTMASKN_EN		0x00000080	/* INT[B-D] enable */
 
+#define	CAS_SATURN_PCFG_TLA	0x00000001	/* PHY activity LED */
+#define	CAS_SATURN_PCFG_FLA	0x00000002	/* PHY 10MBit/sec LED */
+#define	CAS_SATURN_PCFG_CLA	0x00000004	/* PHY 100MBit/sec LED */
+#define	CAS_SATURN_PCFG_LLA	0x00000008	/* PHY 1000MBit/sec LED */
+#define	CAS_SATURN_PCFG_RLA	0x00000010	/* PHY full-duplex LED */
+#define	CAS_SATURN_PCFG_PDS	0x00000020	/* PHY debug mode */
+#define	CAS_SATURN_PCFG_MTP	0x00000080	/* test point select */
+#define	CAS_SATURN_PCFG_GMO	0x00000100	/* GMII observe */
+#define	CAS_SATURN_PCFG_FSI	0x00000200	/* freeze GMII/SERDES */
+#define	CAS_SATURN_PCFG_LAD	0x00000800	/* MAC LED control active low */
+
 /* TX DMA registers */
 #define	CAS_TX_CONF		0x2004	/* TX configuration */
 #define	CAS_TX_FIFO_WR		0x2014	/* FIFO write pointer */
_______________________________________________
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"
Comment 16 dfilter service freebsd_committer freebsd_triage 2010-05-14 20:12:18 UTC
Author: marius
Date: Fri May 14 19:12:01 2010
New Revision: 208087
URL: http://svn.freebsd.org/changeset/base/208087

Log:
  MFC: r207585
  
  - Don't set CAS_PCS_DATAPATH to anything except CAS_PCS_DATAPATH_SERDES
    on Cassini using the external PCS SERDES otherwise unaligned access
    traps and other strange effects happen with some machines. Don't touch
    the MIF which is unused in that case either. These changes require the
    PHY type to use to be determined via the OFW device tree or from the
    VPD in machines without the former.
  - Disable the SERDES pins of Saturn when not used in order to save power
    and ensure they are enabled otherwise.
  - In cas_attach() use the correct register offset for CAS_PCS_CONF_EN.
  - Add some bus space barriers missing in the PCS code path.
  
  These changes make the Sun GigaSwift Ethernet 1.0 MMF cards as well as
  the on-board interfaces found in Sun Fire B100s Blade Server work.
  
  PR:	144867

Modified:
  stable/7/sys/dev/cas/if_cas.c
  stable/7/sys/dev/cas/if_casreg.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/cas/if_cas.c
==============================================================================
--- stable/7/sys/dev/cas/if_cas.c	Fri May 14 19:11:41 2010	(r208086)
+++ stable/7/sys/dev/cas/if_cas.c	Fri May 14 19:12:01 2010	(r208087)
@@ -76,6 +76,7 @@ __FBSDID("$FreeBSD$");
 
 #include <machine/bus.h>
 #if defined(__powerpc__) || defined(__sparc64__)
+#include <dev/ofw/ofw_bus.h>
 #include <dev/ofw/openfirm.h>
 #include <machine/ofw_machdep.h>
 #endif
@@ -321,55 +322,82 @@ cas_attach(struct cas_softc *sc)
 		}
 	}
 
-	CAS_WRITE_4(sc, CAS_PCS_DATAPATH, CAS_PCS_DATAPATH_MII);
-
-	cas_mifinit(sc);
-
-	/*
-	 * Look for an external PHY.
-	 */
-	error = ENXIO;
-	v = CAS_READ_4(sc, CAS_MIF_CONF);
-	if ((v & CAS_MIF_CONF_MDI1) != 0) {
-		v |= CAS_MIF_CONF_PHY_SELECT;
-		CAS_WRITE_4(sc, CAS_MIF_CONF, v);
-		switch (sc->sc_variant) {
-		default:
-			sc->sc_phyad = -1;
-			break;
+	if ((sc->sc_flags & CAS_SERDES) == 0) {
+		CAS_WRITE_4(sc, CAS_PCS_DATAPATH, CAS_PCS_DATAPATH_MII);
+		CAS_BARRIER(sc, CAS_PCS_DATAPATH, 4,
+		    BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
+		cas_mifinit(sc);
+		/*
+		 * Look for an external PHY.
+		 */
+		error = ENXIO;
+		v = CAS_READ_4(sc, CAS_MIF_CONF);
+		if ((v & CAS_MIF_CONF_MDI1) != 0) {
+			v |= CAS_MIF_CONF_PHY_SELECT;
+			CAS_WRITE_4(sc, CAS_MIF_CONF, v);
+			CAS_BARRIER(sc, CAS_MIF_CONF, 4,
+			    BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
+			/* Enable/unfreeze the GMII pins of Saturn. */
+			if (sc->sc_variant == CAS_SATURN) {
+				CAS_WRITE_4(sc, CAS_SATURN_PCFG, 0);
+				CAS_BARRIER(sc, CAS_SATURN_PCFG, 4,
+				    BUS_SPACE_BARRIER_READ |
+				    BUS_SPACE_BARRIER_WRITE);
+			}
+			switch (sc->sc_variant) {
+			default:
+				sc->sc_phyad = -1;
+				break;
+			}
+			error = mii_phy_probe(sc->sc_dev, &sc->sc_miibus,
+			    cas_mediachange, cas_mediastatus);
 		}
-		error = mii_phy_probe(sc->sc_dev, &sc->sc_miibus,
-		    cas_mediachange, cas_mediastatus);
-	}
-
-	/*
-	 * Fall back on an internal PHY if no external PHY was found.
-	 */
-	if (error != 0 && (v & CAS_MIF_CONF_MDI0) != 0) {
-		v &= ~CAS_MIF_CONF_PHY_SELECT;
-		CAS_WRITE_4(sc, CAS_MIF_CONF, v);
-		switch (sc->sc_variant) {
-		default:
-			sc->sc_phyad = -1;
-			break;
+		/*
+		 * Fall back on an internal PHY if no external PHY was found.
+		 */
+		if (error != 0 && (v & CAS_MIF_CONF_MDI0) != 0) {
+			v &= ~CAS_MIF_CONF_PHY_SELECT;
+			CAS_WRITE_4(sc, CAS_MIF_CONF, v);
+			CAS_BARRIER(sc, CAS_MIF_CONF, 4,
+			    BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
+			/* Freeze the GMII pins of Saturn for saving power. */
+			if (sc->sc_variant == CAS_SATURN) {
+				CAS_WRITE_4(sc, CAS_SATURN_PCFG,
+				    CAS_SATURN_PCFG_FSI);
+				CAS_BARRIER(sc, CAS_SATURN_PCFG, 4,
+				    BUS_SPACE_BARRIER_READ |
+				    BUS_SPACE_BARRIER_WRITE);
+			}
+			switch (sc->sc_variant) {
+			default:
+				sc->sc_phyad = -1;
+				break;
+			}
+			error = mii_phy_probe(sc->sc_dev, &sc->sc_miibus,
+			    cas_mediachange, cas_mediastatus);
 		}
-		error = mii_phy_probe(sc->sc_dev, &sc->sc_miibus,
-		    cas_mediachange, cas_mediastatus);
-	}
-
-	/*
-	 * Try the external PCS SERDES if we didn't find any PHYs.
-	 */
-	if (error != 0) {
+	} else {
+		/*
+		 * Use the external PCS SERDES.
+		 */
 		CAS_WRITE_4(sc, CAS_PCS_DATAPATH, CAS_PCS_DATAPATH_SERDES);
+		CAS_BARRIER(sc, CAS_PCS_DATAPATH, 4, BUS_SPACE_BARRIER_WRITE);
+		/* Enable/unfreeze the SERDES pins of Saturn. */
+		if (sc->sc_variant == CAS_SATURN) {
+			CAS_WRITE_4(sc, CAS_SATURN_PCFG, 0);
+			CAS_BARRIER(sc, CAS_SATURN_PCFG, 4,
+			    BUS_SPACE_BARRIER_WRITE);
+		}
 		CAS_WRITE_4(sc, CAS_PCS_SERDES_CTRL, CAS_PCS_SERDES_CTRL_ESD);
-		CAS_WRITE_4(sc, CAS_PCS_CONF_EN, CAS_PCS_CONF_EN);
-		sc->sc_flags |= CAS_SERDES;
+		CAS_BARRIER(sc, CAS_PCS_SERDES_CTRL, 4,
+		    BUS_SPACE_BARRIER_WRITE);
+		CAS_WRITE_4(sc, CAS_PCS_CONF, CAS_PCS_CONF_EN);
+		CAS_BARRIER(sc, CAS_PCS_CONF, 4,
+		    BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
 		sc->sc_phyad = CAS_PHYAD_EXTERNAL;
 		error = mii_phy_probe(sc->sc_dev, &sc->sc_miibus,
 		    cas_mediachange, cas_mediastatus);
 	}
-
 	if (error != 0) {
 		device_printf(sc->sc_dev, "PHY probe failed: %d\n", error);
 		goto fail_rxmap;
@@ -956,8 +984,9 @@ cas_init_locked(struct cas_softc *sc)
 	    __func__);
 #endif
 
-	/* Re-initialize the MIF. */
-	cas_mifinit(sc);
+	if ((sc->sc_flags & CAS_SERDES) == 0)
+		/* Re-initialize the MIF. */
+		cas_mifinit(sc);
 
 	/* step 3.  Setup data structures in host memory. */
 	cas_meminit(sc);
@@ -2105,6 +2134,8 @@ cas_mifinit(struct cas_softc *sc)
 	/* Configure the MIF in frame mode. */
 	CAS_WRITE_4(sc, CAS_MIF_CONF,
 	    CAS_READ_4(sc, CAS_MIF_CONF) & ~CAS_MIF_CONF_BB_MODE);
+	CAS_BARRIER(sc, CAS_MIF_CONF, 4,
+	    BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
 }
 
 /*
@@ -2219,10 +2250,16 @@ cas_mii_writereg(device_t dev, int phy, 
 			CAS_BARRIER(sc, CAS_PCS_CONF, 4,
 			    BUS_SPACE_BARRIER_WRITE);
 			CAS_WRITE_4(sc, CAS_PCS_ANAR, val);
+			CAS_BARRIER(sc, CAS_PCS_ANAR, 4,
+			    BUS_SPACE_BARRIER_WRITE);
 			CAS_WRITE_4(sc, CAS_PCS_SERDES_CTRL,
 			    CAS_PCS_SERDES_CTRL_ESD);
+			CAS_BARRIER(sc, CAS_PCS_CONF, 4,
+			    BUS_SPACE_BARRIER_WRITE);
 			CAS_WRITE_4(sc, CAS_PCS_CONF,
 			    CAS_PCS_CONF_EN);
+			CAS_BARRIER(sc, CAS_PCS_CONF, 4,
+			    BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
 			return (0);
 		case MII_ANLPAR:
 			reg = CAS_PCS_ANLPAR;
@@ -2233,6 +2270,8 @@ cas_mii_writereg(device_t dev, int phy, 
 			return (0);
 		}
 		CAS_WRITE_4(sc, reg, val);
+		CAS_BARRIER(sc, reg, 4,
+		    BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
 		return (0);
 	}
 
@@ -2630,15 +2669,20 @@ static struct resource_spec cas_pci_res_
 	{ -1, 0 }
 };
 
+#define	CAS_LOCAL_MAC_ADDRESS	"local-mac-address"
+#define	CAS_PHY_INTERFACE	"phy-interface"
+#define	CAS_PHY_TYPE		"phy-type"
+#define	CAS_PHY_TYPE_PCS	"pcs"
+
 static int
 cas_pci_attach(device_t dev)
 {
+	char buf[sizeof(CAS_LOCAL_MAC_ADDRESS)];
 	struct cas_softc *sc;
 	int i;
 #if !(defined(__powerpc__) || defined(__sparc64__))
 	u_char enaddr[4][ETHER_ADDR_LEN];
-	char lma[sizeof("local-mac-address")];
-	int found, j;
+	u_int j, k, lma, pcs[4], phy;
 #endif
 
 	sc = device_get_softc(dev);
@@ -2679,13 +2723,20 @@ cas_pci_attach(device_t dev)
 
 #if defined(__powerpc__) || defined(__sparc64__)
 	OF_getetheraddr(dev, sc->sc_enaddr);
+	if (OF_getprop(ofw_bus_get_node(dev), CAS_PHY_INTERFACE, buf,
+	    sizeof(buf)) > 0 || OF_getprop(ofw_bus_get_node(dev),
+	    CAS_PHY_TYPE, buf, sizeof(buf)) > 0) {
+		buf[sizeof(buf) - 1] = '\0';
+		if (strcmp(buf, CAS_PHY_TYPE_PCS) == 0)
+			sc->sc_flags |= CAS_SERDES;
+	}
 #else
 	/*
-	 * Dig out VPD (vital product data) and read the MAX address.
-	 * The VPD resides in the PCI Expansion ROM (PCI FCode) and
-	 * can't be accessed via the PCI capability pointer.
-	 * SUNW,pci-ce and SUNW,pci-qge use the Enhanced VPD format
-	 * described in US Patent 7149820.
+	 * Dig out VPD (vital product data) and read the MAC address as well
+	 * as the PHY type.  The VPD resides in the PCI Expansion ROM (PCI
+	 * FCode) and can't be accessed via the PCI capability pointer.
+	 * SUNW,pci-ce and SUNW,pci-qge use the Enhanced VPD format described
+	 * in the free US Patent 7149820.
 	 */
 
 #define	PCI_ROMHDR_SIZE			0x1c
@@ -2719,7 +2770,10 @@ cas_pci_attach(device_t dev)
 #define	CAS_ROM_READ_4(sc, offs)					\
 	CAS_READ_4((sc), CAS_PCI_ROM_OFFSET + (offs))
 
-	found = 0;
+	lma = phy = 0;
+	memset(enaddr, 0, sizeof(enaddr));
+	memset(pcs, 0, sizeof(pcs));
+
 	/* Enable PCI Expansion ROM access. */
 	CAS_WRITE_4(sc, CAS_BIM_LDEV_OEN,
 	    CAS_BIM_LDEV_OEN_PAD | CAS_BIM_LDEV_OEN_PROM);
@@ -2768,23 +2822,51 @@ cas_pci_attach(device_t dev)
 			if (CAS_ROM_READ_1(sc, j + PCI_VPD_SIZE) != 'I')
 				/* no instance property */
 				continue;
-			if (CAS_ROM_READ_1(sc, j + PCI_VPD_SIZE + 3) != 'B')
-				/* no byte array */
-				continue;
-			if (CAS_ROM_READ_1(sc, j + PCI_VPD_SIZE + 4) !=
-			    ETHER_ADDR_LEN)
-				continue;
-			bus_read_region_1(sc->sc_res[CAS_RES_MEM],
-			    CAS_PCI_ROM_OFFSET + j + PCI_VPD_SIZE + 5,
-			    lma, sizeof(lma));
-			if (strcmp(lma, "local-mac-address") != 0)
-				continue;
-			bus_read_region_1(sc->sc_res[CAS_RES_MEM],
-			    CAS_PCI_ROM_OFFSET + j + PCI_VPD_SIZE + 5 +
-			    sizeof(lma), enaddr[found],
-			    sizeof(enaddr[found]));
-			if (found++ == 4)
-				break;
+			if (CAS_ROM_READ_1(sc, j + PCI_VPD_SIZE + 3) == 'B') {
+				/* byte array */
+				if (CAS_ROM_READ_1(sc,
+				    j + PCI_VPD_SIZE + 4) != ETHER_ADDR_LEN)
+					continue;
+				bus_read_region_1(sc->sc_res[CAS_RES_MEM],
+				    CAS_PCI_ROM_OFFSET + j + PCI_VPD_SIZE + 5,
+				    buf, sizeof(buf));
+				buf[sizeof(buf) - 1] = '\0';
+				if (strcmp(buf, CAS_LOCAL_MAC_ADDRESS) != 0)
+					continue;
+				bus_read_region_1(sc->sc_res[CAS_RES_MEM],
+				    CAS_PCI_ROM_OFFSET + j + PCI_VPD_SIZE +
+				    5 + sizeof(CAS_LOCAL_MAC_ADDRESS),
+				    enaddr[lma], sizeof(enaddr[lma]));
+				lma++;
+				if (lma == 4 && phy == 4)
+					break;
+			} else if (CAS_ROM_READ_1(sc, j + PCI_VPD_SIZE + 3) ==
+			   'S') {
+				/* string */
+				if (CAS_ROM_READ_1(sc,
+				    j + PCI_VPD_SIZE + 4) !=
+				    sizeof(CAS_PHY_TYPE_PCS))
+					continue;
+				bus_read_region_1(sc->sc_res[CAS_RES_MEM],
+				    CAS_PCI_ROM_OFFSET + j + PCI_VPD_SIZE + 5,
+				    buf, sizeof(buf));
+				buf[sizeof(buf) - 1] = '\0';
+				if (strcmp(buf, CAS_PHY_INTERFACE) == 0)
+					k = sizeof(CAS_PHY_INTERFACE);
+				else if (strcmp(buf, CAS_PHY_TYPE) == 0)
+					k = sizeof(CAS_PHY_TYPE);
+				else
+					continue;
+				bus_read_region_1(sc->sc_res[CAS_RES_MEM],
+				    CAS_PCI_ROM_OFFSET + j + PCI_VPD_SIZE +
+				    5 + k, buf, sizeof(buf));
+				buf[sizeof(buf) - 1] = '\0';
+				if (strcmp(buf, CAS_PHY_TYPE_PCS) == 0)
+					pcs[phy] = 1;
+				phy++;
+				if (lma == 4 && phy == 4)
+					break;
+			}
 		}
 		break;
 	default:
@@ -2795,14 +2877,24 @@ cas_pci_attach(device_t dev)
  fail_prom:
 	CAS_WRITE_4(sc, CAS_BIM_LDEV_OEN, 0);
 
-	if (found == 0) {
+	if (lma == 0) {
 		device_printf(dev, "could not determine Ethernet address\n");
 		goto fail;
 	}
 	i = 0;
-	if (found > 1 && pci_get_slot(dev) < sizeof(enaddr) / sizeof(*enaddr))
+	if (lma > 1 && pci_get_slot(dev) < sizeof(enaddr) / sizeof(*enaddr))
 		i = pci_get_slot(dev);
 	memcpy(sc->sc_enaddr, enaddr[i], ETHER_ADDR_LEN);
+
+	if (phy == 0) {
+		device_printf(dev, "could not determine PHY type\n");
+		goto fail;
+	}
+	i = 0;
+	if (phy > 1 && pci_get_slot(dev) < sizeof(pcs) / sizeof(*pcs))
+		i = pci_get_slot(dev);
+	if (pcs[i] != 0)
+		sc->sc_flags |= CAS_SERDES;
 #endif
 
 	if (cas_attach(sc) != 0) {

Modified: stable/7/sys/dev/cas/if_casreg.h
==============================================================================
--- stable/7/sys/dev/cas/if_casreg.h	Fri May 14 19:11:41 2010	(r208086)
+++ stable/7/sys/dev/cas/if_casreg.h	Fri May 14 19:12:01 2010	(r208087)
@@ -68,6 +68,7 @@
 #define	CAS_STATUS4		0x105c	/* interrupt status 4 for INTD */
 #define	CAS_CLEAR_ALIAS4	0x1060	/* clear mask alias 4 for INTD */
 #define	CAS_STATUS_ALIAS4	0x1064	/* interrupt status alias 4 for INTD */
+#define	CAS_SATURN_PCFG		0x106c	/* internal MACPHY pin configuration */
 
 #define	CAS_CAW_RX_WGHT_MASK	0x00000003	/* RX DMA factor for... */
 #define	CAS_CAW_RX_WGHT_SHFT	0		/* ...weighted round robin */
@@ -171,6 +172,17 @@
 /* INTn enable bit for CAS_INTMASK[2-4] */
 #define	CAS_INTMASKN_EN		0x00000080	/* INT[B-D] enable */
 
+#define	CAS_SATURN_PCFG_TLA	0x00000001	/* PHY activity LED */
+#define	CAS_SATURN_PCFG_FLA	0x00000002	/* PHY 10MBit/sec LED */
+#define	CAS_SATURN_PCFG_CLA	0x00000004	/* PHY 100MBit/sec LED */
+#define	CAS_SATURN_PCFG_LLA	0x00000008	/* PHY 1000MBit/sec LED */
+#define	CAS_SATURN_PCFG_RLA	0x00000010	/* PHY full-duplex LED */
+#define	CAS_SATURN_PCFG_PDS	0x00000020	/* PHY debug mode */
+#define	CAS_SATURN_PCFG_MTP	0x00000080	/* test point select */
+#define	CAS_SATURN_PCFG_GMO	0x00000100	/* GMII observe */
+#define	CAS_SATURN_PCFG_FSI	0x00000200	/* freeze GMII/SERDES */
+#define	CAS_SATURN_PCFG_LAD	0x00000800	/* MAC LED control active low */
+
 /* TX DMA registers */
 #define	CAS_TX_CONF		0x2004	/* TX configuration */
 #define	CAS_TX_FIFO_WR		0x2014	/* FIFO write pointer */
_______________________________________________
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"
Comment 17 Marius Strobl freebsd_committer freebsd_triage 2010-05-14 20:42:44 UTC
State Changed
From-To: open->closed

close