linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Andrew Klossner <andrew@cesa.opbu.xerox.com>
Cc: linuxppc-dev@ozlabs.org
Subject: Re: [PATCH] Restore PCI IO space behind Freescale pseudo-bridge
Date: Thu, 15 Jan 2009 07:37:34 +1100	[thread overview]
Message-ID: <1231965454.22571.103.camel@pasglop> (raw)
In-Reply-To: <200901141948.n0EJmXH3002897@pogo.cesa.opbu.xerox.com>

On Wed, 2009-01-14 at 11:48 -0800, Andrew Klossner wrote:
> When I moved from 2.6.27 to 2.6.28, one of my devices didn't work
> until I devised the attached patch.  The kernel disallowed PCI I/O
> space resources behind the pseudo-bridge in the Freescale MPC8545
> because that bridge's config-space registers incorrectly report that
> it doesn't forward I/O space transactions.
> 
> Checking for a specific vendor ID is hacky, but it got my system going
> again with only a few perturbed lines.  Is there a more correct way to
> achieve this?

A few things yes.

First, can't you just set the PCI_COMMAND_IO bit from a quirk or at init
time rather than adding to code to cope with it being cleared later on ?

Also, the fact that it's detected as uninitialized shouldn't have broken
access to your device. If there is need for some IO space, for example
because a device requests some, the kernel should have re-opened that
window of the bridge.

Thus if that failed, it would be useful to track it down a bit more. You
can try enabling DEBUG in pci-common.c and pci-64.c, boot with "debug"
on the kernel command line and and send the resulting dmesg log

Ben.

> diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
> index f36936d..f9f0048 100644
> --- a/arch/powerpc/kernel/pci-common.c
> +++ b/arch/powerpc/kernel/pci-common.c
> @@ -985,6 +985,7 @@ static int __devinit pcibios_uninitialized_bridge_resource(struct pci_bus *bus,
>  	struct pci_dev *dev = bus->self;
>  	resource_size_t offset;
>  	u16 command;
> +	u16 vendor;
>  	int i;
>  
>  	/* We don't do anything if PCI_PROBE_ONLY is set */
> @@ -1030,7 +1031,16 @@ static int __devinit pcibios_uninitialized_bridge_resource(struct pci_bus *bus,
>  		 * starting at low addresses -is- valid. What we do instead if that
>  		 * we consider as unassigned anything that doesn't have IO enabled
>  		 * in the PCI command register, and that's it.
> +		 * However, we don't do that if the bridge is internal to a Freescale
> +		 * CPU, as such bridges break the rules by, for example, not populating
> +		 * the PCI_COMMAND_IO bit.
>  		 */
> +		pci_read_config_word(dev, PCI_VENDOR_ID, &vendor);
> +		if (vendor == PCI_VENDOR_ID_MOTOROLA ||
> +		    vendor == PCI_VENDOR_ID_FREESCALE) {
> +			return 0;
> +		}
> +
>  		pci_read_config_word(dev, PCI_COMMAND, &command);
>  		if (command & PCI_COMMAND_IO)
>  			return 0;
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev

  reply	other threads:[~2009-01-14 20:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-14 19:48 [PATCH] Restore PCI IO space behind Freescale pseudo-bridge Andrew Klossner
2009-01-14 20:37 ` Benjamin Herrenschmidt [this message]
     [not found] <200901271813.n0RIDBHq023872@pogo.cesa.opbu.xerox.com>
2009-01-28  5:37 ` Kumar Gala
2009-01-28  9:31   ` Benjamin Herrenschmidt
2009-01-28 15:59     ` Kumar Gala

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=1231965454.22571.103.camel@pasglop \
    --to=benh@kernel.crashing.org \
    --cc=andrew@cesa.opbu.xerox.com \
    --cc=linuxppc-dev@ozlabs.org \
    /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).