linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* virt_to_bus and virt_to_phys on Apple G4 target
@ 2001-07-03  5:57 mdaljeet
  2001-07-03  7:18 ` David S. Miller
  2001-07-04  7:56 ` Paul Mackerras
  0 siblings, 2 replies; 4+ messages in thread
From: mdaljeet @ 2001-07-03  5:57 UTC (permalink / raw)
  To: linux-kernel

I am running linux 2.4.2 on Apple G4 machine. I think the 'PCI bus
addresses' and 'physical addresses' are same on this architecture. I
expected the two be different but according to asm/io.h 'virt_to_bus(addr)
= virt_to_phys(addr) + PCI_DRAM_OFFSET'. I printed the value of
'PCI_DRAM_OFFSET' and that come out to be zero. Is this correct?

If I somehow get the physical address of a user space buffer in a module
and take this as a PCI bus address, will I be able to do DMA properly?

thanks,
Daljeet.



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: virt_to_bus and virt_to_phys on Apple G4 target
  2001-07-03  5:57 virt_to_bus and virt_to_phys on Apple G4 target mdaljeet
@ 2001-07-03  7:18 ` David S. Miller
  2001-07-04 22:03   ` acmay
  2001-07-04  7:56 ` Paul Mackerras
  1 sibling, 1 reply; 4+ messages in thread
From: David S. Miller @ 2001-07-03  7:18 UTC (permalink / raw)
  To: mdaljeet; +Cc: linux-kernel


mdaljeet@in.ibm.com writes:
 > I am running linux 2.4.2 on Apple G4 machine. I think the 'PCI bus
 > addresses' and 'physical addresses' are same on this architecture. I
 > expected the two be different but according to asm/io.h 'virt_to_bus(addr)
 > = virt_to_phys(addr) + PCI_DRAM_OFFSET'. I printed the value of
 > 'PCI_DRAM_OFFSET' and that come out to be zero. Is this correct?
 > 
 > If I somehow get the physical address of a user space buffer in a module
 > and take this as a PCI bus address, will I be able to do DMA properly?

virt_to_bus() and bus_to_virt() are deprecated interfaces and should
not be used by anything new.  See Documentation/DMA-mapping.txt for
details.

Later,
David S. Miller
davem@redhat.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: virt_to_bus and virt_to_phys on Apple G4 target
  2001-07-03  5:57 virt_to_bus and virt_to_phys on Apple G4 target mdaljeet
  2001-07-03  7:18 ` David S. Miller
@ 2001-07-04  7:56 ` Paul Mackerras
  1 sibling, 0 replies; 4+ messages in thread
From: Paul Mackerras @ 2001-07-04  7:56 UTC (permalink / raw)
  To: mdaljeet; +Cc: linux-kernel

mdaljeet@in.ibm.com writes:

> I am running linux 2.4.2 on Apple G4 machine. I think the 'PCI bus
> addresses' and 'physical addresses' are same on this architecture. I

They are the same on an Apple G4 but not necessarily on other PowerPC
machines.  It depends on the PCI host bridge implementation.

> expected the two be different but according to asm/io.h 'virt_to_bus(addr)
> = virt_to_phys(addr) + PCI_DRAM_OFFSET'. I printed the value of
> 'PCI_DRAM_OFFSET' and that come out to be zero. Is this correct?

Yes, for an Apple G4.

> If I somehow get the physical address of a user space buffer in a module
> and take this as a PCI bus address, will I be able to do DMA properly?

Yes, on an Apple G4.  If you use virt_to_bus then it should work on
all PowerPC machines that I know of (that run 32-bit PPC/Linux).  But
as Dave points out, you should use the interfaces described in
Documentation/DMA-mapping.txt instead if at all possible.  It's quite
possible that virt_to_bus will be removed during 2.5.x development.

Paul.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: virt_to_bus and virt_to_phys on Apple G4 target
  2001-07-03  7:18 ` David S. Miller
@ 2001-07-04 22:03   ` acmay
  0 siblings, 0 replies; 4+ messages in thread
From: acmay @ 2001-07-04 22:03 UTC (permalink / raw)
  To: David S. Miller; +Cc: linux-kernel

On Tue, Jul 03, 2001 at 12:18:58AM -0700, David S. Miller wrote:
> 
> mdaljeet@in.ibm.com writes:
>  > I am running linux 2.4.2 on Apple G4 machine. I think the 'PCI bus
>  > addresses' and 'physical addresses' are same on this architecture. I
>  > expected the two be different but according to asm/io.h 'virt_to_bus(addr)
>  > = virt_to_phys(addr) + PCI_DRAM_OFFSET'. I printed the value of
>  > 'PCI_DRAM_OFFSET' and that come out to be zero. Is this correct?
>  > 
>  > If I somehow get the physical address of a user space buffer in a module
>  > and take this as a PCI bus address, will I be able to do DMA properly?
> 
> virt_to_bus() and bus_to_virt() are deprecated interfaces and should
> not be used by anything new.  See Documentation/DMA-mapping.txt for
> details.

What about non-PCI devices? The IBM 405GP on-chip ethernet controller
is not PCI. It isn't in the standard kernel yet, but I am sure there
are other things that do DMA that aren't PCI.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2001-07-04 22:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-07-03  5:57 virt_to_bus and virt_to_phys on Apple G4 target mdaljeet
2001-07-03  7:18 ` David S. Miller
2001-07-04 22:03   ` acmay
2001-07-04  7:56 ` Paul Mackerras

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).