Re: PCI IO regions and IDE

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 01/09/2007 06:07 PM, Bahadir Balban wrote:

On 1/9/07, Rene Herman <rene.herman@xxxxxxxxx> wrote:

Not very clearly formulated, but "tries to access the IO region [...] in
physical" sounds like you are directly adressing using physical (bus)
addresses?

Yes that is what I meant. With the advice from a former reply, I
advanced the discussion more specifically in the arm-kernel mailing
list since the platform was ARM. But the ata code in 2.6.19 that
causes the oops is as follows, from libata-sff.c:

struct ata_pci_init_native_mode(...)
{
  unsigned long bmdma;
  ...
  bmdma = pci_resource_start(pdev, 4);
  /* Memory reference to a direct physical address. */
  if (inb(bmdma + 2) & 8)
  ...
}

Ah, I see, you were talking about inb(). The story with that is:

On x86, we have two seperate address spaces that are used for I/O. One dedicated (16-bit) I/O address space which the CPU instructions "in" and "out" access and the regular memory addressspace which can also be used for I/O (which is then aptly called "memory mapped I/O").

inb() and friends access the I/O addressspace on x86 -- they translate into "in" CPU instructions and since this I/O addressspace doesn't go though the MMU, the addresses are non-virtual/physical/bus addresses and can thefore be used directly. All you want on the software side is a request_region() to mark the area as reserved for other drivers but you don't need any address translations.

Now on ARM, you don't actually have this seperate I/O address space as far as the CPU is concerned; all I/O is memory mapped. But for PCI (and ISA) compatibility, the x86 I/O address-space is "emulated" in so far that it's memory mapped 1:1 to some (possibly model specific, I don't know ARM) fixed physical memory address. The generic code then takes care of remapping this fixed region of physical addresses to a fixed region of virtual addresses and an "inb(addr)" then just translates to something like "readb(addr + VIRTUAL_BASE_OF_IO_ADDRESS_SPACE)".

So, still no MMU involved past that generic "all of the I/O space" granularity and the addresses can still be used directly.

I'm not subscribed to the ARM kernel list so I'm missing the answers to the question there but I hope this was useful.

Rene.

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux