OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 8:00 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: PCI and Register Addressing
PostPosted: Sun Jul 28, 2019 8:20 am 
Offline

Joined: Sun Jun 16, 2019 11:32 am
Posts: 9
Hello again.. I'm beginner and having hard time understanding PCI register mappings (as some of you already know)...

The thing is if I could connect devices to a PC CPU's I/O bus directly and used fixed adresses for their registers (for example 0x0001 for Register A of Device 1, 0x0002 for Register B of Device 1 and 0x0003 for Register A of device 2), everything would be very easy.

If I got it right BIOS (or Operating system) initializes PCI devices using PCI Configuration Space. They communicate through PCI protocol and exchange information and BIOS(or operating system) fills BAR(base address registers) of the device which is available through configuration space. So device requests 1 to 6 different memory/IO port regions from PC and it allocates them and fills the configuration table with allocated addresses. Not sure if I got this right but my real question is:

Suppose I have a device with 5 registers. How do I know which memory address or io port address corresponds to 1st register (call it register A) for example? Even if I can read BAR registers I can't understand under which rules these assignments are made.

So how can I know something like this:

Register A --- BAR0 + 0x0000
Register B --- BAR0 + 0x0004
Register C --- BAR1 + 0x000C

etc.

I'm so lost and I don't have a PCI supporting device to work on. Just want to learn this theoretically :oops:


Top
 Profile  
 
 Post subject: Re: PCI and Register Addressing
PostPosted: Sun Jul 28, 2019 9:40 am 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 4591
Location: Chichester, UK
The documentation for the particular hardware component will detail which registers correspond to which offset from the base address. It will also tell you what the function of each of those registers is.

The BIOS, or your OS, can set the base address - everything after that is predetermined by the particular device.


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

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot] and 60 guests


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:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group