Board.KolibriOS.org

Official KolibriOS board
It is currently Wed Sep 18, 2019 11:16 pm

All times are UTC+03:00




Post new topic  Reply to topic  [ 10 posts ] 
Author Message
 Post subject: Mapping memory
PostPosted: Sun Dec 01, 2013 12:51 am 
Offline
Mentor/Kernel Developer
User avatar

Joined: Fri Jun 30, 2006 9:01 am
Posts: 1248
Hi,

I'm trying to work with some PCI device that needs a piece of address space where it can map it's own memory to, so I can access it.
But how do I do such a thing in KolibriOS ? I have used 'map_io_mem' before, when the device tells you the address, but now the device is asking me for the virtual address..

Any help appreciated.

_________________
"Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction." Albert Einstein


Last edited by hidnplayr on Tue Dec 03, 2013 8:19 pm, edited 1 time in total.

Top
   
 Post subject: Re: Mapping memory
PostPosted: Sun Dec 01, 2013 12:56 pm 
Offline
Kernel Developer
User avatar

Joined: Fri Aug 14, 2009 1:46 am
Posts: 1342
http://wiki.kolibrios.org/wiki/SysFn62/ ... 0.BA.D0.B0

to let users access MMIO, the kernel shoul be compiled with mmio_pci_addr = b:d.f
(http://websvn.kolibrios.org/filedetails ... Fpci32.inc)
or you need to map MMIO in your driver?


Top
   
 Post subject: Re: Mapping memory
PostPosted: Sun Dec 01, 2013 1:48 pm 
Offline
Mentor/Kernel Developer
User avatar

Joined: Fri Jun 30, 2006 9:01 am
Posts: 1248
art_zh wrote:
http://wiki.kolibrios.org/wiki/SysFn62/ru#.D0.BF.D0.BE.D0.B4.D1.84.D1.83.D0.BD.D0.BA.D1.86.D0.B8.D1.8F_12_-_.D0.BF.D0.BE.D0.BB.D1.83.D1.87.D0.B8.D1.82.D1.8C_.D0.BB.D0.B8.D0.BD.D0.B5.D0.B9.D0.BD.D1.8B.D0.B9_.D0.B0.D0.B4.D1.80.D0.B5.D1.81_MMIO-.D0.B1.D0.BB.D0.BE.D0.BA.D0.B0

to let users access MMIO, the kernel shoul be compiled with mmio_pci_addr = b:d.f
(http://websvn.kolibrios.org/filedetails ... Fpci32.inc)
or you need to map MMIO in your driver?


All I need is one virtual physical address (range) that is available for 4096 bytes (If I understand it correctly).

_________________
"Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction." Albert Einstein


Last edited by hidnplayr on Sun Dec 01, 2013 10:42 pm, edited 1 time in total.

Top
   
 Post subject: Re: Mapping memory
PostPosted: Sun Dec 01, 2013 3:44 pm 
Offline
User avatar

Joined: Fri Jun 27, 2008 3:22 pm
Posts: 988
KernelAlloc ?


Top
   
 Post subject: Re: Mapping memory
PostPosted: Sun Dec 01, 2013 3:45 pm 
Offline
Mentor/Kernel Developer
User avatar

Joined: Fri Jun 30, 2006 9:01 am
Posts: 1248
Asper wrote:
KernelAlloc ?


I dont need memory from RAM.

_________________
"Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction." Albert Einstein


Top
   
 Post subject: Re: Mapping memory
PostPosted: Sun Dec 01, 2013 10:32 pm 
Offline
Mentor/Kernel Developer
User avatar

Joined: Fri Jun 30, 2006 9:01 am
Posts: 1248
I just need to find a physical address that is still free.
For example, 0x7f000000 worked on my test machine. But there is no guarantee that it will work on others...

_________________
"Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction." Albert Einstein


Top
   
 Post subject: Re: Mapping memory
PostPosted: Sun Dec 01, 2013 10:35 pm 
Offline
Kernel Developer

Joined: Sun Feb 10, 2013 12:37 pm
Posts: 2329
hidnplayr
You just need to wait for the forum to come Serge - he will most likely answer your question about the memory manager.

_________________
Всем чмоки в этом проекте! Засуньте эти 11 лет себе в жопу!


Top
   
 Post subject: Re: Mapping memory
PostPosted: Tue Dec 03, 2013 1:57 am 
Offline
Kernel Developer
User avatar

Joined: Fri Aug 14, 2009 1:46 am
Posts: 1342
hidnplayr
the only way to detect the MMIO physical range is to read the device's base address registers (BARs) located in its configspace.
use bus/pci/pci32.inc functions (also available in userspace via fn62)


Top
   
 Post subject: Re: Mapping memory
PostPosted: Tue Dec 03, 2013 11:59 am 
Offline
Mentor/Kernel Developer
User avatar

Joined: Fri Jun 30, 2006 9:01 am
Posts: 1248
art_zh wrote:
hidnplayr
the only way to detect the MMIO physical range is to read the device's base address registers (BARs) located in its configspace.
use bus/pci/pci32.inc functions (also available in userspace via fn62)


For regular PCI devices this has been filled in by the BIOS yes, but not for PCI-pc card bridges.

_________________
"Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction." Albert Einstein


Top
   
 Post subject: Re: Mapping memory
PostPosted: Wed Dec 04, 2013 1:30 am 
Offline
Kernel Developer
User avatar

Joined: Fri Aug 14, 2009 1:46 am
Posts: 1342
Then your driver needs to do the work BIOS does.
I tryed this for PCIe hotplug, but stepped back - it takes tons of clever tricks with MRRs, northbridge apertures and IRQ allocations.
Plug-and-restart is much simpler.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 10 posts ] 

All times are UTC+03:00


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Limited