On 4 January 2013 11:24, Monthadar Al Jaberi <montha...@gmail.com> wrote:
> On Fri, Jan 4, 2013 at 8:13 PM, Adrian Chadd <adr...@freebsd.org> wrote:
>> Ok. The magic you need to try hacking is in ar71xx_pci.c. There's the
>> 7 PCI windows and the 3 interrupt lines that are configured.
>> The IRQ only gets unmasked when a slot claims it as a resource. So
>> you'll have to fiddle with that mapping a little.
>> Look at ar71xx_pci_route_interrupt().  Maybe set it up so
>> AR71XX_PCI_BASE_SLOT is 18 instead of 17?
> Works!!! :D

Hah! Nice!

> The slot is not the issue I think. The code seems to iterate through a
> couple, and when one fails it just checks the other. What it seems is
> wrong is that the interrupts are mapped wrong.
> Linux assigned IRQ 0 to slot 18, while FreeBSD assignes IRQ 1. We need
> a mapping just like openwrt. Code re-write? :D
> We need this: Slot 18 IRQ 0, Slot 19 IRQ 1, Slot 20 IRQ 2
> I don't know really what "slots" are physcially. Does the PCI bridge
> have many slots (ports)?

It's .. slightly more screwed up than that. Well, kind of.

You need to read up on a PCI bus primer to understand how it works.
Remember, the hardware design tries to minimise the amount of custom
hardware logic that you need - so the whole notion of PCI "slots" here
is really just a set of bits in the upper part of the 32 bit physical
address space.

The interrupt lines are fixed - there's what, three of them that come
and get wired to individual physical slots. I think we only get one
wired to INTA on each physical slot.

So yes, it depends upon how they've wired up the board. It sounds like
mikroik wired "slot 18" (which is just a specific combination of high
address pins) to INT0, "slot 19" to INT1, "slot 20" to INT2. Whereas
the PB42 and Ubiquiti hardware wires it starting at "slot 17".

Look at ar71xx_pci_make_addr() to see what the slot/func/bus/etc
mapping to physical 32 bit address is.

Note there's also a PCI window register set that maps the 32 bit
physical addresses for each PCI slot to a KSEG space address that MIPS
code can get at.

So now that we've figured that out, please create a PR with the
description of the problem and the solution, and we'll have to figure
out the "right" way to teach the PCI glue code about this.
Chances are we can just create a PCI bus hint that defaults to "17"
that says where the slots start at. Then for the Mikrotik board we can
start it at 18.

freebsd-wireless@freebsd.org mailing list
To unsubscribe, send any mail to "freebsd-wireless-unsubscr...@freebsd.org"

Reply via email to