All of lore.kernel.org
 help / color / mirror / Atom feed
From: "tiejun.chen" <tiejun.chen@windriver.com>
To: Ravi Gupta <dceravigupta@gmail.com>
Cc: linuxppc-dev@lists.ozlabs.org
Subject: Re: pci_request_regions() failure
Date: Fri, 10 Sep 2010 13:23:21 +0800	[thread overview]
Message-ID: <4C89C0C9.6090007@windriver.com> (raw)
In-Reply-To: <AANLkTik1gWKO6vif+HgtM-j_5EUMJGwKRf+saRgK4TZg@mail.gmail.com>

Ravi Gupta wrote:
> Hi Tiejun,
> 
> Thanks for the reply.
> 
> Omm.
>> Often we always disable this pref windows so please disable this window.
>> Try use
>> the following ways to clear PCI_PREF_MEMORY_BASE and PCI_PREF_MEMORY_LIMIT.
>> ------
>>        pci_write_config_word(dev, PCI_PREF_MEMORY_BASE, 0);
>>        pci_write_config_word(dev, PCI_PREF_MEMORY_LIMIT, 0);
>>
>>
> I have a little confusion about what you said. You said I should disable
> prefetched window corresponds to PCI Bridge to [bus 02-ff], the dmesgs shows
> that it is already disabled.
> 
> pci 0001:01:00.0: PCI bridge to [bus 02-ff]
> pci 0001:01:00.0:   bridge window [io  0x0000-0x0000] (disabled)
> pci 0001:01:00.0:   bridge window [mem 0x00000000-0x000fffff] (disabled)
> *pci 0001:01:00.0:   bridge window [mem 0x00000000-0x000fffff pref]
> (disabled)*

Sorry I miss this line.

> 
> Is it something that I am not getting right or you have miss read something?
> If it is problem with me, then what should be the O/P in case when I disable
> the prefetch window (by issuing pci_write_config_word(dev,
> PCI_PREF_MEMORY_BASE, 0); and pci_write_config_word(dev,
> PCI_PREF_MEMORY_LIMIT, 0); function calls)? And also, I will be really
> thankful to you if you also tell me the function in which I should place
> there function calls as I am new to linux device driver programming.

Firstly I think we'd better print the BAR0 and BAR1 on the probe function of
your device driver because you have to make sure if a8000000-a803ffff is
assigned to BAR0 and 0xa8040000-0xa807ffff for BAR1 as we expect.

u32 value;
pci_read_config_word(pdev, PCI_BASE_ADDRESS_0, &value); printk...
pci_read_config_word(pdev, PCI_BASE_ADDRESS_1, &value); printk....

And you can print this pci_resource_start(pdev, bar), pci_resource_len(pdev,
bar) from the function, __pci_request_region, on the file drivers/pci/pci.c.
Please check this as well.

And currently we have to debug this so on the function, __pci_assign_resource,
from the file drivers/pci/setup-res.c, we can force skipping temporarily
pci_bus_alloc_resource for bus 0001:01 since that will call pci_update_resource
for bus 0001:01.

static int __pci_assign_resource(struct pci_bus *bus, struct pci_dev *dev,
                                 int resno)
{
        struct resource *res = dev->resource + resno;
        resource_size_t size, min, align;
        int ret;

        size = resource_size(res);
        min = (res->flags & IORESOURCE_IO) ? PCIBIOS_MIN_IO : PCIBIOS_MIN_MEM;
        align = pci_resource_alignment(dev, res);
-------
	if (bus->number == 0x01) {
		ret = -ENOMEM
		return ret;
	}
-------

I means we don't want to assign resource as the below line on the log.
------
pci 0001:01:00.0: BAR 8: assigned [mem 0xa8000000-0xa80fffff]

I expect the following output:
------
pci 0001:01:00.0: BAR 8: can't assign mem pref (size 0x100000)

Best Regards
Tiejun

> 
> Regards,
> Ravi
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev

  reply	other threads:[~2010-09-10  5:22 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-06 12:52 pci_request_regions() failure Ravi Gupta
2010-09-07  5:25 ` tiejun.chen
2010-09-07  7:20   ` Ravi Gupta
2010-09-07  9:24     ` tiejun.chen
2010-09-08  9:29       ` Ravi Gupta
2010-09-09  9:55         ` tiejun.chen
2010-09-09 12:37           ` Ravi Gupta
2010-09-10  5:23             ` tiejun.chen [this message]
2010-09-13  9:04               ` Ravi Gupta
2010-09-14  5:38                 ` tiejun.chen
  -- strict thread matches above, loose matches on Subject: below --
2004-05-06  4:00 Alec H. Peterson
2004-05-06 16:33 ` Alec H. Peterson
2004-05-06 19:50   ` Richard B. Johnson
2004-05-06 19:58     ` Alec H. Peterson
2004-05-06 20:00     ` Alec H. Peterson

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=4C89C0C9.6090007@windriver.com \
    --to=tiejun.chen@windriver.com \
    --cc=dceravigupta@gmail.com \
    --cc=linuxppc-dev@lists.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.