public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* accessing on-card ram/rom
@ 2000-11-08 22:48 MEHTA,HIREN (A-SanJose,ex1)
  2000-11-08 22:53 ` Jeff Garzik
  2000-11-09 13:03 ` Richard B. Johnson
  0 siblings, 2 replies; 6+ messages in thread
From: MEHTA,HIREN (A-SanJose,ex1) @ 2000-11-08 22:48 UTC (permalink / raw)
  To: 'linux-kernel@vger.kernel.org'

Hi All,

I have a PCI card which has on-card ram/rom which gets mapped
into pci address space and there is a separate base register
for this memory. Now the question is : can I access this on-card
memory by converting the pci base address into the virtual address
using bus_to_virt and adding the required offset ? Or do I need
to use ioremap function to map the physical address space starting
from the pci base address into the kernel virtual address space ?
Or is there any other interface to access the on-card memory ?
Is it that bus_to_virt can be used only for the normal RAM ?

I tried using bus_to_virt to get the virtual address and then access
it and the kernel panics.

Please copy me on your replies as I am not on the list.

Thanks and regards,
-hiren
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

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

* Re: accessing on-card ram/rom
  2000-11-08 22:48 MEHTA,HIREN (A-SanJose,ex1)
@ 2000-11-08 22:53 ` Jeff Garzik
  2000-11-09 13:03 ` Richard B. Johnson
  1 sibling, 0 replies; 6+ messages in thread
From: Jeff Garzik @ 2000-11-08 22:53 UTC (permalink / raw)
  To: MEHTA,HIREN (A-SanJose,ex1); +Cc: 'linux-kernel@vger.kernel.org'

"MEHTA,HIREN (A-SanJose,ex1)" wrote:
> I have a PCI card which has on-card ram/rom which gets mapped
> into pci address space and there is a separate base register
> for this memory. Now the question is : can I access this on-card
> memory by converting the pci base address into the virtual address
> using bus_to_virt and adding the required offset ? Or do I need
> to use ioremap function to map the physical address space starting
> from the pci base address into the kernel virtual address space ?
> Or is there any other interface to access the on-card memory ?
> Is it that bus_to_virt can be used only for the normal RAM ?

Use ioremap.

For more details, read linux/Documentation/IO-mapping.txt.

	Jeff


-- 
Jeff Garzik             | "When I do this, my computer freezes."
Building 1024           |          -user
MandrakeSoft            | "Don't do that."
                        |          -level 1
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

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

* RE: accessing on-card ram/rom
@ 2000-11-08 22:57 hiren_mehta
  2000-11-08 23:06 ` Jeff Garzik
  2000-11-09 19:27 ` Gérard Roudier
  0 siblings, 2 replies; 6+ messages in thread
From: hiren_mehta @ 2000-11-08 22:57 UTC (permalink / raw)
  To: jgarzik; +Cc: linux-kernel

I looked at the IO-mapping.txt file. It says that
on x86 architecture it should not make any difference.
It also says that "on x86 it _is_ the same memory space. So
on x86 it actually works to just dereference a pointer".

Any inputs on this ?

Thanks and regards,
-hiren

> -----Original Message-----
> From: Jeff Garzik [mailto:jgarzik@mandrakesoft.com]
> Sent: Wednesday, November 08, 2000 2:53 PM
> To: MEHTA,HIREN (A-SanJose,ex1)
> Cc: 'linux-kernel@vger.kernel.org'
> Subject: Re: accessing on-card ram/rom
> 
> 
> "MEHTA,HIREN (A-SanJose,ex1)" wrote:
> > I have a PCI card which has on-card ram/rom which gets mapped
> > into pci address space and there is a separate base register
> > for this memory. Now the question is : can I access this on-card
> > memory by converting the pci base address into the virtual address
> > using bus_to_virt and adding the required offset ? Or do I need
> > to use ioremap function to map the physical address space starting
> > from the pci base address into the kernel virtual address space ?
> > Or is there any other interface to access the on-card memory ?
> > Is it that bus_to_virt can be used only for the normal RAM ?
> 
> Use ioremap.
> 
> For more details, read linux/Documentation/IO-mapping.txt.
> 
> 	Jeff
> 
> 
> -- 
> Jeff Garzik             | "When I do this, my computer freezes."
> Building 1024           |          -user
> MandrakeSoft            | "Don't do that."
>                         |          -level 1
> 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

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

* Re: accessing on-card ram/rom
  2000-11-08 22:57 accessing on-card ram/rom hiren_mehta
@ 2000-11-08 23:06 ` Jeff Garzik
  2000-11-09 19:27 ` Gérard Roudier
  1 sibling, 0 replies; 6+ messages in thread
From: Jeff Garzik @ 2000-11-08 23:06 UTC (permalink / raw)
  To: hiren_mehta; +Cc: linux-kernel

hiren_mehta@agilent.com wrote:
> I looked at the IO-mapping.txt file. It says that
> on x86 architecture it should not make any difference.
> It also says that "on x86 it _is_ the same memory space. So
> on x86 it actually works to just dereference a pointer".

> Any inputs on this ?

Don't depend on architecture-specific guarantees like this, it could
change, etc.

Use ioremap, it's portable, it's standard, it's the way to go.  ;-)

	Jeff


-- 
Jeff Garzik             | "When I do this, my computer freezes."
Building 1024           |          -user
MandrakeSoft            | "Don't do that."
                        |          -level 1
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

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

* Re: accessing on-card ram/rom
  2000-11-08 22:48 MEHTA,HIREN (A-SanJose,ex1)
  2000-11-08 22:53 ` Jeff Garzik
@ 2000-11-09 13:03 ` Richard B. Johnson
  1 sibling, 0 replies; 6+ messages in thread
From: Richard B. Johnson @ 2000-11-09 13:03 UTC (permalink / raw)
  To: MEHTA,HIREN (A-SanJose,ex1); +Cc: 'linux-kernel@vger.kernel.org'


You need ioremap(), etc. Paging is enabled, you need ioremap() to
create a page-table entry (PTE).

Cheers,
Dick Johnson

Penguin : Linux version 2.4.0 on an i686 machine (799.54 BogoMips).

"Memory is like gasoline. You use it up when you are running. Of
course you get it all back when you reboot..."; Actual explanation
obtained from the Micro$oft help desk.


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

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

* RE: accessing on-card ram/rom
  2000-11-08 22:57 accessing on-card ram/rom hiren_mehta
  2000-11-08 23:06 ` Jeff Garzik
@ 2000-11-09 19:27 ` Gérard Roudier
  1 sibling, 0 replies; 6+ messages in thread
From: Gérard Roudier @ 2000-11-09 19:27 UTC (permalink / raw)
  To: hiren_mehta; +Cc: jgarzik, linux-kernel



On Wed, 8 Nov 2000 hiren_mehta@agilent.com wrote:

> I looked at the IO-mapping.txt file. It says that
> on x86 architecture it should not make any difference.
> It also says that "on x86 it _is_ the same memory space. So
> on x86 it actually works to just dereference a pointer".

For bus_to_virt() to give a usable virtual address, such a virtual 
mapping must exist and additionnally be part of the linear kernel 
mapping. A PCI MMIO address is generally _not_ even mapped by default 
by the kernel.

On the other hand, bus_to_virt() hasn't the proper semantic for your
problem, since it applies to main memory addresses as seen from the PCI
BUS, and you want an MMIO address usable by the CPU (=virtual).

Hmmm... ioremap() just create a virtual mapping for the CPU to access 
the MMIO window of your PCI chip just fine.

  Gérard.

> Any inputs on this ?
> 
> Thanks and regards,
> -hiren
> 
> > -----Original Message-----
> > From: Jeff Garzik [mailto:jgarzik@mandrakesoft.com]
> > Sent: Wednesday, November 08, 2000 2:53 PM
> > To: MEHTA,HIREN (A-SanJose,ex1)
> > Cc: 'linux-kernel@vger.kernel.org'
> > Subject: Re: accessing on-card ram/rom
> > 
> > 
> > "MEHTA,HIREN (A-SanJose,ex1)" wrote:
> > > I have a PCI card which has on-card ram/rom which gets mapped
> > > into pci address space and there is a separate base register
> > > for this memory. Now the question is : can I access this on-card
> > > memory by converting the pci base address into the virtual address
> > > using bus_to_virt and adding the required offset ? Or do I need
> > > to use ioremap function to map the physical address space starting
> > > from the pci base address into the kernel virtual address space ?
> > > Or is there any other interface to access the on-card memory ?
> > > Is it that bus_to_virt can be used only for the normal RAM ?
> > 
> > Use ioremap.
> > 
> > For more details, read linux/Documentation/IO-mapping.txt.
> > 
> > 	Jeff
> > 
> > 
> > -- 
> > Jeff Garzik             | "When I do this, my computer freezes."
> > Building 1024           |          -user
> > MandrakeSoft            | "Don't do that."
> >                         |          -level 1
> > 
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> Please read the FAQ at http://www.tux.org/lkml/
> 

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

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

end of thread, other threads:[~2000-11-09 20:27 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2000-11-08 22:57 accessing on-card ram/rom hiren_mehta
2000-11-08 23:06 ` Jeff Garzik
2000-11-09 19:27 ` Gérard Roudier
  -- strict thread matches above, loose matches on Subject: below --
2000-11-08 22:48 MEHTA,HIREN (A-SanJose,ex1)
2000-11-08 22:53 ` Jeff Garzik
2000-11-09 13:03 ` Richard B. Johnson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox