public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jeff Garzik <jgarzik@mandrakesoft.com>
To: Zehetbauer Thomas <TZ@link.topcall.co.at>
Cc: "'linux-kernel@vger.kernel.org'" <linux-kernel@vger.kernel.org>
Subject: Re: Cannot access PCI device
Date: Thu, 12 Jul 2001 10:07:59 -0400	[thread overview]
Message-ID: <3B4DAF3F.37C2EBC6@mandrakesoft.com> (raw)
In-Reply-To: <41EA756DBC9FD0118CFC0020AFDB5C5A188E07@tcint1ntsrv>

Zehetbauer Thomas wrote:
> 
> Hi! I am trying to access a custom PCI device on a Walnut Rev. D system
> running Hard Hat Linux Rev. 1.2 with Montavista kernel snapshot
> 01.04.12. The following code is beeing executed in the probe function of
> a kernel module and works well on Linux 2.4.2/Intel but returns useless
> values on PowerPC.
> 
> ### begin code ###
>         unsigned long linux_addr_start, linux_addr_end, val;
>         u32 config_addr;
> 
>         pdev = pci_find_device(0x10ee, 0x4030, pdev);
>         if (NULL == pdev)
>                 return(-1);

use pci_register_driver or pci_module_init not pci_find_device

>         if (pci_enable_device(pdev))
>                 return(-1);
>         linux_addr_start = pci_resource_start(pdev, 0);
>         linux_addr_end = pci_resource_end(pdev, 0);
>         pci_read_config_dword(pdev, PCI_BASE_ADDRESS_0, &config_addr);
>         printk("Found %s\n", pdev->name);
>         printk("pci_resource_start=%lx\n", linux_addr_start);
>         printk("pci_resource_end=%lx\n", linux_addr_end);
>         printk("PCI_BASE_ADDRESS_0=%lx\n", config_addr);
>         IOAddress = ioremap(config_addr, 0xffff);

bug: calling ioremap with config_addr value directly from PCI BAR
register.  You should mask the value.  However, it is irrelevant: 
linux_addr_start make config_addr unnecessary.

-- 
Jeff Garzik      | A recent study has shown that too much soup
Building 1024    | can cause malaise in laboratory mice.
MandrakeSoft     |

  reply	other threads:[~2001-07-12 14:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-07-12 10:42 Cannot access PCI device Zehetbauer Thomas
2001-07-12 14:07 ` Jeff Garzik [this message]
2001-07-13  1:25 ` Paul Mackerras

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=3B4DAF3F.37C2EBC6@mandrakesoft.com \
    --to=jgarzik@mandrakesoft.com \
    --cc=TZ@link.topcall.co.at \
    --cc=linux-kernel@vger.kernel.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