9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: David Gordon Hogan <dhog@plan9.bell-labs.com>
To: 9fans@cse.psu.edu
Subject: Re: [9fans] IRQs again...
Date: Fri, 24 May 2002 17:23:53 -0400	[thread overview]
Message-ID: <03e8c204a490c3bc0602f3e1e113b22e@plan9.bell-labs.com> (raw)

> Then the code tries to set the IRQs according to the pci routing
> table, and that's where the problems start.  The ali_get() routine
> seems to be very similar to the one linux uses, with several
> exceptions you can see below:
>
> 	plan9:ali_get():
> 		pirq = pcicfgr8(router, 0x48 + ((link-1)>>1));
> 		return (link & 1)? map[pirq&15]: map[pirq>>4];
>
> 	linux:pirq_ali_get():
>  	       return irqmap[read_config_nybble(router, 0x48, pirq-1)];
>
> I'm not sure what warrants these changes in plan9, but as an effect
> ali_get() returns '0' as the interrupt for all pci devices it is
> executed for.

The code fragments are equivalent.  read_config_nybble() is something
the Linux code defines to avoid duplicating all that nasty shifting and anding.

ali_get() is returning 0 on Plan 9 because that's what the southbridge
has in it.  As you are running without any BIOS, the IRQ routing in
the south bridge hasn't been set up.  We do not handle this situation
at present, we assume that the BIOS has allocated IRQs to the various
devices.  We only attempt to repair inconsistent IRQs, not allocate
them ourselves.

> The significant difference was that according to this specification
> the IRQs are to be obtained from the last two bytes of the info
> structure (pciinfo is the name linux and bsd use for it).  The first
> byte is passed as 'link' to ali_get() in the plan9 code (m[0] is the
> variable), however m[1] and m[2] form another 16 bit variable, having
> 1 in the place of each IRQ which is routable on the board (1eb8 for
> our test motherboard).  Going through the bits in search for ones
> gives us the interrupts we can use.

We should probably be checking those masks, at least as a sanity check.

> We're not particularly sure this is the proper way of doing things
> (both linux and freebsd seem to be doing it at one stage or another of
> the pci routing code, but...).

I've looked at the Linux code.  They actually use a heuristic to allocate
IRQs, giving preference to ones that are unlikely to be used by something
else.  Frankly, I'm scared to go there!  All of our machines have a BIOS,
and it has not been necessary for us to do our own IRQ allocation.  But
is this good enough?



             reply	other threads:[~2002-05-24 21:23 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-05-24 21:23 David Gordon Hogan [this message]
2002-05-25  2:26 ` Ronald G Minnich
  -- strict thread matches above, loose matches on Subject: below --
2002-05-28  4:56 David Gordon Hogan
2002-05-28 14:17 ` Ronald G Minnich
2002-05-27 16:20 David Gordon Hogan
2002-05-27 18:55 ` Ronald G Minnich
2002-05-27 14:53 andrey mirtchovski
2002-05-27 14:22 andrey mirtchovski
2002-05-27  4:23 jmk
2002-05-27 18:41 ` Ronald G Minnich
2002-05-21 16:45 andrey mirtchovski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=03e8c204a490c3bc0602f3e1e113b22e@plan9.bell-labs.com \
    --to=dhog@plan9.bell-labs.com \
    --cc=9fans@cse.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).