Bug 25192 - PCI doesn't work on BCM91250A MIPS board
Summary: PCI doesn't work on BCM91250A MIPS board
Status: RESOLVED WILL_NOT_FIX
Alias: None
Product: SCSI Drivers
Classification: Unclassified
Component: Other (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: scsi_drivers-other
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-12-18 23:56 UTC by Matt Turner
Modified: 2012-05-04 00:07 UTC (History)
2 users (show)

See Also:
Kernel Version: 2.6.37
Subsystem:
Regression: No
Bisected commit-id:


Attachments
3ware-8006: lspci, dmesg, /proc/io{mem,ports} (3.00 KB, text/plain)
2010-12-18 23:56 UTC, Matt Turner
Details
3ware-9500s: lspci, dmesg, /proc/io{mem,ports} (712 bytes, text/plain)
2010-12-18 23:57 UTC, Matt Turner
Details
3ware-9500s: lspci, dmesg, /proc/io{mem,ports} (6.92 KB, text/plain)
2010-12-19 02:34 UTC, Matt Turner
Details
9500s debugging (4.81 KB, text/plain)
2010-12-19 21:30 UTC, Matt Turner
Details
9500S debugging - 1GB RAM (1017 bytes, text/plain)
2011-06-05 05:19 UTC, Matt Turner
Details

Description Matt Turner 2010-12-18 23:56:27 UTC
Created attachment 40762 [details]
3ware-8006: lspci, dmesg, /proc/io{mem,ports}

Using the linux-mips tree,

commit 1c334766ddc8ae7b12f3a12e0d06fe3895c5a5a7
Author: Ralf Baechle <ralf@linux-mips.org>
Date:   Wed Dec 1 17:33:17 2010 +0000

I've been trying to use either a 3ware 8006 (3w-xxxx driver) or 3ware 9500s (3w-9xxx driver) in my Broadcom BCM91250a big-endian MIPS system.

I see commits 75913d9bb8328c4eca54cad39a5fb665b48383eb which added big-endian support.

Please tell me what I can do to help debug this.
Comment 1 Matt Turner 2010-12-18 23:57:01 UTC
Created attachment 40772 [details]
3ware-9500s: lspci, dmesg, /proc/io{mem,ports}
Comment 2 Adam Radford 2010-12-19 01:47:31 UTC
The byte swap macros were never added to 3w-xxxx.  

Can you re-post 3w-9xxx lspci,dmesg, /proc/io{mem,port} attachment? 

The attachment doesn't actually contain what you reported it to.

-Adam
Comment 3 Matt Turner 2010-12-19 02:34:28 UTC
Created attachment 40782 [details]
3ware-9500s: lspci, dmesg, /proc/io{mem,ports}

Whoops. Sorry about that. Reattached.
Comment 4 Adam Radford 2010-12-19 06:54:48 UTC
Matt,

What slot do you have the card in, 32-bit or 64-bit?  Can you try the other
size slot?  I.E. 32->64 or 64->32.

This driver and card is known to work on ppc32 Linux and ppc64 Linux.  I did the big-endian driver changes and tested on my Apple G3 (32-bit) and G5 (64-bit).

Are you local to Silicon Valley?

-Adam
Comment 5 Matt Turner 2010-12-19 07:02:43 UTC
(In reply to comment #4)
> What slot do you have the card in, 32-bit or 64-bit?  Can you try the other
> size slot?  I.E. 32->64 or 64->32.

It's in a 64-bit slot, and the edge of the 32-bit slots is too thick for the card to fit, so no-can-do.

> Are you local to Silicon Valley?

No. :(

I'll cover twa_probe() with printks and report back tomorrow.
Comment 6 Adam Radford 2010-12-19 17:49:10 UTC
No need to add prints to twa_probe().  

In twa_poll_response(), just add this printk() and report the results:

response_queue.value = readl(TW_RESPONSE_QUEUE_REG_ADDR(tw_dev));

printk(KERN_WARNING "3w-9xxx: response_queue.value = 0x%x, request_id = 0x%x\n", response_queue.value, request_id);

response_request_id = TW_RESID_OUT(response_queue.response_id);
if (request_id != response_request_id) {
        TW_PRINTK(tw_dev->host, TW_DRIVER, 0x1e, "Found unexpected request id while polling for response");
        goto out;
}

We call twa_empty_response_queue() before this to junk garbage responses in the reigsters on power-up, so if we don't see anything even remotely close to the correct response in response_queue.value, that will tell us a lot.

-Adam
Comment 7 ralf 2010-12-19 18:04:31 UTC
64-bit PCI slots on the Sibyte evaluation boards are implemented using a Hypertransport-to-PCI bridge.  Hypertransport however uses a separate port address space from the native 32-bit PCI slots that port x on 32-bit PCI is different from port x on the Hypertransport.  Memory mapped I/O is not affected by the issue.

The in/out functions don't know which of the busses / port address spaces they're operating on so they're always using the first bus that is the 32-bit PCI bus.  Note that the new style API with iomap() / ioreadX() / iowriteX() is not affected by this problem.

Would that explain the bug?
Comment 8 Adam Radford 2010-12-19 19:16:23 UTC
Ralf,

The 3w-9xxx driver is currently calling ioremap(), then using readl()/writel()
calls for memory mapped I/O.  

Are you suggesting we need to call iomap() and ioread32/iowrite32() for MIPS to work?

-Adam
Comment 9 ralf 2010-12-19 20:41:10 UTC
No.

The issue I mentioned only exists for ioports, those little critters accessed with inX / outX instructions on x86.  readl / writel etc. are working ok afair.

And again it's only this multi-bus scenario that is affected.

  Ralf
Comment 10 Matt Turner 2010-12-19 21:30:30 UTC
Created attachment 40932 [details]
9500s debugging

Doesn't look bizarre to me.
Comment 11 Matt Turner 2010-12-20 03:42:51 UTC
I tried in booting the system in little-endian mode, and it crashes in the same way. The added printk statements print exactly what they print when in big-endian mode.
Comment 12 Adam Radford 2010-12-20 17:05:52 UTC
Matt,

You can prevent the crash from happening by commenting out or removing this line:
        
printk(KERN_WARNING "3w-9xxx: scsi%d: Firmware %s, BIOS %s, Ports: %d.\n",
        host->host_no,
        (char *)twa_get_param(tw_dev, 0, TW_VERSION_TABLE,
        TW_PARAM_FWVER, TW_PARAM_FWVER_LENGTH),
        (char *)twa_get_param(tw_dev, 1, TW_VERSION_TABLE,
        TW_PARAM_BIOSVER, TW_PARAM_BIOSVER_LENGTH),
        le32_to_cpu(*(int *)twa_get_param(tw_dev, 2, TW_INFORMATION_TABLE,
        TW_PARAM_PORTCOUNT, TW_PARAM_PORTCOUNT_LENGTH)));

I was a little over-zealous in assuming the controller would be responding here, or you would have already hung the system in POST.

At this point, since your card won't work in little-endian mode, I am guessing:

1. Your card is bad, which you could test by trying another 9500-S card.
2. The PCI slot you are trying is somehow incompatible with the 3ware hardware.

-Adam
Comment 13 Matt Turner 2010-12-22 19:27:47 UTC
I've confirmed that the card works in an AMD64 system (with a few unknown opcode messages in dmesg, but I suppose that's nothing particularly strange).

Ralf, do you have any ideas about why it wouldn't work with this board?
Comment 14 Matt Turner 2011-03-03 19:48:59 UTC
http://www.cyrius.com/debian/bcm91250a/hardware.html lists hardware that is confirmed working with the bcm91250a.

When I received it, it had installed a Silicon Image card, which I've confirmed doesn't work, much in the same way everything else doesn't work with recent kernels. I can only imagine that it used to work, since it was installed.

At the time, I think the system had 2.6.18 on it, so I guess I'll confirm that .18 works and then try to bisect.
Comment 15 Matt Turner 2011-06-05 05:19:48 UTC
Created attachment 60822 [details]
9500S debugging - 1GB RAM

Adam,

This board has a strange memory layout, which screws with PCI cards if you have more than 1GB of RAM, so the attached file is the debugging statement you requested with only 1GB of RAM installed (I had 2GB installed before). (In big-endian mode this time)

As you can see, there's no catastrophic null pointer dereference. Perhaps this is useful? Let me know, thanks.
Comment 16 Matt Turner 2011-06-05 05:24:44 UTC
I should have added that with 1GB of RAM, a 32-bit sata_sil card, 32-bit aic7xxx scsi card, and a 64-bit tg3 ethernet card work. With 2GB RAM, only the 64-bit tg3 ethernet card works.

The 3Ware 9500S is the only card I've tried that's failed with 1GB of RAM.
Comment 17 Matt Turner 2012-05-04 00:07:27 UTC
I gave up on the 3Ware 9500S and got a 64-bit PCI silicon image SATA controller that works fine.

Note You need to log in before you can comment on or make changes to this bug.